From e24640de9cd2cab3aa3c8f3dc9b58b4e2ec7ea26 Mon Sep 17 00:00:00 2001
From: Janne Mareike Koschinski <janne@kuschku.de>
Date: Sat, 25 Mar 2023 14:30:22 +0100
Subject: [PATCH] feat: update powerdns chart

---
 powerdns/templates/configmap.yaml  |  5 +++--
 powerdns/templates/deployment.yaml | 19 +++++++++++++++++++
 powerdns/templates/secret.yaml     |  2 ++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/powerdns/templates/configmap.yaml b/powerdns/templates/configmap.yaml
index c675096..32b42ee 100644
--- a/powerdns/templates/configmap.yaml
+++ b/powerdns/templates/configmap.yaml
@@ -8,8 +8,9 @@ data:
   pdns.conf: |-
     include-dir=/etc/powerdns/pdns.d
   database.conf: |-
-    launch=lmdb
-    lmdb-filename=/data/pdns.lmdb
+    launch=gsqlite3
+    gsqlite3-dnssec
+    gsqlite3-database=/data/pdns.sqlite
   security.conf: |-
     setuid={{ .Values.securityContext.runAsUser }}
     setgid={{ .Values.securityContext.runAsGroup }}
diff --git a/powerdns/templates/deployment.yaml b/powerdns/templates/deployment.yaml
index a018895..340a612 100644
--- a/powerdns/templates/deployment.yaml
+++ b/powerdns/templates/deployment.yaml
@@ -36,6 +36,25 @@ spec:
         - name: tmp
           emptyDir:
             medium: Memory
+      initContainers:
+        - name: sqlite-init
+          securityContext:
+            {{- toYaml .Values.securityContext | nindent 12 }}
+          image: keinos/sqlite3
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          command:
+            - "sqlite3"
+          args:
+            - "/data/pdns.sqlite"
+            - "-init"
+            - "/secret/init.sql"
+          resources:
+            {{- toYaml .Values.resources | nindent 12 }}
+          volumeMounts:
+            - mountPath: /data
+              name: data
+            - mountPath: /secret
+              name: secret
       containers:
         - name: {{ .Chart.Name }}
           securityContext:
diff --git a/powerdns/templates/secret.yaml b/powerdns/templates/secret.yaml
index 072c5fd..eb23e1f 100644
--- a/powerdns/templates/secret.yaml
+++ b/powerdns/templates/secret.yaml
@@ -10,3 +10,5 @@ stringData:
     {{ if .Values.api.enabled }}
     api-key={{ .Values.api.key }}
     {{ end }}
+  init.sql: |-
+    {{- .Values.init  | nindent 4 }}
-- 
GitLab