From 5e702a4a0d14163046b35aab9e10ff14adc1bfbd Mon Sep 17 00:00:00 2001 From: Pascal Iske Date: Tue, 26 Oct 2021 09:02:21 +0200 Subject: [PATCH] feat(pihole): allow setting node port through values (#193) Allow setting node port through values --- charts/pihole/Chart.yaml | 2 +- charts/pihole/templates/service-dns-tcp.yaml | 3 +++ charts/pihole/templates/service-dns-udp.yaml | 3 +++ charts/pihole/templates/service-dns.yaml | 6 ++++++ charts/pihole/values.yaml | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/charts/pihole/Chart.yaml b/charts/pihole/Chart.yaml index 21ca49f7..6ea6c5b5 100644 --- a/charts/pihole/Chart.yaml +++ b/charts/pihole/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: Installs pihole in kubernetes home: https://github.com/MoJo2600/pihole-kubernetes/tree/master/charts/pihole name: pihole -version: 2.5.0 +version: 2.5.1 sources: - https://github.com/MoJo2600/pihole-kubernetes/tree/master/charts/pihole - https://pi-hole.net/ diff --git a/charts/pihole/templates/service-dns-tcp.yaml b/charts/pihole/templates/service-dns-tcp.yaml index b99792d6..92062601 100644 --- a/charts/pihole/templates/service-dns-tcp.yaml +++ b/charts/pihole/templates/service-dns-tcp.yaml @@ -29,6 +29,9 @@ spec: ports: - port: {{ .Values.serviceDns.port }} targetPort: dns + {{- if and (.Values.serviceDns.nodePort) (eq .Values.serviceDns.type "NodePort") }} + nodePort: {{ .Values.serviceDns.nodePort }} + {{- end }} protocol: TCP name: dns {{- if .Values.monitoring.sidecar.enabled }} diff --git a/charts/pihole/templates/service-dns-udp.yaml b/charts/pihole/templates/service-dns-udp.yaml index 4f03d73e..34835d46 100644 --- a/charts/pihole/templates/service-dns-udp.yaml +++ b/charts/pihole/templates/service-dns-udp.yaml @@ -29,6 +29,9 @@ spec: ports: - port: {{ .Values.serviceDns.port }} targetPort: dns-udp + {{- if and (.Values.serviceDns.nodePort) (eq .Values.serviceDns.type "NodePort") }} + nodePort: {{ .Values.serviceDns.nodePort }} + {{- end }} protocol: UDP name: dns-udp selector: diff --git a/charts/pihole/templates/service-dns.yaml b/charts/pihole/templates/service-dns.yaml index 5eaf97fb..0772138e 100644 --- a/charts/pihole/templates/service-dns.yaml +++ b/charts/pihole/templates/service-dns.yaml @@ -23,10 +23,16 @@ spec: ports: - port: {{ .Values.serviceDns.port }} targetPort: dns + {{- if .Values.serviceDns.nodePort }} + nodePort: {{ .Values.serviceDns.nodePort }} + {{- end }} protocol: TCP name: dns - port: {{ .Values.serviceDns.port }} targetPort: dns-udp + {{- if and (.Values.serviceDns.nodePort) (eq .Values.serviceDns.type "NodePort") }} + nodePort: {{ .Values.serviceDns.nodePort }} + {{- end }} protocol: UDP name: dns-udp {{- if .Values.monitoring.sidecar.enabled }} diff --git a/charts/pihole/values.yaml b/charts/pihole/values.yaml index 61415c56..f8114498 100644 --- a/charts/pihole/values.yaml +++ b/charts/pihole/values.yaml @@ -44,6 +44,9 @@ serviceDns: # -- The port of the DNS service port: 53 + # -- Optional node port for the DNS service + nodePort: "" + # -- `spec.externalTrafficPolicy` for the DHCP Service externalTrafficPolicy: Local