From 25c67b53296e11623f24f8c2ce2a3cd5fced193b Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 11 Oct 2024 10:04:30 +0200 Subject: [PATCH] add configDB.cong support with secret --- Chart.yaml | 2 +- templates/deployment.yaml | 10 +++++++++- templates/secret.yaml | 15 +++++++++++++++ values.yaml | 6 ++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 templates/secret.yaml diff --git a/Chart.yaml b/Chart.yaml index 010bc66..1081d58 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -21,5 +21,5 @@ annotations: category: Houseautomation licenses: GPL'd type: application -version: 1.0.1 +version: 1.0.2 appVersion: "4.0.5-bullseye" diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 22e132e..7668d6d 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -57,6 +57,9 @@ spec: - name: fhem-data mountPath: /opt/fhem subPath: fhem/ + - name: configdb-volume + mountPath: /opt/fhem/configDB.conf + subPath: fhem/configDB.conf resources: {{- toYaml .Values.resources | nindent 12 }} env: @@ -123,9 +126,14 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} volumes: - - name: fhem-data {{- if .Values.persistence.enabled }} + - name: fhem-data persistentVolumeClaim: claimName: {{ include "fhem.fullname" . }} {{- end }} + {{- if eq .Values.configtype "configDB" }} + - name: configdb-volume + secret: + secretName: {{ .Release.Name }}-db-config-secret + {{- end }} restartPolicy: {{ .Values.restartPolicy }} diff --git a/templates/secret.yaml b/templates/secret.yaml new file mode 100644 index 0000000..4f14b6e --- /dev/null +++ b/templates/secret.yaml @@ -0,0 +1,15 @@ +{{- if eq .Values.configtype "configDB" }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-db-config-secret + labels: + app: {{ .Release.Name }} +type: Opaque +data: + configDB.conf: | + {{- $connection := .Values.dbConfig.connection | quote }} + {{- $user := .Values.dbConfig.user | quote }} + {{- $password := .Values.dbConfig.password | quote }} + {{- printf "%%dbconfig= (\n connection => \"%s\",\n user => \"%s\",\n password => \"%s\"\n);" $connection $user $password | b64enc }} +{{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index 17cb66f..9251d2f 100644 --- a/values.yaml +++ b/values.yaml @@ -64,6 +64,12 @@ timezone: "Europe/Berlin" configtype: "fhem.cfg.demo" ### ENDE Container environment variables +### if configtype configDB set, set the follow connection settings for a secret +dbConfig: + connection: "" + user: "" + password: "" + serviceAccount: # Specifies whether a service account should be created create: false