4import type { V1Pod } from '@kubernetes/client-node' 6type GetPodStatusProps = WithClusterName & {name: string} 8export const getPodStatusFromPod = (pod: V1Pod | undefined) => { 10 const phase = pod.status?.phase ?? null 11 const containerStatus = pod.status?.containerStatuses?.[0] 12 const restarts = containerStatus?.restartCount ?? 0 13 const waitingReason = containerStatus?.state?.waiting?.reason ?? null 14 const ready = pod.status?.conditions?.find(c => c.type === 'Ready')?.status === 'True' 16 return {running: phase === 'Running' && ready, phase, restarts, waitingReason, ready, pendingDetail} 19export const getPodStatus = async ({cluster_name, name}: GetPodStatusProps) => { 21 return getPodStatusFromPod(pods[0])