From 9dbb9c0f84373c07cf00ca40bb3d2c971c053388 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Mon, 16 May 2022 13:23:01 +0200 Subject: [PATCH] fix: use actual cluster version for backups --- charts/kubezero-istio-gateway/Chart.yaml | 2 +- charts/kubezero-istio/Chart.yaml | 2 +- releases/v1.22/kubezero.sh | 8 +++++--- releases/v1.22/upgrade_cluster.sh | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/charts/kubezero-istio-gateway/Chart.yaml b/charts/kubezero-istio-gateway/Chart.yaml index 3bf12e02..1233a0a1 100644 --- a/charts/kubezero-istio-gateway/Chart.yaml +++ b/charts/kubezero-istio-gateway/Chart.yaml @@ -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: diff --git a/charts/kubezero-istio/Chart.yaml b/charts/kubezero-istio/Chart.yaml index 6f319a37..51fe307a 100644 --- a/charts/kubezero-istio/Chart.yaml +++ b/charts/kubezero-istio/Chart.yaml @@ -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: diff --git a/releases/v1.22/kubezero.sh b/releases/v1.22/kubezero.sh index 762fb0a4..dc9a9313 100755 --- a/releases/v1.22/kubezero.sh +++ b/releases/v1.22/kubezero.sh @@ -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 diff --git a/releases/v1.22/upgrade_cluster.sh b/releases/v1.22/upgrade_cluster.sh index 788f6727..89e1599f 100755 --- a/releases/v1.22/upgrade_cluster.sh +++ b/releases/v1.22/upgrade_cluster.sh @@ -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: