Skip to content

Commit 4b0b23b

Browse files
author
Tom Barnes
committed
Sit-cfg override fixes:
- MAJOR -- Move log location sit-cfg override stanzas to just after listen-address (work-around for XML parsing issue seen in domain-in-image wl server log). -- Add a 'TBD' note in the code for an outage in handling dynamic cluster SSL, NAP, and admin ports (discovered via code inspection). We need to (A) have the introspect report these, check that the Operator can consume them and set up services accordingly, and (C) add tests to cover this area. - MINOR -- Call 'add' instead of 'replace' if overriding a missing Listen address (best practice, replace works but this is not documented as supported). -- Do not 'replace' or 'add' an unset NAP ListenAddress (corrects mock/unit test issue seen in a particular T3Channel, no override needed as default NAP LA comes from server default LA). -- Do not add SSL listen-address overide stanzas since there's no listen address field in an SSL stanza (this wasn't causing an issue, discovered during code inspection). -- Update introspect mock/unit tests to cover even more use cases.
1 parent 52e8719 commit 4b0b23b

File tree

5 files changed

+64
-30
lines changed

5 files changed

+64
-30
lines changed

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

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,14 @@ def addServerTemplates(self):
603603
self.undent()
604604

605605
def addServerTemplate(self, serverTemplate):
606+
# TBD This looks wrong. It should match addClusteredServer.
607+
# It adds default port & listen address. But:
608+
# It's missing adding admin port, SSL, and NAPs.
609+
# It reports the wrong listen address (original rather than overridden).
610+
# Probably tests are passing fine, as it's likely (A)
611+
# the Operator.java is only reading the port, and (B) cluster tests
612+
# are only looking at the cluster default port.
613+
# So: Follow up and fix this, and file test JIRAs for tests.
606614
name=self.name(serverTemplate)
607615
self.writeln("- name: " + name)
608616
if serverTemplate.isListenPortEnabled():
@@ -803,28 +811,34 @@ def customizeServers(self):
803811
for server in self.env.getDomain().getServers():
804812
self.customizeServer(server)
805813

814+
def writeListenAddress(self, originalValue, newValue):
815+
repVerb="\"replace\""
816+
if originalValue is None or len(originalValue)==0:
817+
repVerb="\"add\""
818+
self.writeln("<d:listen-address f:combine-mode=" + repVerb + ">" + newValue + "</d:listen-address>")
819+
806820
def customizeServer(self, server):
807821
name=server.getName()
808822
listen_address=self.env.toDNS1123Legal(self.env.getDomainUID() + "-" + name)
809823
self.writeln("<d:server>")
810824
self.indent()
811825
self.writeln("<d:name>" + name + "</d:name>")
812-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
813-
if server.getSSL():
814-
self.writeln("<d:ssl>")
815-
self.indent()
816-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
817-
self.undent()
818-
self.writeln("</d:ssl>")
826+
self.customizeLog(name, server, false)
827+
self.writeListenAddress(server.getListenAddress(),listen_address)
819828
for nap in server.getNetworkAccessPoints():
829+
# Don't bother 'add' a nap listen-address, only do a 'replace'.
830+
# If we try 'add' this appears to mess up an attempt to
831+
# 'add' PublicAddress/Port via custom sit-cfg.
832+
# FWIW there's theoretically no need to 'add' or 'replace' when empty
833+
# since the runtime default is the server listen-address.
820834
nap_name=nap.getName()
821-
self.writeln("<d:network-access-point>")
822-
self.indent()
823-
self.writeln("<d:name>" + nap_name + "</d:name>")
824-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
825-
self.undent()
826-
self.writeln("</d:network-access-point>")
827-
self.customizeLog(name, server, false)
835+
if not (nap.getListenAddress() is None) and len(nap.getListenAddress()) > 0:
836+
self.writeln("<d:network-access-point>")
837+
self.indent()
838+
self.writeln("<d:name>" + nap_name + "</d:name>")
839+
self.writeListenAddress("force a replace",listen_address)
840+
self.undent()
841+
self.writeln("</d:network-access-point>")
828842
self.undent()
829843
self.writeln("</d:server>")
830844

@@ -839,8 +853,8 @@ def customizeServerTemplate(self, template):
839853
self.writeln("<d:server-template>")
840854
self.indent()
841855
self.writeln("<d:name>" + name + "</d:name>")
842-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
843856
self.customizeLog(server_name_prefix + "${id}", template, false)
857+
self.writeListenAddress(template.getListenAddress(),listen_address)
844858
self.undent()
845859
self.writeln("</d:server-template>")
846860

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ createFolder ${NODEMGR_HOME}
111111

112112
NODEMGR_LOG_HOME=${NODEMGR_LOG_HOME:-${LOG_HOME:-${NODEMGR_HOME}/${DOMAIN_UID}}}
113113

114+
trace "Info: NODEMGR_HOME='${NODEMGR_HOME}'"
115+
trace "Info: LOG_HOME='${LOG_HOME}'"
116+
trace "Info: SERVER_NAME='${SERVER_NAME}'"
117+
trace "Info: DOMAIN_UID='${DOMAIN_UID}'"
118+
trace "Info: NODEMGR_LOG_HOME='${NODEMGR_LOG_HOME}'"
119+
114120
createFolder ${NODEMGR_LOG_HOME}
115121

116122
nodemgr_log_file=${NODEMGR_LOG_HOME}/${SERVER_NAME}_nodemanager.log

src/integration-tests/introspector/checkBeans.inputt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
/Log/base_domain,FileName,logs/base_domain.log,/shared/logs/base_domain.log
2+
13
/Servers/${ADMIN_NAME},ListenAddress,,${DOMAIN_UID}-${ADMIN_NAME}
4+
25
/Servers/${ADMIN_NAME}/Log/${ADMIN_NAME},FileName,logs/${ADMIN_NAME}.log,/shared/logs/${ADMIN_NAME}.log
36

47
/Servers/${ADMIN_NAME}/NetworkAccessPoints/T3Channel1,ListenAddress,unresolvable-dns-name,${DOMAIN_UID}-${ADMIN_NAME}
@@ -17,6 +20,9 @@
1720
/Servers/standalone1,MaxMessageSize,7777777,1111111
1821
/Servers/standalone2,MaxMessageSize,10000000,2222222
1922

23+
/ServerTemplates/mycluster-template/Log/mycluster-template,FileName,logs/mycluster-template.log,/shared/logs/managed-server${id}.log
24+
/ServerTemplates/mycluster-template,ListenAddress,None,domain1-managed-server${id}
25+
2026
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS,Url,jdbc:oracle:thin:@myoriginalhostname:1521:myoriginalsid,jdbc:oracle:thin:@mynewhost:1521:mynewsid
2127
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS,PasswordEncrypted,*,!
2228
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS/Properties/testDS/Properties/user,Value,scott,supersecret

