Skip to content

Commit 54e80ea

Browse files
committed
added pihole chart in version v2.24.0 from mojo2600
https://github.com/MoJo2600/pihole-kubernetes
1 parent 1e9cef6 commit 54e80ea

34 files changed

+2952
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
my own, forked and extended helm charts
33

44
- stirling pdf
5+
- pihole (forked from mojo2600 in v2.24.0)
56

67
https://lachnerd.github.io/helm-charts/

charts/pihole/.helmignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
23+
# Manually added entries
24+
ci/
25+
examples/
26+
Makefile
27+
README.md.gotmpl

charts/pihole/CHANGELOG.md

+339
Large diffs are not rendered by default.

charts/pihole/Chart.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
description: Installs pihole in kubernetes
3+
home: https://github.com/MoJo2600/pihole-kubernetes/tree/main/charts/pihole
4+
name: pihole
5+
appVersion: "2024.06.0"
6+
# Do not touch will be updated during release
7+
version: 2.24.0
8+
sources:
9+
- https://github.com/MoJo2600/pihole-kubernetes/tree/main/charts/pihole
10+
- https://pi-hole.net/
11+
- https://github.com/pi-hole
12+
- https://github.com/pi-hole/docker-pi-hole
13+
icon: https://i2.wp.com/pi-hole.net/wp-content/uploads/2016/12/Vortex-R.png
14+
maintainers:
15+
- name: MoJo2600
16+

charts/pihole/Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SHELL := /bin/bash
2+
.DEFAULT_GOAL := help
3+
4+
.PHONY: help
5+
help: ## help target to show available commands with information
6+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
7+
8+
.PHONY: generate-documentation
9+
generate-documentation: ## Generate README.md from template
10+
helm-docs

charts/pihole/README.md

+432
Large diffs are not rendered by default.

charts/pihole/README.md.gotmpl

+288
Large diffs are not rendered by default.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
monitoring:
2+
enabled: true
3+
labels:
4+
testExtraLabel: fofa
5+
podMonitor:
6+
enabled: false

