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 57fd624 commit 6e7b574
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 @@ -120,6 +120,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,7 +23,7 @@ image:
pullPolicy: IfNotPresent
env:
manager: []
healthAddr: ":8081"
healthAddr: ":9440"
metricsBindAddr: "127.0.0.1:8080"
diagnosticsAddress: "8443"
insecureDiagnostics: false
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
- --metrics-bind-addr=127.0.0.1:8080
- --diagnostics-address=8443
- --leader-elect=true
Expand Down Expand Up @@ -28414,6 +28414,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 6e7b574

Please sign in to comment.