From 0cf0c04bc597e57a6159c9915bb85b0de4e6fd3a Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Fri, 8 Dec 2023 00:48:38 +0200 Subject: [PATCH] start clean --- .../common/templates/class/_certificate.tpl | 38 ------------------- .../common/templates/spawner/_certificate.tpl | 23 ----------- 2 files changed, 61 deletions(-) diff --git a/library/common/templates/class/_certificate.tpl b/library/common/templates/class/_certificate.tpl index 5178dc22..09eec90e 100644 --- a/library/common/templates/class/_certificate.tpl +++ b/library/common/templates/class/_certificate.tpl @@ -3,43 +3,5 @@ This template serves as a blueprint for all Cert-Manager Certificate objects tha within the common library. */}} {{- define "tc.v1.common.class.certificate" -}} -{{- $root := .root -}} -{{- $name := .name -}} -{{- $hosts := .hosts -}} -{{- $certificateIssuer := .certificateIssuer -}} -{{- $certificateSecretTemplate := .secretTemplate }} ---- -apiVersion: {{ include "tc.v1.common.capabilities.cert-manager.certificate.apiVersion" $ }} -kind: Certificate -metadata: - name: {{ $name }} - namespace: {{ $root.Values.namespace | default $root.Values.global.namespace | default $root.Release.Namespace }} -spec: - secretName: {{ $name }} - dnsNames: - {{- range $hosts }} - - {{ tpl . $root | quote }} - {{- end }} - privateKey: - algorithm: ECDSA - size: 256 - rotationPolicy: Always - issuerRef: - name: {{ tpl $certificateIssuer $root | quote }} - kind: ClusterIssuer - group: cert-manager.io - {{- if $certificateSecretTemplate }} - secretTemplate: - {{- $labels := (mustMerge ($certificateSecretTemplate.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $root | fromYaml)) -}} - {{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $root "labels" $labels) | trim) }} - labels: - {{- . | nindent 6 }} - {{- end -}} - {{- $annotations := (mustMerge ($certificateSecretTemplate.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $root | fromYaml)) -}} - {{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $root "annotations" $annotations) | trim) }} - annotations: - {{- . | nindent 6 }} - {{- end -}} - {{- end -}} {{- end -}} diff --git a/library/common/templates/spawner/_certificate.tpl b/library/common/templates/spawner/_certificate.tpl index 0dd53528..42a5edb9 100644 --- a/library/common/templates/spawner/_certificate.tpl +++ b/library/common/templates/spawner/_certificate.tpl @@ -1,27 +1,4 @@ {{/* Renders the certificate objects required by the chart */}} {{- define "tc.v1.common.spawner.certificate" -}} - {{- $fullname := include "tc.v1.common.lib.chart.names.fullname" $ -}} - {{/* Generate named certs as required */}} - {{- range $name, $cert := .Values.cert -}} - {{- if $cert.enabled -}} - {{- $certValues := $cert -}} - {{- $certName := $fullname -}} - - {{/* set defaults */}} {{/* FIXME: the primary template does not exist */}} - {{- 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 -}} - - {{- if $certValues.secretTemplate -}} - {{- $certName = printf "%v-%v" "clusterissuer-templated" $name -}} - {{- end -}} - - {{- include "tc.v1.common.class.certificate" (dict "root" $ "name" $certName "certificateIssuer" $cert.certificateIssuer "hosts" $cert.hosts "secretTemplate" $cert.secretTemplate ) -}} - {{- end -}} - {{- end -}} {{- end -}}