Skip to content
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

multinode: fix control plane not ready on restart #8698

Merged
merged 8 commits into from
Jul 16, 2020
15 changes: 9 additions & 6 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ func (k *Bootstrapper) SetupCerts(k8s config.KubernetesConfig, n config.Node) er
return err
}

// UpdateCluster updates the cluster.
// UpdateCluster updates the control plane with cluster-level info.
func (k *Bootstrapper) UpdateCluster(cfg config.ClusterConfig) error {
images, err := images.Kubeadm(cfg.KubernetesConfig.ImageRepository, cfg.KubernetesConfig.KubernetesVersion)
if err != nil {
Expand All @@ -745,11 +745,14 @@ func (k *Bootstrapper) UpdateCluster(cfg config.ClusterConfig) error {
}
}

for _, n := range cfg.Nodes {
err := k.UpdateNode(cfg, n, r)
if err != nil {
return errors.Wrap(err, "updating node")
}
cp, err := config.PrimaryControlPlane(&cfg)
if err != nil {
return errors.Wrap(err, "getting control plane")
}

err = k.UpdateNode(cfg, cp, r)
if err != nil {
return errors.Wrap(err, "updating control plane")
}

return nil
Expand Down
14 changes: 12 additions & 2 deletions test/integration/multinode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,21 @@ func validateRestartMultiNodeCluster(ctx context.Context, t *testing.T, profile
}

if strings.Count(rr.Stdout.String(), "host: Running") != 2 {
t.Errorf("status says both hosts are not running: args %q: %v", rr.Command(), rr.Stdout.String())
t.Errorf("status says both hosts are not running: args %q: %v", rr.Command(), rr.Output())
}

if strings.Count(rr.Stdout.String(), "kubelet: Running") != 2 {
t.Errorf("status says both kubelets are not running: args %q: %v", rr.Command(), rr.Stdout.String())
t.Errorf("status says both kubelets are not running: args %q: %v", rr.Command(), rr.Output())
}

// Make sure kubectl reports that all nodes are ready
rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "get", "nodes", "-o", `go-template='{{range .items}}{{range .status.conditions}}{{if eq .type "Ready"}} {{.status}}{{"\n"}}{{end}}{{end}}{{end}}'`))
if err != nil {
t.Fatalf("failed to kubectl get nodes. args %q : %v", rr.Command(), err)
}

if strings.Count(rr.Stdout.String(), "True") != 2 {
t.Errorf("expected 2 nodes Ready status to be True, got %v", rr.Output())
}
}

Expand Down