From 6463644be727497fce1a77f01cf3a21d4779acb0 Mon Sep 17 00:00:00 2001 From: Angelos Kolaitis Date: Wed, 3 Jul 2024 10:25:28 +0300 Subject: [PATCH] Typos and go doc fixes (#525) * typo in k8s kubectl command * godoc in kubernetes.DeleteNode * only wait for node to fully join microcluster on failures --- src/k8s/cmd/k8s/k8s_kubectl.go | 2 +- src/k8s/pkg/client/kubernetes/node.go | 2 +- src/k8s/pkg/k8sd/app/hooks_join.go | 18 +----------------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/k8s/cmd/k8s/k8s_kubectl.go b/src/k8s/cmd/k8s/k8s_kubectl.go index 65e12009a..e9cb26056 100644 --- a/src/k8s/cmd/k8s/k8s_kubectl.go +++ b/src/k8s/cmd/k8s/k8s_kubectl.go @@ -29,7 +29,7 @@ func newKubectlCmd(env cmdutil.ExecutionEnvironment) *cobra.Command { env.Exit(1) return } else if status.ClusterRole == apiv1.ClusterRoleWorker { - cmd.PrintErrln("Error: k8s helm commands are not allowed on worker nodes.") + cmd.PrintErrln("Error: k8s kubectl commands are not allowed on worker nodes.") env.Exit(1) return } diff --git a/src/k8s/pkg/client/kubernetes/node.go b/src/k8s/pkg/client/kubernetes/node.go index d6d89e25c..9d494aad1 100644 --- a/src/k8s/pkg/client/kubernetes/node.go +++ b/src/k8s/pkg/client/kubernetes/node.go @@ -11,7 +11,7 @@ import ( // DeleteNode will remove a node from the kubernetes cluster. // DeleteNode will retry if there is a conflict on the resource. -// DeleteNode will not fail if the node does not +// DeleteNode will not fail if the node does not exist. func (c *Client) DeleteNode(ctx context.Context, nodeName string) error { return retry.RetryOnConflict(retry.DefaultBackoff, func() error { if err := c.CoreV1().Nodes().Delete(ctx, nodeName, metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) { diff --git a/src/k8s/pkg/k8sd/app/hooks_join.go b/src/k8s/pkg/k8sd/app/hooks_join.go index bb24206c6..a2c3be965 100644 --- a/src/k8s/pkg/k8sd/app/hooks_join.go +++ b/src/k8s/pkg/k8sd/app/hooks_join.go @@ -36,23 +36,7 @@ func (a *App) onPostJoin(s *state.State, initConfig map[string]string) (rerr err // the code can register cleanup hooks by appending to this slice var cleanups []func(context.Context) error defer func() { - log.Printf("Waiting for node to finish microcluster join") - control.WaitUntilReady(s.Context, func() (bool, error) { - var notPending bool - if err := s.Database.Transaction(s.Context, func(ctx context.Context, tx *sql.Tx) error { - member, err := cluster.GetInternalClusterMember(ctx, tx, s.Name()) - if err != nil { - log.Printf("Failed to get member: %v", err) - } - notPending = member.Role != cluster.Pending - return nil - }); err != nil { - log.Printf("Transaction to check cluster member role failed: %v", err) - } - return notPending, nil - }) - - // do not cleanup if bootstrap was successful + // do not cleanup if joining was successful if rerr == nil { log.Println("Joined cluster successfully") return