Skip to content

Commit

Permalink
fix: check control plane count of master IPs (#4972)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbluebird authored Aug 15, 2024
1 parent 9e2faf9 commit 6c82972
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/cloud/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,22 @@ wait_cluster_ready() {
done
}

check_control_plane_count() {
# Check if master_ips is empty
if [[ -z "$master_ips" ]]; then
return 0
fi

IFS=',' read -r -a master_ips_array <<< "$master_ips"
num_ips=${#master_ips_array[@]}

# If the number is even, output an error message and exit
if (( num_ips % 2 == 0 )); then
echo "Error: The number of master IPs is even. Please provide an odd number of master IPs."
exit 1
fi
}

loading_animation() {
local message="$1"
local duration="${2:-0.5}"
Expand Down Expand Up @@ -659,6 +675,7 @@ done

[[ $HELP == "" ]] || get_prompt "usage"
[[ $HELP == "" ]] || exit 0
check_control_plane_count
set_language
init
collect_input
Expand Down

0 comments on commit 6c82972

Please sign in to comment.