From a5941cf79886f189aab6c122751e908a631d109a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=8C=AF=E5=AE=87?= <> Date: Mon, 13 Jan 2025 13:16:52 +0800 Subject: [PATCH] feat(ansible): add upgrade control plane script with pre-checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙振宇 <> --- cluster/ansible/upgrade-control-plane.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 cluster/ansible/upgrade-control-plane.sh diff --git a/cluster/ansible/upgrade-control-plane.sh b/cluster/ansible/upgrade-control-plane.sh new file mode 100755 index 00000000..0560306b --- /dev/null +++ b/cluster/ansible/upgrade-control-plane.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -eu -o pipefail + +# Check if `init.sh` has not run +if [ ! -d venv ]; then + echo "Please run init.sh first." + exit 1 +fi + +# Check if kubespray has not been cloned and its empty +if [ ! -d ../../3rd/kubespray ]; then + echo "Please run 'git submoudle --init --recursive' first." + exit 1 +fi + +# Check if `inventory.ini` has not been created +if [ ! -f ../../cluster/ansible/manifests/inventory.ini ]; then + echo "Please create your own inventory.ini first." + exit 1 +fi + +cd ../../3rd/kubespray && ansible-playbook -i ../../cluster/ansible/manifests/inventory.ini ./upgrade-cluster.yml -l kube_control_plane -kK -b \ No newline at end of file