From e010e2ef44613540f355e59fc43f3ace10ff2d5b Mon Sep 17 00:00:00 2001 From: Tom Barnes Date: Tue, 15 Jan 2019 12:53:27 -0800 Subject: [PATCH 1/5] Sit cfg config.xml overrides sometimes fail silently when domain name isn't specified. --- operator/src/main/resources/scripts/introspectDomain.py | 4 +++- site/config-overrides.md | 9 ++++++++- src/integration-tests/introspector/override--config.xmlt | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index 932eb88d71c..5355d7d0e0d 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -106,6 +106,7 @@ def open(self): self.DOMAIN_UID = self.getEnv('DOMAIN_UID') self.DOMAIN_HOME = self.getEnv('DOMAIN_HOME') + self.DOMAIN_NAME = self.getEnv('DOMAIN_NAME') self.LOG_HOME = self.getEnv('LOG_HOME') self.CREDENTIALS_SECRET_NAME = self.getEnv('CREDENTIALS_SECRET_NAME') @@ -786,7 +787,7 @@ def addSitCfgXml(self): self.writeln("") self.writeln("") self.indent() - self.writeln(" 2020-07-16T19:20+01:00 ") + self.writeln("" + self.env.DOMAIN_NAME + "") self.customizeNodeManagerCreds() self.customizeDomainLogPath() self.customizeServers() @@ -908,6 +909,7 @@ def __init__(self, env): self.macroMap['env:DOMAIN_UID'] = self.env.DOMAIN_UID self.macroMap['env:DOMAIN_HOME'] = self.env.DOMAIN_HOME self.macroMap['env:LOG_HOME'] = self.env.LOG_HOME + self.macroMap['env:DOMAIN_NAME'] = self.env.DOMAIN_NAME keys=self.macroMap.keys() keys.sort() diff --git a/site/config-overrides.md b/site/config-overrides.md index 1d25e8e8da9..1ad40829155 100644 --- a/site/config-overrides.md +++ b/site/config-overrides.md @@ -167,7 +167,7 @@ The operator supports embedding macros within override templates. This helps ma Two types of macros are supported `environment variable macros` and `secret macros`: -* Environment variable macros have the syntax `${env:ENV-VAR-NAME}`, where the supported environment variables include `DOMAIN_HOME`, `LOG_HOME`, and `DOMAIN_UID`. +* Environment variable macros have the syntax `${env:ENV-VAR-NAME}`, where the supported environment variables include `DOMAIN_UID`, `DOMAIN_NAME`, `DOMAIN_HOME`, and `LOG_HOME`. * Secret macros have the syntax `${secret:SECRETNAME.SECRETKEY}` and `${secret:SECRETNAME.SECRETKEY:encrypt}`. @@ -190,6 +190,7 @@ The following `config.xml` override file demonstrates setting the `max-message-s + ${env:DOMAIN_NAME} admin-server 78787878 @@ -202,6 +203,8 @@ The following `config.xml` override file demonstrates setting the `max-message-s ``` +**IMPORTANT: To ensure all situational config takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name as in the sample above.** + ### Overriding a data source module The following `jdbc-testDS.xml` override template demonstrates setting the URL, user name, and password-encrypted fields of a JDBC module named `testDS` via secret macros. The generated situational configuration that replaces the macros with secret values will be located in the `DOMAIN_HOME/optconfig/jdbc` directory. The `password-encrypted` field will be populated with an encrypted value because it uses a secret macro with an `:encrypt` suffix. The secret is named `dbsecret` and contains three keys: `url`, `username`, and `password`. @@ -267,6 +270,8 @@ The following `jdbc-testDS.xml` override template demonstrates setting the URL, **IMPORTANT: Incorrectly formatted override files are 'somewhat' silently ignored. WebLogic Servers log errors or warnings when they detect an incorrectly formatted configuration override template file, but will still boot, and will skip overriding. So it is important to make sure that the template files are correct in a QA environment by checking your WebLogic pod logs for situational configuration errors and warnings, before attempting to use them in production.** +**IMPORTANT: To ensure all custom overrides takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name when overriding config.xml fields. Also, remember to use 'replace' verb to modify existing fields in the domain home configuration, and the 'add' verb to add a field that doesn't yet exist in the domain home configuration. Otherwise, situational config may be partially ignored without generating any errors or warnings. See the sample in [Override template samples](#override-template-samples).** + Example domain resource yaml: ``` @@ -332,6 +337,8 @@ spec: **IMPORTANT: Incorrectly formatted override files are 'somewhat' silently ignored. WebLogic Servers log errors or warnings when they detect an incorrectly formatted configuration override template file, but will still boot, and will skip overriding. So it is important to make sure that the template files are correct in a QA environment by checking your WebLogic pod logs for situational configuration errors and warnings, before attempting to use them in production.** +**IMPORTANT: To ensure all custom overrides takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name when overriding config.xml fields. Also, remember to use 'replace' verb to modify existing fields in the domain home configuration, and the 'add' verb to add a field that doesn't yet exist in the domain home configuration. Otherwise, situational config may be partially ignored without generating any errors or warnings. See the sample in [Override template samples](#override-template-samples).** + --- # Internal design flow diff --git a/src/integration-tests/introspector/override--config.xmlt b/src/integration-tests/introspector/override--config.xmlt index 0c81a906bab..7646b0aa1ac 100644 --- a/src/integration-tests/introspector/override--config.xmlt +++ b/src/integration-tests/introspector/override--config.xmlt @@ -1,5 +1,6 @@ + ${env:DOMAIN_NAME} ${ADMIN_NAME} 78787878 From 4314c493813282444fb4670b0af43324bbdb5651 Mon Sep 17 00:00:00 2001 From: Tom Barnes Date: Tue, 15 Jan 2019 13:44:29 -0800 Subject: [PATCH 2/5] Doc editor review changes. --- site/config-overrides.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/config-overrides.md b/site/config-overrides.md index 1ad40829155..e5220487255 100644 --- a/site/config-overrides.md +++ b/site/config-overrides.md @@ -203,7 +203,7 @@ The following `config.xml` override file demonstrates setting the `max-message-s ``` -**IMPORTANT: To ensure all situational config takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name as in the sample above.** +**IMPORTANT: To ensure all situational configuration takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name as in the sample above.** ### Overriding a data source module @@ -270,7 +270,7 @@ The following `jdbc-testDS.xml` override template demonstrates setting the URL, **IMPORTANT: Incorrectly formatted override files are 'somewhat' silently ignored. WebLogic Servers log errors or warnings when they detect an incorrectly formatted configuration override template file, but will still boot, and will skip overriding. So it is important to make sure that the template files are correct in a QA environment by checking your WebLogic pod logs for situational configuration errors and warnings, before attempting to use them in production.** -**IMPORTANT: To ensure all custom overrides takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name when overriding config.xml fields. Also, remember to use 'replace' verb to modify existing fields in the domain home configuration, and the 'add' verb to add a field that doesn't yet exist in the domain home configuration. Otherwise, situational config may be partially ignored without generating any errors or warnings. See the sample in [Override template samples](#override-template-samples).** +**IMPORTANT: To ensure all custom overrides takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name when overriding config.xml fields. Also, remember to use the 'replace' verb to modify existing fields in the domain home configuration, and the 'add' verb to add a field that doesn't yet exist in the domain home configuration. Otherwise, situational configuration may be partially ignored without generating any errors or warnings. See the sample in [Override template samples](#override-template-samples).** Example domain resource yaml: @@ -337,7 +337,7 @@ spec: **IMPORTANT: Incorrectly formatted override files are 'somewhat' silently ignored. WebLogic Servers log errors or warnings when they detect an incorrectly formatted configuration override template file, but will still boot, and will skip overriding. So it is important to make sure that the template files are correct in a QA environment by checking your WebLogic pod logs for situational configuration errors and warnings, before attempting to use them in production.** -**IMPORTANT: To ensure all custom overrides takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name when overriding config.xml fields. Also, remember to use 'replace' verb to modify existing fields in the domain home configuration, and the 'add' verb to add a field that doesn't yet exist in the domain home configuration. Otherwise, situational config may be partially ignored without generating any errors or warnings. See the sample in [Override template samples](#override-template-samples).** +**IMPORTANT: To ensure all custom overrides takes effect, remember to reference the name of each bean in the hierarchy that is overridden, including the domain name when overriding config.xml fields. Also, remember to use the 'replace' verb to modify existing fields in the domain home configuration, and the 'add' verb to add a field that doesn't yet exist in the domain home configuration. Otherwise, situational configuration may be partially ignored without generating any errors or warnings. See the sample in [Override template samples](#override-template-samples).** --- # Internal design flow From f6a99ae62fe605c6e3f2f85d51c6beb56a572427 Mon Sep 17 00:00:00 2001 From: Tom Barnes Date: Tue, 22 Jan 2019 11:28:14 -0800 Subject: [PATCH 3/5] Fix problem with pull 797, patched 12.2.1.3 images still need the expiration sit-cfg field (unlike 19.1). --- operator/src/main/resources/scripts/introspectDomain.py | 1 + 1 file changed, 1 insertion(+) diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index 5355d7d0e0d..2aa98d971e0 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -787,6 +787,7 @@ def addSitCfgXml(self): self.writeln("") self.writeln("") self.indent() + self.writeln(" 2099-07-16T19:20+01:00 ") self.writeln("" + self.env.DOMAIN_NAME + "") self.customizeNodeManagerCreds() self.customizeDomainLogPath() From 95bb732e6e58c669b980ea9983dc757dffabc48b Mon Sep 17 00:00:00 2001 From: Tom Barnes Date: Wed, 23 Jan 2019 12:45:19 -0800 Subject: [PATCH 4/5] Get domain name from domain home instead of env var. --- operator/src/main/resources/scripts/introspectDomain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index 2aa98d971e0..e6b4bb77ac4 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -106,7 +106,6 @@ def open(self): self.DOMAIN_UID = self.getEnv('DOMAIN_UID') self.DOMAIN_HOME = self.getEnv('DOMAIN_HOME') - self.DOMAIN_NAME = self.getEnv('DOMAIN_NAME') self.LOG_HOME = self.getEnv('LOG_HOME') self.CREDENTIALS_SECRET_NAME = self.getEnv('CREDENTIALS_SECRET_NAME') @@ -155,6 +154,7 @@ def open(self): trace("About to load domain from "+self.getDomainHome()) readDomain(self.getDomainHome()) self.domain = cmo + self.DOMAIN_NAME = self.getDomain().getName() def close(self): closeDomain() From c84efa13d0ad1cc2d204187b4d5c97ebffe4e581 Mon Sep 17 00:00:00 2001 From: Tom Barnes Date: Wed, 23 Jan 2019 16:26:34 -0800 Subject: [PATCH 5/5] sit cfg domain: skip setting domain name in internal sit-cfg --- operator/src/main/resources/scripts/introspectDomain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index e6b4bb77ac4..0a51929de82 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -788,7 +788,7 @@ def addSitCfgXml(self): self.writeln("") self.indent() self.writeln(" 2099-07-16T19:20+01:00 ") - self.writeln("" + self.env.DOMAIN_NAME + "") + #self.writeln("" + self.env.DOMAIN_NAME + "") self.customizeNodeManagerCreds() self.customizeDomainLogPath() self.customizeServers()