Преглед на файлове

Move Pihole to ix-dev and fix DHCP/DNS (#1049)

* move pihole to ix-dev

* always use the web_port for webUI

* Apply fixes for DHCP/DNS + hostnetwork

* Don't attempt to generate service at all on hostnet

* clean url
Stavros Kois преди 2 години
родител
ревизия
11d1506ccc

+ 0 - 6
charts/pihole/1.0.12/Chart.lock

@@ -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"

+ 0 - 14
charts/pihole/1.0.12/Chart.yaml

@@ -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

BIN
charts/pihole/1.0.12/charts/common-2207.0.0.tgz


+ 0 - 21
charts/pihole/1.0.12/templates/tests/deployment-check.yaml

@@ -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

+ 0 - 0
charts/pihole/.helmignore → library/ix-dev/charts/pihole/.helmignore


+ 6 - 0
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"

+ 24 - 0
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

+ 0 - 0
charts/pihole/1.0.12/README.md → library/ix-dev/charts/pihole/README.md


+ 0 - 0
charts/pihole/1.0.12/app-readme.md → library/ix-dev/charts/pihole/app-readme.md


BIN
library/ix-dev/charts/pihole/charts/common-2207.0.0.tgz


+ 22 - 0
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

+ 0 - 4
charts/pihole/1.0.12/test_values.yaml → 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

+ 0 - 0
charts/pihole/item.yaml → library/ix-dev/charts/pihole/item.yaml


+ 35 - 10
charts/pihole/1.0.12/questions.yaml → 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"

+ 40 - 1
charts/pihole/1.0.12/templates/deployment.yaml → 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 }}

+ 0 - 0
charts/pihole/1.0.12/templates/pre-install-job.yaml → library/ix-dev/charts/pihole/templates/pre-install-job.yaml


+ 0 - 0
charts/pihole/1.0.12/templates/secret.yaml → library/ix-dev/charts/pihole/templates/secret.yaml


+ 6 - 1
charts/pihole/1.0.12/templates/service.yaml → 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 }}

+ 0 - 0
charts/pihole/upgrade_info.json → library/ix-dev/charts/pihole/upgrade_info.json


+ 3 - 3
charts/pihole/upgrade_strategy → 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 {}
 

+ 1 - 1
charts/pihole/1.0.12/ix_values.yaml → 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