mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 04:52:08 +00:00
fix null lastTransitionTime in pod condition when setting scheduling gate
This commit is contained in:
parent
60dcf7fd8d
commit
bbcb4ee690
@ -752,7 +752,7 @@ func applyWaitingForSchedulingGatesCondition(pod *api.Pod) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pod.Status.Conditions = append(pod.Status.Conditions, api.PodCondition{
|
podutil.UpdatePodCondition(&pod.Status, &api.PodCondition{
|
||||||
Type: api.PodScheduled,
|
Type: api.PodScheduled,
|
||||||
Status: api.ConditionFalse,
|
Status: api.ConditionFalse,
|
||||||
Reason: apiv1.PodReasonSchedulingGated,
|
Reason: apiv1.PodReasonSchedulingGated,
|
||||||
|
@ -371,7 +371,10 @@ func TestWaitingForGatesCondition(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if diff := cmp.Diff(tt.want, got); diff != "" {
|
if got.LastTransitionTime.IsZero() && got.Type != "" {
|
||||||
|
t.Errorf("unexpected empty LastTransitionTime in condition")
|
||||||
|
}
|
||||||
|
if diff := cmp.Diff(tt.want, got, cmpopts.IgnoreFields(api.PodCondition{}, "LastTransitionTime")); diff != "" {
|
||||||
t.Errorf("unexpected field errors (-want, +got):\n%s", diff)
|
t.Errorf("unexpected field errors (-want, +got):\n%s", diff)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user