Skip to content

fix: move imagePullSecrets to pod spec level in Helm deployment templates#2975

Open
joonas wants to merge 1 commit intodefenseunicorns:mainfrom
joonas:fix/helm-imagepullsecrets-pod-spec-level
Open

fix: move imagePullSecrets to pod spec level in Helm deployment templates#2975
joonas wants to merge 1 commit intodefenseunicorns:mainfrom
joonas:fix/helm-imagepullsecrets-pod-spec-level

Conversation

@joonas
Copy link
Copy Markdown
Member

@joonas joonas commented Mar 1, 2026

Description

The imagePullSecrets block in both watcherDeployTemplate and admissionDeployTemplate was indented inside the container list item. Kubernetes expects imagePullSecrets as a sibling of containers and volumes under spec.template.spec. When nested inside a container definition, the field is silently ignored, causing image pulls from private registries to fail with no diagnostic output.

Move the {{- if gt (len .Values.imagePullSecrets) 0 }} block from inside the container item to the pod spec level in both templates. The indentation drops from 16 spaces (container field) to 12 spaces (pod spec field), making imagePullSecrets a proper sibling of containers, serviceAccountName, and volumes.

Add two new tests that assert imagePullSecrets shares the same indentation level as containers, preventing regression.

End to End Test:
(See Pepr Excellent Examples)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

…plates

The `imagePullSecrets` block in both `watcherDeployTemplate` and
`admissionDeployTemplate` was indented inside the container list
item. Kubernetes expects `imagePullSecrets` as a sibling of
`containers` and `volumes` under `spec.template.spec`. When nested
inside a container definition, the field is silently ignored,
causing image pulls from private registries to fail with no
diagnostic output.

Move the `{{- if gt (len .Values.imagePullSecrets) 0 }}` block
from inside the container item to the pod spec level in both
templates. The indentation drops from 16 spaces (container field)
to 12 spaces (pod spec field), making `imagePullSecrets` a proper
sibling of `containers`, `serviceAccountName`, and `volumes`.

Add two new tests that assert `imagePullSecrets` shares the same
indentation level as `containers`, preventing regression.

Signed-off-by: Joonas Bergius <joonas@defenseunicorns.com>
@joonas joonas requested a review from a team as a code owner March 1, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant