Skip to content

MLE-21265 update liveness probe #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions charts/templates/configmap-scripts.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This configMap contains scirpts for MarkLogic Helm Chart:
# liveness-probe.sh
# copy-certs.sh
# prestop-hook.sh
# poststart-hook.sh
Expand All @@ -8,37 +7,6 @@ kind: ConfigMap
metadata:
name: {{ include "marklogic.fullname" . }}-scripts
data:
liveness-probe.sh: |
#!/bin/bash
log () {
local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
echo "${TIMESTAMP} $@" > /proc/1/fd/1
}

# Check if ML service is running. Exit with 1 if it is other than running
if [ -e /etc/init.d/MarkLogic ]; then
ml_status=$(/etc/init.d/MarkLogic status)
else
ml_status=$(/etc/MarkLogic/MarkLogic-service.sh status)
fi

if [[ "$ml_status" =~ "running" ]]; then
http_code=$(curl -o /tmp/probe_response.txt -s -w "%{http_code}" "http://${HOSTNAME}:8001/admin/v1/timestamp")
curl_code=$?
http_resp=$(cat /tmp/probe_response.txt)

if [[ $curl_code -ne 0 && $http_code -ne 401 ]]; then
log "Info: [Liveness Probe] Error with MarkLogic"
log "Info: [Liveness Probe] Curl response code: "$curl_code
log "Info: [Liveness Probe] Http response code: "$http_code
log "Info: [Liveness Probe] Http response message: "$http_resp
fi
rm -f /tmp/probe_response.txt
exit 0
else
exit 1
fi

copy-certs.sh: |
#!/bin/bash
MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/ml-secrets/username)"
Expand Down
6 changes: 2 additions & 4 deletions charts/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ spec:
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
exec:
command:
- /bin/bash
- /tmp/helm-scripts/liveness-probe.sh
tcpSocket:
port: 8001
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
Expand Down