@@ -44,7 +44,7 @@ void addClusterInvalidMountPaths(ClusterResource cluster) {
44
44
ClusterSpec spec = cluster .getSpec ();
45
45
Optional .of (spec ).map (ClusterSpec ::getAdditionalVolumeMounts )
46
46
.ifPresent (mounts -> mounts .forEach (mount ->
47
- checkValidMountPath (mount , getEnvNames (spec ), getRemainingVolumeMounts (mounts , mount ))));
47
+ checkValidMountPath (null , mount , getEnvNames (spec ), getRemainingVolumeMounts (mounts , mount ))));
48
48
}
49
49
50
50
List <V1VolumeMount > getRemainingVolumeMounts (List <V1VolumeMount > list , V1VolumeMount mount ) {
@@ -63,7 +63,8 @@ Set<String> getEnvNames(ClusterSpec spec) {
63
63
.collect (toSet ());
64
64
}
65
65
66
- void checkValidMountPath (V1VolumeMount mount , Set <String > envNames , List <V1VolumeMount > mounts ) {
66
+ void checkValidMountPath (DomainSpec spec , V1VolumeMount mount , Set <String > envNames ,
67
+ List <V1VolumeMount > mounts ) {
67
68
if (skipValidation (mount .getMountPath (), envNames )) {
68
69
return ;
69
70
}
@@ -72,10 +73,16 @@ void checkValidMountPath(V1VolumeMount mount, Set<String> envNames, List<V1Volum
72
73
failures .add (DomainValidationMessages .badVolumeMountPath (mount ));
73
74
}
74
75
75
- mounts .stream ().forEach (m -> checkOverlappingMountPaths (mount , m ));
76
+ mounts .stream ().forEach (m -> checkOverlappingMountPaths (spec , mount , m ));
76
77
}
77
78
78
- private void checkOverlappingMountPaths (V1VolumeMount mount1 , V1VolumeMount mount2 ) {
79
+ private void checkOverlappingMountPaths (DomainSpec spec , V1VolumeMount mount1 , V1VolumeMount mount2 ) {
80
+ // This validation only applies to the initialize domain on PV use case
81
+ if (Optional .ofNullable (spec ).map (DomainSpec ::getConfiguration )
82
+ .map (Configuration ::getInitializeDomainOnPV ).isEmpty ()) {
83
+ return ;
84
+ }
85
+
79
86
List <String > list1 = getTokensWithCollection (mount1 .getMountPath ());
80
87
List <String > list2 = getTokensWithCollection (mount2 .getMountPath ());
81
88
for (int i = 0 ; i < Math .min (list1 .size (), list2 .size ()); i ++) {
0 commit comments