Skip to content

Commit

Permalink
handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Oct 18, 2023
1 parent 63bcb38 commit 3f42c6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/handlers/helmvm_node_join_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func (h *Handler) GenerateK0sNodeJoinCommand(w http.ResponseWriter, r *http.Requ
return
}
nodeJoinCommand, err := helmvm.GenerateAddNodeCommand(r.Context(), client, token)
if err != nil {
logger.Error(fmt.Errorf("failed to generate add node command: %w", err))
w.WriteHeader(http.StatusInternalServerError)
return
}

JSON(w, http.StatusOK, GenerateK0sNodeJoinCommandResponse{
Command: []string{nodeJoinCommand},
Expand Down
2 changes: 1 addition & 1 deletion pkg/helmvm/node_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func GenerateK0sJoinCommand(ctx context.Context, client kubernetes.Interface, ro
}
}

cmd := []string{"install", k0sRole, "--force"}
cmd := []string{"/usr/local/bin/k0s", "install", k0sRole, "--force"}
if k0sRole == "controller" {
cmd = append(cmd, "--enable-worker")
}
Expand Down

0 comments on commit 3f42c6b

Please sign in to comment.