Skip to content

Commit

Permalink
[stable/rabbitmq] enhance readiness-probe to handle pod restart (helm…
Browse files Browse the repository at this point in the history
…#14926)

* [stable/rabbitmq] enhance readiness-probe to allow rabbitmq sync data after pod restart
Signed-off-by: aggiefly <[email protected]>

* [[stable/rabbitmq] enhance readiness-probe to allow rabbitmq sync data after restart

Signed-off-by: aggiefly <[email protected]>
  • Loading branch information
aggiefly authored and davidkarlsen committed Jul 3, 2019
1 parent 879ff16 commit 41daaeb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stable/rabbitmq/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: rabbitmq
version: 6.1.3
version: 6.1.4
appVersion: 3.7.15
description: Open source message broker software that implements the Advanced Message Queuing Protocol (AMQP)
keywords:
Expand Down
22 changes: 20 additions & 2 deletions stable/rabbitmq/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ spec:
- |
mkdir -p /opt/bitnami/rabbitmq/.rabbitmq/
mkdir -p /opt/bitnami/rabbitmq/etc/rabbitmq/
touch /opt/bitnami/rabbitmq/var/lib/rabbitmq/.start
#persist the erlang cookie in both places for server and cli tools
echo $RABBITMQ_ERL_COOKIE > /opt/bitnami/rabbitmq/var/lib/rabbitmq/.erlang.cookie
cp /opt/bitnami/rabbitmq/var/lib/rabbitmq/.erlang.cookie /opt/bitnami/rabbitmq/.rabbitmq/
Expand All @@ -105,6 +106,23 @@ spec:
test "\${EXPECTED}" = "\${ACTUAL}"
EOF
chmod a+x /opt/bitnami/rabbitmq/sbin/rabbitmq-api-check
#health check for probes, handle period during rabbtmq sync
cat > /opt/bitnami/rabbitmq/sbin/rabbitmq-health-check <<EOF
#!/bin/sh
START_FLAG=/opt/bitnami/rabbitmq/var/lib/rabbitmq/.start
if [ -f \${START_FLAG} ]; then
rabbitmqctl node_health_check
RESULT=\$?
if [ \$RESULT -ne 0 ]; then
rabbitmqctl status
exit $?
fi
rm -f \${START_FLAG}
exit \${RESULT}
fi
rabbitmq-api-check \$1 \$2
EOF
chmod a+x /opt/bitnami/rabbitmq/sbin/rabbitmq-health-check
{{- if and .Values.persistence.enabled .Values.forceBoot.enabled }}
if [ -d "{{ .Values.persistence.path }}/mnesia/${RABBITMQ_NODENAME}" ]; then rabbitmqctl force_boot; fi
{{- end }}
Expand Down Expand Up @@ -138,7 +156,7 @@ spec:
command:
- sh
- -c
- rabbitmq-api-check "http://{{ .Values.rabbitmq.username }}:[email protected]:{{ .Values.service.managerPort }}/api/healthchecks/node" '{"status":"ok"}'
- rabbitmq-api-check "http://{{ .Values.rabbitmq.username }}:[email protected]:{{ .Values.service.managerPort }}/api/healthchecks/node" '{"status":"ok"}'
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
Expand All @@ -151,7 +169,7 @@ spec:
command:
- sh
- -c
- rabbitmq-api-check "http://{{ .Values.rabbitmq.username }}:[email protected]:{{ .Values.service.managerPort }}/api/healthchecks/node" '{"status":"ok"}'
- rabbitmq-health-check "http://{{ .Values.rabbitmq.username }}:[email protected]:{{ .Values.service.managerPort }}/api/healthchecks/node" '{"status":"ok"}'
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
Expand Down

0 comments on commit 41daaeb

Please sign in to comment.