From 8ebef03509550bb3260f43552e562a514012da7a Mon Sep 17 00:00:00 2001 From: Peter Dodd Date: Tue, 6 Oct 2026 03:10:44 +0100 Subject: [PATCH] helm: expose s3 update strategy, lifecycle, and termination grace period (#11602) The standalone s3 Deployment hardcoded terminationGracePeriodSeconds and offered no way to set a container lifecycle or the Deployment strategy, so operators could not add a preStop delay to drain endpoints before SIGTERM or hold maxUnavailable at 0 during rollouts. Add s3.updateStrategy, s3.lifecycle and s3.terminationGracePeriodSeconds. Defaults render the same manifest as before. --- .github/workflows/helm_ci.yml | 20 ++++++++++++++++- .../seaweedfs/templates/s3/s3-deployment.yaml | 10 ++++++++- k8s/charts/seaweedfs/values.yaml | 22 +++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/helm_ci.yml b/.github/workflows/helm_ci.yml index b26451f5a..a08b8c23a 100644 --- a/.github/workflows/helm_ci.yml +++ b/.github/workflows/helm_ci.yml @@ -57,7 +57,25 @@ jobs: helm template test $CHART_DIR --set s3.enabled=true > /tmp/s3.yaml grep -q "kind: Deployment" /tmp/s3.yaml && grep -q "seaweedfs-s3" /tmp/s3.yaml echo "S3 deployment renders correctly" - + + echo "=== Testing S3 rollout settings ===" + helm template test $CHART_DIR --show-only templates/s3/s3-deployment.yaml \ + --set s3.enabled=true > /tmp/s3-rollout-defaults.yaml + grep -q "terminationGracePeriodSeconds: 10$" /tmp/s3-rollout-defaults.yaml + test "$(grep -cE '^ strategy:|^ +lifecycle:' /tmp/s3-rollout-defaults.yaml)" -eq 0 + helm template test $CHART_DIR --show-only templates/s3/s3-deployment.yaml \ + --set s3.enabled=true \ + --set s3.terminationGracePeriodSeconds=30 \ + --set s3.updateStrategy.type=RollingUpdate \ + --set s3.updateStrategy.rollingUpdate.maxUnavailable=0 \ + --set-string 's3.lifecycle.preStop.exec.command={sleep,5}' \ + > /tmp/s3-rollout.yaml + grep -q "terminationGracePeriodSeconds: 30$" /tmp/s3-rollout.yaml + grep -A 4 "^ strategy:" /tmp/s3-rollout.yaml | grep -q "maxUnavailable: 0" + grep -A 4 "^ strategy:" /tmp/s3-rollout.yaml | grep -q "type: RollingUpdate" + grep -A 5 "^ lifecycle:" /tmp/s3-rollout.yaml | grep -q -- "- sleep" + echo "S3 rollout settings render correctly" + echo "=== Testing S3 credentials from an existing secret ===" credential_args=( --set s3.credentials.admin.existingSecret=minio-root diff --git a/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml index 4fd499401..8a2f744a0 100644 --- a/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml @@ -17,6 +17,10 @@ metadata: {{- end }} spec: replicas: {{ .Values.s3.replicas }} + {{- with .Values.s3.updateStrategy }} + strategy: + {{- toYaml . | nindent 4 }} + {{- end }} selector: matchLabels: app.kubernetes.io/name: {{ template "seaweedfs.name" . }} @@ -59,7 +63,7 @@ spec: {{ tpl .Values.s3.tolerations . | nindent 8 | trim }} {{- end }} {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }} - terminationGracePeriodSeconds: 10 + terminationGracePeriodSeconds: {{ .Values.s3.terminationGracePeriodSeconds }} {{- if .Values.s3.priorityClassName }} priorityClassName: {{ .Values.s3.priorityClassName | quote }} {{- end }} @@ -235,6 +239,10 @@ spec: failureThreshold: {{ .Values.s3.livenessProbe.failureThreshold }} timeoutSeconds: {{ .Values.s3.livenessProbe.timeoutSeconds }} {{- end }} + {{- with .Values.s3.lifecycle }} + lifecycle: + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.s3.resources }} resources: {{- toYaml . | nindent 12 }} diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index 3f7c56d07..1a6315d05 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -1035,6 +1035,17 @@ s3: imageOverride: null restartPolicy: null replicas: 1 + # Deployment update strategy, rendered as the Deployment's strategy + # ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy + # Example: + # updateStrategy: + # type: RollingUpdate + # rollingUpdate: + # maxUnavailable: 0 + # maxSurge: 25% + updateStrategy: {} + # Time the s3 pod is given to shut down, including any preStop hook + terminationGracePeriodSeconds: 10 bindAddress: 0.0.0.0 port: 8333 # add additional https port @@ -1227,6 +1238,17 @@ s3: failureThreshold: 100 timeoutSeconds: 10 + # Lifecycle hooks for the s3 container. A preStop sleep lets the pod leave + # the Service endpoints before it receives SIGTERM; keep it shorter than + # terminationGracePeriodSeconds. + # ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ + # Example: + # lifecycle: + # preStop: + # exec: + # command: ["sleep", "5"] + lifecycle: {} + createBucketsHook: resources: {}