mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-08-28 03:27:08 +00:00
chore: Update Home Assistant chart version to 0.1.18 and add PVC backup CronJob template
This commit is contained in:
@@ -5,5 +5,5 @@ type: application
|
|||||||
annotations:
|
annotations:
|
||||||
version-source: github-release:home-assistant/core
|
version-source: github-release:home-assistant/core
|
||||||
version-pattern: "s|^v||"
|
version-pattern: "s|^v||"
|
||||||
version: 0.1.17
|
version: 0.1.18
|
||||||
appVersion: "2026.4.1"
|
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 }}
|
||||||
@@ -130,6 +130,15 @@ backup:
|
|||||||
existingSecret: ""
|
existingSecret: ""
|
||||||
secretKey: password
|
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: {}
|
nodeSelector: {}
|
||||||
|
|
||||||
tolerations: []
|
tolerations: []
|
||||||
|
|||||||
Reference in New Issue
Block a user