Add configurable failurePolicy for injector's webhook (#400)
Fixes #399
This commit is contained in:
parent
5242cfe6a7
commit
5eb0ba5865
3 changed files with 32 additions and 0 deletions
|
@ -24,4 +24,7 @@ webhooks:
|
||||||
namespaceSelector:
|
namespaceSelector:
|
||||||
{{ toYaml .Values.injector.namespaceSelector | indent 6}}
|
{{ toYaml .Values.injector.namespaceSelector | indent 6}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{- with .Values.injector.failurePolicy }}
|
||||||
|
failurePolicy: {{.}}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -75,3 +75,26 @@ load _helpers
|
||||||
|
|
||||||
[ "${actual}" = "true" ]
|
[ "${actual}" = "true" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "injector/MutatingWebhookConfiguration: failurePolicy empty by default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/injector-mutating-webhook.yaml \
|
||||||
|
--set 'injector.enabled=true' \
|
||||||
|
--namespace foo \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.webhooks[0].failurePolicy' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "injector/MutatingWebhookConfiguration: can set failurePolicy" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/injector-mutating-webhook.yaml \
|
||||||
|
--set 'injector.enabled=true' \
|
||||||
|
--set 'injector.failurePolicy=Fail' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.webhooks[0].failurePolicy' | tee /dev/stderr)
|
||||||
|
|
||||||
|
[ "${actual}" = "\"Fail\"" ]
|
||||||
|
}
|
||||||
|
|
|
@ -70,6 +70,12 @@ injector:
|
||||||
# sidecar-injector: enabled
|
# sidecar-injector: enabled
|
||||||
namespaceSelector: {}
|
namespaceSelector: {}
|
||||||
|
|
||||||
|
# Configures failurePolicy of the webhook. By default webhook failures are ignored.
|
||||||
|
# To block pod creation while webhook is unavailable, set the policy to `Fail` below.
|
||||||
|
# See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#failure-policy
|
||||||
|
#
|
||||||
|
# failurePolcy: Fail
|
||||||
|
|
||||||
certs:
|
certs:
|
||||||
# secretName is the name of the secret that has the TLS certificate and
|
# secretName is the name of the secret that has the TLS certificate and
|
||||||
# private key to serve the injector webhook. If this is null, then the
|
# private key to serve the injector webhook. If this is null, then the
|
||||||
|
|
Loading…
Reference in a new issue