diff --git a/charts/pihole/1.0.12/Chart.lock b/charts/pihole/1.0.12/Chart.lock deleted file mode 100644 index 9d78dd0ba2..0000000000 --- a/charts/pihole/1.0.12/Chart.lock +++ /dev/null @@ -1,6 +0,0 @@ -dependencies: -- name: common - repository: file://../../../library/common/2207.0.0 - version: 2207.0.0 -digest: sha256:f17f3d458ca0210a52e39da0dce35034e900b36f2040d4b19bed46a7aae91506 -generated: "2022-07-25T00:20:48.289564886+05:00" diff --git a/charts/pihole/1.0.12/Chart.yaml b/charts/pihole/1.0.12/Chart.yaml deleted file mode 100644 index 5fcd136e25..0000000000 --- a/charts/pihole/1.0.12/Chart.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v2 -appVersion: 2022.12.1 -dependencies: -- name: common - repository: file://../../../library/common/2207.0.0 - version: 2207.0.0 -description: DNS and Ad-filtering for your network. -home: https://pi-hole.net/ -icon: https://github.com/pi-hole/graphics/raw/master/Vortex/Vortex_Vertical_wordmark_lightmode.png?raw=true) -keywords: -- networking -- dns -name: pihole -version: 1.0.12 diff --git a/charts/pihole/1.0.12/charts/common-2207.0.0.tgz b/charts/pihole/1.0.12/charts/common-2207.0.0.tgz deleted file mode 100644 index 2adf94b438..0000000000 Binary files a/charts/pihole/1.0.12/charts/common-2207.0.0.tgz and /dev/null differ diff --git a/charts/pihole/1.0.12/templates/tests/deployment-check.yaml b/charts/pihole/1.0.12/templates/tests/deployment-check.yaml deleted file mode 100644 index ca148e6b40..0000000000 --- a/charts/pihole/1.0.12/templates/tests/deployment-check.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{{- $serviceName := (include "common.names.fullname" .) -}} -apiVersion: v1 -kind: Pod -metadata: - name: {{ .Release.Name }}-test-pod - labels: - app: {{ .Release.Name }} - release: {{ .Release.Name }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: test-curl - image: alpine/curl - imagePullPolicy: "IfNotPresent" - command: - - /bin/sh - - -ec - - | - curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 15 --retry-max-time 90 --retry-all-errors -ksf http://{{ $serviceName }}:{{.Values.web_port}}/admin/login.php - restartPolicy: Never diff --git a/charts/pihole/.helmignore b/library/ix-dev/charts/pihole/.helmignore similarity index 100% rename from charts/pihole/.helmignore rename to library/ix-dev/charts/pihole/.helmignore diff --git a/library/ix-dev/charts/pihole/Chart.lock b/library/ix-dev/charts/pihole/Chart.lock new file mode 100644 index 0000000000..fc9d0c4c85 --- /dev/null +++ b/library/ix-dev/charts/pihole/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common/2207.0.0 + version: 2207.0.0 +digest: sha256:a301ba0f99ec1e08a60a7f0a0320aa02d225993572f2f056f09520f06df88b37 +generated: "2023-03-22T14:34:22.657500007Z" diff --git a/library/ix-dev/charts/pihole/Chart.yaml b/library/ix-dev/charts/pihole/Chart.yaml new file mode 100644 index 0000000000..bbb20a318b --- /dev/null +++ b/library/ix-dev/charts/pihole/Chart.yaml @@ -0,0 +1,24 @@ +name: pihole +description: DNS and Ad-filtering for your network. +annotations: + title: Pi-hole +type: application +version: 1.0.13 +apiVersion: v2 +appVersion: '2023.02.2' +kubeVersion: '>=1.16.0-0' +maintainers: + - name: truenas + url: https://www.truenas.com/ +dependencies: + - name: common + repository: file://../../../common/2207.0.0 + version: 2207.0.0 +home: https://pi-hole.net/ +icon: https://github.com/pi-hole/graphics/raw/master/Vortex/Vortex_Vertical_wordmark_lightmode.png?raw=true +sources: + - https://pi-hole.net/ + - https://github.com/truenas/charts/tree/master/library/ix-dev/charts/pihole +keywords: + - networking + - dns diff --git a/charts/pihole/1.0.12/README.md b/library/ix-dev/charts/pihole/README.md similarity index 100% rename from charts/pihole/1.0.12/README.md rename to library/ix-dev/charts/pihole/README.md diff --git a/charts/pihole/1.0.12/app-readme.md b/library/ix-dev/charts/pihole/app-readme.md similarity index 100% rename from charts/pihole/1.0.12/app-readme.md rename to library/ix-dev/charts/pihole/app-readme.md diff --git a/library/ix-dev/charts/pihole/charts/common-2207.0.0.tgz b/library/ix-dev/charts/pihole/charts/common-2207.0.0.tgz new file mode 100644 index 0000000000..f106775893 Binary files /dev/null and b/library/ix-dev/charts/pihole/charts/common-2207.0.0.tgz differ diff --git a/library/ix-dev/charts/pihole/ci/hostnet-values.yaml b/library/ix-dev/charts/pihole/ci/hostnet-values.yaml new file mode 100644 index 0000000000..110f705716 --- /dev/null +++ b/library/ix-dev/charts/pihole/ci/hostnet-values.yaml @@ -0,0 +1,22 @@ +appVolumeMounts: + config: + emptyDir: true + mountPath: /etc/pihole + dnsmasq: + emptyDir: true + mountPath: /etc/dnsmasq.d +dhcp: true +dhcp_start: 192.168.10.2 +dhcp_end: 192.168.10.254 +dhcp_gateway: 192.168.10.1 +dnsConfig: + options: [] +emptyDirVolumes: true +environmentVariables: [] +extraAppVolumeMounts: [] +hostNetwork: true +ownerGID: 568 +ownerUID: 568 +password: admin123 +timezone: America/Los_Angeles +web_port: 32000 diff --git a/charts/pihole/1.0.12/test_values.yaml b/library/ix-dev/charts/pihole/ci/test-values.yaml similarity index 83% rename from charts/pihole/1.0.12/test_values.yaml rename to library/ix-dev/charts/pihole/ci/test-values.yaml index 36caf64883..7c8b3220b6 100644 --- a/charts/pihole/1.0.12/test_values.yaml +++ b/library/ix-dev/charts/pihole/ci/test-values.yaml @@ -15,10 +15,6 @@ emptyDirVolumes: true environmentVariables: [] extraAppVolumeMounts: [] hostNetwork: false -image: - pullPolicy: IfNotPresent - repository: pihole/pihole - tag: 2022.12.1 ownerGID: 568 ownerUID: 568 password: admin123 diff --git a/charts/pihole/item.yaml b/library/ix-dev/charts/pihole/item.yaml similarity index 100% rename from charts/pihole/item.yaml rename to library/ix-dev/charts/pihole/item.yaml diff --git a/charts/pihole/1.0.12/questions.yaml b/library/ix-dev/charts/pihole/questions.yaml similarity index 89% rename from charts/pihole/1.0.12/questions.yaml rename to library/ix-dev/charts/pihole/questions.yaml index 3c7c2e6795..1a13f03b2d 100644 --- a/charts/pihole/1.0.12/questions.yaml +++ b/library/ix-dev/charts/pihole/questions.yaml @@ -39,6 +39,7 @@ questions: min: 8000 max: 65535 default: 20721 + show_if: [["hostNetwork", "=", false]] required: true - variable: dns_udp_port label: "DNS UDP Port for pihole" @@ -48,6 +49,7 @@ questions: min: 8000 max: 65535 default: 20721 + show_if: [["hostNetwork", "=", false]] required: true - variable: dhcp label: "Enable DHCP" @@ -55,16 +57,39 @@ questions: schema: type: boolean default: false - - variable: dhcp_port - label: "DHCP Port for pihole" - group: Networking - schema: - type: int - min: 8000 - max: 65535 - default: 20722 - required: true - show_if: [["dhcp", "=", true]] + show_subquestions_if: true + subquestions: + - variable: dhcp_port + label: "DHCP Port for pihole" + group: Networking + schema: + type: int + min: 8000 + max: 65535 + default: 20722 + show_if: [["hostNetwork", "=", false]] + required: true + - variable: dhcp_start + label: "DHCP Start Address" + group: Networking + schema: + type: ipaddr + cidr: false + required: true + - variable: dhcp_end + label: "DHCP End Address" + group: Networking + schema: + type: ipaddr + cidr: false + required: true + - variable: dhcp_gateway + label: "Gateway" + group: Networking + schema: + type: ipaddr + cidr: false + required: true - variable: dnsConfig label: "DNS Configuration" diff --git a/charts/pihole/1.0.12/templates/deployment.yaml b/library/ix-dev/charts/pihole/templates/deployment.yaml similarity index 64% rename from charts/pihole/1.0.12/templates/deployment.yaml rename to library/ix-dev/charts/pihole/templates/deployment.yaml index eb404f4835..bb8eece8e0 100644 --- a/charts/pihole/1.0.12/templates/deployment.yaml +++ b/library/ix-dev/charts/pihole/templates/deployment.yaml @@ -37,9 +37,17 @@ spec: - name: extrappvolume-{{ $index }} mountPath: {{ $hostPathConfiguration.mountPath }} {{ end }} + securityContext: + capabilities: + {{ if .Values.hostNetwork }} + {{/* This is needed to be able to bind 53(DNS) and 67(DHCP) ports */}} + add: ["NET_ADMIN"] + {{ else }} + add: [] + {{ end }} ports: - name: web - containerPort: 80 + containerPort: {{ .Values.web_port }} - name: dns-tcp containerPort: 53 protocol: TCP @@ -51,13 +59,44 @@ spec: containerPort: 67 protocol: UDP {{ end }} + readinessProbe: + httpGet: + path: /admin/login.php + port: {{ .Values.web_port }} + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 2 + livenessProbe: + httpGet: + path: /admin/login.php + port: {{ .Values.web_port }} + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + startupProbe: + httpGet: + path: /admin/login.php + port: {{ .Values.web_port }} + initialDelaySeconds: 10 + periodSeconds: 5 + timeoutSeconds: 2 + failureThreshold: 60 + successThreshold: 1 env: {{ $secretName := (include "common.names.fullname" .) }} {{ $envList := (default list .Values.environmentVariables) }} {{ $envList = mustAppend $envList (dict "name" "WEBPASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "password") }} {{ $envList = mustAppend $envList (dict "name" "TZ" "value" (printf "%s" .Values.timezone)) }} + {{ $envList = mustAppend $envList (dict "name" "WEB_PORT" "value" .Values.web_port) }} {{ if .Values.dhcp }} {{ $envList = mustAppend $envList (dict "name" "DHCP_ACTIVE" "value" "true") }} + {{ $envList = mustAppend $envList (dict "name" "DHCP_START" "value" .Values.dhcp_start) }} + {{ $envList = mustAppend $envList (dict "name" "DHCP_END" "value" .Values.dhcp_end) }} + {{ $envList = mustAppend $envList (dict "name" "DHCP_ROUTER" "value" .Values.dhcp_gateway) }} {{ end }} {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }} {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }} diff --git a/charts/pihole/1.0.12/templates/pre-install-job.yaml b/library/ix-dev/charts/pihole/templates/pre-install-job.yaml similarity index 100% rename from charts/pihole/1.0.12/templates/pre-install-job.yaml rename to library/ix-dev/charts/pihole/templates/pre-install-job.yaml diff --git a/charts/pihole/1.0.12/templates/secret.yaml b/library/ix-dev/charts/pihole/templates/secret.yaml similarity index 100% rename from charts/pihole/1.0.12/templates/secret.yaml rename to library/ix-dev/charts/pihole/templates/secret.yaml diff --git a/charts/pihole/1.0.12/templates/service.yaml b/library/ix-dev/charts/pihole/templates/service.yaml similarity index 84% rename from charts/pihole/1.0.12/templates/service.yaml rename to library/ix-dev/charts/pihole/templates/service.yaml index 566328dbc1..dfe6923507 100644 --- a/charts/pihole/1.0.12/templates/service.yaml +++ b/library/ix-dev/charts/pihole/templates/service.yaml @@ -1,8 +1,11 @@ +{{/* Create services only if we are not using hostNetwork */}} +{{ if not .Values.hostNetwork }} + {{ $selectors := list }} {{ $selectors = mustAppend $selectors (dict "key" "app" "value" (include "common.names.name" .) ) }} {{ $selectors = mustAppend $selectors (dict "key" "release" "value" .Release.Name ) }} {{ $ports := list }} -{{ $ports = mustAppend $ports (dict "name" "web" "port" .Values.web_port "nodePort" .Values.web_port "targetPort" 80) }} +{{ $ports = mustAppend $ports (dict "name" "web" "port" .Values.web_port "nodePort" .Values.web_port "targetPort" .Values.web_port) }} {{ $ports = mustAppend $ports (dict "name" "dns-tcp" "port" .Values.dns_tcp_port "nodePort" .Values.dns_tcp_port "targetPort" 53) }} {{ $ports = mustAppend $ports (dict "name" "dns-udp" "port" .Values.dns_udp_port "nodePort" .Values.dns_udp_port "targetPort" 53 "protocol" "UDP") }} {{ if .Values.dhcp }} @@ -12,3 +15,5 @@ {{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }} {{ $_1 := set .Values "extraSelectorLabels" $selectors }} {{ include "common.classes.service" $params }} + +{{ end }} diff --git a/charts/pihole/upgrade_info.json b/library/ix-dev/charts/pihole/upgrade_info.json similarity index 100% rename from charts/pihole/upgrade_info.json rename to library/ix-dev/charts/pihole/upgrade_info.json diff --git a/charts/pihole/upgrade_strategy b/library/ix-dev/charts/pihole/upgrade_strategy similarity index 73% rename from charts/pihole/upgrade_strategy rename to library/ix-dev/charts/pihole/upgrade_strategy index 39bb56546a..d584440143 100755 --- a/charts/pihole/upgrade_strategy +++ b/library/ix-dev/charts/pihole/upgrade_strategy @@ -2,13 +2,13 @@ import json import sys -from catalog_update.upgrade_strategy import semantic_versioning +from catalog_update.upgrade_strategy import datetime_versioning def newer_mapping(image_tags): key = list(image_tags.keys())[0] - tags = {t: t for t in image_tags[key]} - version = semantic_versioning(list(tags)) + tags = {t for t in image_tags[key]} + version = datetime_versioning(list(tags), '%Y-%m-%d') if not version: return {} diff --git a/charts/pihole/1.0.12/ix_values.yaml b/library/ix-dev/charts/pihole/values.yaml similarity index 78% rename from charts/pihole/1.0.12/ix_values.yaml rename to library/ix-dev/charts/pihole/values.yaml index b0713af98e..f5a7eaab14 100644 --- a/charts/pihole/1.0.12/ix_values.yaml +++ b/library/ix-dev/charts/pihole/values.yaml @@ -1,4 +1,4 @@ image: pullPolicy: IfNotPresent repository: pihole/pihole - tag: 2022.12.1 + tag: 2023.02.2