feat: add post-upgrade multus cleanup
This commit is contained in:
parent
7863202ca7
commit
09a2ead705
@ -2,7 +2,10 @@
|
||||
|
||||
# All things BEFORE the first controller / control plane upgrade
|
||||
pre_control_plane_upgrade_cluster() {
|
||||
echo
|
||||
if [ "$PLATFORM" != "gke" ];then
|
||||
# patch multus DS to ONLY run pods on 1.31 controllers
|
||||
kubectl patch ds kube-multus-ds -n kube-system -p '{"spec": {"template": {"spec": {"nodeSelector": {"node.kubernetes.io/kubezero.version": "v1.31.6"}}}}}' || true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +19,16 @@ post_control_plane_upgrade_cluster() {
|
||||
pre_cluster_upgrade_final() {
|
||||
set +e
|
||||
|
||||
echo
|
||||
if [ "$PLATFORM" != "gke" ];then
|
||||
# cleanup multus
|
||||
kubectl delete clusterrolebinding multus
|
||||
kubectl delete clusterrole multus
|
||||
kubectl delete serviceaccount multus -n kube-system
|
||||
kubectl delete cm multus-cni-config -n kube-system
|
||||
kubectl delete ds kube-multus-ds -n kube-system
|
||||
kubectl delete NetworkAttachmentDefinition cilium
|
||||
kubectl delete crd network-attachment-definitions.k8s.cni.cncf.io
|
||||
fi
|
||||
|
||||
set -e
|
||||
}
|
||||
|
@ -95,6 +95,20 @@ function ensure_kubezero_secret_key() {
|
||||
}
|
||||
|
||||
|
||||
function ensure_kubezero_secret_key() {
|
||||
local secret="$(kubectl get secret -n $ns $secret -o yaml)"
|
||||
local key
|
||||
local val
|
||||
|
||||
for key in $1; do
|
||||
val=$(echo $secret | yq ".data.\"$key\""
|
||||
if [ "$val" == "null" ]; then
|
||||
set_kubezero_secret $key ""
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function set_kubezero_secret() {
|
||||
local key="$1"
|
||||
local val="$2"
|
||||
|
Loading…
x
Reference in New Issue
Block a user