Skip to content

feat(helm): add podSecurityContext and podAnnotations to crdHook Job#2009

Merged
Slach merged 1 commit into
Altinity:0.27.2from
qlevasseur-genetec:ql/crdhook-pod-security
Jun 17, 2026
Merged

feat(helm): add podSecurityContext and podAnnotations to crdHook Job#2009
Slach merged 1 commit into
Altinity:0.27.2from
qlevasseur-genetec:ql/crdhook-pod-security

Conversation

@qlevasseur-genetec

@qlevasseur-genetec qlevasseur-genetec commented Jun 17, 2026

Copy link
Copy Markdown

Follow-up to #1950, which added crdHook.containerSecurityContext.

Summary

The crd-install Helm hook Job currently exposes only container-level securityContext. There is no way to set pod-level securityContext nor pod-template annotations. This blocks two real-world deployments:

  • Kyverno restrict-seccomp-strict rejects the Job because the pod spec lacks a pod-level seccompProfile. Container-level seccomp is not sufficient under the strict variant of this policy. https://kyverno.io/policies/pod-security/restricted/restrict-seccomp-strict/
  • Istio sidecar auto-injection adds an istio-init initContainer at admission time. That initContainer has no seccompProfile, again tripping Kyverno strict. The canonical opt-out is the pod-template annotation sidecar.istio.io/inject: "false", but the chart had no field to set it.

This PR adds two new value keys:

Key Renders to
crdHook.podSecurityContext spec.template.spec.securityContext
crdHook.podAnnotations spec.template.metadata.annotations

Both default to {} and render under {{- with }}, so the output is byte-identical when unset.

Changes

  • templates/hooks/crd-install-job.yaml — render the two new blocks
  • values.yaml — documented under crdHook: with commented-out examples
  • values.schema.json — declared both as type: object
  • README.md — two new rows in the values table

Backward compatibility

Defaults unchanged. With no overrides, the rendered Job is identical to the pre-PR chart (verified via diff of helm template output).

The crd-install Job pod template currently exposes only container-level
securityContext via `crdHook.containerSecurityContext`. This blocks two
real-world deployments:

- Kyverno `restrict-seccomp-strict` rejects the Job because the pod has
  no pod-level `seccompProfile`.
- Istio sidecar auto-injection adds an `istio-init` initContainer that
  lacks `seccompProfile`, again tripping the same policy. The standard
  opt-out (`sidecar.istio.io/inject: "false"`) requires a pod-template
  annotation, which the chart had no way to set.

Add two new value keys:
- `crdHook.podSecurityContext` -> `spec.template.spec.securityContext`
- `crdHook.podAnnotations`     -> `spec.template.metadata.annotations`

Both default to `{}` and render under `{{- with }}`, so the rendered
output is byte-identical when unset. Same pattern already used for
`imagePullSecrets`, `nodeSelector`, `affinity`, `tolerations`,
`containerSecurityContext`.

Also wires the new keys into `values.schema.json` and the README values
table.

Signed-off-by: Quentin Levasseur (Genetec) <qlevasseur@genetec.com>
@Slach Slach merged commit 08d615d into Altinity:0.27.2 Jun 17, 2026
1 of 2 checks passed
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.

2 participants