Skip to content

Commit

Permalink
Add support for spec.schedulingGates in calcDiffSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmabaryon committed Apr 6, 2023
1 parent 74e1195 commit 08fa331
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/controllers/resources/pods/translate/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

0 comments on commit 08fa331

Please sign in to comment.