@@ -44,7 +44,7 @@ void addClusterInvalidMountPaths(ClusterResource cluster) {
4444 ClusterSpec spec = cluster .getSpec ();
4545 Optional .of (spec ).map (ClusterSpec ::getAdditionalVolumeMounts )
4646 .ifPresent (mounts -> mounts .forEach (mount ->
47- checkValidMountPath (mount , getEnvNames (spec ), getRemainingVolumeMounts (mounts , mount ))));
47+ checkValidMountPath (null , mount , getEnvNames (spec ), getRemainingVolumeMounts (mounts , mount ))));
4848 }
4949
5050 List <V1VolumeMount > getRemainingVolumeMounts (List <V1VolumeMount > list , V1VolumeMount mount ) {
@@ -63,7 +63,8 @@ Set<String> getEnvNames(ClusterSpec spec) {
6363 .collect (toSet ());
6464 }
6565
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 ) {
6768 if (skipValidation (mount .getMountPath (), envNames )) {
6869 return ;
6970 }
@@ -72,10 +73,16 @@ void checkValidMountPath(V1VolumeMount mount, Set<String> envNames, List<V1Volum
7273 failures .add (DomainValidationMessages .badVolumeMountPath (mount ));
7374 }
7475
75- mounts .stream ().forEach (m -> checkOverlappingMountPaths (mount , m ));
76+ mounts .stream ().forEach (m -> checkOverlappingMountPaths (spec , mount , m ));
7677 }
7778
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+
7986 List <String > list1 = getTokensWithCollection (mount1 .getMountPath ());
8087 List <String > list2 = getTokensWithCollection (mount2 .getMountPath ());
8188 for (int i = 0 ; i < Math .min (list1 .size (), list2 .size ()); i ++) {
0 commit comments