fix(common): don't try to lookup a configmap in a potentially non-existing namespace

This commit is contained in:
Kjeld Schouten
2023-05-28 14:17:51 +02:00
committed by GitHub
parent 2e0954f03b
commit 2c7be270d1

View File

@@ -1,7 +1,9 @@
{{- define "tc.v1.common.lib.util.operator.register" -}}
{{- if .Values.operator.register -}}
{{- with (lookup "v1" "ConfigMap" "tc-system" $.Chart.Name) -}}
{{- fail (printf "You cannot install the [%s] operator twice..." $.Chart.Name) -}}
{{- with (lookup "v1" "Namespace" "tc-system" "") -}}
{{- with (lookup "v1" "ConfigMap" "tc-system" $.Chart.Name) -}}
{{- fail (printf "You cannot install the [%s] operator twice..." $.Chart.Name) -}}
{{- end -}}
{{- end -}}
{{- $objectData := (dict "name" $.Chart.Name