chore: Update Home Assistant chart version to 0.1.18 and add PVC backup CronJob template

This commit is contained in:
sha
2026-04-10 22:08:14 +03:00
parent 6fd0c2f749
commit 5c86c59a26
3 changed files with 81 additions and 1 deletions
+1 -1
View File
@@ -5,5 +5,5 @@ type: application
annotations:
version-source: github-release:home-assistant/core
version-pattern: "s|^v||"
version: 0.1.17
version: 0.1.18
appVersion: "2026.4.1"
@@ -0,0 +1,71 @@
{{- if .Values.pvcBackup.enabled -}}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "home-assistant.fullname" . }}-pvc-backup
{{- if .Values.namespaceOverride }}
namespace: {{ .Values.namespaceOverride }}
{{- end }}
labels:
{{- include "home-assistant.labels" . | nindent 4 }}
spec:
schedule: {{ .Values.pvcBackup.schedule | quote }}
jobTemplate:
spec:
template:
spec:
containers:
- name: pvc-backup
image: {{ .Values.pvcBackup.image }}
command:
- /bin/sh
- -c
- |
set -e
BACKUP_DIR="/backup/{{ include "home-assistant.fullname" . }}"
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
mkdir -p "$BACKUP_DIR"
# Create compressed tar of config PVC
tar czf "$BACKUP_DIR/config-${TIMESTAMP}.tar.gz" -C /config .
# Retention: Delete backups older than specified days
find "$BACKUP_DIR" -name "config-*.tar.gz" -mtime +{{ .Values.pvcBackup.retentionDays }} -delete
volumeMounts:
- name: config
mountPath: /config
readOnly: true
- name: backup-storage
mountPath: /backup
volumes:
- name: config
persistentVolumeClaim:
claimName: {{ .Values.persistence.config.existingClaim | default (include "home-assistant.fullname" .) }}
- name: backup-storage
hostPath:
path: {{ .Values.pvcBackup.storagePath }}
type: DirectoryOrCreate
restartPolicy: OnFailure
{{- if .Values.pvcBackup.node }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- {{ .Values.pvcBackup.node }}
{{- else }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
+9
View File
@@ -130,6 +130,15 @@ backup:
existingSecret: ""
secretKey: password
pvcBackup:
enabled: false
schedule: "0 3 * * *"
image: busybox:latest
retentionDays: 7
storagePath: /storage/backups/pvc
# Node to run backup on (hostname). Overrides global affinity/tolerations.
node: ""
nodeSelector: {}
tolerations: []