From d3e1c6006dfbca8983b037bfce05a89b00736545 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 19 Oct 2023 13:58:27 -0600 Subject: [PATCH] cleanup the k0s join token creation pod after completion (#4091) --- pkg/helmvm/node_join.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/helmvm/node_join.go b/pkg/helmvm/node_join.go index 4c98ef0034..34b7ac8053 100644 --- a/pkg/helmvm/node_join.go +++ b/pkg/helmvm/node_join.go @@ -202,6 +202,12 @@ func runAddNodeCommandPod(ctx context.Context, client kubernetes.Interface, node return "", fmt.Errorf("failed to get pod logs: %w", err) } + // delete the completed pod + err = client.CoreV1().Pods("kube-system").Delete(ctx, podName, metav1.DeleteOptions{}) + if err != nil { + return "", fmt.Errorf("failed to delete pod: %w", err) + } + // the logs are just a join token, which needs to be added to other things to get a join command return string(podLogs), nil }