Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions charts/substrate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ 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.
Comment on lines +69 to +71

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the anyuid upgrade note from the PR description go here too? The repo has no CHANGELOG, so after merge this paragraph is where an OpenShift operator will look. Anyone who keeps the grant gets an unwritable RustFS PVC on a new install.

Also, every test run was a fresh install. Upgrading an anyuid install with data owned by 10001 should still work, because kubelet changes the volume's group to the new fsGroup. Drivers that skip ownership changes don't do that, and many NFS setups are like that. Worth a test, or a line in the note.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ Good catch. Hang on!

@adalundhe adalundhe Nov 19, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the README in 7fc7e85. I tested the upgrade with RustFS data written as UID 10001:

  • If the storage applies the new fsGroup, RustFS reads and writes.
  • If the storage skips that change, RustFS can read but not write.
  • If anyuid is kept, RustFS runs as UID 10001 and reads and writes.

So the README says to keep anyuid on storage that skips the change.


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/`.
Expand Down
8 changes: 8 additions & 0 deletions charts/substrate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ definition so the fallback cannot drift between pods.
{{- ((.Values.global).imagePullPolicy) | default "IfNotPresent" -}}
{{- end -}}

{{/*
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 -}}
{{- end -}}

{{/* Object storage settings shared by object-store plugins. */}}
{{- define "substrate.storage.env" -}}
- name: ATE_STORAGE_BACKEND
Expand Down
2 changes: 0 additions & 2 deletions charts/substrate/templates/k8s-credential-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ spec:
serviceAccountName: {{ include "substrate.fullname" (list "k8s-credential-provider" .) }}
{{- with include "substrate.imagePullSecrets" . }}{{- . | nindent 6 }}{{- end }}
securityContext:
runAsUser: 65532
runAsGroup: 65532
runAsNonRoot: true
containers:
- name: k8s-credential-provider
Expand Down
2 changes: 2 additions & 0 deletions charts/substrate/templates/rustfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions charts/substrate/tests/control_plane_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,46 @@ 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: nothing checks that the IDs stay on vanilla Kubernetes. I made substrate.pinIDs always return empty and all 65 unit tests still passed. render-manifests.sh --check caught the RustFS change, but k8s-credential-provider.yaml is in PRESERVED_FILES, so nothing covers that pod. A mirror case without capabilities would catch it. If you take the credential-provider suggestion, the render check already covers RustFS and you can skip this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooof. Yeah, also this. Hang on.

@adalundhe adalundhe Nov 19, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in add6537. One test checks that RustFS keeps its IDs off OpenShift. Another checks that the credential provider sets no IDs. Your mutation now fails the RustFS test.

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:
Expand Down
Loading