fix: use actual cluster version for backups

This commit is contained in:
Stefan Reimer 2022-05-16 13:23:01 +02:00
parent 975d166bec
commit 9dbb9c0f84
4 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: kubezero-istio-gateway name: kubezero-istio-gateway
description: KubeZero Umbrella Chart for Istio gateways description: KubeZero Umbrella Chart for Istio gateways
type: application type: application
version: 0.8.0 version: 0.8.1
home: https://kubezero.com home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png
keywords: keywords:

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: kubezero-istio name: kubezero-istio
description: KubeZero Umbrella Chart for Istio description: KubeZero Umbrella Chart for Istio
type: application type: application
version: 0.8.0 version: 0.8.1
home: https://kubezero.com home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png
keywords: keywords:

View File

@ -349,10 +349,12 @@ elif [[ "$1" =~ "^(bootstrap|restore|join)$" ]]; then
echo "${1} cluster $CLUSTERNAME successfull." echo "${1} cluster $CLUSTERNAME successfull."
# Since 1.21 we only need to backup etcd + /etc/kubernetes/pki ! # backup etcd + /etc/kubernetes/pki
elif [ "$1" == 'backup' ]; then elif [ "$1" == 'backup' ]; then
restic snapshots || restic init || exit 1 restic snapshots || restic init || exit 1
CLUSTER_VERSION="v1.$(kubectl version --short=true -o json | jq .serverVersion.minor -r)"
etcdctl --endpoints=https://${ETCD_NODENAME}:2379 snapshot save ${WORKDIR}/etcd_snapshot etcdctl --endpoints=https://${ETCD_NODENAME}:2379 snapshot save ${WORKDIR}/etcd_snapshot
# pki & cluster-admin access # pki & cluster-admin access
@ -361,12 +363,12 @@ elif [ "$1" == 'backup' ]; then
# Backup via restic # Backup via restic
restic snapshots || restic init restic snapshots || restic init
restic backup ${WORKDIR} -H $CLUSTERNAME --tag $VERSION restic backup ${WORKDIR} -H $CLUSTERNAME --tag $CLUSTER_VERSION
echo "Backup complete." echo "Backup complete."
# Remove backups from previous versions # Remove backups from previous versions
restic forget --keep-tag $VERSION --prune restic forget --keep-tag $CLUSTER_VERSION --prune
# Regular retention # Regular retention
restic forget --keep-hourly 24 --keep-daily ${RESTIC_RETENTION:-7} --prune restic forget --keep-hourly 24 --keep-daily ${RESTIC_RETENTION:-7} --prune

View File

@ -68,7 +68,7 @@ spec:
hostPID: true hostPID: true
containers: containers:
- name: kubezero-admin - name: kubezero-admin
image: public.ecr.aws/zero-downtime/kubezero-admin:${VERSION} image: public.ecr.aws/zero-downtime/kubezero-admin:${VERSION}-9
imagePullPolicy: Always imagePullPolicy: Always
command: ["kubezero.sh"] command: ["kubezero.sh"]
args: args: