fix: use actual cluster version for backups

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

View File

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

View File

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

View File

@ -349,10 +349,12 @@ elif [[ "$1" =~ "^(bootstrap|restore|join)$" ]]; then
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
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
# pki & cluster-admin access
@ -361,12 +363,12 @@ elif [ "$1" == 'backup' ]; then
# Backup via restic
restic snapshots || restic init
restic backup ${WORKDIR} -H $CLUSTERNAME --tag $VERSION
restic backup ${WORKDIR} -H $CLUSTERNAME --tag $CLUSTER_VERSION
echo "Backup complete."
# Remove backups from previous versions
restic forget --keep-tag $VERSION --prune
restic forget --keep-tag $CLUSTER_VERSION --prune
# Regular retention
restic forget --keep-hourly 24 --keep-daily ${RESTIC_RETENTION:-7} --prune

View File

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