-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy pathoperator.sh
executable file
·90 lines (72 loc) · 2.72 KB
/
operator.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Copyright (c) 2017, 2025, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
echo "Launching Oracle WebLogic Server Kubernetes Operator..."
# Relays SIGTERM to all java processes
relay_SIGTERM() {
pid=`grep java /proc/[0-9]*/comm | awk -F / '{ print $3; }'`
echo "Sending SIGTERM to java process " $pid
kill -SIGTERM $pid
exit 0
}
trap relay_SIGTERM SIGTERM
# Relays SIGKILL to all java processes
relay_SIGKILL() {
pid=`grep java /proc/[0-9]*/comm | awk -F / '{ print $3; }'`
echo "Sending SIGKILL to java process " $pid
kill -SIGKILL $pid
exit 0
}
trap relay_SIGKILL SIGKILL
exitMessage() {
echo "Exiting container for the Oracle WebLogic Server Kubernetes Operator..."
}
trap exitMessage EXIT
DEPLOYMENT_DIR="/deployment"
${DEPLOYMENT_DIR}/initialize-external-operator-identity.sh
if [[ ! -z "$REMOTE_DEBUG_PORT" ]]; then
DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,suspend=$DEBUG_SUSPEND,address=*:$REMOTE_DEBUG_PORT"
echo "DEBUG=$DEBUG"
else
DEBUG=""
fi
# start logstash
# set up a logging.properties file that has a FileHandler in it, and have it
# write to /logs/operator.log
LOGGING_CONFIG="${DEPLOYMENT_DIR}/logstash.properties"
# if the java logging level has been customized and is a valid value, update logstash.properties to match
if [[ ! -z "$JAVA_LOGGING_LEVEL" ]]; then
SEVERE="SEVERE"
WARNING="WARNING"
INFO="INFO"
CONFIG="CONFIG"
FINE="FINE"
FINER="FINER"
FINEST="FINEST"
if [ $JAVA_LOGGING_LEVEL != $SEVERE ] && \
[ $JAVA_LOGGING_LEVEL != $WARNING ] && \
[ $JAVA_LOGGING_LEVEL != $INFO ] && \
[ $JAVA_LOGGING_LEVEL != $CONFIG ] && \
[ $JAVA_LOGGING_LEVEL != $FINE ] && \
[ $JAVA_LOGGING_LEVEL != $FINER ] && \
[ $JAVA_LOGGING_LEVEL != $FINEST ]; then
echo "WARNING: Ignoring invalid JAVA_LOGGING_LEVEL: \"${JAVA_LOGGING_LEVEL}\". Valid values are $SEVERE, $WARNING, $INFO, $CONFIG, $FINE, $FINER and $FINEST."
else
sed -i -e "s|INFO|${JAVA_LOGGING_LEVEL}|g" $LOGGING_CONFIG
fi
fi
sed -i -e "s|JAVA_LOGGING_MAXSIZE|${JAVA_LOGGING_MAXSIZE:-20000000}|g" $LOGGING_CONFIG
sed -i -e "s|JAVA_LOGGING_COUNT|${JAVA_LOGGING_COUNT:-10}|g" $LOGGING_CONFIG
if [ "${MOCK_WLS}" == 'true' ]; then
MOCKING_WLS="-DmockWLS=true"
fi
LOGGING="-Djava.util.logging.config.file=${LOGGING_CONFIG}"
mkdir -m 777 -p /logs
# assumption is that we have mounted a volume on /logs which is also visible to
# the logstash container/pod.
# Start operator
java $JVM_OPTIONS $MOCKING_WLS $DEBUG $LOGGING -jar /operator/weblogic-kubernetes-operator.jar &
PID=$!
wait $PID
SHUTDOWN_COMPLETE_MARKER_FILE="${DEPLOYMENT_DIR}/marker.shutdown-complete"
touch ${SHUTDOWN_COMPLETE_MARKER_FILE}