From dd4d06e40fcac4ad01ce522b79c0a1b0fce8cd38 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 20 Nov 2026 03:43:48 -0800 Subject: [PATCH] helm: restart every security.toml reader when volume HTTPS is toggled security.toml is mounted with subPath and read once at startup, so on an upgrade that turns volume HTTPS on, the volume servers restarted with TLS while filer, S3 and the other clients kept speaking plain HTTP. A checksum/volume-https pod annotation, rendered only while the option is on, rolls them all. Co-Authored-By: Claude Opus 5.5 --- k8s/charts/seaweedfs/README.md | 1 + .../seaweedfs/templates/admin/admin-statefulset.yaml | 1 + k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml | 1 + .../seaweedfs/templates/filer/filer-statefulset.yaml | 1 + .../seaweedfs/templates/master/master-statefulset.yaml | 1 + k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml | 1 + k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml | 1 + k8s/charts/seaweedfs/templates/shared/_helpers.tpl | 8 ++++++++ .../seaweedfs/templates/vector/vector-deployment.yaml | 1 + .../seaweedfs/templates/volume/volume-statefulset.yaml | 1 + .../seaweedfs/templates/worker/worker-deployment.yaml | 1 + 11 files changed, 18 insertions(+) diff --git a/k8s/charts/seaweedfs/README.md b/k8s/charts/seaweedfs/README.md index 396e80a571..ade734ead8 100644 --- a/k8s/charts/seaweedfs/README.md +++ b/k8s/charts/seaweedfs/README.md @@ -619,6 +619,7 @@ With `global.seaweedfs.enableSecurity`, gRPC between components uses mutual TLS, - `[https.volume]` points at the volume certificate, which then also names every volume group's service (`*.-volume.`), since volume servers register as `.-volume.`. With `certificates.externalCertificates`, the provided `-volume-cert` needs those names. - `[https.client]` is enabled with the client certificate and the chart CA, so every chart pod that talks to the volume servers does it over HTTPS. - The volume probes use HTTPS. +- Every pod that reads `security.toml` gets a `checksum/volume-https` annotation, so switching the option on or off restarts them together. The volume servers do not require client certificates, because kubelet probes cannot present one; enable JWT signing (`securityConfig.jwtSigning`) to authorize volume reads and writes. `[https.client]` switches every HTTP request between components to HTTPS while master and filer HTTP stay plain, so a follower master can no longer forward HTTP API calls to the leader. A volume Ingress or HTTPRoute needs its controller's HTTPS-backend setting. `weed mount`, the CSI driver and other clients outside the chart need their own `[https.client]` with the chart CA. The option is not supported with `allInOne`, whose volume server registers by pod IP. diff --git a/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml b/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml index 6c379c20e4..a475f09c3f 100644 --- a/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml @@ -56,6 +56,7 @@ spec: {{- with .Values.admin.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: restartPolicy: {{ default .Values.global.seaweedfs.restartPolicy .Values.admin.restartPolicy }} {{- if .Values.admin.affinity }} diff --git a/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml b/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml index fa8ce557c3..85d99f775a 100644 --- a/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml @@ -39,6 +39,7 @@ spec: {{- with .Values.cosi.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: restartPolicy: {{ default .Values.global.seaweedfs.restartPolicy .Values.cosi.restartPolicy }} {{- if .Values.cosi.affinity }} diff --git a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml index 172ef1cf89..48d26d8083 100644 --- a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml @@ -57,6 +57,7 @@ spec: {{- end }} annotations: {{- toYaml $podAnnotations | nindent 8 }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: restartPolicy: {{ default .Values.global.seaweedfs.restartPolicy .Values.filer.restartPolicy }} {{- if .Values.filer.affinity }} diff --git a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml index c7574d3f51..87b967ca3d 100644 --- a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml @@ -48,6 +48,7 @@ spec: {{- $_ := set $podAnnotations "checksum/master-config" (include "seaweedfs.master.configChecksum" .) }} annotations: {{- toYaml $podAnnotations | nindent 8 }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: restartPolicy: {{ default .Values.global.seaweedfs.restartPolicy .Values.master.restartPolicy }} {{- if .Values.master.affinity }} diff --git a/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml index 4205ebac0e..b6d50aa65d 100644 --- a/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml @@ -54,6 +54,7 @@ spec: {{- end }} annotations: {{- toYaml $podAnnotations | nindent 8 }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: restartPolicy: {{ default .Values.global.seaweedfs.restartPolicy .Values.s3.restartPolicy }} {{- if .Values.s3.affinity }} diff --git a/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml b/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml index 5078b799e2..60e29118e5 100644 --- a/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml @@ -43,6 +43,7 @@ spec: {{- with .Values.sftp.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: restartPolicy: {{ default .Values.global.seaweedfs.restartPolicy .Values.sftp.restartPolicy }} {{- if .Values.sftp.affinity }} diff --git a/k8s/charts/seaweedfs/templates/shared/_helpers.tpl b/k8s/charts/seaweedfs/templates/shared/_helpers.tpl index d9b00af9f0..cca9fe672f 100644 --- a/k8s/charts/seaweedfs/templates/shared/_helpers.tpl +++ b/k8s/charts/seaweedfs/templates/shared/_helpers.tpl @@ -502,6 +502,14 @@ true {{- end -}} {{- end -}} +{{/* Pod annotation that restarts the readers of security.toml when volume + HTTPS is switched on or off. */}} +{{- define "seaweedfs.volumeHttpsAnnotation" -}} +{{- with include "seaweedfs.volumeHttps" . -}} +checksum/volume-https: {{ sha256sum . | quote }} +{{- end -}} +{{- end -}} + {{/* Read a JWT key from the chart's existing security.toml without fromToml (which requires Helm >=3.17). Args: (list "
" $raw). Return the single-line TOML string token, including its quotes, so escapes diff --git a/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml b/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml index dbaae22fad..ef83a86178 100644 --- a/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml @@ -25,6 +25,7 @@ spec: annotations: {{- with .Values.podAnnotations }}{{ toYaml . | nindent 8 }}{{ end }} {{- with .Values.vector.podAnnotations }}{{ toYaml . | nindent 8 }}{{ end }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }} automountServiceAccountToken: {{ .Values.global.seaweedfs.automountServiceAccountToken }} diff --git a/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml index 41eeaac8f8..b62e7bf63a 100644 --- a/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml @@ -55,6 +55,7 @@ spec: {{- with $volume.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: {{- if $volume.affinity }} affinity: diff --git a/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml b/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml index 94907fbcfa..d23a389fab 100644 --- a/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml @@ -46,6 +46,7 @@ spec: {{- with .Values.worker.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "seaweedfs.volumeHttpsAnnotation" $ }}{{ . | nindent 8 }}{{ end }} spec: restartPolicy: {{ default .Values.global.seaweedfs.restartPolicy .Values.worker.restartPolicy }} {{- if .Values.worker.affinity }}