Skip to content

Commit

Permalink
add livenessProbe to values.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
swang392 committed Sep 13, 2024
1 parent f16a2ed commit 3a52601
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
15 changes: 14 additions & 1 deletion charts/datadog-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,17 @@ Check operator image tag version.
{{- else -}}
{{ "1.8.0" }}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Returns probe definition based on user settings and default HTTP port.
Accepts a map with `port` (default port) and `settings` (probe settings).
*/}}
{{- define "probe.http" -}}
{{ if or .settings.httpGet .settings.tcpSocket .settings.exec }}
{{ toYaml .settings }}
{{- else -}}
{{ $handler := dict "httpGet" (dict "port" .port "path" "/healthz/") }}
{{ toYaml (merge $handler .settings) }}
{{- end -}}
{{- end -}}
6 changes: 2 additions & 4 deletions charts/datadog-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ spec:
containerPort: {{ .Values.metricsPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /healthz/
port: 8081
periodSeconds: 10
{{- $live := .Values.livenessProbe }}
{{ include "probe.http" (dict "settings" $live "path" "/live" "port" .Values.healthPort) | indent 12}}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
Expand Down
10 changes: 10 additions & 0 deletions charts/datadog-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,13 @@ volumeMounts: []
# - name: <VOLUME_NAME>
# mountPath: <CONTAINER_PATH>
# readOnly: true

# livenessProbe -- Add default livenessProbe settings
livenessProbe:
periodSeconds: 10
httpGet:
path: /healthz/
port: 8081

# healthPort -- Port number to use in the Operator for the healthz endpoint
healthPort: 8081

0 comments on commit 3a52601

Please sign in to comment.