Skip to content

Commit

Permalink
Function worker liveness probe works with token authentication enabled (
Browse files Browse the repository at this point in the history
  • Loading branch information
cdbartholomew authored Dec 10, 2021
1 parent 3a2d4d4 commit 19c25db
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ spec:
{{- end }}
terminationGracePeriodSeconds: {{ .Values.function.gracePeriod }}
volumes:
- name: health
configMap:
name: "{{ template "pulsar.fullname" . }}-health"
defaultMode: 0755
- name: config-volume
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.function.component }}"
Expand Down Expand Up @@ -196,9 +200,9 @@ spec:
periodSeconds: {{ .Values.function.probe.period }}
timeoutSeconds: {{ .Values.function.probe.timeout }}
livenessProbe:
httpGet:
path: {{ .Values.function.probe.metricsPath | default "/metrics" }}
port: {{ .Values.function.probe.port }}
exec:
command:
- "/pulsar/health/function_worker_health_check.sh"
initialDelaySeconds: {{ .Values.function.probe.initial }}
periodSeconds: {{ .Values.function.probe.period }}
timeoutSeconds: {{ .Values.function.probe.timeout }}
Expand Down Expand Up @@ -252,6 +256,8 @@ spec:
value: 'true'
{{- end }}
volumeMounts:
- name: health
mountPath: /pulsar/health
{{- if .Values.enableTokenAuth }}
- mountPath: "/pulsar/token-superuser"
name: token-superuser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ data:
{{- else }}
curl -s --max-time {{ .Values.broker.probe.timeout }} --fail http://localhost:8080/admin/v2/brokers/health
{{- end }}
function_worker_health_check.sh: |
#!/bin/bash
{{- if .Values.enableTokenAuth }}
curl -s --max-time {{ .Values.proxy.probe.timeout }} --fail -H "Authorization: Bearer $(cat /pulsar/token-superuser/superuser.jwt | tr -d '\r')" http://localhost:{{ .Values.function.probe.port }}/metrics/ > /dev/null
{{- else }}
curl -s --max-time {{ .Values.proxy.probe.timeout }} --fail http://localhost:{{ .Values.function.probe.port }}/metrics/ > /dev/null
{{- end }}

0 comments on commit 19c25db

Please sign in to comment.