Skip to content

Commit 95ce626

Browse files
Merge pull request #203 from robertlich/failure-policy-configurable
set failure policy to be configurable for webhooks
2 parents ef68f47 + 7529e51 commit 95ce626

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

.github/workflows/pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: |
5555
kind load docker-image $IMAGE --name=chart-testing
5656
helm install $USER chart/tugger --debug --wait \
57-
--set=createMutatingWebhook=true \
57+
--set=mutatingWebhook.create=true \
5858
--set=image.tag=latest
5959
6060
- name: Test Mutation

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ helm install --name tugger \
6767
--set docker.registryUrl=jainishshah17, \
6868
--set whitelistNamespaces={kube-system,default}, \
6969
--set whitelistRegistries={jainishshah17} \
70-
--set createValidatingWebhook=true \
71-
--set createMutatingWebhook=true \
70+
--set validatingWebhook.create=true \
71+
--set mutatingWebhook.create=true \
7272
tugger/tugger
7373
```
7474

chart/tugger/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: "0.1.8"
33
description: A Helm chart for Tugger
44
name: tugger
5-
version: 0.4.5
5+
version: 0.4.6
66
keywords:
77
- DevOps
88
- helm

chart/tugger/ci/lint-values.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# enables optional features in the chart so they will be linted in the PR test
2-
createValidatingWebhook: true
3-
createMutatingWebhook: true
2+
validatingWebhook:
3+
create: true
4+
mutatingWebhook:
5+
create: true
46
env: prod
57
docker:
68
ifExists: true

chart/tugger/templates/admission-registration.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{{ $caCert = $ca.Cert }}
1414
{{- end }}
1515

16-
{{- if .Values.createValidatingWebhook }}
16+
{{- if or .Values.createValidatingWebhook .Values.validatingWebhook.create}}
1717
---
1818
apiVersion: admissionregistration.k8s.io/v1
1919
kind: ValidatingWebhookConfiguration
@@ -42,7 +42,7 @@ webhooks:
4242
resources:
4343
- pods
4444
scope: "Namespaced"
45-
failurePolicy: Ignore
45+
failurePolicy: {{ default "Ignore" .Values.validatingWebhook.failurePolicy }}
4646
clientConfig:
4747
service:
4848
name: {{ $serviceName }}
@@ -52,7 +52,7 @@ webhooks:
5252
caBundle: {{ b64enc $caCert }}
5353
{{- end }}
5454

55-
{{- if .Values.createMutatingWebhook }}
55+
{{- if or .Values.createMutatingWebhook .Values.mutatingWebhook.create }}
5656
---
5757
apiVersion: admissionregistration.k8s.io/v1
5858
kind: MutatingWebhookConfiguration
@@ -76,7 +76,7 @@ webhooks:
7676
apiGroups: [""]
7777
apiVersions: ["v1"]
7878
resources: ["pods"]
79-
failurePolicy: Ignore
79+
failurePolicy: {{ default "Ignore" .Values.mutatingWebhook.failurePolicy }}
8080
clientConfig:
8181
service:
8282
name: {{ $serviceName }}

chart/tugger/values.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ namespaceSelector:
7070
# operator: NotIn
7171
# values: ["0","1"]
7272

73-
createValidatingWebhook: false
74-
createMutatingWebhook: false
73+
validatingWebhook:
74+
create: false
75+
failurePolicy: #default: Ignore, options: Ignore, Fail
76+
mutatingWebhook:
77+
create: false
78+
failurePolicy: #default: Ignore, options: Ignore, Fail
7579

7680
resources: {}
7781
# We usually recommend not to specify default resources and to leave this as a conscious

0 commit comments

Comments
 (0)