Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check control plane count of master IPs in install.sh #4972

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add return in PROMPTS_EN/PROMPTS_CN

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
Loading