diff --git a/pkg/controllers/resources/pods/translate/translator.go b/pkg/controllers/resources/pods/translate/translator.go index 644a0641a..768c40d4d 100644 --- a/pkg/controllers/resources/pods/translate/translator.go +++ b/pkg/controllers/resources/pods/translate/translator.go @@ -911,6 +911,14 @@ func (t *translator) calcSpecDiff(pObj, vObj *corev1.Pod) *corev1.PodSpec { updatedPodSpec.InitContainers = updatedContainer } + isEqual := isPodSpecSchedulingGatesDiff(pObj.Spec.SchedulingGates, vObj.Spec.SchedulingGates) + if !isEqual { + if updatedPodSpec == nil { + updatedPodSpec = pObj.Spec.DeepCopy() + } + updatedPodSpec.SchedulingGates = vObj.Spec.SchedulingGates + } + return updatedPodSpec } @@ -959,3 +967,15 @@ func isInt64Different(i1, i2 *int64) (*int64, bool) { return updated, false } + +func isPodSpecSchedulingGatesDiff(pGates, vGates []corev1.PodSchedulingGate) bool { + if len(vGates) != len(pGates) { + return false + } + for i, v := range vGates { + if v.Name != pGates[i].Name { + return false + } + } + return true +}