Skip to content

Commit

Permalink
fix: make talosctl bootstrap accept only single node
Browse files Browse the repository at this point in the history
Previously talosctl would accept multiple nodes for the bootstrap
command which is a strictly single-node operation. Talosctl will abort
the bootstrap command if more than one node is specified either as a
command-line flag or in talosconfig.

Fixes #5636

Signed-off-by: Philipp Sauter <[email protected]>
  • Loading branch information
Philipp Sauter committed Jun 10, 2022
1 parent 217fba2 commit 7a11b4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/talosctl/cmd/talos/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Talos etcd cluster can be recovered from a known snapshot with '--recover-from='
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return WithClient(func(ctx context.Context, c *client.Client) error {
if len(Nodes) > 1 {
return fmt.Errorf("command \"bootstrap\" is not supported with multiple nodes")
}

if bootstrapCmdFlags.recoverFrom != "" {
manager := snapshot.NewV3(logging.Wrap(os.Stderr))

Expand Down Expand Up @@ -65,7 +69,7 @@ Talos etcd cluster can be recovered from a known snapshot with '--recover-from='
RecoverEtcd: bootstrapCmdFlags.recoverFrom != "",
RecoverSkipHashCheck: bootstrapCmdFlags.recoverSkipHashCheck,
}); err != nil {
return fmt.Errorf("error executing bootstrap: %s", err)
return fmt.Errorf("error executing bootstrap: %w", err)
}

return nil
Expand Down

0 comments on commit 7a11b4d

Please sign in to comment.