Skip to content

Commit

Permalink
feat: Add optional PodDisruptionBudget (#272)
Browse files Browse the repository at this point in the history
Adds support for creating a PodDisruptionBudget. This will configure K8s to always attempt to have either minAvailable pods running, or no more than minUnavailable pods unavailable. This will prevent an outage in the event of nodes running the pods being taken out of service for maintenance.
  • Loading branch information
bkonicek authored Nov 30, 2023
1 parent ba7d4b2 commit 98c3720
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
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: "2023.05.2"
version: 2.18.0
version: 2.19.0
sources:
- https://github.com/MoJo2600/pihole-kubernetes/tree/master/charts/pihole
- https://pi-hole.net/
Expand Down
21 changes: 21 additions & 0 deletions charts/pihole/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.podDisruptionBudget.enabled -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ template "pihole.fullname" . }}-pdb
labels:
app: {{ template "pihole.name" . }}
chart: {{ template "pihole.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
app: {{ template "pihole.name" . }}
{{- end }}
12 changes: 11 additions & 1 deletion charts/pihole/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ podAnnotations:
# prometheus.io/scrape: 'true'

# -- any initContainers you might want to run before starting pihole
extraInitContainers: []
extraInitContainers:
[]
# - name: copy-config
# image: busybox
# args:
Expand Down Expand Up @@ -524,3 +525,12 @@ podDnsConfig:
nameservers:
- 127.0.0.1
- 8.8.8.8

# -- configure a Pod Disruption Budget
podDisruptionBudget:
# -- set to true to enable creating the PDB
enabled: false
# -- minimum number of pods Kubernetes should try to have running at all times
minAvailable: 1
# -- maximum number of pods Kubernetes will allow to be unavailable. Cannot set both `minAvailable` and `maxAvailable`
# maxUnavailable: 1

0 comments on commit 98c3720

Please sign in to comment.