From b7fc202ad92f73f5cf827001b3ee336a601f0b13 Mon Sep 17 00:00:00 2001 From: Feng Ruohang Date: Thu, 3 Dec 2026 16:43:59 +0800 Subject: [PATCH] fix(helm): use node health endpoints and preserve probe upgrade defaults Share the built-in and custom probe rendering across both server workloads. Check live during startup and for restarts, and ready for Service traffic. Set the transport from the server TLS setting and target its API port. An older release can supply none of the new defaults during --reuse-values. Omit inactive probes and supply the timing defaults when just an enabled flag is set. Cover both values paths and custom overrides in the Helm migration check. Refs #288, #283. Signed-off-by: Feng Ruohang --- .../testdata/optional-values.yaml | 6 ++ buildscripts/verify-helm-migration.sh | 33 ++++++++- helm/silo/README.md | 38 ++++++++++ helm/silo/templates/_helpers.tpl | 22 ++++++ helm/silo/templates/deployment.yaml | 39 +---------- helm/silo/templates/statefulset.yaml | 39 +---------- helm/silo/values.yaml | 69 +++++-------------- 7 files changed, 115 insertions(+), 131 deletions(-) diff --git a/buildscripts/helm-migration-guard/testdata/optional-values.yaml b/buildscripts/helm-migration-guard/testdata/optional-values.yaml index 2704da3a9..c481c408b 100644 --- a/buildscripts/helm-migration-guard/testdata/optional-values.yaml +++ b/buildscripts/helm-migration-guard/testdata/optional-values.yaml @@ -30,3 +30,9 @@ oidc: imagePullSecrets: - name: primary-pull - name: '{{ .Release.Name }}-pull' +startupProbe: + enabled: true +livenessProbe: + enabled: true +readinessProbe: + enabled: true diff --git a/buildscripts/verify-helm-migration.sh b/buildscripts/verify-helm-migration.sh index c1886e638..8347f7757 100755 --- a/buildscripts/verify-helm-migration.sh +++ b/buildscripts/verify-helm-migration.sh @@ -55,14 +55,23 @@ helm_run lint "${new_chart}" helm_run template silo "${new_chart}" \ --namespace silo \ --set rootUser=silo-admin \ - --set rootPassword=test-password-123456 >/dev/null + --set rootPassword=test-password-123456 >"${work_dir}/default-distributed.yaml" helm_run template silo "${new_chart}" \ --namespace silo \ --set mode=standalone \ --set replicas=1 \ --set persistence.enabled=false \ --set rootUser=silo-admin \ - --set rootPassword=test-password-123456 >/dev/null + --set rootPassword=test-password-123456 >"${work_dir}/default-standalone.yaml" +if grep -Eq '^[[:space:]]+(liveness|readiness|startup)Probe:' "${work_dir}"/default-*.yaml; then + echo "default workload unexpectedly enables a server probe" >&2 + exit 1 +fi + +# --reuse-values renders new templates with the old release's coalesced defaults. +# Passing -f old/values.yaml alone would fill missing keys with new defaults. +cp -R helm/silo "${work_dir}/reuse" +git show RELEASE.2026-11-12T00-00-00Z:helm/silo/values.yaml >"${work_dir}/reuse/values.yaml" # Exercise the persisted standalone PVC, optional legacy values, and OIDC in both workloads. cp buildscripts/helm-migration-guard/testdata/optional-values.yaml "${work_dir}/optional-values.yaml" @@ -72,6 +81,12 @@ for mode in standalone distributed; do -f "${output_dir}/optional-values.yaml" --set "mode=${mode}" >"${render}" expect_rendered "${render}" \ 'createBucket chart-test "none" false "" false' \ + 'startupProbe:' 'livenessProbe:' 'readinessProbe:' \ + 'path: /minio/health/live' \ + 'path: /minio/health/ready' \ + 'scheme: HTTPS' \ + 'periodSeconds: 30' \ + 'failureThreshold: 60' \ 'name: "chart-oidc"' \ 'key: "discovery"' \ 'value: "https://console.example.test/oauth_callback"' \ @@ -80,6 +95,20 @@ for mode in standalone distributed; do echo "${mode} sets a browser redirect without a configured URL" >&2 exit 1 fi + + render="${work_dir}/${mode}-reuse.yaml" + helm_run template silo-reuse "${output_dir}/reuse" --is-upgrade \ + --set "mode=${mode}" --set minioAPIPort=9443 \ + --set readinessProbe.enabled=true,startupProbe.enabled=true \ + --set customStartupProbe.tcpSocket.port=9444 >"${render}" + expect_rendered "${render}" \ + 'path: /minio/health/ready' 'port: 9443' 'scheme: HTTP' \ + 'periodSeconds: 15' 'failureThreshold: 3' 'timeoutSeconds: 5' \ + 'startupProbe:' 'tcpSocket:' 'port: 9444' + if grep -Eq 'livenessProbe:|path: /minio/health/live' "${render}"; then + echo "${mode} rendered a disabled or overridden built-in probe" >&2 + exit 1 + fi done # Existing values commonly address the historical myminio target. Render the diff --git a/helm/silo/README.md b/helm/silo/README.md index f4e090cda..de59fd51f 100644 --- a/helm/silo/README.md +++ b/helm/silo/README.md @@ -146,6 +146,44 @@ helm upgrade --install silo ./helm/silo \ Additional trusted CAs can be supplied through `trustedCertsSecret`. +## Kubernetes health probes + +Enable each probe independently for the server container in either mode. + +```yaml +startupProbe: + enabled: true +livenessProbe: + enabled: true +readinessProbe: + enabled: true +``` + +| Probe | Pod endpoint | Default action after consecutive failures | +| --- | --- | --- | +| Startup | `/minio/health/live` | Restart after 60 checks at 5-second intervals. The first success releases the liveness and readiness checks. | +| Liveness | `/minio/health/live` | Restart after 3 checks at 30-second intervals. A saturated request queue can fail this check. | +| Readiness | `/minio/health/ready` | Stop routing new Service traffic to the Pod after 3 checks at 15-second intervals. Resume traffic on recovery. | + +Enable startup alongside liveness when a cold start may exceed the liveness +failure window. Built-in probes use `minioAPIPort` and switch to HTTPS with +`tls.enabled`. +Kubelet skips certificate verification for HTTPS probes. Readiness includes +configured KMS and etcd checks. Both endpoints can succeed while storage or IAM +is loading. The distributed headless Service publishes peer addresses during +bootstrap. Use cluster quorum checks for monitoring and a signed S3 write and +readback when an application needs to verify object access. +[Health check guide](https://silo.pgsty.com/operations/monitoring/healthcheck-probe/) + +All three probes default to disabled, including on upgrades with `--reuse-values` +from charts that predate these settings. A chart version change updates the +Pod template checksums for the ConfigMap and Secret by default and can trigger +a rollout even with all probes disabled. Set timing fields on each probe, for +example `--set startupProbe.failureThreshold=120` for a ten-minute startup budget. +A nonempty `customStartupProbe`, `customLivenessProbe`, or `customReadinessProbe` +supplies the complete Kubernetes probe even when its built-in is disabled. +Custom probe fields are passed through literally. + ## Existing Secrets and post-install resources The chart treats `rootUser` and `rootPassword` as literal values. A parent chart diff --git a/helm/silo/templates/_helpers.tpl b/helm/silo/templates/_helpers.tpl index bc60c6264..addd54e27 100644 --- a/helm/silo/templates/_helpers.tpl +++ b/helm/silo/templates/_helpers.tpl @@ -282,3 +282,25 @@ otherwise it generates a random value. value: {{ $oidc.displayName | quote }} {{- end }} {{- end -}} + +{{/* Old releases can lack all probe settings on helm upgrade --reuse-values. */}} +{{- define "silo.probes" -}} +{{- range $name, $period := dict "startupProbe" 5 "livenessProbe" 30 "readinessProbe" 15 }} +{{- $settings := index $.Values $name | default dict }} +{{- $custom := index $.Values (printf "custom%s" (title $name)) }} +{{- if $custom }} +{{ $name }}: {{- toYaml $custom | nindent 2 }} +{{- else if $settings.enabled }} +{{ $name }}: + httpGet: + path: {{ ternary "/minio/health/ready" "/minio/health/live" (eq $name "readinessProbe") }} + port: {{ $.Values.minioAPIPort }} + scheme: {{ ternary "HTTPS" "HTTP" $.Values.tls.enabled }} + initialDelaySeconds: {{ $settings.initialDelaySeconds | default 0 | toJson }} + periodSeconds: {{ $settings.periodSeconds | default $period | toJson }} + timeoutSeconds: {{ $settings.timeoutSeconds | default 5 | toJson }} + successThreshold: {{ $settings.successThreshold | default 1 | toJson }} + failureThreshold: {{ $settings.failureThreshold | default (ternary 60 3 (eq $name "startupProbe")) | toJson }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/helm/silo/templates/deployment.yaml b/helm/silo/templates/deployment.yaml index 012a326cd..795307990 100644 --- a/helm/silo/templates/deployment.yaml +++ b/helm/silo/templates/deployment.yaml @@ -147,44 +147,7 @@ spec: securityContext: {{ toYaml . | nindent 12}} {{- end }} {{- end }} - {{- if .Values.customLivenessProbe }} - livenessProbe: {{- toYaml $.Values.customLivenessProbe | nindent 12 }} - {{- else if .Values.livenessProbe.enabled }} - livenessProbe: - httpGet: - path: /minio/health/live - port: {{ .Values.minioAPIPort }} - scheme: {{ ternary "HTTPS" "HTTP" .Values.tls.enabled | quote }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - {{- end }} - {{- if .Values.customReadinessProbe }} - readinessProbe: {{- toYaml $.Values.customReadinessProbe | nindent 12 }} - {{- else if .Values.readinessProbe.enabled }} - readinessProbe: - tcpSocket: - port: {{ .Values.minioAPIPort }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - {{- end }} - {{- if .Values.customStartupProbe }} - startupProbe: {{- toYaml .Values.customStartupProbe | nindent 12 }} - {{- else if .Values.startupProbe.enabled }} - startupProbe: - tcpSocket: - port: {{ .Values.minioAPIPort }} - initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.startupProbe.periodSeconds }} - timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }} - successThreshold: {{ .Values.startupProbe.successThreshold }} - failureThreshold: {{ .Values.startupProbe.failureThreshold }} - {{- end }} + {{- include "silo.probes" . | nindent 10 }} {{- with .Values.extraContainers }} {{- if eq (typeOf .) "string" }} {{- tpl . $ | nindent 8 }} diff --git a/helm/silo/templates/statefulset.yaml b/helm/silo/templates/statefulset.yaml index 1f6ce2e3b..d23ca9cbb 100644 --- a/helm/silo/templates/statefulset.yaml +++ b/helm/silo/templates/statefulset.yaml @@ -167,44 +167,7 @@ spec: securityContext: {{ toYaml . | nindent 12}} {{- end }} {{- end }} - {{- if .Values.customLivenessProbe }} - livenessProbe: {{- toYaml $.Values.customLivenessProbe | nindent 12 }} - {{- else if .Values.livenessProbe.enabled }} - livenessProbe: - httpGet: - path: /minio/health/live - port: {{ .Values.minioAPIPort }} - scheme: {{ ternary "HTTPS" "HTTP" .Values.tls.enabled | quote }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - {{- end }} - {{- if .Values.customReadinessProbe }} - readinessProbe: {{- toYaml $.Values.customReadinessProbe | nindent 12 }} - {{- else if .Values.readinessProbe.enabled }} - readinessProbe: - tcpSocket: - port: {{ .Values.minioAPIPort }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - {{- end }} - {{- if .Values.customStartupProbe }} - startupProbe: {{- toYaml .Values.customStartupProbe | nindent 12 }} - {{- else if .Values.startupProbe.enabled }} - startupProbe: - tcpSocket: - port: {{ .Values.minioAPIPort }} - initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.startupProbe.periodSeconds }} - timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }} - successThreshold: {{ .Values.startupProbe.successThreshold }} - failureThreshold: {{ .Values.startupProbe.failureThreshold }} - {{- end }} + {{- include "silo.probes" . | nindent 10 }} {{- with .Values.extraContainers }} {{- if eq (typeOf .) "string" }} {{- tpl . $ | nindent 8 }} diff --git a/helm/silo/values.yaml b/helm/silo/values.yaml index bec6dc971..59b5b1b49 100644 --- a/helm/silo/values.yaml +++ b/helm/silo/values.yaml @@ -301,64 +301,27 @@ resources: requests: memory: 16Gi -## Configure extra options for liveness probe -## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes -## livenessProbe.enabled Enable livenessProbe -## livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe -## livenessProbe.periodSeconds Period seconds for livenessProbe -## livenessProbe.timeoutSeconds Timeout seconds for livenessProbe -## livenessProbe.failureThreshold Failure threshold for livenessProbe -## livenessProbe.successThreshold Success threshold for livenessProbe -## -livenessProbe: - enabled: false - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 -## Configure extra options for readiness probe -## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes -## readinessProbe.enabled Enable readinessProbe -## readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe -## readinessProbe.periodSeconds Period seconds for readinessProbe -## readinessProbe.timeoutSeconds Timeout seconds for readinessProbe -## readinessProbe.failureThreshold Failure threshold for readinessProbe -## readinessProbe.successThreshold Success threshold for readinessProbe -## -readinessProbe: - enabled: false - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 1 - successThreshold: 1 - failureThreshold: 5 -## Configure extra options for startupProbe probe -## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes -## startupProbe.enabled Enable startupProbe -## startupProbe.initialDelaySeconds Initial delay seconds for startupProbe -## startupProbe.periodSeconds Period seconds for startupProbe -## startupProbe.timeoutSeconds Timeout seconds for startupProbe -## startupProbe.failureThreshold Failure threshold for startupProbe -## startupProbe.successThreshold Success threshold for startupProbe -## +## Each built-in probe uses the S3 API port and follows tls.enabled. +## All three accept initialDelaySeconds (default 0), timeoutSeconds (5), +## successThreshold (1), periodSeconds and failureThreshold. startupProbe: enabled: false - initialDelaySeconds: 0 - periodSeconds: 10 - timeoutSeconds: 5 - successThreshold: 1 + periodSeconds: 5 failureThreshold: 60 +livenessProbe: + enabled: false + periodSeconds: 30 + failureThreshold: 3 +readinessProbe: + enabled: false + periodSeconds: 15 + failureThreshold: 3 -## customLivenessProbe Override default liveness probe -## -customLivenessProbe: {} -## customReadinessProbe Override default readiness probe -## -customReadinessProbe: {} -## customStartupProbe Override default startup probe -## +## A nonempty custom probe supplies the complete Kubernetes Probe and takes +## precedence over the corresponding built-in, including its enabled flag. customStartupProbe: {} +customLivenessProbe: {} +customReadinessProbe: {} ## Policies to create after installing Silo. ##