From a0b52817ba506c9af29eecc2a0d690b1d6bbfd19 Mon Sep 17 00:00:00 2001 From: Lishen Yao Date: Fri, 22 Sep 2023 17:32:39 +0800 Subject: [PATCH] Add auth in proxy health check --- .../templates/proxy/proxy-statefulset.yaml | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/charts/pulsar/templates/proxy/proxy-statefulset.yaml b/charts/pulsar/templates/proxy/proxy-statefulset.yaml index b204f1dc3..f26ebd9f4 100644 --- a/charts/pulsar/templates/proxy/proxy-statefulset.yaml +++ b/charts/pulsar/templates/proxy/proxy-statefulset.yaml @@ -192,27 +192,36 @@ spec: imagePullPolicy: {{ .Values.images.proxy.pullPolicy }} {{- if .Values.proxy.probe.liveness.enabled }} livenessProbe: - httpGet: - path: /status.html - port: {{ .Values.proxy.ports.http }} + httpGet: null + exec: + command: + - /bin/bash + - -c + - 'res=$(curl -H "Authorization: Bearer $brokerClientAuthenticationParameters" http://localhost:8080/status.html);if [[ $res == "OK" ]]; then exit 0; else exit 1; fi' initialDelaySeconds: {{ .Values.proxy.probe.liveness.initialDelaySeconds }} periodSeconds: {{ .Values.proxy.probe.liveness.periodSeconds }} failureThreshold: {{ .Values.proxy.probe.liveness.failureThreshold }} {{- end }} {{- if .Values.proxy.probe.readiness.enabled }} readinessProbe: - httpGet: - path: /status.html - port: {{ .Values.proxy.ports.http }} + httpGet: null + exec: + command: + - /bin/bash + - -c + - 'res=$(curl -H "Authorization: Bearer $brokerClientAuthenticationParameters" http://localhost:8080/status.html);if [[ $res == "OK" ]]; then exit 0; else exit 1; fi' initialDelaySeconds: {{ .Values.proxy.probe.readiness.initialDelaySeconds }} periodSeconds: {{ .Values.proxy.probe.readiness.periodSeconds }} failureThreshold: {{ .Values.proxy.probe.readiness.failureThreshold }} {{- end }} {{- if .Values.proxy.probe.startup.enabled }} startupProbe: - httpGet: - path: /status.html - port: {{ .Values.proxy.ports.http }} + httpGet: null + exec: + command: + - /bin/bash + - -c + - 'res=$(curl -H "Authorization: Bearer $brokerClientAuthenticationParameters" http://localhost:8080/status.html);if [[ $res == "OK" ]]; then exit 0; else exit 1; fi' initialDelaySeconds: {{ .Values.proxy.probe.startup.initialDelaySeconds }} periodSeconds: {{ .Values.proxy.probe.startup.periodSeconds }} failureThreshold: {{ .Values.proxy.probe.startup.failureThreshold }}