[stable/rabbitmq] Improve the readiness and liveness probes: now print healthcheck result (#12744)

Signed-off-by: Thomas Riccardi <thomas@deepomatic.com>
This commit is contained in:
Thomas Riccardi
2019-04-04 02:22:51 -07:00
committed by Kubernetes Prow Robot
parent e516404270
commit d5dbfb8d7f
2 changed files with 20 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: rabbitmq
version: 4.11.0
version: 4.11.1
appVersion: 3.7.14
description: Open source message broker software that implements the Advanced Message Queuing Protocol (AMQP)
keywords:
+19 -2
View File
@@ -88,6 +88,17 @@ spec:
ulimit -n "${RABBITMQ_ULIMIT_NOFILES}"
#replace the default password that is generated
sed -i "s/CHANGEME/$RABBITMQ_PASSWORD/g" /opt/bitnami/rabbitmq/etc/rabbitmq/rabbitmq.conf
#api check for probes
cat > /opt/bitnami/rabbitmq/sbin/rabbitmq-api-check <<EOF
#!/bin/sh
set -e
URL=\$1
EXPECTED=\$2
ACTUAL=\$(curl --silent --show-error --fail "\${URL}")
echo "\${ACTUAL}"
test "\${EXPECTED}" = "\${ACTUAL}"
EOF
chmod a+x /opt/bitnami/rabbitmq/sbin/rabbitmq-api-check
exec rabbitmq-server
{{- if .Values.resources }}
resources:
@@ -115,7 +126,10 @@ spec:
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
exec:
command: ["sh", "-c", "test \"$(curl -sS -f --user {{ .Values.rabbitmq.username }}:$RABBITMQ_PASSWORD 127.0.0.1:{{ .Values.service.managerPort }}/api/healthchecks/node)\" = '{\"status\":\"ok\"}'"]
command:
- sh
- -c
- rabbitmq-api-check "http://{{ .Values.rabbitmq.username }}:$RABBITMQ_PASSWORD@127.0.0.1:{{ .Values.service.managerPort }}/api/healthchecks/node" '{"status":"ok"}'
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
@@ -125,7 +139,10 @@ spec:
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
exec:
command: ["sh", "-c", "test \"$(curl -sS -f --user {{ .Values.rabbitmq.username }}:$RABBITMQ_PASSWORD 127.0.0.1:{{ .Values.service.managerPort }}/api/healthchecks/node)\" = '{\"status\":\"ok\"}'"]
command:
- sh
- -c
- rabbitmq-api-check "http://{{ .Values.rabbitmq.username }}:$RABBITMQ_PASSWORD@127.0.0.1:{{ .Values.service.managerPort }}/api/healthchecks/node" '{"status":"ok"}'
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}