Remove unneeded lookup function from upgrade hook (#104)

Those upgrading to 0.17.0 should no longer need the code to check for the old webhook.

Signed-off-by: Kevin Fox <[email protected]>
Co-authored-by: Faisal Memon <[email protected]>
This commit is contained in:
kfox1111
2023-12-01 10:49:29 -08:00
committed by GitHub
co-authored by Faisal Memon
parent 8422b8d141
commit 692d463718
@@ -1,9 +1,4 @@
{{- if eq ((dig "installAndUpgradeHooks" "enabled" .Values.controllerManager.installAndUpgradeHook.enabled .Values.global) | toString) "true" }}
{{- $webhookname := printf "%s-%s-webhook" .Release.Namespace (include "spire-controller-manager.fullname" .) }}
{{- $oldwebhookname := printf "%s-webhook" (include "spire-controller-manager.fullname" .) }}
{{- if not (lookup "admissionregistration.k8s.io/v1" "ValidatingWebhookConfiguration" "" $webhookname) }}
{{- $webhookname = $oldwebhookname }}
{{- end }}
{{- if eq (.Values.controllerManager.enabled | toString) "true" }}
{{- if eq .Values.controllerManager.validatingWebhookConfiguration.failurePolicy "Fail" }}
apiVersion: v1
@@ -27,7 +22,7 @@ metadata:
rules:
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations"]
resourceNames: [{{ $webhookname | quote }}]
resourceNames: [{{ printf "%s-%s-webhook" .Release.Namespace (include "spire-controller-manager.fullname" .) | quote }}]
verbs: ["get", "patch"]
---
kind: ClusterRoleBinding
@@ -73,7 +68,7 @@ spec:
args:
- patch
- validatingwebhookconfiguration
- {{ $webhookname }}
- {{ printf "%s-%s-webhook" .Release.Namespace (include "spire-controller-manager.fullname" .) }}
- --type=strategic
- -p
- |