Skip to content

Commit 22e7b16

Browse files
pengzhoumlPeng Zhou
andauthored
MLE-21265: update liveness probe (#318)
Co-authored-by: Peng Zhou <[email protected]>
1 parent f729731 commit 22e7b16

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

charts/templates/configmap-scripts.yaml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# This configMap contains scirpts for MarkLogic Helm Chart:
2-
# liveness-probe.sh
32
# copy-certs.sh
43
# prestop-hook.sh
54
# poststart-hook.sh
@@ -8,37 +7,6 @@ kind: ConfigMap
87
metadata:
98
name: {{ include "marklogic.fullname" . }}-scripts
109
data:
11-
liveness-probe.sh: |
12-
#!/bin/bash
13-
log () {
14-
local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
15-
echo "${TIMESTAMP} $@" > /proc/1/fd/1
16-
}
17-
18-
# Check if ML service is running. Exit with 1 if it is other than running
19-
if [ -e /etc/init.d/MarkLogic ]; then
20-
ml_status=$(/etc/init.d/MarkLogic status)
21-
else
22-
ml_status=$(/etc/MarkLogic/MarkLogic-service.sh status)
23-
fi
24-
25-
if [[ "$ml_status" =~ "running" ]]; then
26-
http_code=$(curl -o /tmp/probe_response.txt -s -w "%{http_code}" "http://${HOSTNAME}:8001/admin/v1/timestamp")
27-
curl_code=$?
28-
http_resp=$(cat /tmp/probe_response.txt)
29-
30-
if [[ $curl_code -ne 0 && $http_code -ne 401 ]]; then
31-
log "Info: [Liveness Probe] Error with MarkLogic"
32-
log "Info: [Liveness Probe] Curl response code: "$curl_code
33-
log "Info: [Liveness Probe] Http response code: "$http_code
34-
log "Info: [Liveness Probe] Http response message: "$http_resp
35-
fi
36-
rm -f /tmp/probe_response.txt
37-
exit 0
38-
else
39-
exit 1
40-
fi
41-
4210
copy-certs.sh: |
4311
#!/bin/bash
4412
MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/ml-secrets/username)"

charts/templates/statefulset.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,8 @@ spec:
200200
{{- end }}
201201
{{- if .Values.livenessProbe.enabled }}
202202
livenessProbe:
203-
exec:
204-
command:
205-
- /bin/bash
206-
- /tmp/helm-scripts/liveness-probe.sh
203+
tcpSocket:
204+
port: 8001
207205
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
208206
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
209207
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}

0 commit comments

Comments
 (0)