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

Feature: Add support for dualstack loadbalancers #202

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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.01.1
version: 2.5.6
version: 2.5.7
sources:
- https://github.com/MoJo2600/pihole-kubernetes/tree/master/charts/pihole
- https://pi-hole.net/
Expand Down
12 changes: 10 additions & 2 deletions charts/pihole/templates/service-dhcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ metadata:
{{- end }}
spec:
type: {{ .Values.serviceDhcp.type }}
{{- if and (.Values.dualStack.enabled) (not (eq .Values.serviceDhcp.type "LoadBalancer")) }}
{{- if and (.Values.dualStack.enabled) (or (not (eq .Values.serviceDhcp.type "LoadBalancer")) (.Values.dualStack.loadBalancer)) }}
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- if and (.Values.serviceDhcp.loadBalancerIP) (.Values.serviceDhcp.loadBalancerIPv6) }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIP }},{{ .Values.serviceDhcp.loadBalancerIPv6 }}
{{- else if .Values.serviceDhcp.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIP }}
{{- else if .Values.serviceDhcp.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIPv6 }}
{{- end }}
{{- else }}
{{- if .Values.serviceDhcp.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIP }}
{{- end }}
{{- end }}
{{- if or (eq .Values.serviceDhcp.type "NodePort") (eq .Values.serviceDhcp.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDhcp.externalTrafficPolicy }}
{{- end }}
Expand All @@ -35,7 +43,7 @@ spec:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
---
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDhcp.type "LoadBalancer") -}}
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDhcp.type "LoadBalancer") (not .Values.dualStack.loadBalancer) -}}
apiVersion: v1
kind: Service
metadata:
Expand Down
12 changes: 10 additions & 2 deletions charts/pihole/templates/service-dns-tcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ metadata:
{{- end }}
spec:
type: {{ .Values.serviceDns.type }}
{{- if and (.Values.dualStack.enabled) (not (eq .Values.serviceDns.type "LoadBalancer")) }}
{{- if and (.Values.dualStack.enabled) (or (not (eq .Values.serviceDns.type "LoadBalancer")) (.Values.dualStack.loadBalancer)) }}
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- if and (.Values.serviceDns.loadBalancerIP) (.Values.serviceDns.loadBalancerIPv6) }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }},{{ .Values.serviceDns.loadBalancerIPv6 }}
{{- else if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- else if .Values.serviceDns.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIPv6 }}
{{- end }}
{{- else }}
{{- if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- end }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand All @@ -44,7 +52,7 @@ spec:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
---
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDns.type "LoadBalancer") -}}
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDns.type "LoadBalancer") (not .Values.dualStack.loadBalancer) -}}
apiVersion: v1
kind: Service
metadata:
Expand Down
12 changes: 10 additions & 2 deletions charts/pihole/templates/service-dns-udp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ metadata:
{{- end }}
spec:
type: {{ .Values.serviceDns.type }}
{{- if and (.Values.dualStack.enabled) (not (eq .Values.serviceDns.type "LoadBalancer")) }}
{{- if and (.Values.dualStack.enabled) (or (not (eq .Values.serviceDns.type "LoadBalancer")) (.Values.dualStack.loadBalancer)) }}
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- if and (.Values.serviceDns.loadBalancerIP) (.Values.serviceDns.loadBalancerIPv6) }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }},{{ .Values.serviceDns.loadBalancerIPv6 }}
{{- else if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- else if .Values.serviceDns.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIPv6 }}
{{- end }}
{{- else }}
{{- if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- end }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand All @@ -38,7 +46,7 @@ spec:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
---
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDns.type "LoadBalancer") -}}
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDns.type "LoadBalancer") (not .Values.dualStack.loadBalancer) -}}
apiVersion: v1
kind: Service
metadata:
Expand Down
16 changes: 15 additions & 1 deletion charts/pihole/templates/service-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,23 @@ metadata:
{{- end }}
spec:
type: {{ .Values.serviceDns.type }}
{{- if and (.Values.dualStack.enabled) (.Values.dualStack.loadBalancer) }}
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- if and (.Values.serviceDns.loadBalancerIP) (.Values.serviceDns.loadBalancerIPv6) }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }},{{ .Values.serviceDns.loadBalancerIPv6 }}
{{- else if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- else if .Values.serviceDns.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIPv6 }}
{{- end }}
{{- else }}
{{- if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- end }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
Expand Down Expand Up @@ -45,7 +59,7 @@ spec:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
---
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDns.type "LoadBalancer") -}}
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDns.type "LoadBalancer") (not .Values.dualStack.loadBalancer) -}}
apiVersion: v1
kind: Service
metadata:
Expand Down
12 changes: 10 additions & 2 deletions charts/pihole/templates/service-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@ metadata:
{{- end }}
spec:
type: {{ .Values.serviceWeb.type }}
{{- if and (.Values.dualStack.enabled) (not (eq .Values.serviceWeb.type "LoadBalancer")) }}
{{- if and (.Values.dualStack.enabled) (or (not (eq .Values.serviceWeb.type "LoadBalancer")) (.Values.dualStack.loadBalancer)) }}
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- if and (.Values.serviceWeb.loadBalancerIP) (.Values.serviceWeb.loadBalancerIPv6) }}
loadBalancerIP: {{ .Values.serviceWeb.loadBalancerIP }},{{ .Values.serviceWeb.loadBalancerIPv6 }}
{{- else if .Values.serviceWeb.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceWeb.loadBalancerIP }}
{{- else if .Values.serviceWeb.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceWeb.loadBalancerIPv6 }}
{{- end }}
{{- else }}
{{- if .Values.serviceWeb.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceWeb.loadBalancerIP }}
{{- end }}
{{- end }}
{{- if or (eq .Values.serviceWeb.type "NodePort") (eq .Values.serviceWeb.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceWeb.externalTrafficPolicy }}
{{- end }}
Expand All @@ -47,7 +55,7 @@ spec:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
---
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceWeb.type "LoadBalancer") -}}
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceWeb.type "LoadBalancer") (not .Values.dualStack.loadBalancer) -}}
apiVersion: v1
kind: Service
metadata:
Expand Down
2 changes: 2 additions & 0 deletions charts/pihole/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ image:
dualStack:
# -- set this to true to enable creation of DualStack services or creation of separate IPv6 services if `serviceDns.type` is set to `"LoadBalancer"`
enabled: false
# -- set this to true to create a single loadbalancer service. Some loadbalancer implementations do not work well with separate services for IPv4 and IPv6, i.e. klipper-lb (k3s)
loadBalancer: false

dnsHostPort:
# -- set this to true to enable dnsHostPort
Expand Down