File tree Expand file tree Collapse file tree
charts/kubewarden-controller Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,24 @@ Create the name of the service account to use for kubewarden-controller
112112{{- end -}}
113113{{- end -}}
114114
115+ {{/*
116+ Build a comma-separated list of Secret names from .Values.imagePullSecrets,
117+ for use with the controller --image-pull-secrets flag. Handles both string
118+ entries and {name: ...} objects. Returns an empty string when no secrets
119+ are configured.
120+ */ }}
121+ {{- define " policyServerImagePullSecretNames" -}}
122+ {{- $names := list -}}
123+ {{- range .Values.imagePullSecrets -}}
124+ {{- if kindIs " string" . -}}
125+ {{- $names = append $names . -}}
126+ {{- else -}}
127+ {{- $names = append $names .name -}}
128+ {{- end -}}
129+ {{- end -}}
130+ {{- join " ," $names -}}
131+ {{- end -}}
132+
115133{{- define " audit-scanner.command" -}}
116134{{- $parallelNamespaces := .Values.auditScanner.parallelNamespaces | int -}}
117135{{- $parallelResources := .Values.auditScanner.parallelResources | int -}}
Original file line number Diff line number Diff line change 5858 {{- if .Values.mTLS.enable }}
5959 - --client-ca-configmap-name={{ .Values.mTLS.configMapName }}
6060 {{- end }}
61+ {{- $imagePullSecretNames := include "policyServerImagePullSecretNames" . }}
62+ {{- if $imagePullSecretNames }}
63+ - --image-pull-secrets={{ $imagePullSecretNames }}
64+ {{- end }}
6165 {{- if or .Values.telemetry.metrics .Values.telemetry.tracing }}
6266 {{- if eq .Values.telemetry.mode "sidecar" }}
6367 - --enable-otel-sidecar
Original file line number Diff line number Diff line change 1+ suite : image-pull-secrets flag
2+ templates :
3+ - deployment.yaml
4+ tests :
5+ - it : " should not include --image-pull-secrets when imagePullSecrets is empty (default)"
6+ asserts :
7+ - notContains :
8+ path : spec.template.spec.containers[0].args
9+ content : " --image-pull-secrets"
10+ any : true
11+
12+ - it : " should include --image-pull-secrets when imagePullSecrets contains a string entry"
13+ set :
14+ imagePullSecrets :
15+ - my-registry-secret
16+ asserts :
17+ - contains :
18+ path : spec.template.spec.containers[0].args
19+ content : " --image-pull-secrets=my-registry-secret"
20+
21+ - it : " should include --image-pull-secrets when imagePullSecrets contains an object entry"
22+ set :
23+ imagePullSecrets :
24+ - name : my-registry-secret
25+ asserts :
26+ - contains :
27+ path : spec.template.spec.containers[0].args
28+ content : " --image-pull-secrets=my-registry-secret"
29+
30+ - it : " should include multiple imagePullSecrets as a comma-separated list"
31+ set :
32+ imagePullSecrets :
33+ - secret-one
34+ - secret-two
35+ asserts :
36+ - contains :
37+ path : spec.template.spec.containers[0].args
38+ content : " --image-pull-secrets=secret-one,secret-two"
Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ global:
109109nameOverride : " "
110110# fullnameOverride completely replaces the generated release name
111111fullnameOverride : " "
112- # Secrets to pull container images from private registries
112+ # Secrets to pull container images from private registries. When set, the
113+ # secret names are passed to the controller via --image-pull-secrets and added
114+ # to the spec.template.spec.imagePullSecrets of every policy-server Deployment.
113115imagePullSecrets : []
114116# -- Additional labels to add to all resources
115117additionalLabels : {}
You can’t perform that action at this time.
0 commit comments