Skip to content

Commit 138014c

Browse files
authored
Merge pull request #1542 from jvanz/issue1540
fix(charts): allow evaluations in controller namespace.
2 parents 9e9ed3d + d1d1523 commit 138014c

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

charts/kubewarden-controller/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ spec:
5151
- --leader-elect
5252
- --deployments-namespace={{ .Release.Namespace }}
5353
- --webhook-service-name={{ include "kubewarden-controller.fullname" . }}-webhook-service
54+
{{- if .Values.alwaysAcceptAdmissionReviewsOnDeploymentsNamespace }}
5455
- --always-accept-admission-reviews-on-deployments-namespace
56+
{{- end }}
5557
- --zap-log-level={{ .Values.logLevel }}
5658
{{- if .Values.mTLS.enable }}
5759
- --client-ca-configmap-name={{ .Values.mTLS.configMapName }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
suite: alwaysAcceptAdmissionReviewsOnDeploymentsNamespace flag
2+
templates:
3+
- deployment.yaml
4+
tests:
5+
- it: "should include the flag when alwaysAcceptAdmissionReviewsOnDeploymentsNamespace is true (default)"
6+
asserts:
7+
- contains:
8+
path: spec.template.spec.containers[0].args
9+
content: "--always-accept-admission-reviews-on-deployments-namespace"
10+
11+
- it: "should include the flag when alwaysAcceptAdmissionReviewsOnDeploymentsNamespace is explicitly true"
12+
set:
13+
alwaysAcceptAdmissionReviewsOnDeploymentsNamespace: true
14+
asserts:
15+
- contains:
16+
path: spec.template.spec.containers[0].args
17+
content: "--always-accept-admission-reviews-on-deployments-namespace"
18+
19+
- it: "should not include the flag when alwaysAcceptAdmissionReviewsOnDeploymentsNamespace is false"
20+
set:
21+
alwaysAcceptAdmissionReviewsOnDeploymentsNamespace: false
22+
asserts:
23+
- notContains:
24+
path: spec.template.spec.containers[0].args
25+
content: "--always-accept-admission-reviews-on-deployments-namespace"

charts/kubewarden-controller/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ preDeleteHook:
145145
runAsNonRoot: true
146146
seccompProfile:
147147
type: RuntimeDefault
148+
# If true, the controller will always accept admission reviews in the
149+
# deployment namespace. It is recommended to keep this value true unless you
150+
# have a specific reason to disable it. This is a safety flag to avoid policy
151+
# evaluations that could interfere with the Kubewarden stack running in the
152+
# admission controller namespace.
153+
alwaysAcceptAdmissionReviewsOnDeploymentsNamespace: true
148154
# Verbosity of logging. Can be one of 'debug', 'info', 'error'.
149155
logLevel: info
150156
# open-telemetry options

0 commit comments

Comments
 (0)