From cdcb979bbe296362c86d36c77d60bea566cf524a Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Thu, 15 Sep 2022 14:58:08 +0200 Subject: [PATCH] feat: run upgrade with -e, set argo app yaml file as parameter --- admin/kubezero.sh | 2 +- admin/upgrade_cluster.sh | 7 ++++--- admin/v1.23/pre-upgrade.sh | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/admin/kubezero.sh b/admin/kubezero.sh index 69101d9..789fba9 100755 --- a/admin/kubezero.sh +++ b/admin/kubezero.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e if [ -n "$DEBUG" ]; then set -x diff --git a/admin/upgrade_cluster.sh b/admin/upgrade_cluster.sh index 65090cf..1651f6e 100755 --- a/admin/upgrade_cluster.sh +++ b/admin/upgrade_cluster.sh @@ -1,7 +1,8 @@ #!/bin/bash -e -#VERSION="v1.23.10-3" -VERSION="latest" +VERSION="v1.23" +#VERSION="latest" +ARGO_APP=${1:-/tmp/new-kubezero-argoapp.yaml} SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/libhelm.sh @@ -143,5 +144,5 @@ argo_used && enable_argo # Final step is to commit the new argocd kubezero app kubectl get app kubezero -n argocd -o yaml | yq 'del(.status) | del(.metadata) | .metadata.name="kubezero" | .metadata.namespace="argocd"' | yq 'sort_keys(..) | .spec.source.helm.values |= (from_yaml | to_yaml)' > /tmp/new-kubezero-argoapp.yaml -echo "Please commit /tmp/new-kubezero-argoapp.yaml as the updated kubezero/application.yaml for your cluster!" +echo "Please commit $ARGO_APP as the updated kubezero/application.yaml for your cluster." echo "Then head over to ArgoCD for this cluster and sync all KubeZero modules to apply remaining upgrades." diff --git a/admin/v1.23/pre-upgrade.sh b/admin/v1.23/pre-upgrade.sh index 4b75c92..a4c6ee8 100644 --- a/admin/v1.23/pre-upgrade.sh +++ b/admin/v1.23/pre-upgrade.sh @@ -26,6 +26,8 @@ yq e '.addons | # extract network yq e '.network | .cilium.enabled = true | + .calico.enabled = true | + .multus.enabled = true | .multus.defaultNetworks = ["cilium"] | .cilium.cluster.name = strenv(CLUSTERNAME) | {"network": .}' ${HOSTFS}/etc/kubernetes/kubeadm-values.yaml > $WORKDIR/network-values.yaml @@ -52,3 +54,6 @@ 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)' | \ kubectl apply -f - + +# finally remove annotation to allow argo to sync again +kubectl patch app kubezero -n argocd --type json -p='[{"op": "remove", "path": "/metadata/annotations"}]'