Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 11182f7

Browse files
jshum2479rjeberhard
authored andcommitted
Correct DOPV volume mounts validation, it should report error only if the...
1 parent 53d4f5f commit 11182f7

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

‎operator/src/main/java/oracle/kubernetes/weblogic/domain/model/Validator.java‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017, 2024, Oracle and/or its affiliates.
1+
// Copyright (c) 2017, 2025, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.weblogic.domain.model;
@@ -83,15 +83,21 @@ private void checkOverlappingMountPaths(DomainSpec spec, V1VolumeMount mount1, V
8383
return;
8484
}
8585

86-
List<String> list1 = getTokensWithCollection(mount1.getMountPath());
87-
List<String> list2 = getTokensWithCollection(mount2.getMountPath());
88-
for (int i = 0; i < Math.min(list1.size(), list2.size()); i++) {
89-
if (!list1.get(i).equals(list2.get(i))) {
90-
return;
86+
if (spec.getDomainHome() != null) {
87+
List<String> domainHomeTokens = getTokensWithCollection(spec.getDomainHome());
88+
List<String> list1 = getTokensWithCollection(mount1.getMountPath());
89+
List<String> list2 = getTokensWithCollection(mount2.getMountPath());
90+
for (int i = 0; i < Math.min(list1.size(), list2.size()); i++) {
91+
if (!list1.get(i).equals(list2.get(i))) {
92+
return;
93+
}
94+
}
95+
if (list1.getFirst().equals(domainHomeTokens.getFirst())
96+
&& list2.getFirst().equals(domainHomeTokens.getFirst())) {
97+
failures.add(DomainValidationMessages.overlappingVolumeMountPath(mount1, mount2));
9198
}
9299
}
93100

94-
failures.add(DomainValidationMessages.overlappingVolumeMountPath(mount1, mount2));
95101
}
96102

97103
private List<String> getTokensWithCollection(String str) {

‎operator/src/test/java/oracle/kubernetes/weblogic/domain/model/DomainValidationTest.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,7 @@ void whenPersistentVolumeClaimStorageClassNotSpecifiedUnderInitPvDomain_reportEr
14031403
@Test
14041404
void whenMultipleVolumeMountHaveOverlappingMountPath_initPvDomain_reportError() {
14051405
configuredDomainWithInitializeDomainOnPVWithPVCVolume()
1406+
.withDomainHome("/domain-path1/domains/mydomain")
14061407
.withAdditionalVolumeMount("volume1", "/domain-path1")
14071408
.withAdditionalVolumeMount("volume2", "/domain-path1/dir1");
14081409

@@ -1414,6 +1415,7 @@ void whenMultipleVolumeMountHaveOverlappingMountPath_initPvDomain_reportError()
14141415
@Test
14151416
void whenMultipleVolumeMountHaveSameMountPath_initPvDomain_reportError() {
14161417
configuredDomainWithInitializeDomainOnPVWithPVCVolume()
1418+
.withDomainHome("/domain-path1/dir1/dir2/mydomain")
14171419
.withInitializeDomainOnPv(new InitializeDomainOnPV())
14181420
.withAdditionalVolumeMount("volume1", "/domain-path1/dir1")
14191421
.withAdditionalVolumeMount("volume2", "/domain-path1/dir1");

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /