Skip to content

Commit 9f23d4e

Browse files
committed
Speed up mock server pod shutdown
1 parent b5d5846 commit 9f23d4e

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,32 @@ function mockWLS() {
9494
echo "RUNNING:Y:N" > $STATEFILE
9595
}
9696

97+
function waitUntilShutdown() {
98+
#
99+
# Wait forever. Kubernetes will monitor this pod via liveness and readyness probes.
100+
#
101+
if [ "${SERVER_OUT_IN_POD_LOG}" == 'true' ] ; then
102+
trace "Showing the server out file from ${SERVER_OUT_FILE}"
103+
tail -F -n +0 ${SERVER_OUT_FILE} || exitOrLoop
104+
else
105+
trace "Wait indefinitely so that the Kubernetes pod does not exit and try to restart"
106+
while true; do sleep 60; done
107+
fi
108+
}
109+
110+
function mockWaitUntilShutdown() {
111+
#
112+
# Wait forever. Kubernetes will monitor this pod via liveness and readyness probes.
113+
#
114+
trace "Wait indefinitely so that the Kubernetes pod does not exit and try to restart"
115+
while true; do
116+
if [ -e /u01/doShutdown ] ; then
117+
exit 0
118+
fi
119+
sleep 5
120+
done
121+
}
122+
97123
# Define helper fn to copy sit cfg xml files from one dir to another
98124
# $src_dir files are assumed to start with $fil_prefix and end with .xml
99125
# Copied $tgt_dir files are stripped of their $fil_prefix
@@ -180,8 +206,10 @@ copySitCfg /weblogic-operator/introspector ${DOMAIN_HOME}/optconfig/wldf 'Sit-C
180206

181207
if [ "${MOCK_WLS}" == 'true' ]; then
182208
mockWLS
209+
mockWaitUntilShutdown
183210
else
184211
startWLS
212+
waitUntilShutdown
185213
fi
186214

187215
#

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ trace "Stop server ${SERVER_NAME}"
1818
checkEnv SERVER_NAME || exit 1
1919

2020
if [ "${MOCK_WLS}" == 'true' ]; then
21+
touch /u01/doShutdown
2122
exit 0
2223
fi
2324

0 commit comments

Comments
 (0)