Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 9 additions & 5 deletions cmd/installer/cli/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ func addJoinFlags(cmd *cobra.Command, flags *JoinCmdFlags) error {
}

func runJoin(ctx context.Context, name string, flags JoinCmdFlags, jcmd *kotsadm.JoinCommandResponse, metricsReporter preflights.MetricsReporter) error {
// both controller and worker nodes will have 'worker' in the join command
isWorker := !strings.Contains(jcmd.K0sJoinCommand, "controller")
if !isWorker {
logrus.Warnf("Do not join another node until this join is complete.")
}

if err := runJoinVerifyAndPrompt(name, flags, jcmd); err != nil {
return err
}
Expand Down Expand Up @@ -172,11 +178,11 @@ func runJoin(ctx context.Context, name string, flags JoinCmdFlags, jcmd *kotsadm
}

logrus.Debugf("installing and joining cluster")
if err := installAndJoinCluster(ctx, jcmd, name, flags); err != nil {
if err := installAndJoinCluster(ctx, jcmd, name, flags, isWorker); err != nil {
return err
}

if !strings.Contains(jcmd.K0sJoinCommand, "controller") {
if isWorker {
logrus.Debugf("worker node join finished")
return nil
}
Expand Down Expand Up @@ -296,7 +302,7 @@ func getJoinCIDRConfig(jcmd *kotsadm.JoinCommandResponse) (*CIDRConfig, error) {
}, nil
}

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

logrus.Debugf("creating systemd unit files")
// both controller and worker nodes will have 'worker' in the join command
isWorker := !strings.Contains(jcmd.K0sJoinCommand, "controller")
if err := createSystemdUnitFiles(ctx, isWorker, jcmd.InstallationSpec.Proxy); err != nil {
return fmt.Errorf("unable to create systemd unit files: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/installer/cli/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func ResetCmd(ctx context.Context, name string) *cobra.Command {
return err
}

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