From fdd85060857dcc49967c7a1394c9bfa743622b3a Mon Sep 17 00:00:00 2001 From: Danil-Grigorev Date: Fri, 20 Dec 2024 15:25:38 +0100 Subject: [PATCH] Implement healthz and readyz checks in the deployment Signed-off-by: Danil-Grigorev --- .../templates/deployment.yaml | 24 +++++++++++++++++++ hack/charts/cluster-api-operator/values.yaml | 2 +- test/e2e/resources/full-chart-install.yaml | 22 ++++++++++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/hack/charts/cluster-api-operator/templates/deployment.yaml b/hack/charts/cluster-api-operator/templates/deployment.yaml index a0c31477..598d85c8 100644 --- a/hack/charts/cluster-api-operator/templates/deployment.yaml +++ b/hack/charts/cluster-api-operator/templates/deployment.yaml @@ -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: diff --git a/hack/charts/cluster-api-operator/values.yaml b/hack/charts/cluster-api-operator/values.yaml index 7038e9b6..05ce1dde 100644 --- a/hack/charts/cluster-api-operator/values.yaml +++ b/hack/charts/cluster-api-operator/values.yaml @@ -23,8 +23,8 @@ image: pullPolicy: IfNotPresent env: manager: [] -healthAddr: ":8081" diagnosticsAddress: ":8443" +healthAddr: ":9440" insecureDiagnostics: false watchConfigSecret: false imagePullSecrets: {} diff --git a/test/e2e/resources/full-chart-install.yaml b/test/e2e/resources/full-chart-install.yaml index f51b0082..945d8085 100644 --- a/test/e2e/resources/full-chart-install.yaml +++ b/test/e2e/resources/full-chart-install.yaml @@ -28386,7 +28386,7 @@ spec: containers: - args: - --v=2 - - --health-addr=:8081 + - --health-addr=:9440 - --diagnostics-address=:8443 - --leader-elect=true command: @@ -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