Skip to content

Commit e8a765a

Browse files
maggiehe00rjeberhard
authored andcommitted
Backport MR4414(run-as-root) to release/4.1
1 parent 09a3050 commit e8a765a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

integration-tests/src/test/java/oracle/weblogic/domain/InitializeDomainOnPV.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ public class InitializeDomainOnPV {
3939
+ " proceeding with the domain creation. Defaults to true.")
4040
Boolean waitForPvcToBind;
4141

42+
/** Whether to run the domain initialization init container in the introspector job as root. Default is false. */
43+
@ApiModelProperty("Specifies whether the operator will run the domain initialization init container in the "
44+
+ "introspector job as root. This may be needed in some environments to create the domain home directory on PV."
45+
+ " Defaults to false.")
46+
Boolean runDomainInitContainerAsRoot;
47+
48+
/** Whether to set the default 'fsGroup' in pod security context. Default is true. */
49+
@ApiModelProperty("Specifies whether the operator will set the default 'fsGroup' in the introspector job pod"
50+
+ " security context. This is needed to create the domain home directory on PV in some environments."
51+
+ " If the 'fsGroup' is specified as part of 'spec.introspector.serverPod.podSecurityContext', then the operator"
52+
+ " will use that 'fsGroup' instead of the default 'fsGroup'. Defaults to true.")
53+
Boolean setDefaultSecurityContextFsGroup;
54+
4255
public PersistentVolume getPersistentVolume() {
4356
return persistentVolume;
4457
}
@@ -75,6 +88,24 @@ public InitializeDomainOnPV waitForPvcToBind(Boolean waitForPvcToBind) {
7588
return this;
7689
}
7790

91+
public Boolean getRunDomainInitContainerAsRoot() {
92+
return Optional.ofNullable(runDomainInitContainerAsRoot).orElse(false);
93+
}
94+
95+
public InitializeDomainOnPV runInitContainerAsRoot(Boolean runInitContainerAsRoot) {
96+
this.runDomainInitContainerAsRoot = runInitContainerAsRoot;
97+
return this;
98+
}
99+
100+
public Boolean getSetDefaultSecurityContextFsGroup() {
101+
return Optional.ofNullable(setDefaultSecurityContextFsGroup).orElse(true);
102+
}
103+
104+
public InitializeDomainOnPV setDefaultFsGroup(Boolean setDefaultFsGroup) {
105+
this.setDefaultSecurityContextFsGroup = setDefaultFsGroup;
106+
return this;
107+
}
108+
78109
@Override
79110
public String toString() {
80111
ToStringBuilder builder =

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/FmwUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ public static DomainResource createDomainResourceSimplifyJrfPv(
425425
.addSecretsItem(rcuAccessSecretName)
426426
.introspectorJobActiveDeadlineSeconds(3000L)
427427
.initializeDomainOnPV((new InitializeDomainOnPV()
428+
.runInitContainerAsRoot(true)
428429
.persistentVolume(new PersistentVolume()
429430
.metadata(new V1ObjectMeta()
430431
.name(pvName))

0 commit comments

Comments
 (0)