From 2b9dbf1bf64f1f1937372e36a73e57b9d4e35676 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Fri, 27 Jun 2025 19:45:27 +0100 Subject: [PATCH] make probes configurable --- hosting/k8s/helm/README.md | 102 +++++++++++++++++++++ hosting/k8s/helm/templates/electric.yaml | 33 +++++-- hosting/k8s/helm/templates/registry.yaml | 33 +++++-- hosting/k8s/helm/templates/supervisor.yaml | 33 +++++-- hosting/k8s/helm/templates/webapp.yaml | 33 +++++-- hosting/k8s/helm/values.yaml | 92 +++++++++++++++++++ 6 files changed, 294 insertions(+), 32 deletions(-) diff --git a/hosting/k8s/helm/README.md b/hosting/k8s/helm/README.md index a56ae2c89..742f2215b 100644 --- a/hosting/k8s/helm/README.md +++ b/hosting/k8s/helm/README.md @@ -323,6 +323,108 @@ Health checks are configured for all services: - Database connection tests - Readiness and liveness probes +### Health Probe Configuration + +All non-Bitnami services support configurable health probes: + +```yaml +# Webapp health probes +webapp: + livenessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 1 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + +# Supervisor health probes +supervisor: + livenessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 1 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + +# Electric health probes +electric: + livenessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 1 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + +# Registry health probes +registry: + livenessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 1 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 +``` + ### Prometheus Integration ServiceMonitors are available for webapp and supervisor services: diff --git a/hosting/k8s/helm/templates/electric.yaml b/hosting/k8s/helm/templates/electric.yaml index b56b6bdcb..014294656 100644 --- a/hosting/k8s/helm/templates/electric.yaml +++ b/hosting/k8s/helm/templates/electric.yaml @@ -46,22 +46,39 @@ spec: {{- with .Values.electric.extraEnvVars }} {{- toYaml . | nindent 12 }} {{- end }} + {{- if .Values.electric.livenessProbe.enabled }} livenessProbe: httpGet: path: /v1/health port: http - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 + initialDelaySeconds: {{ .Values.electric.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.electric.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.electric.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.electric.livenessProbe.failureThreshold }} + successThreshold: {{ .Values.electric.livenessProbe.successThreshold }} + {{- end }} + {{- if .Values.electric.readinessProbe.enabled }} readinessProbe: httpGet: path: /v1/health port: http - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 + initialDelaySeconds: {{ .Values.electric.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.electric.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.electric.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.electric.readinessProbe.failureThreshold }} + successThreshold: {{ .Values.electric.readinessProbe.successThreshold }} + {{- end }} + {{- if .Values.electric.startupProbe.enabled }} + startupProbe: + httpGet: + path: /v1/health + port: http + initialDelaySeconds: {{ .Values.electric.startupProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.electric.startupProbe.periodSeconds }} + timeoutSeconds: {{ .Values.electric.startupProbe.timeoutSeconds }} + failureThreshold: {{ .Values.electric.startupProbe.failureThreshold }} + successThreshold: {{ .Values.electric.startupProbe.successThreshold }} + {{- end }} resources: {{- toYaml .Values.electric.resources | nindent 12 }} --- diff --git a/hosting/k8s/helm/templates/registry.yaml b/hosting/k8s/helm/templates/registry.yaml index 9e1155852..52f31e25d 100644 --- a/hosting/k8s/helm/templates/registry.yaml +++ b/hosting/k8s/helm/templates/registry.yaml @@ -51,22 +51,39 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} + {{- if .Values.registry.livenessProbe.enabled }} livenessProbe: httpGet: path: / port: http - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 + initialDelaySeconds: {{ .Values.registry.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.registry.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.registry.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.registry.livenessProbe.failureThreshold }} + successThreshold: {{ .Values.registry.livenessProbe.successThreshold }} + {{- end }} + {{- if .Values.registry.readinessProbe.enabled }} readinessProbe: httpGet: path: / port: http - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 + initialDelaySeconds: {{ .Values.registry.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.registry.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.registry.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.registry.readinessProbe.failureThreshold }} + successThreshold: {{ .Values.registry.readinessProbe.successThreshold }} + {{- end }} + {{- if .Values.registry.startupProbe.enabled }} + startupProbe: + httpGet: + path: / + port: http + initialDelaySeconds: {{ .Values.registry.startupProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.registry.startupProbe.periodSeconds }} + timeoutSeconds: {{ .Values.registry.startupProbe.timeoutSeconds }} + failureThreshold: {{ .Values.registry.startupProbe.failureThreshold }} + successThreshold: {{ .Values.registry.startupProbe.successThreshold }} + {{- end }} resources: {{- toYaml .Values.registry.resources | nindent 12 }} volumeMounts: diff --git a/hosting/k8s/helm/templates/supervisor.yaml b/hosting/k8s/helm/templates/supervisor.yaml index a6911623d..e6af463d8 100644 --- a/hosting/k8s/helm/templates/supervisor.yaml +++ b/hosting/k8s/helm/templates/supervisor.yaml @@ -95,22 +95,39 @@ spec: - name: metrics containerPort: {{ .Values.supervisor.service.ports.metrics }} protocol: TCP + {{- if .Values.supervisor.livenessProbe.enabled }} livenessProbe: httpGet: path: /health port: workload - initialDelaySeconds: 30 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 3 + initialDelaySeconds: {{ .Values.supervisor.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.supervisor.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.supervisor.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.supervisor.livenessProbe.failureThreshold }} + successThreshold: {{ .Values.supervisor.livenessProbe.successThreshold }} + {{- end }} + {{- if .Values.supervisor.readinessProbe.enabled }} readinessProbe: httpGet: path: /health port: workload - initialDelaySeconds: 15 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 3 + initialDelaySeconds: {{ .Values.supervisor.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.supervisor.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.supervisor.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.supervisor.readinessProbe.failureThreshold }} + successThreshold: {{ .Values.supervisor.readinessProbe.successThreshold }} + {{- end }} + {{- if .Values.supervisor.startupProbe.enabled }} + startupProbe: + httpGet: + path: /health + port: workload + initialDelaySeconds: {{ .Values.supervisor.startupProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.supervisor.startupProbe.periodSeconds }} + timeoutSeconds: {{ .Values.supervisor.startupProbe.timeoutSeconds }} + failureThreshold: {{ .Values.supervisor.startupProbe.failureThreshold }} + successThreshold: {{ .Values.supervisor.startupProbe.successThreshold }} + {{- end }} resources: {{- toYaml .Values.supervisor.resources | nindent 12 }} env: diff --git a/hosting/k8s/helm/templates/webapp.yaml b/hosting/k8s/helm/templates/webapp.yaml index a8567cc03..ec3bf4b5d 100644 --- a/hosting/k8s/helm/templates/webapp.yaml +++ b/hosting/k8s/helm/templates/webapp.yaml @@ -49,22 +49,39 @@ spec: - name: http containerPort: {{ .Values.webapp.service.targetPort }} protocol: TCP + {{- if .Values.webapp.livenessProbe.enabled }} livenessProbe: httpGet: path: /healthcheck port: http - initialDelaySeconds: 10 - periodSeconds: 30 - timeoutSeconds: 10 - failureThreshold: 5 + initialDelaySeconds: {{ .Values.webapp.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.webapp.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.webapp.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.webapp.livenessProbe.failureThreshold }} + successThreshold: {{ .Values.webapp.livenessProbe.successThreshold }} + {{- end }} + {{- if .Values.webapp.readinessProbe.enabled }} readinessProbe: httpGet: path: /healthcheck port: http - initialDelaySeconds: 10 - periodSeconds: 30 - timeoutSeconds: 10 - failureThreshold: 5 + initialDelaySeconds: {{ .Values.webapp.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.webapp.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.webapp.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.webapp.readinessProbe.failureThreshold }} + successThreshold: {{ .Values.webapp.readinessProbe.successThreshold }} + {{- end }} + {{- if .Values.webapp.startupProbe.enabled }} + startupProbe: + httpGet: + path: /healthcheck + port: http + initialDelaySeconds: {{ .Values.webapp.startupProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.webapp.startupProbe.periodSeconds }} + timeoutSeconds: {{ .Values.webapp.startupProbe.timeoutSeconds }} + failureThreshold: {{ .Values.webapp.startupProbe.failureThreshold }} + successThreshold: {{ .Values.webapp.startupProbe.successThreshold }} + {{- end }} resources: {{- toYaml .Values.webapp.resources | nindent 12 }} env: diff --git a/hosting/k8s/helm/values.yaml b/hosting/k8s/helm/values.yaml index 2a659d33d..70f91c59f 100644 --- a/hosting/k8s/helm/values.yaml +++ b/hosting/k8s/helm/values.yaml @@ -124,6 +124,29 @@ webapp: labels: {} basicAuth: {} + # Health probe configuration + livenessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 10 + failureThreshold: 5 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 10 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + clickhouse: logLevel: "info" # one of: log, error, warn, info, debug runReplication: @@ -229,6 +252,29 @@ supervisor: labels: {} basicAuth: {} + # Health probe configuration + livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 15 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + # Bootstrap configuration # When enabled: reads token from shared file, otherwise uses workerToken config bootstrap: @@ -330,6 +376,29 @@ electric: targetPort: 3000 resources: {} + # Health probe configuration + livenessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + # External Electric connection (when deploy: false) external: url: "" # For example: "http://electric:3000" @@ -472,6 +541,29 @@ registry: targetPort: 5000 resources: {} + # Health probe configuration + livenessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + enabled: false + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 60 + successThreshold: 1 + # External Registry connection (when deploy: false) external: host: "localhost"