Skip to content

Commit

Permalink
Typos and go doc fixes (#525)
Browse files Browse the repository at this point in the history
* typo in k8s kubectl command

* godoc in kubernetes.DeleteNode

* only wait for node to fully join microcluster on failures
  • Loading branch information
neoaggelos authored Jul 3, 2024
1 parent 8cf53b9 commit 6463644
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/k8s/cmd/k8s/k8s_kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/k8s/pkg/client/kubernetes/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 1 addition & 17 deletions src/k8s/pkg/k8sd/app/hooks_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6463644

Please sign in to comment.