From 080af98b86d1a71f673e92ae1d5f0420f2799a4e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 20 Nov 2026 03:22:53 -0800 Subject: [PATCH] helm: render volume server HTTPS in security.toml global.seaweedfs.volumeHttps.enabled sets [https.volume] to the volume certificate and turns on [https.client] with the client certificate and the chart CA, so the volume data port is no longer plaintext under enableSecurity. The option fails without enableSecurity. Co-Authored-By: Claude Opus 5.5 --- .../seaweedfs/templates/shared/_helpers.tpl | 11 +++++++++++ .../templates/shared/security-configmap.yaml | 18 +++++++++++++++--- k8s/charts/seaweedfs/values.yaml | 12 ++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/k8s/charts/seaweedfs/templates/shared/_helpers.tpl b/k8s/charts/seaweedfs/templates/shared/_helpers.tpl index 5d77663663..d9b00af9f0 100644 --- a/k8s/charts/seaweedfs/templates/shared/_helpers.tpl +++ b/k8s/charts/seaweedfs/templates/shared/_helpers.tpl @@ -491,6 +491,17 @@ true {{- end -}} {{- end -}} +{{/* True when the volume servers serve HTTPS. Their certificates come from + enableSecurity, so the option fails without it. */}} +{{- define "seaweedfs.volumeHttps" -}} +{{- if ((.Values.global.seaweedfs).volumeHttps).enabled -}} +{{- if not .Values.global.seaweedfs.enableSecurity -}} +{{- fail "global.seaweedfs.volumeHttps.enabled requires global.seaweedfs.enableSecurity, which provides the certificates" -}} +{{- end -}} +true +{{- 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/shared/security-configmap.yaml b/k8s/charts/seaweedfs/templates/shared/security-configmap.yaml index d1572ee7af..f39c53c87b 100644 --- a/k8s/charts/seaweedfs/templates/shared/security-configmap.yaml +++ b/k8s/charts/seaweedfs/templates/shared/security-configmap.yaml @@ -121,13 +121,25 @@ data: cert = "/usr/local/share/ca-certificates/client/tls.crt" key = "/usr/local/share/ca-certificates/client/tls.key" - # volume server https options - # Note: work in progress! - # this does not work with other clients, e.g., "weed filer|mount" etc, yet. + {{- if include "seaweedfs.volumeHttps" . }} + + [https.client] + enabled = true + cert = "/usr/local/share/ca-certificates/client/tls.crt" + key = "/usr/local/share/ca-certificates/client/tls.key" + ca = "/usr/local/share/ca-certificates/ca/tls.crt" + + [https.volume] + cert = "/usr/local/share/ca-certificates/volume/tls.crt" + key = "/usr/local/share/ca-certificates/volume/tls.key" + {{- else }} + + # volume server https: set global.seaweedfs.volumeHttps.enabled [https.client] enabled = false [https.volume] cert = "" key = "" {{- end }} + {{- end }} {{- end }} diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index 493d6ef3da..0c9d6591f5 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -45,6 +45,18 @@ global: volumeRead: 0 filerWrite: 0 filerRead: 0 + # Serve the volume servers' HTTP port over TLS with the chart's volume + # certificate, and make every chart component reach them over HTTPS + # ([https.volume] and [https.client] in security.toml). Requires + # enableSecurity and is not supported with allInOne. Clients outside the + # chart (weed mount, the CSI driver) need their own [https.client]. + # The volume servers do not ask for client certificates, because kubelet + # probes cannot present one; JWT signing keeps authorizing volume access. + # [https.client] makes every HTTP request between components use HTTPS + # while master and filer HTTP stay plain, so for example a follower + # master can no longer forward HTTP API calls to the leader. + volumeHttps: + enabled: false # we will use this serviceAccountName for all ClusterRoles/ClusterRoleBindings serviceAccountName: "seaweedfs" serviceAccountAnnotations: {}