charts/pihole/docs/Values.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Values
2+
3+
## admin
4+
5+
### admin.annotations
6+
7+
By allowing annotations to be added to the password secret, we can use tools like [Reflector](https://github.com/emberstack/kubernetes-reflector) to synchronize secrets across namespaces.
8+
9+
This is interesting e.g. with the [ExternalDNS](https://github.com/kubernetes-sigs/external-dns) 0.14+'s Pi-Hole integration that can automatically expose Ingress host names to the Local DNS configuration:
10+
11+
```yaml
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
metadata:
15+
name: external-dns
16+
spec:
17+
strategy:
18+
type: Recreate
19+
selector:
20+
matchLabels:
21+
app: external-dns
22+
template:
23+
metadata:
24+
labels:
25+
app: external-dns
26+
spec:
27+
serviceAccountName: external-dns
28+
containers:
29+
- name: external-dns
30+
image: registry.k8s.io/external-dns/external-dns:v0.14.0
31+
# If authentication is disabled and/or you didn't create
32+
# a secret, you can remove this block.
33+
envFrom:
34+
- secretRef:
35+
# Change this if you gave the secret a different name
36+
name: pihole-password
37+
args:
38+
- --source=service
39+
- --source=ingress
40+
# Pihole only supports A/CNAME records so there is no mechanism to track ownership.
41+
# You don't need to set this flag, but if you leave it unset, you will receive warning
42+
# logs when ExternalDNS attempts to create TXT records.
43+
- --registry=noop
44+
# IMPORTANT: If you have records that you manage manually in Pi-hole, set
45+
# the policy to upsert-only so they do not get deleted.
46+
- --policy=upsert-only
47+
- --provider=pihole
48+
# Change this to the actual address of your Pi-hole web server
49+
- --pihole-server=http://pihole-web.pihole.svc.cluster.local
50+
resources:
51+
limits:
52+
cpu: 1
53+
memory: 1Gi
54+
requests:
55+
cpu: 100m
56+
memory: 256M
57+
securityContext:
58+
fsGroup: 65534 # For ExternalDNS to be able to read Kubernetes token files
59+
```
60+
61+
Since the Secret reference can only refer to a secret in the same namespace as ExternalDNS, using Reflector is a viable option to synchronize the two secrets. This can now be done via
62+
63+
```yaml
64+
admin:
65+
enabled: true
66+
existingSecret: ""
67+
passwordKey: "password"
68+
annotations:
69+
reflector.v1.k8s.emberstack.com/reflection-allowed: "true"
70+
reflector.v1.k8s.emberstack.com/reflection-allowed-namespaces: "external-dns"
71+
```
72+
73+
For Reflector to work we also need to create the mirror (target) secret in ExternalDNS' namespace like this:
74+
75+
```yaml
76+
apiVersion: v1
77+
kind: Secret
78+
metadata:
79+
# Change this to match the secretRef used in the ExternalDNS deployment:
80+
name: pihole-password
81+
# Change this to ExternalDNS' namespace:
82+
namespace: external-dns
83+
annotations:
84+
# Change this to address the pihole password secret: 'namespace/secret-name':
85+
reflector.v1.k8s.emberstack.com/reflects: "pihole/pihole-password"
86+
data: {} # Will be overwritten by Reflector
87+
```
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This is the values.yaml I used on my k3s raspberrypi cluster
2+
3+
# if you have a problem with serviceWeb Pods not building you might need to checkout this issue:
4+
# https://github.com/MoJo2600/pihole-kubernetes/issues/230
5+
6+
ingress:
7+
enabled: true
8+
9+
persistentVolumeClaim:
10+
enabled: true
11+
12+
serviceWeb:
13+
loadBalancerIP: 192.168.178.201
14+
annotations:
15+
metallb.universe.tf/allow-shared-ip: pihole-svc
16+
type: LoadBalancer
17+
18+
serviceDns:
19+
loadBalancerIP: 192.168.178.201
20+
annotations:
21+
metallb.universe.tf/allow-shared-ip: pihole-svc
22+
type: LoadBalancer
23+
24+
serviceDhcp:
25+
loadBalancerIP: 192.168.178.201
26+
annotations:
27+
metallb.universe.tf/allow-shared-ip: pihole-svc
28+
type: LoadBalancer
29+
30+
podDnsConfig:
31+
enabled: true
32+
policy: "None"
33+
nameservers:
34+
- 127.0.0.1
35+
- 8.8.8.8
36+
37+
#! use an existing secret in a prod env
38+
adminPassword: "0n4BQ2l7Dbu3ViYgd4wu"
39+
40+
resources:
41+
limits:
42+
cpu: 200m
43+
memory: 256Mi
44+
requests:
45+
cpu: 100m
46+
memory: 128Mi
47+
48+
extraEnvVars: {
49+
DNSMASQ_USER: "root"
50+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
dnsmasq:
2+
customDnsEntries:
3+
- address=/nas/192.168.178.10
4+
5+
persistentVolumeClaim:
6+
enabled: true
7+
8+
serviceTCP:
9+
loadBalancerIP: 192.168.178.253
10+
annotations:
11+
metallb.universe.tf/address-pool: network-services
12+
metallb.universe.tf/allow-shared-ip: pihole-svc
13+
14+
serviceUDP:
15+
loadBalancerIP: 192.168.178.253
16+
annotations:
17+
metallb.universe.tf/address-pool: network-services
18+
metallb.universe.tf/allow-shared-ip: pihole-svc
19+

charts/pihole/templates/NOTES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test test asdfas

charts/pihole/templates/_helpers.tpl

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "pihole.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "pihole.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "pihole.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Default password secret name.
36+
*/}}
37+
{{- define "pihole.password-secret" -}}
38+
{{- printf "%s-%s" (include "pihole.fullname" .) "password" | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
39+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{ if .Values.adlists }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "pihole.fullname" . }}-adlists
6+
labels:
7+
app: {{ template "pihole.name" . }}
8+
chart: {{ template "pihole.chart" . }}
9+
release: {{ .Release.Name }}
10+
heritage: {{ .Release.Service }}
11+
data:
12+
adlists.list: |
13+
{{- range .Values.adlists }}
14+
{{ . }}
15+
{{- end }}
16+
{{ end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{ if .Values.blacklist }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "pihole.fullname" . }}-blacklist
6+
labels:
7+
app: {{ template "pihole.name" . }}
8+
chart: {{ template "pihole.chart" . }}
9+
release: {{ .Release.Name }}
10+
heritage: {{ .Release.Service }}
11+
data:
12+
blacklist.txt: |
13+
{{- range .Values.blacklist }}
14+
{{ . }}
15+
{{- end }}
16+
{{ end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{ if .Values.regex }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "pihole.fullname" . }}-regex
6+
labels:
7+
app: {{ template "pihole.name" . }}
8+
chart: {{ template "pihole.chart" . }}
9+
release: {{ .Release.Name }}
10+
heritage: {{ .Release.Service }}
11+
data:
12+
regex.list: |
13+
{{- range .Values.regex }}
14+
{{ . }}
15+
{{- end }}
16+
{{ end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{ if .Values.dnsmasq.staticDhcpEntries }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "pihole.fullname" . }}-static-dhcp
6+
labels:
7+
app: {{ template "pihole.name" . }}
8+
chart: {{ template "pihole.chart" . }}
9+
release: {{ .Release.Name }}
10+
heritage: {{ .Release.Service }}
11+
data:
12+
pihole-static-dhcp.conf: |
13+
{{- range .Values.dnsmasq.staticDhcpEntries }}
14+
{{ . }}
15+
{{- end }}
16+
{{ end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{ if .Values.whitelist }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "pihole.fullname" . }}-whitelist
6+
labels:
7+
app: {{ template "pihole.name" . }}
8+
chart: {{ template "pihole.chart" . }}
9+
release: {{ .Release.Name }}
10+
heritage: {{ .Release.Service }}
11+
data:
12+
whitelist.txt: |
13+
{{- range .Values.whitelist }}
14+
{{ . }}
15+
{{- end }}
16+
{{ end }}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ template "pihole.fullname" . }}-custom-dnsmasq
5+
labels:
6+
app: {{ template "pihole.name" . }}
7+
chart: {{ template "pihole.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
data:
11+
02-custom.conf: |
12+
addn-hosts=/etc/addn-hosts
13+
{{- range .Values.dnsmasq.upstreamServers }}
14+
{{ . }}
15+
{{- end }}
16+
{{- range .Values.dnsmasq.customDnsEntries }}
17+
{{ . }}
18+
{{- end }}
19+
{{- if .Values.serviceDns.loadBalancerIP }}
20+
dhcp-option=6,{{ .Values.serviceDns.loadBalancerIP }}
21+
{{- end }}
22+
{{- range .Values.dnsmasq.customSettings }}
23+
{{ . }}
24+
{{- end }}
25+
addn-hosts: |
26+
{{- range .Values.dnsmasq.additionalHostsEntries }}
27+
{{ . }}
28+
{{- end }}
29+
05-pihole-custom-cname.conf: |
30+
{{- range .Values.dnsmasq.customCnameEntries }}
31+
{{ . }}
32+
{{- end }}

0 commit comments

Comments
 (0)