From 3f42c6b1a70a5ad398f503c2e330d0d4eef62630 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Wed, 18 Oct 2023 15:18:40 -0600 Subject: [PATCH] handle error --- pkg/handlers/helmvm_node_join_command.go | 5 +++++ pkg/helmvm/node_join.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/handlers/helmvm_node_join_command.go b/pkg/handlers/helmvm_node_join_command.go index 6f64dde5b0..bb09993cd9 100644 --- a/pkg/handlers/helmvm_node_join_command.go +++ b/pkg/handlers/helmvm_node_join_command.go @@ -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}, diff --git a/pkg/helmvm/node_join.go b/pkg/helmvm/node_join.go index e48b748459..66f27a8ba5 100644 --- a/pkg/helmvm/node_join.go +++ b/pkg/helmvm/node_join.go @@ -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") }