src/integration-tests/introspector/introspectTest.sh

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,20 @@ function cleanupMajor() {
179179
function cleanupMinor() {
180180
trace "Info: RERUN_INTROSPECT_ONLY==true, skipping cleanup.sh and domain home setup, and only deleting wl pods + introspector job."
181181

182-
kubectl -n $NAMESPACE delete pod ${DOMAIN_UID}-${ADMIN_NAME} > /dev/null 2>&1
183-
kubectl -n $NAMESPACE delete pod ${DOMAIN_UID}-${MANAGED_SERVER_NAME_BASE}1 > /dev/null 2>&1
184-
kubectl -n $NAMESPACE delete job ${DOMAIN_UID}-introspect-domain-job > /dev/null 2>&1
182+
kubectl -n $NAMESPACE delete pod ${DOMAIN_UID}-${ADMIN_NAME} --grace-period=2 > /dev/null 2>&1
183+
kubectl -n $NAMESPACE delete pod ${DOMAIN_UID}-${MANAGED_SERVER_NAME_BASE}1 --grace-period=2 > /dev/null 2>&1
184+
kubectl -n $NAMESPACE delete job ${DOMAIN_UID}-introspect-domain-job --grace-period=2 > /dev/null 2>&1
185+
kubectl -n $NAMESPACE delete pod ${DOMAIN_UID}--introspect-domain-pod --grace-period=2 > /dev/null 2>&1
185186
rm -fr ${test_home}/jobfiles
186187
tracen "Info: Waiting for wl pods to completely go away before continuing."
187188
while [ 1 -eq 1 ]; do
188189
echo -n "."
189-
[ "`kubectl -n ${NAMESPACE} get pods | grep '${DOMAIN_UID}.*server'`" = "" ] && break
190+
# echo
191+
# echo "Waiting for: '`kubectl -n ${NAMESPACE} get pods | grep \"${DOMAIN_UID}.*server\"`'"
192+
# echo "Waiting for: '`kubectl -n ${NAMESPACE} get pods | grep \"${DOMAIN_UID}.*introspect\"`'"
193+
[ "`kubectl -n ${NAMESPACE} get pods | grep \"${DOMAIN_UID}.*server\"`" = "" ] \
194+
&& [ "`kubectl -n ${NAMESPACE} get pods | grep \"${DOMAIN_UID}.*introspect\"`" = "" ] \
195+
&& break
190196
sleep 1
191197
done
192198
echo
@@ -339,7 +345,7 @@ function deployTestScriptConfigMap() {
339345
cp ${SCRIPTPATH}/introspectDomainProxy.sh ${test_home}/test-scripts || exit 1
340346

341347
if [ "$CREATE_DOMAIN" = "true" ]; then
342-
rm -f ${test_home}/scripts/createDomain.py
348+
rm -f ${test_home}/test-scripts/createDomain.py
343349
${SCRIPTPATH}/util_subst.sh -g createDomain.pyt ${test_home}/test-scripts/createDomain.py || exit 1
344350
fi
345351

@@ -498,19 +504,15 @@ function deployIntrospectJobPod() {
498504

499505
trace "Info: Run introspection job, parse its output to files, and put files in configmap '$introspect_output_cm_name'."
500506

501-
# delete anything left over from a previous invocation of this function
507+
# delete anything left over from a previous invocation of this function, assume all pods
508+
# have already been cleaned up
509+
510+
rm -f ${target_yaml}
502511

503512
kubectl -n $NAMESPACE delete cm $introspect_output_cm_name \
504513
--ignore-not-found \
505514
2>&1 | tracePipe "Info: kubectl output: "
506515

507-
if [ -f "${target_yaml}" ]; then
508-
kubectl -n $NAMESPACE delete -f ${target_yaml} \
509-
--ignore-not-found \
510-
2>&1 | tracePipe "Info: kubectl output: "
511-
rm -f ${target_yaml}
512-
fi
513-
514516
trace "Info: Deploying job pod '$pod_name' and waiting for it to be ready."
515517

516518
(
@@ -755,11 +757,13 @@ function checkOverrides() {
755757
# matches
756758
#
757759

760+
758761
kubectl -n $NAMESPACE delete secret my-secret > /dev/null 2>&1
759762
kubectl -n $NAMESPACE create secret generic my-secret \
760763
--from-literal=key1=supersecret \
761764
--from-literal=key2=topsecret 2>&1 | tracePipe "Info: kubectl output: "
762765

766+
763767
if [ ! "$RERUN_INTROSPECT_ONLY" = "true" ]; then
764768

765769
cleanupMajor
@@ -785,9 +789,13 @@ else
785789

786790
cleanupMinor
787791

792+
deployDomainConfigMap
793+
deployTestScriptConfigMap
788794
deployCustomOverridesConfigMap
789-
deployIntrospectJob
795+
#deployIntrospectJob
796+
deployIntrospectJobPod
790797
deployPod ${ADMIN_NAME?}
798+
deployPod ${MANAGED_SERVER_NAME_BASE?}1
791799

792800
fi
793801

src/integration-tests/introspector/util_subst.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ sed -i -e 's;${[a-zA-Z0-9_][a-zA-Z0-9_]*:-\([^}]*\)};\1;g' $tfilename
100100
# On a failure, helpfully list the problem lines in the input file
101101
# along with the line numbers.
102102

103-
count="`grep -v 'subst-ignore-missing' $tfilename | grep -v 'env:' | grep -v 'secret:' | grep -c '\${'`"
103+
count="`grep -v 'subst-ignore-missing' $tfilename | grep -v 'env:' | grep -v 'secret:' | grep -v '\${id}' | grep -c '\${'`"
104104
if [ $count -gt 0 ]; then
105105
trace "Debug: Error, found unresolved variables in file '$sfilename':"
106106
grep -n "\${" $tfilename | sed 's/^/@ line /' | grep -v 'subst-ignore-missing'

0 commit comments

Comments
 (0)