From 6df0f8a2ed2d1a08aa2b476dcc63da7669c6bd1b Mon Sep 17 00:00:00 2001 From: Ada Lundhe Date: Tue, 17 Nov 2026 12:07:48 -0800 Subject: [PATCH 1/5] charts: let OpenShift's SCC assign pod IDs OpenShift's default SCC, restricted-v2, assigns each pod a UID and fsGroup from its namespace's range and refuses a runAsUser or fsGroup outside it. RustFS and k8s-credential-provider pin theirs, so a default install on OpenShift never starts them. Leave runAsUser, runAsGroup and fsGroup unset when the cluster serves security.openshift.io/v1, so these pods run in group 0 like other pods with an assigned UID. Other clusters render the same manifests as before. RustFS runs as an arbitrary UID with a group-writable /data; it logs to stdout when it cannot write /logs. Signed-off-by: Ada Lundhe --- charts/substrate/README.md | 4 ++++ charts/substrate/templates/_helpers.tpl | 11 +++++++++++ .../templates/k8s-credential-provider.yaml | 2 ++ charts/substrate/templates/rustfs.yaml | 2 ++ charts/substrate/tests/control_plane_test.yaml | 18 ++++++++++++++++++ 5 files changed, 37 insertions(+) diff --git a/charts/substrate/README.md b/charts/substrate/README.md index de1dd125fa..b5984221d9 100644 --- a/charts/substrate/README.md +++ b/charts/substrate/README.md @@ -66,6 +66,10 @@ allow. New installs should set `atelet.enabled=false` and install the helm template substrate ./charts/substrate ``` +On OpenShift the chart leaves pod UIDs and fsGroups for the SCC to assign. It +detects OpenShift from the cluster's API versions, which `helm template` cannot +see, so add `--api-versions security.openshift.io/v1` when rendering for it. + `manifests/ate-install/` in the repo is the rendered mTLS output and is regenerated by `hack/render-manifests.sh`. The separate `substrate-crds` chart mirrors `manifests/ate-install/generated/`. diff --git a/charts/substrate/templates/_helpers.tpl b/charts/substrate/templates/_helpers.tpl index 38e4d1b433..881154a4c5 100644 --- a/charts/substrate/templates/_helpers.tpl +++ b/charts/substrate/templates/_helpers.tpl @@ -241,6 +241,17 @@ definition so the fallback cannot drift between pods. {{- ((.Values.global).imagePullPolicy) | default "IfNotPresent" -}} {{- end -}} +{{/* +pinIDs is non-empty unless the cluster is OpenShift. OpenShift's default SCC, +restricted-v2, assigns each pod a UID and fsGroup from its namespace's range +and refuses a runAsUser or fsGroup outside it. Pods leave runAsGroup unset there +too, so they run in group 0 like other pods with an assigned UID. To render for +OpenShift without a cluster, pass --api-versions security.openshift.io/v1. +*/}} +{{- define "substrate.pinIDs" -}} +{{- if not (.Capabilities.APIVersions.Has "security.openshift.io/v1") }}true{{ end -}} +{{- end -}} + {{/* Object storage settings shared by object-store plugins. */}} {{- define "substrate.storage.env" -}} - name: ATE_STORAGE_BACKEND diff --git a/charts/substrate/templates/k8s-credential-provider.yaml b/charts/substrate/templates/k8s-credential-provider.yaml index b6215b8c85..6476fd14c5 100644 --- a/charts/substrate/templates/k8s-credential-provider.yaml +++ b/charts/substrate/templates/k8s-credential-provider.yaml @@ -70,8 +70,10 @@ spec: serviceAccountName: {{ include "substrate.fullname" (list "k8s-credential-provider" .) }} {{- with include "substrate.imagePullSecrets" . }}{{- . | nindent 6 }}{{- end }} securityContext: +{{- if include "substrate.pinIDs" . }} runAsUser: 65532 runAsGroup: 65532 +{{- end }} runAsNonRoot: true containers: - name: k8s-credential-provider diff --git a/charts/substrate/templates/rustfs.yaml b/charts/substrate/templates/rustfs.yaml index 95a5b10053..bd1f70ec32 100644 --- a/charts/substrate/templates/rustfs.yaml +++ b/charts/substrate/templates/rustfs.yaml @@ -69,10 +69,12 @@ spec: app: rustfs spec: serviceAccountName: {{ include "substrate.fullname" (list "rustfs" .) }} +{{- if include "substrate.pinIDs" . }} securityContext: runAsUser: 10001 runAsGroup: 10001 fsGroup: 10001 +{{- end }} {{- with include "substrate.imagePullSecrets" . }}{{- . | nindent 6 }}{{- end }} containers: - name: rustfs diff --git a/charts/substrate/tests/control_plane_test.yaml b/charts/substrate/tests/control_plane_test.yaml index 72fe6c2026..e9c3404fc5 100644 --- a/charts/substrate/tests/control_plane_test.yaml +++ b/charts/substrate/tests/control_plane_test.yaml @@ -206,6 +206,24 @@ tests: content: name: statusz containerPort: 4040 +- it: leaves pod IDs to OpenShift's SCC + templates: + - k8s-credential-provider.yaml + - rustfs.yaml + documentSelector: + path: kind + value: Deployment + matchMany: true + capabilities: + apiVersions: + - security.openshift.io/v1 + asserts: + - notExists: + path: spec.template.spec.securityContext.runAsUser + - notExists: + path: spec.template.spec.securityContext.runAsGroup + - notExists: + path: spec.template.spec.securityContext.fsGroup - it: stops OTLP push without an endpoint but keeps the scraped metrics template: ate-controller.yaml documentSelector: From 1cf843f73533ea926adf77ab85c5c470fd166020 Mon Sep 17 00:00:00 2001 From: Ada Lundhe Date: Wed, 18 Nov 2026 15:17:07 -0800 Subject: [PATCH 2/5] charts: shorten the substrate.pinIDs comment The README already says how to render for OpenShift without a cluster. Signed-off-by: Ada Lundhe --- charts/substrate/templates/_helpers.tpl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/charts/substrate/templates/_helpers.tpl b/charts/substrate/templates/_helpers.tpl index 881154a4c5..f4bb6fa0d4 100644 --- a/charts/substrate/templates/_helpers.tpl +++ b/charts/substrate/templates/_helpers.tpl @@ -242,11 +242,8 @@ definition so the fallback cannot drift between pods. {{- end -}} {{/* -pinIDs is non-empty unless the cluster is OpenShift. OpenShift's default SCC, -restricted-v2, assigns each pod a UID and fsGroup from its namespace's range -and refuses a runAsUser or fsGroup outside it. Pods leave runAsGroup unset there -too, so they run in group 0 like other pods with an assigned UID. To render for -OpenShift without a cluster, pass --api-versions security.openshift.io/v1. +Empty on OpenShift, whose restricted-v2 SCC assigns each pod's UID and fsGroup +and refuses IDs outside the namespace's range. */}} {{- define "substrate.pinIDs" -}} {{- if not (.Capabilities.APIVersions.Has "security.openshift.io/v1") }}true{{ end -}} From 56f8c7a91c26cf40854ff64871f3650f7ce7d504 Mon Sep 17 00:00:00 2001 From: Ada Lundhe Date: Thu, 19 Nov 2026 08:28:13 -0800 Subject: [PATCH 3/5] charts: let the credential provider run as its image's user kubernetes-secrets is built on distroless static nonroot, which runs as 65532:65532, like ate-controller, ate-api-server and ate-idp-server. Those set only runAsNonRoot, so the credential provider does the same on every cluster. OpenShift then needs no capability check for this pod. Without a pod-wide UID, kubelet writes the projected credential bundle with the projected volume's default mode, 0644, as it does for the other three pods. Signed-off-by: Ada Lundhe --- charts/substrate/templates/k8s-credential-provider.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/charts/substrate/templates/k8s-credential-provider.yaml b/charts/substrate/templates/k8s-credential-provider.yaml index 6476fd14c5..b824d11d75 100644 --- a/charts/substrate/templates/k8s-credential-provider.yaml +++ b/charts/substrate/templates/k8s-credential-provider.yaml @@ -70,10 +70,6 @@ spec: serviceAccountName: {{ include "substrate.fullname" (list "k8s-credential-provider" .) }} {{- with include "substrate.imagePullSecrets" . }}{{- . | nindent 6 }}{{- end }} securityContext: -{{- if include "substrate.pinIDs" . }} - runAsUser: 65532 - runAsGroup: 65532 -{{- end }} runAsNonRoot: true containers: - name: k8s-credential-provider From 7fc7e8598bfc7ffda5deea91e54d2e1abbb5d05e Mon Sep 17 00:00:00 2001 From: Ada Lundhe Date: Thu, 19 Nov 2026 08:28:14 -0800 Subject: [PATCH 4/5] charts: document the RustFS SCC grant on upgrade An anyuid grant assigns no fsGroup, so RustFS cannot write a new volume under it. Existing data moves to the new fsGroup unless the storage skips ownership changes, in which case keeping anyuid keeps RustFS on UID 10001. Signed-off-by: Ada Lundhe --- charts/substrate/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charts/substrate/README.md b/charts/substrate/README.md index b5984221d9..172c564ed5 100644 --- a/charts/substrate/README.md +++ b/charts/substrate/README.md @@ -70,6 +70,13 @@ On OpenShift the chart leaves pod UIDs and fsGroups for the SCC to assign. It detects OpenShift from the cluster's API versions, which `helm template` cannot see, so add `--api-versions security.openshift.io/v1` when rendering for it. +When you upgrade on OpenShift, remove an `anyuid` grant made for RustFS. `anyuid` +takes priority over restricted-v2 and assigns no fsGroup, so RustFS cannot write +a new volume. Kubelet moves existing RustFS data to the fsGroup restricted-v2 +assigns. Storage that skips that ownership change, as many NFS setups do, leaves +the data writable only by UID 10001: keep the `anyuid` grant there, so RustFS +still runs as that user. + `manifests/ate-install/` in the repo is the rendered mTLS output and is regenerated by `hack/render-manifests.sh`. The separate `substrate-crds` chart mirrors `manifests/ate-install/generated/`. From add65371abc1003f4aea738dcd408a5bfae51a66 Mon Sep 17 00:00:00 2001 From: Ada Lundhe Date: Thu, 19 Nov 2026 08:28:15 -0800 Subject: [PATCH 5/5] charts: test the pod IDs off OpenShift A substrate.pinIDs that always returns empty passed every unit test. Signed-off-by: Ada Lundhe --- .../substrate/tests/control_plane_test.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/charts/substrate/tests/control_plane_test.yaml b/charts/substrate/tests/control_plane_test.yaml index e9c3404fc5..47c7cb12da 100644 --- a/charts/substrate/tests/control_plane_test.yaml +++ b/charts/substrate/tests/control_plane_test.yaml @@ -206,6 +206,28 @@ tests: content: name: statusz containerPort: 4040 +- it: pins RustFS's IDs off OpenShift + template: rustfs.yaml + documentSelector: + path: kind + value: Deployment + asserts: + - equal: + path: spec.template.spec.securityContext + value: + runAsUser: 10001 + runAsGroup: 10001 + fsGroup: 10001 +- it: runs the credential provider as its image's non-root user + template: k8s-credential-provider.yaml + documentSelector: + path: kind + value: Deployment + asserts: + - equal: + path: spec.template.spec.securityContext + value: + runAsNonRoot: true - it: leaves pod IDs to OpenShift's SCC templates: - k8s-credential-provider.yaml