Remove unnecessary traversal of pod.Status.Conditions

Kubernetes-commit: 936ae632a0b6e1a83f1729aeff736baebbc4e68c
This commit is contained in:
Ted Yu 2019-09-24 10:47:34 -07:00 committed by Kubernetes Publisher
parent fc0c7def07
commit b89bb29485
1 changed files with 4 additions and 6 deletions

View File

@ -170,12 +170,10 @@ func afterOrZero(t1, t2 *metav1.Time) bool {
}
func podReadyTime(pod *corev1.Pod) *metav1.Time {
if IsPodReady(pod) {
for _, c := range pod.Status.Conditions {
// we only care about pod ready conditions
if c.Type == corev1.PodReady && c.Status == corev1.ConditionTrue {
return &c.LastTransitionTime
}
for _, c := range pod.Status.Conditions {
// we only care about pod ready conditions
if c.Type == corev1.PodReady && c.Status == corev1.ConditionTrue {
return &c.LastTransitionTime
}
}
return &metav1.Time{}