Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ClusterIPs for use with KubeRouter instead of MetalLB #241

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/pihole/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Installs pihole in kubernetes
home: https://github.com/MoJo2600/pihole-kubernetes/tree/master/charts/pihole
name: pihole
appVersion: "2022.09.1"
version: 2.9.3
version: 2.9.7
sources:
- https://github.com/MoJo2600/pihole-kubernetes/tree/master/charts/pihole
- https://pi-hole.net/
Expand Down
11 changes: 9 additions & 2 deletions charts/pihole/templates/service-dhcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ spec:
{{- if .Values.serviceDhcp.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIP }}
{{- end }}
{{- if .Values.serviceDhcp.clusterIP }}
clusterIP: {{ .Values.serviceDhcp.clusterIP }}
{{- end }}
{{- if .Values.serviceDhcp.clusterIPs }}
clusterIPs:
{{- toYaml .Values.serviceDhcp.clusterIPs | nindent 4 }}
{{- end }}
{{- if or (eq .Values.serviceDhcp.type "NodePort") (eq .Values.serviceDhcp.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDhcp.externalTrafficPolicy }}
{{- end }}
Expand Down Expand Up @@ -57,8 +64,8 @@ spec:
ipFamilies:
- IPv6
ipFamilyPolicy: SingleStack
{{- if .Values.serviceDhcp.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIPv6 }}
{{- if .Values.serviceDhcp.clusterIPv6 }}
clusterIP: {{ .Values.serviceDhcp.clusterIPv6 }}
{{- end }}
{{- if or (eq .Values.serviceDhcp.type "NodePort") (eq .Values.serviceDhcp.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDhcp.externalTrafficPolicy }}
Expand Down
10 changes: 10 additions & 0 deletions charts/pihole/templates/service-dns-tcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ spec:
{{- if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- end }}
{{- if .Values.serviceDns.clusterIP }}
clusterIP: {{ .Values.serviceDns.clusterIP }}
{{- end }}
{{- if .Values.serviceDns.clusterIPs }}
clusterIPs:
{{- toYaml .Values.serviceDns.clusterIPs | nindent 4 }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand Down Expand Up @@ -66,6 +73,9 @@ spec:
{{- if .Values.serviceDns.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIPv6 }}
{{- end }}
{{- if .Values.serviceDns.clusterIPv6 }}
clusterIP: {{ .Values.serviceDns.clusterIPv6 }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand Down
10 changes: 10 additions & 0 deletions charts/pihole/templates/service-dns-udp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ spec:
{{- if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- end }}
{{- if .Values.serviceDns.clusterIP }}
clusterIP: {{ .Values.serviceDns.clusterIP }}
{{- end }}
{{- if .Values.serviceDns.clusterIPs }}
clusterIPs:
{{- toYaml .Values.serviceDns.clusterIPs | nindent 4 }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand Down Expand Up @@ -60,6 +67,9 @@ spec:
{{- if .Values.serviceDns.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIPv6 }}
{{- end }}
{{- if .Values.serviceDns.clusterIPv6 }}
clusterIP: {{ .Values.serviceDns.clusterIPv6 }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand Down
24 changes: 24 additions & 0 deletions charts/pihole/templates/service-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,26 @@ metadata:
{{- end }}
spec:
type: {{ .Values.serviceDns.type }}
{{- if and (.Values.dualStack.enabled) (not (eq .Values.serviceDns.type "LoadBalancer")) }}
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- else }}
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
{{- end }}
{{- if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- end }}
{{- if .Values.serviceDns.clusterIP }}
clusterIP: {{ .Values.serviceDns.clusterIP }}
{{- end }}
{{- if .Values.serviceDns.clusterIPs }}
clusterIPs:
{{- toYaml .Values.serviceDns.clusterIPs | nindent 4 }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand Down Expand Up @@ -64,9 +81,16 @@ spec:
ipFamilies:
- IPv6
ipFamilyPolicy: SingleStack
{{- if .Values.serviceDns.clusterIPv6 }}
clusterIP: {{ .Values.serviceDns.clusterIPv6 }}
{{- end }}
{{- if .Values.serviceDns.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIPv6 }}
{{- end }}
{{- if .Values.serviceDns.clusterIPs }}
clusterIPs:
{{- .Values.serviceDns.clusterIPs | indent 4 }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand Down
14 changes: 14 additions & 0 deletions charts/pihole/templates/service-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ spec:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- else }}
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
{{- end }}
{{- if .Values.serviceWeb.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceWeb.loadBalancerIP }}
{{- end }}
{{- if .Values.serviceWeb.clusterIP }}
clusterIP: {{ .Values.serviceWeb.clusterIP }}
{{- end }}
{{- if .Values.serviceWeb.clusterIPs }}
clusterIPs:
{{- toYaml .Values.serviceWeb.clusterIPs | nindent 4 }}
{{- end }}
{{- if or (eq .Values.serviceWeb.type "NodePort") (eq .Values.serviceWeb.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceWeb.externalTrafficPolicy }}
{{- end }}
Expand Down Expand Up @@ -75,6 +86,9 @@ spec:
{{- if .Values.serviceWeb.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceWeb.loadBalancerIPv6 }}
{{- end }}
{{- if .Values.serviceWeb.clusterIPv6 }}
clusterIP: {{ .Values.serviceWeb.clusterIPv6 }}
{{- end }}
{{- if or (eq .Values.serviceWeb.type "NodePort") (eq .Values.serviceWeb.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceWeb.externalTrafficPolicy }}
{{- end }}
Expand Down
79 changes: 57 additions & 22 deletions charts/pihole/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dnsHostPort:

# -- Configuration for the DNS service on port 53
serviceDns:

# -- deploys a mixed (TCP + UDP) Service instead of separate ones
mixedService: false

Expand All @@ -55,14 +54,21 @@ serviceDns:
# -- A fixed `spec.loadBalancerIP` for the IPv6 DNS Service
loadBalancerIPv6: ""

# -- A fixed `spec.clusterIP` for the DNS Service
clusterIP: ""
# -- Multiple fixed `spec.clusterIPs` for the IPv6 DNS Service
clusterIPv6: ""
# -- Multiple fixed `spec.clusterIPs` for the Dual-Stack DNS Service
clusterIPS: []

# -- Annotations for the DNS service
annotations: {}
annotations:
{}
# metallb.universe.tf/address-pool: network-services
# metallb.universe.tf/allow-shared-ip: pihole-svc

# -- Configuration for the DHCP service on port 67
serviceDhcp:

# -- Generate a Service resource for DHCP traffic
enabled: true

Expand All @@ -83,16 +89,23 @@ serviceDhcp:
# -- A fixed `spec.loadBalancerIP` for the IPv6 DHCP Service
loadBalancerIPv6: ""

# -- A fixed `spec.clusterIP` for the DHCP Service
clusterIP: ""
# -- Multiple fixed `spec.clusterIPs` for the IPv6 DHCP Service
clusterIPv6: ""
# -- Multiple fixed `spec.clusterIPs` for the Dual-Stack DHCP Service
clusterIPS: []

# -- Annotations for the DHCP service
annotations: {}
annotations:
{}
# metallb.universe.tf/address-pool: network-services
# metallb.universe.tf/allow-shared-ip: pihole-svc

# -- Configuration for the web interface service
serviceWeb:
# -- Configuration for the HTTP web interface listener
http:

# -- Generate a service for HTTP traffic
enabled: true

Expand Down Expand Up @@ -124,8 +137,16 @@ serviceWeb:
# -- A fixed `spec.loadBalancerIP` for the IPv6 web interface Service
loadBalancerIPv6: ""

# -- A fixed `spec.clusterIP` for the web interface Service
clusterIP: ""
# -- Multiple fixed `spec.clusterIPs` for the IPv6 web interface Service
clusterIPv6: ""
# -- Multiple fixed `spec.clusterIPs` for the Dual-Stack web interface Service
clusterIPS: []

# -- Annotations for the DHCP service
annotations: {}
annotations:
{}
# metallb.universe.tf/address-pool: network-services
# metallb.universe.tf/allow-shared-ip: pihole-svc

Expand All @@ -140,7 +161,8 @@ ingress:
# ingressClassName: nginx

# -- Annotations for the ingress
annotations: {}
annotations:
{}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
Expand Down Expand Up @@ -177,7 +199,8 @@ probes:
# -- choice for the user. This also increases chances charts run on environments with little
# -- resources, such as Minikube. If you do want to specify resources, uncomment the following
# -- lines, adjust them as necessary, and remove the curly braces after 'resources:'.
resources: {}
resources:
{}
# limits:
# cpu: 100m
# memory: 128Mi
Expand Down Expand Up @@ -241,11 +264,13 @@ admin:
passwordKey: "password"

# -- extraEnvironmentVars is a list of extra enviroment variables to set for pihole to use
extraEnvVars: {}
extraEnvVars:
{}
# TZ: UTC

# -- extraEnvVarsSecret is a list of secrets to load in as environment variables.
extraEnvVarsSecret: {}
extraEnvVarsSecret:
{}
# env_var:
# name: secret-name
# key: secret-key
Expand All @@ -272,7 +297,8 @@ doh:
tag: latest
pullPolicy: IfNotPresent
# -- Here you can pass environment variables to the DoH container, for example:
envVars: {}
envVars:
{}
# TUNNEL_DNS_UPSTREAM: "https://1.1.1.2/dns-query,https://1.0.0.2/dns-query"

# -- Probes configuration
Expand Down Expand Up @@ -337,28 +363,33 @@ dnsmasq:
# - cname=cname record,dns record

# -- list of adlists to import during initial start of the container
adlists: {}
adlists:
{}
# If you want to provide blocklists, add them here.
# - https://hosts-file.net/grm.txt
# - https://reddestdream.github.io/Projects/MinimalHosts/etc/MinimalHostsBlocker/minimalhosts

# -- list of whitelisted domains to import during initial start of the container
whitelist: {}
whitelist:
{}
# If you want to provide whitelisted domains, add them here.
# - clients4.google.com

# -- list of blacklisted domains to import during initial start of the container
blacklist: {}
blacklist:
{}
# If you want to have special domains blacklisted, add them here
# - *.blackist.com

# -- list of blacklisted regex expressions to import during initial start of the container
regex: {}
regex:
{}
# Add regular expression blacklist items
# - (^|\.)facebook\.com$

# -- values that should be added to pihole-FTL.conf
ftl: {}
ftl:
{}
# Add values for pihole-FTL.conf
# MAXDBDAYS: 14

Expand All @@ -381,24 +412,28 @@ customVolumes:
# -- set this to true to enable custom volumes
enabled: false
# -- any volume type can be used here
config: {}
config:
{}
# hostPath:
# path: "/mnt/data"

# -- any extra volumes you might want
extraVolumes: {}
extraVolumes:
{}
# external-conf:
# configMap:
# name: pi-hole-lighttpd-external-conf

# -- any extra volume mounts you might want
extraVolumeMounts: {}
extraVolumeMounts:
{}
# external-conf:
# mountPath: /etc/lighttpd/external.conf
# subPath: external.conf

# -- Additional annotations for pods
podAnnotations: {}
podAnnotations:
{}
# Example below allows Prometheus to scape on metric port (requires pihole-exporter sidecar enabled)
# prometheus.io/port: '9617'
# prometheus.io/scrape: 'true'
Expand Down Expand Up @@ -428,5 +463,5 @@ podDnsConfig:
enabled: true
policy: "None"
nameservers:
- 127.0.0.1
- 8.8.8.8
- 127.0.0.1
- 8.8.8.8