@@ -597,7 +597,7 @@ func (c *Cluster) compareContainers(description string, setA, setB []v1.Containe
597
597
newCheck ("new %s's %s (index %d) security context does not match the current one" ,
598
598
func (a , b v1.Container ) bool { return ! reflect .DeepEqual (a .SecurityContext , b .SecurityContext ) }),
599
599
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 ) }),
601
601
}
602
602
603
603
if ! c .OpConfig .EnableLazySpiloUpgrade {
@@ -738,6 +738,27 @@ func comparePorts(a, b []v1.ContainerPort) bool {
738
738
return true
739
739
}
740
740
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
+
741
762
func (c * Cluster ) compareAnnotations (old , new map [string ]string ) (bool , string ) {
742
763
reason := ""
743
764
ignoredAnnotations := make (map [string ]bool )
0 commit comments