From 08fa33186f534d67fbb51d1a6e83ea334a145a5a Mon Sep 17 00:00:00 2001 From: sigmabaryon Date: Thu, 6 Apr 2023 09:03:35 +0530 Subject: [PATCH] Add support for spec.schedulingGates in calcDiffSpec --- .../resources/pods/translate/translator.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/controllers/resources/pods/translate/translator.go b/pkg/controllers/resources/pods/translate/translator.go index 644a0641a1..07d97ec6ab 100644 --- a/pkg/controllers/resources/pods/translate/translator.go +++ b/pkg/controllers/resources/pods/translate/translator.go @@ -911,6 +911,12 @@ func (t *translator) calcSpecDiff(pObj, vObj *corev1.Pod) *corev1.PodSpec { updatedPodSpec.InitContainers = updatedContainer } + schedulingGatesVal, equal := isPodSchedulingGateSliceDiff(pObj.Spec.SchedulingGates, vObj.Spec.SchedulingGates) + if !equal { + updatedPodSpec = pObj.Spec.DeepCopy() + updatedPodSpec.SchedulingGates = schedulingGatesVal + } + return updatedPodSpec } @@ -959,3 +965,15 @@ func isInt64Different(i1, i2 *int64) (*int64, bool) { return updated, false } + +func isPodSchedulingGateSliceDiff(a, b []corev1.PodSchedulingGate) ([]corev1.PodSchedulingGate, bool) { + if len(a) != len(b) { + return a, false + } + for i, v := range a { + if v != b[i] { + return a, false + } + } + return a, true +}