From 9ec39b29c19b57b94f9a75c5d4eefdcd699847c0 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 21 Feb 2023 10:02:13 +0100 Subject: [PATCH] rename some files --- .../common/templates/spawner/_certificate.tpl | 48 ++++++------------- .../templates/spawner/_scaleCertificate.tpl | 39 +++++++++++++++ .../templates/spawner/_tc-certificate.tpl | 21 -------- 3 files changed, 54 insertions(+), 54 deletions(-) create mode 100644 library/common/templates/spawner/_scaleCertificate.tpl delete mode 100644 library/common/templates/spawner/_tc-certificate.tpl diff --git a/library/common/templates/spawner/_certificate.tpl b/library/common/templates/spawner/_certificate.tpl index 4bc2e39c..b4e47371 100644 --- a/library/common/templates/spawner/_certificate.tpl +++ b/library/common/templates/spawner/_certificate.tpl @@ -1,39 +1,21 @@ -{{/* Certificate Spawwner */}} -{{/* Call this template: -{{ include "tc.v1.common.spawner.scaleCertificate" $ -}} -*/}} +{{/* Renders the certificate objects required by the chart */}} +{{- define "tc.v1.common.spawner.certificate" -}} + {{/* Generate named certs as required */}} + {{- range $name, $cert := .Values.cert -}} + {{- if $cert.enabled -}} + {{- $certValues := $cert -}} + {{- $certName := include "tc.v1.common.lib.chart.names.fullname" $ -}} -{{- define "tc.v1.common.spawner.scaleCertificate" -}} + {{/* set defaults */}} + {{- if and (not $certValues.nameOverride) (ne $name (include "tc.v1.common.lib.util.cert.primary" $)) -}} + {{- $_ := set $certValues "nameOverride" $name -}} + {{- end -}} - {{- range $name, $certificate := .Values.scaleCertificate -}} - - {{- if $certificate.enabled -}} - - {{/* Create a copy of the certificate */}} - {{- $objectData := (mustDeepCopy $certificate) -}} - - {{- $objectName := (printf "%s-%s" (include "tc.v1.common.lib.chart.names.fullname" $) $name) -}} - {{/* Perform validations */}} - {{- include "tc.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} - {{- include "tc.v1.common.lib.scaleCertificate.validation" (dict "objectData" $objectData) -}} - {{- include "tc.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Certificate") -}} - - {{/* Prepare data */}} - {{- $data := fromJson (include "tc.v1.common.lib.scaleCertificate.getData" (dict "rootCtx" $ "objectData" $objectData)) -}} - {{- $_ := set $objectData "data" $data -}} - - {{/* Set the type to certificate */}} - {{- $_ := set $objectData "type" "certificate" -}} - - {{/* Set the name of the certificate */}} - {{- $_ := set $objectData "name" $objectName -}} - {{- $_ := set $objectData "shortName" $name -}} - - {{/* Call class to create the object */}} - {{- include "tc.v1.common.class.secret" (dict "rootCtx" $ "objectData" $objectData) -}} + {{- if $certValues.nameOverride -}} + {{- $certName = printf "%v-%v" $certName $certValues.nameOverride -}} + {{- end -}} + {{- include "tc.v1.common.class.certificate" (dict "root" $ "name" $certName "certificateIssuer" $cert.certificateIssuer "hosts" $cert.hosts ) -}} {{- end -}} - {{- end -}} - {{- end -}} diff --git a/library/common/templates/spawner/_scaleCertificate.tpl b/library/common/templates/spawner/_scaleCertificate.tpl new file mode 100644 index 00000000..4bc2e39c --- /dev/null +++ b/library/common/templates/spawner/_scaleCertificate.tpl @@ -0,0 +1,39 @@ +{{/* Certificate Spawwner */}} +{{/* Call this template: +{{ include "tc.v1.common.spawner.scaleCertificate" $ -}} +*/}} + +{{- define "tc.v1.common.spawner.scaleCertificate" -}} + + {{- range $name, $certificate := .Values.scaleCertificate -}} + + {{- if $certificate.enabled -}} + + {{/* Create a copy of the certificate */}} + {{- $objectData := (mustDeepCopy $certificate) -}} + + {{- $objectName := (printf "%s-%s" (include "tc.v1.common.lib.chart.names.fullname" $) $name) -}} + {{/* Perform validations */}} + {{- include "tc.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} + {{- include "tc.v1.common.lib.scaleCertificate.validation" (dict "objectData" $objectData) -}} + {{- include "tc.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Certificate") -}} + + {{/* Prepare data */}} + {{- $data := fromJson (include "tc.v1.common.lib.scaleCertificate.getData" (dict "rootCtx" $ "objectData" $objectData)) -}} + {{- $_ := set $objectData "data" $data -}} + + {{/* Set the type to certificate */}} + {{- $_ := set $objectData "type" "certificate" -}} + + {{/* Set the name of the certificate */}} + {{- $_ := set $objectData "name" $objectName -}} + {{- $_ := set $objectData "shortName" $name -}} + + {{/* Call class to create the object */}} + {{- include "tc.v1.common.class.secret" (dict "rootCtx" $ "objectData" $objectData) -}} + + {{- end -}} + + {{- end -}} + +{{- end -}} diff --git a/library/common/templates/spawner/_tc-certificate.tpl b/library/common/templates/spawner/_tc-certificate.tpl deleted file mode 100644 index b4e47371..00000000 --- a/library/common/templates/spawner/_tc-certificate.tpl +++ /dev/null @@ -1,21 +0,0 @@ -{{/* Renders the certificate objects required by the chart */}} -{{- define "tc.v1.common.spawner.certificate" -}} - {{/* Generate named certs as required */}} - {{- range $name, $cert := .Values.cert -}} - {{- if $cert.enabled -}} - {{- $certValues := $cert -}} - {{- $certName := include "tc.v1.common.lib.chart.names.fullname" $ -}} - - {{/* set defaults */}} - {{- if and (not $certValues.nameOverride) (ne $name (include "tc.v1.common.lib.util.cert.primary" $)) -}} - {{- $_ := set $certValues "nameOverride" $name -}} - {{- end -}} - - {{- if $certValues.nameOverride -}} - {{- $certName = printf "%v-%v" $certName $certValues.nameOverride -}} - {{- end -}} - - {{- include "tc.v1.common.class.certificate" (dict "root" $ "name" $certName "certificateIssuer" $cert.certificateIssuer "hosts" $cert.hosts ) -}} - {{- end -}} - {{- end -}} -{{- end -}}