Skip to content

feat(chart): expose podSecurityContext and securityContext values#1258

Open
vishwakt wants to merge 1 commit into
hetznercloud:mainfrom
vishwakt:feature/chart-security-context
Open

feat(chart): expose podSecurityContext and securityContext values#1258
vishwakt wants to merge 1 commit into
hetznercloud:mainfrom
vishwakt:feature/chart-security-context

Conversation

@vishwakt
Copy link
Copy Markdown

@vishwakt vishwakt commented Jun 4, 2026

What

Closes #1253.

Adds podSecurityContext (pod-level) and securityContext (container-level) values to the Helm chart and wires them into both the Deployment and DaemonSet templates (chart/templates/deployment.yaml, chart/templates/daemonset.yaml).

Secure defaults are shipped, as proposed in the issue, so the controller no longer runs as root with a writable root filesystem out of the box:

podSecurityContext:
  runAsNonRoot: true
  runAsUser: 65532
  seccompProfile:
    type: RuntimeDefault
securityContext:            # container-level
  readOnlyRootFilesystem: true
  allowPrivilegeEscalation: false
  capabilities:
    drop: ["ALL"]

Why

This satisfies the Pod Security restricted profile and common lint gates (kube-linter run-as-non-root / no-read-only-root-fs), removing the need for repo-wide lint waivers or post-render kustomize patches on hardened clusters.

Notes

  • readOnlyRootFilesystem: true is safe: the runtime controller does not write to its root filesystem (the only filesystem writes in the repo are in tools/ and internal/testsupport/, neither of which is in the runtime path). No writable emptyDir is needed.
  • The image runs as root (no USER in the Dockerfile), so runAsNonRoot is correctly paired with an explicit runAsUser: 65532.
  • Both blocks are {{- with }}-guarded, so operators can relax or disable them by overriding the values (e.g. set to {}).
  • This changes behavior on upgrade for existing installs (they flip to non-root + read-only root fs). Flagging for release-note visibility.
  • Regenerated chart snapshots (chart/.snapshots/*.yaml) and deploy manifests (deploy/ccm.yaml, deploy/ccm-networks.yaml); helm lint passes.

🤖 Generated with Claude Code

Add `podSecurityContext` (pod-level) and `securityContext` (container-level)
values and wire them into both the Deployment and DaemonSet templates.

Secure defaults are provided so the controller no longer runs as root with a
writable root filesystem out of the box, satisfying the Pod Security
"restricted" profile and lint gates such as kube-linter's `run-as-non-root`
and `no-read-only-root-fs`:

- podSecurityContext: runAsNonRoot, runAsUser 65532, RuntimeDefault seccomp
- securityContext: readOnlyRootFilesystem, no privilege escalation, drop ALL

The runtime does not write to its root filesystem, so readOnlyRootFilesystem
is safe. Both blocks are `with`-guarded so operators can relax them by
overriding the values.

Closes hetznercloud#1253

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helm chart: expose securityContext/podSecurityContext values — Deployment runs as root with a writable root filesystem

1 participant