Fixed disable webhook script
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
parent
4528e35872
commit
15ae2e615a
@ -39,7 +39,7 @@ FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","opera
|
|||||||
|
|
||||||
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
|
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
|
||||||
printf "🚫 Disabling mutating webhook ${NAME}..."
|
printf "🚫 Disabling mutating webhook ${NAME}..."
|
||||||
kubectl annotate mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state='kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json'
|
kubectl annotate mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
|
||||||
HOOKS=$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
HOOKS=$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
||||||
for HOOK in ${HOOKS}
|
for HOOK in ${HOOKS}
|
||||||
do
|
do
|
||||||
@ -48,7 +48,7 @@ if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
|
|||||||
printf " ✅ Done"
|
printf " ✅ Done"
|
||||||
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
|
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
|
||||||
printf "🚫 Disabling validating webhook ${NAME}..."
|
printf "🚫 Disabling validating webhook ${NAME}..."
|
||||||
kubectl annotate validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state='kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json'
|
kubectl annotate validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
|
||||||
HOOKS=$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
HOOKS=$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
||||||
for HOOK in ${HOOKS}
|
for HOOK in ${HOOKS}
|
||||||
do
|
do
|
||||||
|
Loading…
Reference in New Issue
Block a user