From 364e01b0934a3db9415836f4c09bd268a8144f9f Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Thu, 15 Feb 2024 15:42:57 +0530 Subject: [PATCH] fix helm lint by defining new template helper Signed-off-by: Rajat Jindal --- charts/spin-operator/templates/_helpers.tpl | 11 +++++++++++ charts/spin-operator/templates/serving-cert.yaml | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/charts/spin-operator/templates/_helpers.tpl b/charts/spin-operator/templates/_helpers.tpl index 3ba9a00c..b4698580 100644 --- a/charts/spin-operator/templates/_helpers.tpl +++ b/charts/spin-operator/templates/_helpers.tpl @@ -23,6 +23,17 @@ If release name contains chart name it will be used as a full name. {{- end }} {{- end }} + +{{/* +helmify replaces namespace name with `{{ .Release.Namespace }}` in dnsNames for Certificate object +which means `{{ include "spin-operator.fullname" . }}` gets replaced with `{{ include "{{ .Release.Namespace }}.fullname" . }}` + +This is most likely a bug in helmify, but we can workaround it by defining a new template helper with name `{{ .Release.Namespace }}.fullname` +*/}} +{{- define "{{ .Release.Namespace }}.fullname" -}} +{{ include "spin-operator.fullname" . }} +{{- end }} + {{/* Create chart name and version as used by the chart label. */}} diff --git a/charts/spin-operator/templates/serving-cert.yaml b/charts/spin-operator/templates/serving-cert.yaml index 7fe199b9..5c07e8d2 100644 --- a/charts/spin-operator/templates/serving-cert.yaml +++ b/charts/spin-operator/templates/serving-cert.yaml @@ -9,9 +9,9 @@ metadata: {{- include "spin-operator.labels" . | nindent 4 }} spec: dnsNames: - - '{{ include "spin-operator.fullname" . }}-webhook-service.{{ .Release.Namespace + - '{{ include "{{ .Release.Namespace }}.fullname" . }}-webhook-service.{{ .Release.Namespace }}.svc' - - '{{ include "spin-operator.fullname" . }}-webhook-service.{{ .Release.Namespace + - '{{ include "{{ .Release.Namespace }}.fullname" . }}-webhook-service.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesClusterDomain }}' issuerRef: kind: Issuer