fix: add persistent volume claim
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Markus Pesch 2023-11-09 17:42:34 +01:00
parent e2ebfb3943
commit e8cd20b9f5
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
3 changed files with 46 additions and 15 deletions

View File

@ -48,9 +48,10 @@ spec:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
{{- with .Values.volumeMounts }} {{- if .Values.persistentStorage.enabled }}
volumeMounts: volumes:
{{- toYaml . | nindent 8 }} - name: config
mountPath: /config
{{- end }} {{- end }}
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
@ -69,7 +70,15 @@ spec:
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.persistentStorage.enabled }}
volumes: volumes:
{{- with .Values.volumes }} {{- if .Values.persistentStorage.existingClaim }}
{{- toYaml . | nindent 6 }} - name: config
persistentVolumeClaim:
claimName: {{ .Values.persistentStorage.existingClaim }}
{{- else }}
- name: config
persistentVolumeClaim:
claimName: {{ include "homeassistant.fullname" . }}
{{- end }}
{{- end }} {{- end }}

View File

@ -0,0 +1,24 @@
{{- if .Values.persistentStorage.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
{{- with .Values.persistentStorage.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ include "homeassistant.fullname" . }}
labels:
{{- include "homeassistant.labels" . | nindent 4 }}
{{- with .Values.persistentStorage.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- ReadWriteOnce
{{- if .Values.persistentStorage.storageClass }}
storageClassName: {{ .Values.persistentStorage.storageClass }}
{{- end }}
resources:
requests:
storage: {{ required "Require size of persistent volume claim" .Values.persistentStorage.size }}
{{- end }}

View File

@ -37,6 +37,14 @@ ingress:
nodeSelector: {} nodeSelector: {}
persistentStorage:
enabled: false
existingClaim: ""
annotations: {}
labels: {}
storageClass:
size: 15Gi
podAnnotations: {} podAnnotations: {}
podPriorityClassName: "" podPriorityClassName: ""
@ -70,13 +78,3 @@ service:
port: 8123 port: 8123
tolerations: [] tolerations: []
volumeMounts: []
# - name: config
# mountPath: /config
volumes: []
# - name: config
# hostPath:
# path: /etc/homeassistant
# type: DirectoryOrCreate