Skip to content

Commit 1a16e76

Browse files
committed
Changes to move 'chmod -R g=u' in the introspector for MII domain instead of startServer.sh.
1 parent 7c03475 commit 1a16e76

File tree

6 files changed

+26
-8
lines changed

6 files changed

+26
-8
lines changed

operator/src/main/java/oracle/kubernetes/operator/helpers/BasePodStepContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
public abstract class BasePodStepContext extends StepContextBase {
4141

42+
public static final String KUBERNETES_PLATFORM_SYSTEM_PROPERTY = "kubernetesPlatform";
43+
4244
BasePodStepContext(DomainPresenceInfo info) {
4345
super(info);
4446
}

operator/src/main/java/oracle/kubernetes/operator/helpers/JobHelper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ List<V1EnvVar> getConfiguredEnvVars(TuningParameters tuningParameters) {
325325
addEnvVar(vars, IntrospectorJobEnvVars.ISTIO_ENABLED, Boolean.toString(isIstioEnabled()));
326326
addEnvVar(vars, IntrospectorJobEnvVars.ADMIN_CHANNEL_PORT_FORWARDING_ENABLED,
327327
Boolean.toString(isAdminChannelPortForwardingEnabled(getDomain().getSpec())));
328+
Optional.ofNullable(getKubernetesPlatform())
329+
.ifPresent(v -> addEnvVar(vars, ServerEnvVars.KUBERNETES_PLATFORM, v));
330+
328331
addEnvVar(vars, IntrospectorJobEnvVars.ISTIO_READINESS_PORT, Integer.toString(getIstioReadinessPort()));
329332
addEnvVar(vars, IntrospectorJobEnvVars.ISTIO_POD_NAMESPACE, getNamespace());
330333
if (isUseOnlineUpdate()) {
@@ -391,6 +394,10 @@ List<V1EnvVar> getConfiguredEnvVars(TuningParameters tuningParameters) {
391394
return vars;
392395
}
393396

397+
private String getKubernetesPlatform() {
398+
return System.getProperty(KUBERNETES_PLATFORM_SYSTEM_PROPERTY);
399+
}
400+
394401
}
395402

396403
static class DomainIntrospectorJobStep extends Step {

operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ private boolean mockWls() {
10811081
}
10821082

10831083
private String getKubernetesPlatform() {
1084-
return System.getProperty("kubernetesPlatform");
1084+
return System.getProperty(KUBERNETES_PLATFORM_SYSTEM_PROPERTY);
10851085
}
10861086

10871087
private abstract class BaseStep extends Step {

operator/src/main/resources/scripts/introspectDomain.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,10 @@ def generate(self):
905905
self.close()
906906

907907
def addDomainConfig(self):
908+
kubernetes_platform = self.env.getEnvOrDef("KUBERNETES_PLATFORM", "")
909+
if (str(kubernetes_platform).upper() == 'OPENSHIFT'):
910+
os.system("chmod -R g=u %s" % self.domain_home)
911+
908912
# Note: only config type is needed fmwconfig, security is excluded because it's in the primordial and contain
909913
# all the many policies files
910914
packcmd = "tar -pczf /tmp/domain.tar.gz %s/config/config.xml %s/config/jdbc/ %s/config/jms %s/config/coherence " \

operator/src/main/resources/scripts/modelInImage.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,12 @@ function createPrimordialDomain() {
785785
local MII_PASSPHRASE=$(cat ${RUNTIME_ENCRYPTION_SECRET_PASSWORD})
786786
encrypt_decrypt_domain_secret "encrypt" ${DOMAIN_HOME} ${MII_PASSPHRASE}
787787

788+
if [[ "${KUBERNETES_PLATFORM^^}" == "OPENSHIFT" ]]; then
789+
# Operator running on Openshift platform - change file permissions in the DOMAIN_HOME dir to give
790+
# group same permissions as user .
791+
chmod -R g=u ${DOMAIN_HOME} || return 1
792+
fi
793+
788794
tar -pczf ${LOCAL_PRIM_DOMAIN_ZIP} --exclude ${DOMAIN_HOME}/wlsdeploy --exclude ${DOMAIN_HOME}/sysman/log \
789795
--exclude ${DOMAIN_HOME}/lib --exclude ${DOMAIN_HOME}/backup_config ${empath} ${DOMAIN_HOME}/*
790796

operator/src/main/resources/scripts/startServer.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,16 @@ if [ ${DOMAIN_SOURCE_TYPE} != "FromModel" ]; then
300300
copySitCfgWhileBooting /weblogic-operator/introspector ${DOMAIN_HOME}/optconfig/jms 'Sit-Cfg-JMS--'
301301
copySitCfgWhileBooting /weblogic-operator/introspector ${DOMAIN_HOME}/optconfig/jdbc 'Sit-Cfg-JDBC--'
302302
copySitCfgWhileBooting /weblogic-operator/introspector ${DOMAIN_HOME}/optconfig/diagnostics 'Sit-Cfg-WLDF--'
303-
else
304-
if [[ ${KUBERNETES_PLATFORM^^} == "OPENSHIFT" ]]; then
305-
# Operator running on Openshift platform - change file permissions in the DOMAIN_HOME dir to give
306-
# group same permissions as user .
307-
chmod -R g=u ${DOMAIN_HOME} || return 1
308-
fi
309303
fi
310304

311-
if [[ ${KUBERNETES_PLATFORM^^} == "OPENSHIFT" ]]; then
305+
if [[ "${KUBERNETES_PLATFORM^^}" == "OPENSHIFT" ]]; then
312306
# When the Operator is running on Openshift platform, disable insecure file system warnings.
313307
export JAVA_OPTIONS="-Dweblogic.SecureMode.WarnOnInsecureFileSystem=false $JAVA_OPTIONS"
308+
if [[ "${DOMAIN_SOURCE_TYPE}" == "Image" ]]; then
309+
# Change the file permissions in the DOMAIN_HOME dir to give group same permissions as user .
310+
chmod -R g=u ${DOMAIN_HOME} || return 1
311+
fi
312+
314313
fi
315314

316315
#

0 commit comments

Comments
 (0)