add configDB.cong support with secret #1

Merged
marko merged 1 commits from patch-addConfigdbSecret into main 2024-10-11 08:05:08 +00:00
4 changed files with 31 additions and 2 deletions

View File

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

View File

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

15
templates/secret.yaml Normal file
View File

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

View File

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