Skip to content

Commit c30bd88

Browse files
Tom Barnesrjeberhard
authored andcommitted
Sit cfg config.xml overrides sometimes fail silently when domain name isn't specified.
1 parent a7de71a commit c30bd88

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def open(self):
106106

107107
self.DOMAIN_UID = self.getEnv('DOMAIN_UID')
108108
self.DOMAIN_HOME = self.getEnv('DOMAIN_HOME')
109+
self.DOMAIN_NAME = self.getEnv('DOMAIN_NAME')
109110
self.LOG_HOME = self.getEnv('LOG_HOME')
110111
self.CREDENTIALS_SECRET_NAME = self.getEnv('CREDENTIALS_SECRET_NAME')
111112

@@ -786,7 +787,7 @@ def addSitCfgXml(self):
786787
self.writeln("<?xml version='1.0' encoding='UTF-8'?>")
787788
self.writeln("<d:domain xmlns:d=\"http://xmlns.oracle.com/weblogic/domain\" xmlns:f=\"http://xmlns.oracle.com/weblogic/domain-fragment\" xmlns:s=\"http://xmlns.oracle.com/weblogic/situational-config\">")
788789
self.indent()
789-
self.writeln("<s:expiration> 2020-07-16T19:20+01:00 </s:expiration>")
790+
self.writeln("<d:name>" + self.env.DOMAIN_NAME + "</d:name>")
790791
self.customizeNodeManagerCreds()
791792
self.customizeDomainLogPath()
792793
self.customizeServers()
@@ -908,6 +909,7 @@ def __init__(self, env):
908909
self.macroMap['env:DOMAIN_UID'] = self.env.DOMAIN_UID
909910
self.macroMap['env:DOMAIN_HOME'] = self.env.DOMAIN_HOME
910911
self.macroMap['env:LOG_HOME'] = self.env.LOG_HOME
912+
self.macroMap['env:DOMAIN_NAME'] = self.env.DOMAIN_NAME
911913

912914
keys=self.macroMap.keys()
913915
keys.sort()

site/config-overrides.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ The operator supports embedding macros within override templates. This helps ma
167167

168168
Two types of macros are supported `environment variable macros` and `secret macros`:
169169

170-
* Environment variable macros have the syntax `${env:ENV-VAR-NAME}`, where the supported environment variables include `DOMAIN_HOME`, `LOG_HOME`, and `DOMAIN_UID`.
170+
* 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`.
171171

172172
* Secret macros have the syntax `${secret:SECRETNAME.SECRETKEY}` and `${secret:SECRETNAME.SECRETKEY:encrypt}`.
173173

@@ -190,6 +190,7 @@ The following `config.xml` override file demonstrates setting the `max-message-s
190190
<domain xmlns="http://xmlns.oracle.com/weblogic/domain"
191191
xmlns:f="http://xmlns.oracle.com/weblogic/domain-fragment"
192192
xmlns:s="http://xmlns.oracle.com/weblogic/situational-config">
193+
<name>${env:DOMAIN_NAME}</name>
193194
<server>
194195
<name>admin-server</name>
195196
<max-message-size f:combine-mode="add">78787878</max-message-size>
@@ -202,6 +203,8 @@ The following `config.xml` override file demonstrates setting the `max-message-s
202203
</domain>
203204
```
204205

206+
**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.**
207+
205208
### Overriding a data source module
206209

207210
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,
267270
268271
**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.**
269272
273+
**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).**
274+
270275
271276
Example domain resource yaml:
272277
```
@@ -332,6 +337,8 @@ spec:
332337
333338
**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.**
334339
340+
**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).**
341+
335342
---
336343
# Internal design flow
337344

src/integration-tests/introspector/override--config.xmlt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<domain xmlns="http://xmlns.oracle.com/weblogic/domain" xmlns:f="http://xmlns.oracle.com/weblogic/domain-fragment" xmlns:s="http://xmlns.oracle.com/weblogic/situational-config">
3+
<name>${env:DOMAIN_NAME}</name>
34
<server>
45
<name>${ADMIN_NAME}</name>
56
<max-message-size f:combine-mode="replace">78787878</max-message-size>

0 commit comments

Comments
 (0)