Skip to content

Commit 49d3d5b

Browse files
authored
warn about joining controllers in parallel (#2017)
1 parent 6e08143 commit 49d3d5b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

cmd/installer/cli/join.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ func addJoinFlags(cmd *cobra.Command, flags *JoinCmdFlags) error {
129129
}
130130

131131
func runJoin(ctx context.Context, name string, flags JoinCmdFlags, jcmd *kotsadm.JoinCommandResponse, metricsReporter preflights.MetricsReporter) error {
132+
// both controller and worker nodes will have 'worker' in the join command
133+
isWorker := !strings.Contains(jcmd.K0sJoinCommand, "controller")
134+
if !isWorker {
135+
logrus.Warnf("Do not join another node until this join is complete.")
136+
}
137+
132138
if err := runJoinVerifyAndPrompt(name, flags, jcmd); err != nil {
133139
return err
134140
}
@@ -172,11 +178,11 @@ func runJoin(ctx context.Context, name string, flags JoinCmdFlags, jcmd *kotsadm
172178
}
173179

174180
logrus.Debugf("installing and joining cluster")
175-
if err := installAndJoinCluster(ctx, jcmd, name, flags); err != nil {
181+
if err := installAndJoinCluster(ctx, jcmd, name, flags, isWorker); err != nil {
176182
return err
177183
}
178184

179-
if !strings.Contains(jcmd.K0sJoinCommand, "controller") {
185+
if isWorker {
180186
logrus.Debugf("worker node join finished")
181187
return nil
182188
}
@@ -296,7 +302,7 @@ func getJoinCIDRConfig(jcmd *kotsadm.JoinCommandResponse) (*CIDRConfig, error) {
296302
}, nil
297303
}
298304

299-
func installAndJoinCluster(ctx context.Context, jcmd *kotsadm.JoinCommandResponse, name string, flags JoinCmdFlags) error {
305+
func installAndJoinCluster(ctx context.Context, jcmd *kotsadm.JoinCommandResponse, name string, flags JoinCmdFlags, isWorker bool) error {
300306
logrus.Debugf("saving token to disk")
301307
if err := saveTokenToDisk(jcmd.K0sToken); err != nil {
302308
return fmt.Errorf("unable to save token to disk: %w", err)
@@ -314,8 +320,6 @@ func installAndJoinCluster(ctx context.Context, jcmd *kotsadm.JoinCommandRespons
314320
}
315321

316322
logrus.Debugf("creating systemd unit files")
317-
// both controller and worker nodes will have 'worker' in the join command
318-
isWorker := !strings.Contains(jcmd.K0sJoinCommand, "controller")
319323
if err := createSystemdUnitFiles(ctx, isWorker, jcmd.InstallationSpec.Proxy); err != nil {
320324
return fmt.Errorf("unable to create systemd unit files: %w", err)
321325
}

cmd/installer/cli/reset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func ResetCmd(ctx context.Context, name string) *cobra.Command {
7070
return err
7171
}
7272

73-
logrus.Info("This will remove this node from the cluster and completely reset it, removing all data stored on the node.")
74-
logrus.Info("This node will also reboot. Do not reset another node until this is complete.")
73+
logrus.Warn("This will remove this node from the cluster and completely reset it, removing all data stored on the node.")
74+
logrus.Warn("This node will also reboot. Do not reset another node until this is complete.")
7575
if !force && !assumeYes && !prompts.New().Confirm("Do you want to continue?", false) {
7676
return fmt.Errorf("Aborting")
7777
}

0 commit comments

Comments
 (0)