From c3d3fef8b38eb1732632574cb8af6bdc14a57b8d Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sun, 28 May 2023 23:16:45 +0300 Subject: [PATCH] fix(pihole): fix pihole (#9229) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ 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/incubator/pihole/Chart.yaml | 2 +- charts/incubator/pihole/questions.yaml | 26 +++++++++---------- .../incubator/pihole/templates/_configmap.tpl | 17 +++++++----- charts/incubator/pihole/values.yaml | 19 +++++++------- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/charts/incubator/pihole/Chart.yaml b/charts/incubator/pihole/Chart.yaml index fff7f4c4059..11655966238 100644 --- a/charts/incubator/pihole/Chart.yaml +++ b/charts/incubator/pihole/Chart.yaml @@ -22,7 +22,7 @@ sources: - https://github.com/pi-hole - https://github.com/pi-hole/docker-pi-hole type: application -version: 10.0.0 +version: 10.0.1 annotations: truecharts.org/catagories: | - networking diff --git a/charts/incubator/pihole/questions.yaml b/charts/incubator/pihole/questions.yaml index 07f42765b04..b325f297386 100644 --- a/charts/incubator/pihole/questions.yaml +++ b/charts/incubator/pihole/questions.yaml @@ -27,25 +27,25 @@ questions: additional_attrs: true type: dict attrs: - - variable: WEBPASSWORD - label: "WEBPASSWORD" + - variable: webPassword + label: "Web Password" description: "Sets admin password for the GUI" schema: type: string default: "" required: true - - variable: DNS1 - label: "DNS1" - description: "Sets the first DNS server (use #port suffix for ports)" + - variable: dnsServers + label: "DNS Servers" + description: "Set DNS servers. Max 2. Use #port suffix for ports" schema: - type: string - default: "9.9.9.9" - - variable: DNS2 - label: "DNS2" - description: "Sets the second DNS server (use #port suffix for ports), only if DNS1 is entered" - schema: - type: string - default: "149.112.112.112" + type: list + default: ["9.9.9.9", "149.112.112.112"] + items: + - variable: dnsEntry + label: "DNS Server Entry" + schema: + type: string + default: "" # Include{podOptions} # Include{serviceRoot} - variable: main diff --git a/charts/incubator/pihole/templates/_configmap.tpl b/charts/incubator/pihole/templates/_configmap.tpl index 86436e72745..d39976e9e89 100644 --- a/charts/incubator/pihole/templates/_configmap.tpl +++ b/charts/incubator/pihole/templates/_configmap.tpl @@ -1,9 +1,14 @@ {{/* Define the configmap */}} {{- define "pihole.configmap" -}} -enabled: true -data: - WEBPASSWORD: {{ .Values.pihole.WEBPASSWORD | squote }} - {{- if .Values.pihole.DNS1 }} - "PIHOLE_DNS_": {{ if .Values.pihole.DNS2 }}{{ ( printf "%v;%v" .Values.pihole.DNS1 .Values.pihole.DNS2 ) | squote }}{{ else }}{{ .Values.pihole.DNS1 | squote }}{{ end }} - {{- end }} +configmap: + pihole-env: + enabled: true + data: + WEBPASSWORD: {{ .Values.pihole.webPassword | squote }} + {{- with .Values.pihole.dnsServers }} + {{- if gt (len .) 2 -}} + {{- fail (printf "Pihole - Expected max 2 DNS Servers. But got [%v]" (len .)) -}} + {{- end }} + PIHOLE_DNS_: {{ join ";" . | quote }} + {{- end }} {{- end -}} diff --git a/charts/incubator/pihole/values.yaml b/charts/incubator/pihole/values.yaml index ccddb168c30..2b6e540f3f9 100644 --- a/charts/incubator/pihole/values.yaml +++ b/charts/incubator/pihole/values.yaml @@ -3,11 +3,16 @@ image: pullPolicy: IfNotPresent tag: 2023.03.1@sha256:e48aa04bcdef84fb42f35fa2aaf54dd3ee868e2b80ab535a0ca59a8c6901453b +pihole: + webPassword: "somepassword" + dnsServers: + - "9.9.9.9" + - "149.112.112.112" + securityContext: container: readOnlyRootFilesystem: false runAsNonRoot: false - allowPrivilegeEscalation: true runAsUser: 0 runAsGroup: 0 capabilities: @@ -22,6 +27,9 @@ workload: podSpec: containers: main: + envFrom: + - configMapRef: + name: pihole-env probes: liveness: type: http @@ -33,10 +41,6 @@ workload: type: http path: /admin/index.php -envFrom: - - configMapRef: - name: pihole-env - service: main: ports: @@ -59,11 +63,6 @@ service: port: 53 targetPort: 53 -pihole: - WEBPASSWORD: "somepassword" - DNS1: "9.9.9.9" - DNS2: "149.112.112.112" - persistence: config: enabled: true