NAS-121233 / 23.10 / fix(pihole): hostnetwork toggle not showing and dhcp (#1060)

* fix(pihole): hostnetwork toggle not showing and dhcp

* bump version

* add note

* set appropriate dnsPolicy with hostNet
This commit is contained in:
Stavros Kois
2023-04-10 19:16:59 +03:00
committed by GitHub
parent f55742a089
commit b15b4e7550
5 changed files with 10 additions and 65 deletions

View File

@@ -3,7 +3,7 @@ description: DNS and Ad-filtering for your network.
annotations:
title: Pi-hole
type: application
version: 1.0.13
version: 1.0.14
apiVersion: v2
appVersion: '2023.02.2'
kubeVersion: '>=1.16.0-0'

View File

@@ -5,8 +5,7 @@ appVolumeMounts:
dnsmasq:
emptyDir: true
mountPath: /etc/dnsmasq.d
dhcp: false
dhcp_port: 32003
dhcp: true
dnsConfig:
options: []
dns_tcp_port: 32001
@@ -14,7 +13,6 @@ dns_udp_port: 32002
emptyDirVolumes: true
environmentVariables: []
extraAppVolumeMounts: []
hostNetwork: false
ownerGID: 568
ownerUID: 568
password: admin123

View File

@@ -31,26 +31,7 @@ questions:
max: 65535
default: 20720
required: true
- variable: dns_tcp_port
label: "DNS TCP Port for pihole"
group: Networking
schema:
type: int
min: 8000
max: 65535
default: 20721
show_if: [["hostNetwork", "=", false]]
required: true
- variable: dns_udp_port
label: "DNS UDP Port for pihole"
group: Networking
schema:
type: int
min: 8000
max: 65535
default: 20721
show_if: [["hostNetwork", "=", false]]
required: true
- variable: dhcp
label: "Enable DHCP"
group: "Networking"
@@ -59,16 +40,6 @@ questions:
default: false
show_subquestions_if: true
subquestions:
- variable: dhcp_port
label: "DHCP Port for pihole"
group: Networking
schema:
type: int
min: 8000
max: 65535
default: 20722
show_if: [["hostNetwork", "=", false]]
required: true
- variable: dhcp_start
label: "DHCP Start Address"
group: Networking
@@ -157,13 +128,6 @@ questions:
$ref:
- "definitions/timezone"
- variable: hostNetwork
label: "Enable Host Network"
group: "Networking"
schema:
type: boolean
default: false
- variable: environmentVariables
label: "Pihole environment"
group: "Configuration"

View File

@@ -27,7 +27,13 @@ spec:
{{- include "common.labels.selectorLabels" . | nindent 8 }}
annotations: {{ include "common.annotations" . | nindent 8 }}
spec:
hostNetwork: {{ .Values.hostNetwork }}
{{/*
Host network is pretty much a requirement for apps like this.
Because NodePort can't bind ports like 53(DNS) or 67(DHCP)
and the majority of devices do not have option to change the port.
*/}}
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: {{ .Chart.Name }}
{{ include "common.resources.limitation" . | nindent 10 }}
@@ -39,12 +45,8 @@ spec:
{{ end }}
securityContext:
capabilities:
{{ if .Values.hostNetwork }}
{{/* This is needed to be able to bind 53(DNS) and 67(DHCP) ports */}}
add: ["NET_ADMIN"]
{{ else }}
add: []
{{ end }}
ports:
- name: web
containerPort: {{ .Values.web_port }}

View File

@@ -1,19 +0,0 @@
{{/* Create services only if we are not using hostNetwork */}}
{{ if not .Values.hostNetwork }}
{{ $selectors := list }}
{{ $selectors = mustAppend $selectors (dict "key" "app" "value" (include "common.names.name" .) ) }}
{{ $selectors = mustAppend $selectors (dict "key" "release" "value" .Release.Name ) }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "web" "port" .Values.web_port "nodePort" .Values.web_port "targetPort" .Values.web_port) }}
{{ $ports = mustAppend $ports (dict "name" "dns-tcp" "port" .Values.dns_tcp_port "nodePort" .Values.dns_tcp_port "targetPort" 53) }}
{{ $ports = mustAppend $ports (dict "name" "dns-udp" "port" .Values.dns_udp_port "nodePort" .Values.dns_udp_port "targetPort" 53 "protocol" "UDP") }}
{{ if .Values.dhcp }}
{{ $ports = mustAppend $ports (dict "name" "dhcp" "port" .Values.dhcp_port "nodePort" .Values.dhcp_port "targetPort" 67 "protocol" "UDP") }}
{{ end }}
{{ $params := . }}
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
{{ $_1 := set .Values "extraSelectorLabels" $selectors }}
{{ include "common.classes.service" $params }}
{{ end }}