diff --git a/.github/scripts/helm_jwt_keys.py b/.github/scripts/helm_jwt_keys.py index 8b79984203..74ee8a9ca1 100755 --- a/.github/scripts/helm_jwt_keys.py +++ b/.github/scripts/helm_jwt_keys.py @@ -22,6 +22,16 @@ CHART = ROOT / "k8s/charts/seaweedfs" SECTIONS = ("jwt.signing", "jwt.signing.read", "jwt.filer_signing", "jwt.filer_signing.read") KEYS = {section: f"active-{index}" for index, section in enumerate(SECTIONS)} ESCAPED_HEADER = '["jw\\u0074".signing]\nkey = "existing"' +# No workload is needed to exercise Helm's real lookup and update. +RELEASE_SETTINGS = ( + "master.enabled=false", "volume.enabled=false", "filer.enabled=false", + "global.seaweedfs.createClusterRole=false", + "global.seaweedfs.securityConfig.jwtSigning.volumeWrite=true", + "global.seaweedfs.securityConfig.jwtSigning.volumeRead=true", + "global.seaweedfs.securityConfig.jwtSigning.filerWrite=true", + "global.seaweedfs.securityConfig.jwtSigning.filerRead=true", +) +CONFIGMAP_CHART = ("seaweedfs", "--repo", "https://seaweedfs.github.io/seaweedfs/helm", "--version", "4.54.0") def run(*args): @@ -77,8 +87,7 @@ def fixtures(): def check_generated(value): - decoded = base64.b64decode(value, validate=True).decode("ascii") - assert len(decoded) == 10 and decoded.isascii() and decoded.isalnum(), "invalid generated JWT key" + assert len(value) == 64 and value.isascii() and value.isalnum(), "invalid generated JWT key" def check_helpers(helm, reference_helm): @@ -147,20 +156,11 @@ def check_upgrades(helm, context): legacy = "seaweedfs-security-config" kubectl = ["kubectl", "--context", context, "-n", namespace] release_args = ["jk", str(CHART), "--kube-context", context, "-n", namespace] - # No workload is needed to exercise Helm's real ConfigMap lookup and update. - for setting in ( - "master.enabled=false", "volume.enabled=false", "filer.enabled=false", - "global.seaweedfs.createClusterRole=false", - "global.seaweedfs.securityConfig.jwtSigning.volumeWrite=true", - "global.seaweedfs.securityConfig.jwtSigning.volumeRead=true", - "global.seaweedfs.securityConfig.jwtSigning.filerWrite=true", - "global.seaweedfs.securityConfig.jwtSigning.filerRead=true", - ): + for setting in RELEASE_SETTINGS: release_args += ["--set", setting] def stored(): - cm = json.loads(run(*kubectl, "get", "configmap", current, "-o", "json")) - return keys(cm["data"]["security.toml"]) + return secret_keys(kubectl, current) def upgrade(): run(helm, "upgrade", *release_args) @@ -168,8 +168,8 @@ def check_upgrades(helm, context): def patch(raw): # Seed previous-release content without taking Helm 4's SSA ownership. - run(*kubectl, "patch", "configmap", current, "--type=merge", "--field-manager=helm", "-p", - json.dumps({"data": {"security.toml": raw}})) + run(*kubectl, "patch", "secret", current, "--type=merge", "--field-manager=helm", "-p", + json.dumps({"stringData": {"security.toml": raw}})) run(*kubectl, "create", "namespace", namespace) try: @@ -194,17 +194,24 @@ def check_upgrades(helm, context): assert upgrade() == actual, f"{name}: subsequent upgrade changed a key" print(f"PASS upgrade: {name}") - # Migration from the old chart name, followed by precedence of the current name. + # Migration from the ConfigMaps of earlier chart versions, then precedence of the Secret. + configmap_raw = "\n".join(f'[{section}]\nkey = "configmap-{index}"' + for index, section in enumerate(SECTIONS)) + run(*kubectl, "create", "configmap", current, "--from-literal=security.toml=" + configmap_raw) + run(*kubectl, "delete", "secret", current) + assert upgrade() == keys(configmap_raw), "ConfigMap keys were not preserved" + print("PASS upgrade: ConfigMap migration") legacy_raw = "\n".join(f'[{section}]\nkey = "legacy-{index}"' for index, section in enumerate(SECTIONS)) - run(*kubectl, "create", "configmap", legacy, "--from-literal=security.toml=" + legacy_raw) run(*kubectl, "delete", "configmap", current) + run(*kubectl, "create", "configmap", legacy, "--from-literal=security.toml=" + legacy_raw) + run(*kubectl, "delete", "secret", current) assert upgrade() == keys(legacy_raw), "legacy ConfigMap keys were not preserved" print("PASS upgrade: legacy ConfigMap migration") current_raw = next(fixtures())[1] patch(current_raw) - assert upgrade() == keys(current_raw), "legacy ConfigMap overrode current ConfigMap" - print("PASS upgrade: current ConfigMap takes precedence") + assert upgrade() == keys(current_raw), "legacy ConfigMap overrode the Secret" + print("PASS upgrade: Secret takes precedence") patch(ESCAPED_HEADER) try: @@ -213,13 +220,76 @@ def check_upgrades(helm, context): assert "unsupported quoted section header" in error.stderr, error.stderr else: raise AssertionError("unsupported quoted header silently rotated its key") - assert keys(run(*kubectl, "get", "configmap", current, "-o", - "jsonpath={.data.security\\.toml}"))["jwt.signing"] == "existing" + assert stored()["jwt.signing"] == "existing" print("PASS upgrade: unsupported quoted header leaves stored key untouched") finally: run(*kubectl, "delete", "namespace", namespace, "--wait=false") +def secret_keys(kubectl, name): + secret = json.loads(run(*kubectl, "get", "secret", name, "-o", "json")) + return keys(base64.b64decode(secret["data"]["security.toml"]).decode()) + + +def check_configmap_release_upgrade(helm, context): + namespace = "jwt-key-migrate-" + uuid.uuid4().hex[:8] + name = "jk-seaweedfs-security-config" + kubectl = ["kubectl", "--context", context, "-n", namespace] + common = ["--kube-context", context, "-n", namespace] + for setting in RELEASE_SETTINGS: + common += ["--set", setting] + upgrade = ["upgrade", "jk", str(CHART), *common, "--set", "master.enabled=true"] + + def refuse_partitioned(stage): + try: + run(helm, *upgrade, "--set", "master.updatePartition=1") + except subprocess.CalledProcessError as error: + assert "updatePartition=0" in error.stderr, error.stderr + else: + raise AssertionError(f"partitioned upgrade removed the ConfigMap ({stage})") + + def exists(kind): + return run(*kubectl, "get", kind, name, "--ignore-not-found", "-o", "name").strip() + + run(*kubectl, "create", "namespace", namespace) + try: + run(helm, "install", "jk", *CONFIGMAP_CHART, *common) + before = keys(run(*kubectl, "get", "configmap", name, "-o", "jsonpath={.data.security\\.toml}")) + assert set(before) == set(SECTIONS), "ConfigMap chart omitted a JWT section" + refuse_partitioned("ConfigMap release") + print("PASS upgrade: partitioned upgrade from the ConfigMap chart is refused") + + # Fail an upgrade after Helm created the Secret, so it never removes the ConfigMap. + run(*kubectl, "create", "quota", "no-statefulsets", "--hard=count/statefulsets.apps=0") + try: + run(helm, *upgrade) + except subprocess.CalledProcessError as error: + assert "quota" in error.stderr, error.stderr + else: + raise AssertionError("upgrade was not blocked by the quota") + run(*kubectl, "delete", "quota", "no-statefulsets") + assert exists("secret") and exists("configmap"), "failed upgrade did not leave both objects" + refuse_partitioned("retry after a failed upgrade") + print("PASS upgrade: partitioned retry after a failed migration is refused") + + run(helm, "upgrade", "jk", str(CHART), *common) + assert secret_keys(kubectl, name) == before, "upgrade from the ConfigMap chart changed a key" + assert not exists("configmap"), "upgrade left the ConfigMap behind" + print("PASS upgrade: ConfigMap chart release moves its keys to the Secret") + + # The unprefixed legacy name can belong to another release in the namespace. + other = "seaweedfs-security-config" + run(*kubectl, "create", "configmap", other, '--from-literal=security.toml=[jwt.signing]\nkey = "other"') + run(*kubectl, "annotate", "configmap", other, "meta.helm.sh/release-name=other", + "meta.helm.sh/release-namespace=" + namespace) + run(helm, *upgrade, "--set", "master.updatePartition=1") + assert secret_keys(kubectl, name) == before, "another release's ConfigMap changed a key" + assert run(*kubectl, "get", "configmap", other, "-o", "name").strip(), "removed another release's ConfigMap" + print("PASS upgrade: another release's legacy ConfigMap does not block a partitioned upgrade") + finally: + run(*kubectl, "delete", "namespace", namespace, "--wait=false") + + def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--helm", default="helm") @@ -230,6 +300,7 @@ def main(): check_helpers(args.helm, args.reference_helm) if args.context: check_upgrades(args.helm, args.context) + check_configmap_release_upgrade(args.helm, args.context) if __name__ == "__main__": diff --git a/.github/workflows/helm_ci.yml b/.github/workflows/helm_ci.yml index aef8d2277c..907557c412 100644 --- a/.github/workflows/helm_ci.yml +++ b/.github/workflows/helm_ci.yml @@ -360,9 +360,9 @@ jobs: def docs(manifest): return [d for d in yaml.safe_load_all(manifest) if d] - def configmap(manifest, name): + def security_config(manifest, name): for d in docs(manifest): - if d.get("kind") == "ConfigMap" and d["metadata"]["name"] == name: + if d.get("kind") == "Secret" and d["metadata"]["name"] == name: return d return None @@ -387,13 +387,13 @@ jobs: # security-related; preserve that so this PR is non-breaking on # existing installs. out = render({}) - if configmap(out, "test-seaweedfs-security-config") is not None: - failed.append("defaults: security ConfigMap should not render") + if security_config(out, "test-seaweedfs-security-config") is not None: + failed.append("defaults: security Secret should not render") else: - print("defaults: no security-config ConfigMap (unchanged)") + print("defaults: no security-config Secret (unchanged)") # Case 2: filerWrite=true alone is the documented opt-in for - # the Admin UI Users tab. Configmap must render with + # the Admin UI Users tab. The Secret must render with # [jwt.filer_signing] and NO [grpc.*] sections (cert paths # only exist with mTLS). out = render({ @@ -403,11 +403,11 @@ jobs: # refuses to bind without authentication. "admin.secret.adminPassword": "ci-admin-password", }) - cm = configmap(out, "test-seaweedfs-security-config") + cm = security_config(out, "test-seaweedfs-security-config") if cm is None: - failed.append("filerWrite=true: security ConfigMap missing") + failed.append("filerWrite=true: security Secret missing") else: - toml = cm["data"]["security.toml"] + toml = cm["stringData"]["security.toml"] if "[jwt.filer_signing]" not in toml: failed.append("filerWrite=true: security.toml missing [jwt.filer_signing]") if "[grpc" in toml: @@ -415,7 +415,7 @@ jobs: if "[jwt.filer_signing]" in toml and "[grpc" not in toml: print("filerWrite=true: security.toml has [jwt.filer_signing], no [grpc.*]") - # Case 3: filer + admin pods must MOUNT the security ConfigMap + # Case 3: filer + admin pods must MOUNT the security Secret # under filerWrite=true so the JWT key reaches both processes. # Cert volumes must NOT be present (no mTLS). for wl in ("test-seaweedfs-filer", "test-seaweedfs-admin"): @@ -435,11 +435,11 @@ jobs: # with both [jwt.signing] and [grpc.*]. Guards against the # decoupling change accidentally regressing the mTLS path. out = render({"global.seaweedfs.enableSecurity": "true"}) - cm = configmap(out, "test-seaweedfs-security-config") + cm = security_config(out, "test-seaweedfs-security-config") if cm is None: - failed.append("enableSecurity=true: security ConfigMap missing") + failed.append("enableSecurity=true: security Secret missing") else: - toml = cm["data"]["security.toml"] + toml = cm["stringData"]["security.toml"] missing = [s for s in ("[jwt.signing]", "[grpc.master]") if s not in toml] if missing: failed.append(f"enableSecurity=true: security.toml missing {missing}") @@ -456,8 +456,8 @@ jobs: except subprocess.CalledProcessError as e: failed.append(f"{null_path}=null: render failed: {e.output[:200] if e.output else e}") continue - if configmap(out, "test-seaweedfs-security-config") is not None: - failed.append(f"{null_path}=null: should not render configmap") + if security_config(out, "test-seaweedfs-security-config") is not None: + failed.append(f"{null_path}=null: should not render the security Secret") else: print(f"{null_path}=null: render tolerates explicit null") @@ -561,16 +561,16 @@ jobs: mount = next((m for m in pod["containers"][0].get("volumeMounts", []) if m["name"] == "security-config"), None) # The file has to land on one of weed's config search paths, so # the target matters as much as the volume itself - and a volume - # of that name backed by anything but the chart's ConfigMap + # of that name backed by anything but the chart's Secret # leaves `weed shell` without the signing key just the same. target = ("/etc/seaweedfs/security.toml", "security.toml") - configmap = "test-seaweedfs-security-config" + secret = "test-seaweedfs-security-config" if vol is None or mount is None: failed.append("filerWrite=true: bucket hook does not mount security-config (s3.configure would fail)") elif (mount.get("mountPath"), mount.get("subPath")) != target: failed.append(f"filerWrite=true: bucket hook mounts security-config as {mount}") - elif vol.get("configMap", {}).get("name") != configmap: - failed.append(f"filerWrite=true: security-config is not backed by the {configmap} ConfigMap: {vol}") + elif vol.get("secret", {}).get("secretName") != secret: + failed.append(f"filerWrite=true: security-config is not backed by the {secret} Secret: {vol}") else: print("filerWrite=true: bucket hook mounts security-config at /etc/seaweedfs/security.toml") @@ -2076,7 +2076,7 @@ jobs: "--set", "admin.enabled=true", "--set", "admin.secret.adminPassword=ci", "--set", "cosi.enabled=true", "--set", "networkPolicy.enabled=true", "--set", "volumes.dc2.replicas=1", - # render the security ConfigMap without its generated jwt key + # render the security Secret without its generated jwt key "--set", "global.seaweedfs.enableSecurity=true", "--set", "global.seaweedfs.securityConfig.jwtSigning.volumeWrite=false", ] diff --git a/k8s/charts/seaweedfs/README.md b/k8s/charts/seaweedfs/README.md index f294c255a8..ca932adafa 100644 --- a/k8s/charts/seaweedfs/README.md +++ b/k8s/charts/seaweedfs/README.md @@ -30,10 +30,12 @@ so your deployment will be spread/HA. The chart's templates render with Helm 3.16.3 and newer versions tested in CI. Earlier Helm versions are not covered by this chart's compatibility checks. -When JWT signing is enabled, a live upgrade reuses keys from the existing -security ConfigMap (including the legacy ConfigMap name); a key absent from -that ConfigMap is generated. Plain `helm template` does not read cluster state; -use an install and upgrade against a cluster to check key persistence. +When JWT signing is enabled, `security.toml` is kept in the +`-security-config` Secret. A live upgrade reuses keys from that +Secret, or from the security ConfigMap of earlier chart versions (including +the legacy ConfigMap name); a key absent from them is generated. Plain +`helm template` does not read cluster state; use an install and upgrade +against a cluster to check key persistence. The key reader supports single-line quoted TOML strings in JWT sections, including indented assignments, quoted key names, and bare or simply quoted diff --git a/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml b/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml index 6c379c20e4..f178ee5889 100644 --- a/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/admin/admin-statefulset.yaml @@ -313,8 +313,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-deployment.yaml b/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-deployment.yaml index e3bebb08a8..bc54f11b92 100644 --- a/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/all-in-one/all-in-one-deployment.yaml @@ -504,8 +504,8 @@ spec: name: {{ include "seaweedfs.fullname" . }}-master-config {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml b/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml index fa8ce557c3..2eecb45fa9 100644 --- a/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/cosi/cosi-deployment.yaml @@ -195,8 +195,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml index 172ef1cf89..ca6afe751b 100644 --- a/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer/filer-statefulset.yaml @@ -452,8 +452,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml index c7574d3f51..998bc097bb 100644 --- a/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/master/master-statefulset.yaml @@ -299,8 +299,8 @@ spec: name: {{ include "seaweedfs.fullname" . }}-master-config {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml index 4205ebac0e..78af54f1b3 100644 --- a/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/s3/s3-deployment.yaml @@ -288,8 +288,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml b/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml index 5078b799e2..6750a7933a 100644 --- a/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/sftp/sftp-deployment.yaml @@ -297,8 +297,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml b/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml index 6a4bc2535c..756f178cab 100644 --- a/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml +++ b/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml @@ -286,8 +286,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/shared/security-configmap.yaml b/k8s/charts/seaweedfs/templates/shared/security-configmap.yaml index d1572ee7af..9fa2105dd9 100644 --- a/k8s/charts/seaweedfs/templates/shared/security-configmap.yaml +++ b/k8s/charts/seaweedfs/templates/shared/security-configmap.yaml @@ -1,7 +1,7 @@ {{- include "seaweedfs.compat" . -}} {{- if include "seaweedfs.securityConfigEnabled" . }} apiVersion: v1 -kind: ConfigMap +kind: Secret metadata: name: {{ include "seaweedfs.fullname" . }}-security-config namespace: {{ include "seaweedfs.namespace" . | quote }} @@ -11,7 +11,8 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/instance: {{ .Release.Name }} {{- with include "seaweedfs.commonLabels" $ }}{{ . | nindent 4 }}{{ end }} -data: +type: Opaque +stringData: {{- $fullname := include "seaweedfs.fullname" . }} {{- $securityConfigName := printf "%s-security-config" $fullname }} {{- $existing := lookup "v1" "ConfigMap" (include "seaweedfs.namespace" .) $securityConfigName }} @@ -19,7 +20,11 @@ data: {{- $legacyName := printf "%s-%s" (include "seaweedfs.name" .) "security-config" }} {{- $existing = lookup "v1" "ConfigMap" (include "seaweedfs.namespace" .) $legacyName }} {{- end }} - {{- $existingToml := dig "data" "security.toml" "" $existing }} + {{- $ownConfigMap := eq (dig "metadata" "annotations" "meta.helm.sh/release-name" "" $existing) .Release.Name }} + {{- if and $ownConfigMap (or (and .Values.master.enabled (gt (int .Values.master.updatePartition) 0)) (and .Values.filer.enabled (gt (int .Values.filer.updatePartition) 0))) }} + {{- fail "this upgrade moves security.toml from a ConfigMap to a Secret and removes the ConfigMap; run it with master.updatePartition=0 and filer.updatePartition=0 so no pod is left on the old template" }} + {{- end }} + {{- $existingToml := dig "data" "security.toml" "" (lookup "v1" "Secret" (include "seaweedfs.namespace" .) $securityConfigName) | b64dec | default (dig "data" "security.toml" "" $existing) }} {{- $securityConfigValues := .Values.global.seaweedfs.securityConfig | default dict }} {{- $jwtSigning := $securityConfigValues.jwtSigning | default dict }} {{- $expiresAfterSeconds := $jwtSigning.expiresAfterSeconds | default dict }} @@ -30,7 +35,7 @@ data: # the jwt signing key is read by master and volume server # the jwt defaults to expire after 10 seconds [jwt.signing] - key = {{ include "seaweedfs.existingTomlKey" (list "jwt.signing" $existingToml) | default (randAlphaNum 10 | b64enc | quote) }} + key = {{ include "seaweedfs.existingTomlKey" (list "jwt.signing" $existingToml) | default (randAlphaNum 64 | quote) }} {{- if gt (int $expiresAfterSeconds.volumeWrite) 0 }} expires_after_seconds = {{ int $expiresAfterSeconds.volumeWrite }} {{- end }} @@ -42,7 +47,7 @@ data: # - the Volume server validates the JWT on reading # the jwt defaults to expire after 60 seconds [jwt.signing.read] - key = {{ include "seaweedfs.existingTomlKey" (list "jwt.signing.read" $existingToml) | default (randAlphaNum 10 | b64enc | quote) }} + key = {{ include "seaweedfs.existingTomlKey" (list "jwt.signing.read" $existingToml) | default (randAlphaNum 64 | quote) }} {{- if gt (int $expiresAfterSeconds.volumeRead) 0 }} expires_after_seconds = {{ int $expiresAfterSeconds.volumeRead }} {{- end }} @@ -54,7 +59,7 @@ data: # - the Filer server validates the JWT on writing # the jwt defaults to expire after 10 seconds [jwt.filer_signing] - key = {{ include "seaweedfs.existingTomlKey" (list "jwt.filer_signing" $existingToml) | default (randAlphaNum 10 | b64enc | quote) }} + key = {{ include "seaweedfs.existingTomlKey" (list "jwt.filer_signing" $existingToml) | default (randAlphaNum 64 | quote) }} {{- if gt (int $expiresAfterSeconds.filerWrite) 0 }} expires_after_seconds = {{ int $expiresAfterSeconds.filerWrite }} {{- end }} @@ -66,7 +71,7 @@ data: # - the Filer server validates the JWT on reading # the jwt defaults to expire after 60 seconds [jwt.filer_signing.read] - key = {{ include "seaweedfs.existingTomlKey" (list "jwt.filer_signing.read" $existingToml) | default (randAlphaNum 10 | b64enc | quote) }} + key = {{ include "seaweedfs.existingTomlKey" (list "jwt.filer_signing.read" $existingToml) | default (randAlphaNum 64 | quote) }} {{- if gt (int $expiresAfterSeconds.filerRead) 0 }} expires_after_seconds = {{ int $expiresAfterSeconds.filerRead }} {{- end }} diff --git a/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml b/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml index dbaae22fad..f7fa2efb6c 100644 --- a/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/vector/vector-deployment.yaml @@ -150,8 +150,8 @@ spec: emptyDir: {} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} {{- range list "ca" "client" "vector" }} diff --git a/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml index b49000cb18..6b1e1d0b20 100644 --- a/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/volume/volume-statefulset.yaml @@ -370,8 +370,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" $ }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" $ }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" $ }}-security-config {{- end }} {{- if $.Values.global.seaweedfs.enableSecurity }} - name: ca-cert diff --git a/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml b/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml index 94907fbcfa..9938702dd7 100644 --- a/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/worker/worker-deployment.yaml @@ -374,8 +374,8 @@ spec: {{- end }} {{- if include "seaweedfs.securityConfigEnabled" . }} - name: security-config - configMap: - name: {{ include "seaweedfs.fullname" . }}-security-config + secret: + secretName: {{ include "seaweedfs.fullname" . }}-security-config {{- end }} {{- if .Values.global.seaweedfs.enableSecurity }} - name: ca-cert