From 171a6716a3393280743f7528f50497e677e1f10b Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Mon, 5 Jun 2023 10:08:22 +0300 Subject: [PATCH] fix(blocky): fix tpl (#9396) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes #9183 On first render helm will evaluate all expressions, but later when it gets templated again `{{ tpl (toYaml $content) $ }}` it will try to evaluate Corefile expressions. Nesting the expression is a quick workaround. Need to think how to solve this on common side at configmap creation. **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [x] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [x] 👀 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 - [x] ⚠️ 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._ --- charts/enterprise/blocky/Chart.yaml | 2 +- charts/enterprise/blocky/templates/_k8sgateway.tpl | 10 ++++++++-- charts/enterprise/blocky/templates/common.yaml | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/charts/enterprise/blocky/Chart.yaml b/charts/enterprise/blocky/Chart.yaml index 483764fc41a..4e6cea7320c 100644 --- a/charts/enterprise/blocky/Chart.yaml +++ b/charts/enterprise/blocky/Chart.yaml @@ -25,7 +25,7 @@ sources: - https://0xerr0r.github.io/blocky/ - https://github.com/0xERR0R/blocky - https://github.com/Mozart409/blocky-frontend -version: 5.0.36 +version: 5.0.37 annotations: truecharts.org/catagories: | - network diff --git a/charts/enterprise/blocky/templates/_k8sgateway.tpl b/charts/enterprise/blocky/templates/_k8sgateway.tpl index 37bf5833e14..463923f85da 100644 --- a/charts/enterprise/blocky/templates/_k8sgateway.tpl +++ b/charts/enterprise/blocky/templates/_k8sgateway.tpl @@ -38,7 +38,7 @@ Create the matchable regex from domain {{- $fqdn := ( include "tc.v1.common.lib.chart.names.fqdn" . ) }} enabled: true data: - Corefile: |- + Corefile: | .:{{ .Values.service.k8sgateway.ports.k8sgateway.targetPort }} { errors log @@ -48,9 +48,15 @@ data: ready {{- range .Values.k8sgateway.domains }} {{- if .dnsChallenge.enabled }} + {{- if not .dnsChallenge.domain -}} + {{- fail "DNS01 challenge domain is mandatory" -}} + {{- end }} + template IN ANY {{ required "Delegated domain ('domain') is mandatory" .domain }} { match "_acme-challenge[.](.*)[.]{{ include "k8sgateway.configmap.regex" . }}" - answer "{{ "{{" }} .Name {{ "}}" }} 5 IN CNAME {{ "{{" }} index .Match 1 {{ "}}" }}.{{ required "DNS01 challenge domain is mandatory" .dnsChallenge.domain }}" + {{- $name := "{{ \"{{ .Name }}\" }}" }} + {{- $index := "{{ \"{{ index .Match 1 }}\" }}" }} + answer "{{ $name }} 5 IN CNAME {{ $index }}.{{ .dnsChallenge.domain }}" fallthrough } {{- end }} diff --git a/charts/enterprise/blocky/templates/common.yaml b/charts/enterprise/blocky/templates/common.yaml index 40bf6d293a4..310ef64af8f 100644 --- a/charts/enterprise/blocky/templates/common.yaml +++ b/charts/enterprise/blocky/templates/common.yaml @@ -4,7 +4,6 @@ {{- end }} {{- include "tc.v1.common.loader.init" . }} - {{/* Render configmap for blocky */}} {{- $configmapFile := include "blocky.configmap" . | fromYaml -}} {{- if $configmapFile -}}