@@ -597,7 +597,7 @@ func (c *Cluster) compareContainers(description string, setA, setB []v1.Containe
597597 newCheck ("new %s's %s (index %d) security context does not match the current one" ,
598598 func (a , b v1.Container ) bool { return ! reflect .DeepEqual (a .SecurityContext , b .SecurityContext ) }),
599599 newCheck ("new %s's %s (index %d) volume mounts do not match the current one" ,
600- func (a , b v1.Container ) bool { return ! reflect . DeepEqual (a .VolumeMounts , b .VolumeMounts ) }),
600+ func (a , b v1.Container ) bool { return ! compareVolumeMounts (a .VolumeMounts , b .VolumeMounts ) }),
601601 }
602602
603603 if ! c .OpConfig .EnableLazySpiloUpgrade {
@@ -738,6 +738,27 @@ func comparePorts(a, b []v1.ContainerPort) bool {
738738 return true
739739}
740740
741+ func compareVolumeMounts (old , new []v1.VolumeMount ) bool {
742+ if len (old ) != len (new ) {
743+ return false
744+ }
745+ for _ , mount := range old {
746+ if ! volumeMountExists (mount , new ) {
747+ return false
748+ }
749+ }
750+ return true
751+ }
752+
753+ func volumeMountExists (mount v1.VolumeMount , mounts []v1.VolumeMount ) bool {
754+ for _ , m := range mounts {
755+ if reflect .DeepEqual (mount , m ) {
756+ return true
757+ }
758+ }
759+ return false
760+ }
761+
741762func (c * Cluster ) compareAnnotations (old , new map [string ]string ) (bool , string ) {
742763 reason := ""
743764 ignoredAnnotations := make (map [string ]bool )
0 commit comments