From b2541ee2e63d6c4d80ecae36ed321c63fef9a53d Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:21:08 +0200 Subject: [PATCH] chore(clusterissuer): BREAKING CHANGE adapt to common changes (#15889) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Kjeld Schouten Co-authored-by: Kjeld Schouten --- charts/enterprise/clusterissuer/Chart.yaml | 16 ++++++------ .../clusterissuer/_clusterCertificates.tpl | 25 +++++++++---------- .../clusterissuer/templates/common.yaml | 12 +++++---- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/charts/enterprise/clusterissuer/Chart.yaml b/charts/enterprise/clusterissuer/Chart.yaml index d2cd34f14c8..ff24c89e8c9 100644 --- a/charts/enterprise/clusterissuer/Chart.yaml +++ b/charts/enterprise/clusterissuer/Chart.yaml @@ -1,7 +1,7 @@ kubeVersion: '>=1.24.0-0' apiVersion: v2 name: clusterissuer -version: 4.2.14 +version: 5.0.0 appVersion: latest description: Certificate management for Kubernetes home: https://truecharts.org/charts/enterprise/clusterissuer @@ -19,13 +19,13 @@ keywords: - cert-manager - certificates dependencies: - - name: common - version: 14.5.0 - repository: https://library-charts.truecharts.org - condition: "" - alias: "" - tags: [] - import-values: [] + - name: common + version: 16.2.4 + repository: https://library-charts.truecharts.org + condition: "" + alias: "" + tags: [] + import-values: [] annotations: max_scale_version: 23.10.2 min_scale_version: 23.10.0 diff --git a/charts/enterprise/clusterissuer/templates/clusterissuer/_clusterCertificates.tpl b/charts/enterprise/clusterissuer/templates/clusterissuer/_clusterCertificates.tpl index 86ff731b3fb..a1e06520730 100644 --- a/charts/enterprise/clusterissuer/templates/clusterissuer/_clusterCertificates.tpl +++ b/charts/enterprise/clusterissuer/templates/clusterissuer/_clusterCertificates.tpl @@ -1,8 +1,7 @@ {{- define "certmanager.clusterissuer.clusterCertificates" -}} {{- if .Values.clusterCertificates -}} - {{- $certs := dict -}} {{- $secretTemplates := dict -}} - {{- $certNamespace := (include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $ "objectData" $certs "caller" "ClusterCertificates")) -}} + {{- $certNamespace := (include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $ "objectData" dict "caller" "ClusterCertificates")) -}} {{- $replicationNamespaces := ".*" -}} {{- if .Values.clusterCertificates.replicationNamespaces -}} {{- $replicationNamespaces = .Values.clusterCertificates.replicationNamespaces -}} @@ -18,18 +17,18 @@ {{- $_ := set $secretTemplates "annotations" $certAnnotations -}} - {{- range .Values.clusterCertificates.certificates -}} - {{- $_ := set $certs .name dict -}} - {{- $currentCert := (index $certs (.name)) -}} - {{- $_ := set $currentCert "enabled" .enabled -}} - {{- $_ := set $currentCert "nameOverride" .name -}} - {{- $_ := set $currentCert "hosts" .hosts -}} - {{- $_ := set $currentCert "certificateIssuer" .certificateIssuer -}} - {{- $_ := set $currentCert "secretTemplate" $secretTemplates -}} + {{- if not $.Values.certificate -}} + {{- $_ := set $.Values "certificate" dict -}} + {{- end -}} + + {{- range .Values.clusterCertificates.certificates -}} + {{- $_ := set $.Values.certificate .name (dict + "enabled" .enabled + "hosts" .hosts + "certificateIssuer" .certificateIssuer + "certificateSecretTemplate" $secretTemplates + ) -}} {{- end -}} - {{- $_ := set .Values "cert" $certs -}} - {{/* Render the ClusterWide Certificate(s) */}} - {{- include "tc.v1.common.spawner.certificate" . | nindent 0 -}} {{- end -}} {{- end -}} diff --git a/charts/enterprise/clusterissuer/templates/common.yaml b/charts/enterprise/clusterissuer/templates/common.yaml index 8d713d12f0f..494bfc898d5 100644 --- a/charts/enterprise/clusterissuer/templates/common.yaml +++ b/charts/enterprise/clusterissuer/templates/common.yaml @@ -1,14 +1,16 @@ {{/* Make sure all variables are set properly */}} {{- include "tc.v1.common.loader.init" . }} +{{/* + Generate certificate data and set them to $.Values.ceritificate + Let common handle the creation of the objects +*/}} +{{- include "certmanager.clusterissuer.clusterCertificates" . }} + {{/* Render the templates */}} {{ include "tc.v1.common.loader.apply" . }} +{{/* Generate the cluster issuers */}} {{- include "certmanager.clusterissuer.acme" . }} {{- include "certmanager.clusterissuer.selfsigned" . }} {{- include "certmanager.clusterissuer.ca" . }} - -{{/* Must be called after the initial loader.apply template, - because it overrides .Values.cert in order to generate - the additional cluster-wide certificates */}} -{{- include "certmanager.clusterissuer.clusterCertificates" . }}