From 7aeb0209b33460ac09be0afe04c3615c89d79b70 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Thu, 10 Nov 2022 19:54:26 +0100 Subject: [PATCH] fix: several upgrade flow fixes --- admin/kubezero.sh | 5 ----- admin/v1.24/pre-upgrade.sh | 10 +++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/admin/kubezero.sh b/admin/kubezero.sh index cb4b60c0..d7845eab 100755 --- a/admin/kubezero.sh +++ b/admin/kubezero.sh @@ -65,11 +65,6 @@ render_kubeadm() { parse_kubezero() { - # remove with 1.24 - if [ ! -f ${HOSTFS}/etc/kubernetes/kubeadm-values.yaml ]; then - [ -f ${HOSTFS}/etc/kubernetes/kubezero.yaml ] && cp ${HOSTFS}/etc/kubernetes/kubezero.yaml ${HOSTFS}/etc/kubernetes/kubeadm-values.yaml - fi - export CLUSTERNAME=$(yq eval '.global.clusterName // .clusterName' ${HOSTFS}/etc/kubernetes/kubeadm-values.yaml) export HIGHAVAILABLE=$(yq eval '.global.highAvailable // .highAvailable // "false"' ${HOSTFS}/etc/kubernetes/kubeadm-values.yaml) export ETCD_NODENAME=$(yq eval '.etcd.nodeName' ${HOSTFS}/etc/kubernetes/kubeadm-values.yaml) diff --git a/admin/v1.24/pre-upgrade.sh b/admin/v1.24/pre-upgrade.sh index e6f24fa8..86e35193 100644 --- a/admin/v1.24/pre-upgrade.sh +++ b/admin/v1.24/pre-upgrade.sh @@ -1,20 +1,20 @@ #!/bin/bash -# get current argo cd values -kubectl get application kubezero -n argocd -o yaml | yq '.spec.source.helm.values' > "${WORKDIR}"/argo-values.yaml +# get current values, argo app over cm +get_kubezero_values # tumble new config through migrate.py -migrate_argo_values.py < "$WORKDIR"/argo-values.yaml > "$WORKDIR"/kubezero-values.yaml +migrate_argo_values.py < "$WORKDIR"/kubezero-values.yaml > "$WORKDIR"/new-kubezero-values.yaml # Update kubezero-values CM kubectl get cm -n kube-system kubezero-values -o=yaml | \ - yq e '.data."values.yaml" |= load_str("/tmp/kubezero/kubezero-values.yaml")' | \ + yq e '.data."values.yaml" |= load_str("/tmp/kubezero/new-kubezero-values.yaml")' | \ kubectl replace -f - # update argo app kubectl get application kubezero -n argocd -o yaml | \ kubezero_chart_version=$(yq .version /charts/kubezero/Chart.yaml) \ - yq '.spec.source.helm.values |= load_str("/tmp/kubezero/kubezero-values.yaml") | .spec.source.targetRevision = strenv(kubezero_chart_version)' | \ + yq '.spec.source.helm.values |= load_str("/tmp/kubezero/new-kubezero-values.yaml") | .spec.source.targetRevision = strenv(kubezero_chart_version)' | \ kubectl apply -f - # finally remove annotation to allow argo to sync again