Fix security context comparison logic in StatefulSet

This commit is contained in:
Benjamin Desrousseaux 2025-09-14 12:33:26 +02:00
parent fa4bc21538
commit dde68cfb34
No known key found for this signature in database
GPG Key ID: 07241F570BDAB363
1 changed files with 9 additions and 3 deletions

View File

@ -530,10 +530,16 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *appsv1.StatefulSet) *compa
reasons = append(reasons, "new statefulset's pod template metadata annotations does not match "+reason)
}
if !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.SecurityContext, statefulSet.Spec.Template.Spec.SecurityContext) {
//needsReplace = true
//needsRollUpdate = true
//reasons = append(reasons, "new statefulset's pod template security context in spec does not match the current one")
if reflect.ValueOf(statefulSet.Spec.Template.Spec.SecurityContext.SeccompProfile).IsNil() {
} else {
needsReplace = true
needsRollUpdate = true
reasons = append(reasons, "new statefulset's pod template security context in spec does not match the current one")
}
}
if len(c.Statefulset.Spec.VolumeClaimTemplates) != len(statefulSet.Spec.VolumeClaimTemplates) {
needsReplace = true
reasons = append(reasons, "new statefulset's volumeClaimTemplates contains different number of volumes to the old one")