in clusterloader2/pkg/measurement/util/pods.go [64:92]
func podStatus(p *corev1.Pod) status {
if p.DeletionTimestamp != nil {
return Terminating
}
if p.Status.Phase == corev1.PodRunning {
ready := false
for _, c := range p.Status.Conditions {
if c.Type == corev1.PodReady && c.Status == corev1.ConditionTrue {
ready = true
break
}
}
if ready {
// Only count a pod is running when it is also ready.
return RunningAndReady
}
return RunningButNotReady
}
if p.Status.Phase == corev1.PodPending {
if p.Spec.NodeName == "" {
return PendingNotScheduled
}
return PendingScheduled
}
if p.Status.Phase == corev1.PodSucceeded || p.Status.Phase == corev1.PodFailed {
return Inactive
}
return Unknown
}