-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75cdad7
commit f839831
Showing
13 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v2 | ||
name: pi-hole-exporter | ||
description: Pi-Hole Exporter | ||
home: https://github.com/eko/pihole-exporter | ||
icon: https://helm.wyrihaximus.net/images/charts/pi-hole-exporter.png | ||
type: application | ||
version: 0.1.0 | ||
appVersion: d05df48 | ||
maintainers: | ||
- name: WyriHaximus | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Pi-Hole Exporter | ||
|
||
<p align="center"> | ||
<img src="https://helm.wyrihaximus.net/images/charts/pi-hole-exporter.png"> | ||
</p> | ||
|
||
Opinionated helm chart for [`eko/pihole-exporter`](https://github.com/eko/pihole-exporter). There is an alternative | ||
available at [`SiM22/pihole-exporter-helm-chart`](https://github.com/SiM22/pihole-exporter-helm-chart) but that didn't | ||
meet my requirements. | ||
|
||
## Configuration | ||
|
||
By default, this chart will look for a secret name `pi-hole` in the same namespace for additional env vars to add to the | ||
container. It is required that it contains the location of your [`PiHole`](https://pi-hole.net/) and a away to authenticate against it. Those | ||
can be find [here](https://github.com/eko/pihole-exporter#using-docker). You can find an example secret file in | ||
[`library-ci/secret.yaml`](https://github.com/WyriHaximusNet/helm-charts/blob/master/charts/pi-hole-exporter/library-ci/secret.yaml). | ||
|
||
## Opinionated decisions | ||
|
||
* Port is hardcoded to `9617` for the metrics. | ||
* Metrics collection from Pi-Hole happens every 30 seconds. | ||
* Requires you to configure a secret in the same namespace as you deploy this chart to container additional env vars. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: pi-hole | ||
type: Opaque | ||
data: | ||
PIHOLE_HOSTNAME: UElIT0xFX0hPU1ROQU1F | ||
PIHOLE_PASSWORD: UElIT0xFX1BBU1NXT1JE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Congratulations, your prometheus compatible scraped Pi-Hole metrics are now available for scraping. | ||
|
||
You can access them by using a port forward: | ||
kubectl port-forward svc/{{ include ".helm.fullname" . }} 9617:9617 -n {{ .Release.Namespace }} | ||
|
||
And then point your browser to: | ||
http://localhost:9617/metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define ".helm.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{- define ".helm.nameRevision" -}} | ||
{{ template ".helm.name" . }}___{{ .Release.Revision }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define ".helm.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define ".helm.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define ".helm.labels" -}} | ||
helm.sh/chart: {{ include ".helm.chart" . }} | ||
{{ include ".helm.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define ".helm.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include ".helm.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define ".helm.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include ".helm.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include ".helm.fullname" . }} | ||
labels: | ||
app: {{ include ".helm.fullname" . }} | ||
appRevision: {{ template ".helm.nameRevision" . }} | ||
release: {{ include ".helm.fullname" . }} | ||
releaseRevision: {{ .Release.Revision | quote }} | ||
{{- include ".helm.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicas }} | ||
selector: | ||
matchLabels: | ||
{{- include ".helm.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/port: "9617" | ||
labels: | ||
app: {{ include ".helm.fullname" . }} | ||
release: {{ include ".helm.fullname" . }} | ||
{{- include ".helm.selectorLabels" . | nindent 8 }} | ||
spec: | ||
containers: | ||
- name: pi-hole-exporter | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: metrics | ||
containerPort: 9617 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /metrics | ||
port: metrics | ||
readinessProbe: | ||
httpGet: | ||
path: /metrics | ||
port: metrics | ||
startupProbe: | ||
failureThreshold: 120 | ||
periodSeconds: 1 | ||
httpGet: | ||
path: /metrics | ||
port: metrics | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ .Values.configurationSecret | quote }} | ||
env: | ||
- name: INTERVAL | ||
value: "30s" | ||
- name: PORT | ||
value: "9617" | ||
affinity: | ||
podAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- {{ template ".helm.nameRevision" . }} | ||
topologyKey: "kubernetes.io/hostname" |
12 changes: 12 additions & 0 deletions
12
charts/pi-hole-exporter/templates/pod-disruption-budget.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if gt (.Values.replicas | int) 1 -}} | ||
apiVersion: policy/v1beta1 | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ include ".helm.fullname" . }} | ||
spec: | ||
minAvailable: 1 | ||
selector: | ||
matchLabels: | ||
app: {{ include ".helm.fullname" . }} | ||
release: {{ include ".helm.fullname" . }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include ".helm.fullname" . }} | ||
labels: | ||
{{- include ".helm.labels" . | nindent 4 }} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 9617 | ||
targetPort: metrics | ||
protocol: TCP | ||
name: metrics | ||
selector: | ||
{{- include ".helm.selectorLabels" . | nindent 4 }} |
15 changes: 15 additions & 0 deletions
15
charts/pi-hole-exporter/templates/tests/test-connection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include ".helm.fullname" . }}-test-connection" | ||
labels: | ||
{{ include ".helm.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test-success | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include ".helm.fullname" . }}:9617/metrics'] | ||
restartPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
image: | ||
repository: ekofr/pihole-exporter | ||
tag: 0.0.10 | ||
pullPolicy: IfNotPresent | ||
|
||
configurationSecret: pi-hole | ||
|
||
replicas: 1 | ||
|
||
resources: | ||
# Setting this pretty low since this is a low resource intensive application, increase when needed | ||
limits: | ||
cpu: 30m | ||
memory: 64Mi | ||
requests: | ||
cpu: 30m | ||
memory: 64Mi |