Skip to content

helm: add configurable containerSecurityContext for operator containers - #13577

Open
jcrosel wants to merge 2 commits into
projectcalico:masterfrom
jcrosel:feat/helm-operator-container-security-context
Open

helm: add configurable containerSecurityContext for operator containers#13577
jcrosel wants to merge 2 commits into
projectcalico:masterfrom
jcrosel:feat/helm-operator-container-security-context

Conversation

@jcrosel

@jcrosel jcrosel commented Aug 20, 2026

Copy link
Copy Markdown

What this PR does

Adds a new containerSecurityContext Helm value (default: {}, backwards-compatible no-op) that is applied as securityContext: to all containers in the tigera-operator Deployment:

  • The main tigera-operator container
  • The OpenShift-specific bootstrap-crds init container
  • The OpenShift-specific create-initial-resources init container

This allows users to harden the operator pod (e.g. runAsNonRoot, readOnlyRootFilesystem, dropping privilege escalation) without needing to fork the chart or apply a post-install patch.

Why

Security-conscious users and enterprise environments often require all containers to have an explicit securityContext. Without this value, the only way to add one was to fork or patch the chart.

Pattern precedent

This follows the same approach already merged for other components:

Testing

  • Default (containerSecurityContext: {}) produces identical rendered output to the current chart — fully backwards-compatible.
  • Setting a value (e.g. runAsNonRoot: true) injects the field into all three containers as expected.
  • Verified with helm template locally.

Release note:

Add `containerSecurityContext` Helm value to the tigera-operator chart, allowing users to configure a container-level security context for the operator and its init containers. Defaults to `{}` (no change in existing behaviour).

@jcrosel
jcrosel requested a review from a team as a code owner August 20, 2026 08:24
Copilot AI lite review requested due to automatic review settings August 20, 2026 08:24
@marvin-tigera marvin-tigera added this to the Calico v3.34.0 milestone Aug 20, 2026
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Aug 20, 2026
@CLAassistant

CLAassistant commented Aug 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new Helm value to the tigera-operator chart that lets users apply a container-level Kubernetes securityContext to the operator container and its OpenShift-specific init containers, enabling hardening without forking or post-install patching.

Changes:

  • Introduces a new containerSecurityContext value (default {} / no-op) in charts/tigera-operator/values.yaml.
  • Renders securityContext: into the operator container and OpenShift init containers when containerSecurityContext is set.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
charts/tigera-operator/values.yaml Adds the new containerSecurityContext value and inline documentation/example.
charts/tigera-operator/templates/tigera-operator/02-tigera-operator.yaml Applies .Values.containerSecurityContext as securityContext: on the operator container and OpenShift init containers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread charts/tigera-operator/values.yaml
jcrosel and others added 2 commits August 20, 2026 10:56
Adds a new `containerSecurityContext` value (default: `{}`, no-op) that
is applied to the tigera-operator container and the OpenShift-specific
init containers (bootstrap-crds, create-initial-resources). This allows
operators to harden the deployment without requiring a custom patch or
fork.

Follows the same pattern used for calico-kube-controllers (projectcalico#6499) and
calico-typha (projectcalico#6524).
Add the new containerSecurityContext value to the Values reference
section of the chart README, keeping it in sync with values.yaml.

Co-authored-by: Claude <noreply@anthropic.com>
@jcrosel
jcrosel force-pushed the feat/helm-operator-container-security-context branch from cf7bac6 to 6443f78 Compare August 20, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-pr-required Change is not yet documented release-note-required Change has user-facing impact (no matter how small)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants