Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable statically provisioned volumes #48

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions charts/home-assistant/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (not .Values.persistence.enabled) .Values.additionalVolumes }}
volumes:
{{- if not .Values.persistence.enabled }}
- name: {{ include "home-assistant.fullname" . }}
Expand All @@ -123,14 +122,27 @@ spec:
{{- if .Values.additionalVolumes }}
{{- .Values.additionalVolumes | toYaml | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: {{ include "home-assistant.fullname" . }}
spec:
accessModes:
- {{ .Values.persistence.accessMode }}
{{- if .Values.persistence.existingVolume }}
volumeName: {{ .Values.persistence.existingVolume }}
{{- end }}
{{- if or .Values.persistence.matchLabels (.Values.persistence.matchExpressions) }}
selector:
{{- if .Values.persistence.matchLabels }}
matchLabels:
{{ toYaml .Values.persistence.matchLabels | indent 8 }}
{{- end -}}
{{- if .Values.persistence.matchExpressions }}
matchExpressions:
{{ toYaml .Values.persistence.matchExpressions | indent 8 }}
{{- end -}}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size }}
Expand Down
6 changes: 6 additions & 0 deletions charts/home-assistant/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ persistence:
size: 5Gi
# Storage class for the persistent volume claim
storageClass: ""
# Name of the existing volume claim for the stateful set, this option can be used to use existing volumes
existingVolume: ""
## Persistent Volume selectors
## https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector
matchLabels: {}
matchExpressions: {}

# if you need any additional volumes, you can define them here
additionalVolumes: []
Expand Down