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 16, 2023
1 parent 74e1195 commit 769fd34
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 := isPodSpecSchedulingGatesDiff(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 isPodSpecSchedulingGatesDiff(pGates, vGates []corev1.PodSchedulingGate) ([]corev1.PodSchedulingGate, bool) {
if len(vGates) != len(pGates) {
return vGates, false
}
for i, v := range vGates {
if v.Name != pGates[i].Name {
return vGates, false
}
}
return vGates, true
}

0 comments on commit 769fd34

Please sign in to comment.