-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathcluster-state-check.sh
More file actions
20 lines (18 loc) · 925 Bytes
/
cluster-state-check.sh
File metadata and controls
20 lines (18 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Copyright (C) 2024-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
check_cluster_state() {
echo "Checking the state of the Kubernetes cluster..."
ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root --become-password-file="${BECOME_PASSWORD_FILE}" upgrade-cluster.yml --check
# Check the exit status of the Ansible playbook command
if [ $? -eq 0 ]; then
echo "Kubernetes cluster state check completed successfully."
else
echo "Kubernetes cluster state check indicates potential issues."
return 1 # Return a non-zero value to indicate potential issues
fi
}
run_k8s_cluster_wait() {
echo "Waiting for Kubernetes control plane to become ready..."
ansible -i "${INVENTORY_PATH}" kube_control_plane -m wait_for -a "port=6443 timeout=600" --become --become-user=root --become-password-file="${BECOME_PASSWORD_FILE}"
return $?
}