Skip to content

make sure worker nodes actually join control plane on restart #9476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,18 +673,14 @@ func (k *Bootstrapper) JoinCluster(cc config.ClusterConfig, n config.Node, joinC
klog.Infof("kubeadm reset failed, continuing anyway: %v", err)
}

out, err := k.c.RunCmd(exec.Command("/bin/bash", "-c", joinCmd))
_, err = k.c.RunCmd(exec.Command("/bin/bash", "-c", joinCmd))
if err != nil {
if strings.Contains(err.Error(), "status \"Ready\" already exists in the cluster") {
klog.Infof("Node %s already joined the cluster, skip failure.", n.Name)
} else {
return errors.Wrapf(err, "cmd failed: %s\n%+v\n", joinCmd, out.Output())
}
return errors.Wrapf(err, "kubeadm join")
}
return nil
}

if err := retry.Expo(join, 10*time.Second, 1*time.Minute); err != nil {
if err := retry.Expo(join, 10*time.Second, 3*time.Minute); err != nil {
return errors.Wrap(err, "joining cp")
}

Expand Down
7 changes: 3 additions & 4 deletions pkg/minikube/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
return nil, errors.Wrap(err, "setting up certs")
}

if err := bs.UpdateNode(*starter.Cfg, *starter.Node, cr); err != nil {
return nil, errors.Wrap(err, "update node")
}
}

var wg sync.WaitGroup
Expand Down Expand Up @@ -167,10 +170,6 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
prepareNone()
}
} else {
if err := bs.UpdateNode(*starter.Cfg, *starter.Node, cr); err != nil {
return nil, errors.Wrap(err, "update node")
}

// Make sure to use the command runner for the control plane to generate the join token
cpBs, cpr, err := cluster.ControlPlaneBootstrapper(starter.MachineAPI, starter.Cfg, viper.GetString(cmdcfg.Bootstrapper))
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions test/integration/multinode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"os/exec"
"strings"
"testing"
"time"
)

func TestMultiNode(t *testing.T) {
Expand Down Expand Up @@ -228,8 +227,6 @@ func validateRestartMultiNodeCluster(ctx context.Context, t *testing.T, profile
t.Fatalf("failed to start cluster. args %q : %v", rr.Command(), err)
}

time.Sleep(Seconds(45))

// Make sure minikube status shows 2 running nodes
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "status", "--alsologtostderr"))
if err != nil {
Expand Down