forked from helm/charts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable/rabbitmq] enhance readiness-probe to handle pod restart (helm…
…#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
1 parent
879ff16
commit 41daaeb
Showing
2 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/ | ||
|
@@ -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 }} | ||
|
@@ -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 }} | ||
|
@@ -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 }} | ||
|