Skip to content

Commit

Permalink
Implement healthz and readyz checks in the deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Danil-Grigorev <[email protected]>
  • Loading branch information
Danil-Grigorev committed Dec 20, 2024
1 parent d03c162 commit fdd8506
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
24 changes: 24 additions & 0 deletions hack/charts/cluster-api-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,30 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
terminationMessagePolicy: FallbackToLogsOnError
{{- $healthAddr := $.Values.healthAddr }}
{{- if contains ":" $healthAddr -}}
{{ $healthAddr = ( split ":" $.Values.healthAddr)._1 | int }}
{{- end }}
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: {{ $healthAddr | default 9440 }}
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 20
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /readyz
port: {{ $healthAddr | default 9440 }}
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
terminationGracePeriodSeconds: 10
{{- with .Values.volumes }}
volumes:
Expand Down
2 changes: 1 addition & 1 deletion hack/charts/cluster-api-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ image:
pullPolicy: IfNotPresent
env:
manager: []
healthAddr: ":8081"
diagnosticsAddress: ":8443"
healthAddr: ":9440"
insecureDiagnostics: false
watchConfigSecret: false
imagePullSecrets: {}
Expand Down
22 changes: 21 additions & 1 deletion test/e2e/resources/full-chart-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28386,7 +28386,7 @@ spec:
containers:
- args:
- --v=2
- --health-addr=:8081
- --health-addr=:9440
- --diagnostics-address=:8443
- --leader-elect=true
command:
Expand All @@ -28413,6 +28413,26 @@ spec:
name: cert
readOnly: true
terminationMessagePolicy: FallbackToLogsOnError
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 9440
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 20
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /readyz
port: 9440
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
terminationGracePeriodSeconds: 10
volumes:
- name: cert
Expand Down

0 comments on commit fdd8506

Please sign in to comment.