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

cluster: print more clear warning when scale in with --force #1477

Merged
merged 2 commits into from
Jul 14, 2021
Merged
Changes from 1 commit
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
19 changes: 11 additions & 8 deletions pkg/cluster/manager/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ func (m *Manager) ScaleIn(
nodes []string = gOpt.Nodes
)
if !skipConfirm {
if err := tui.PromptForConfirmOrAbortError(
"This operation will delete the %s nodes in `%s` and all their data.\nDo you want to continue? [y/N]:",
strings.Join(nodes, ","),
color.HiYellowString(name)); err != nil {
return err
}

if force {
if err := tui.PromptForConfirmOrAbortError(
"Forcing scale in is unsafe and may result in data lost for stateful components.\nDo you want to continue? [y/N]:",
color.HiRedString("Forcing scale in is unsafe and may result in data loss for stateful components.\n"+
"The process is irreversible and could NOT be cancelled.\n") +
"Only use `--force` when some of the servers are already permanently offline.\n" +
"Are you sure to continue? [y/N]:",
); err != nil {
return err
}
}

if err := tui.PromptForConfirmOrAbortError(
"This operation will delete the %s nodes in `%s` and all their data.\nDo you want to continue? [y/N]:",
strings.Join(nodes, ","),
color.HiYellowString(name)); err != nil {
return err
}

log.Infof("Scale-in nodes...")
}

Expand Down