generate join token on control plane
parent
442c2dc7c3
commit
0e221450f9
|
@ -156,9 +156,11 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
|
|||
return nil, errors.Wrap(err, "Updating node")
|
||||
}
|
||||
|
||||
cpBs, err := cluster.Bootstrapper(starter.MachineAPI, viper.GetString(cmdcfg.Bootstrapper), *starter.Cfg, starter.Runner)
|
||||
// Make sure to use the command runner for the control plane to generate the join token
|
||||
c := mustload.Running(starter.Cfg.Name)
|
||||
cpBs, err := cluster.Bootstrapper(starter.MachineAPI, viper.GetString(cmdcfg.Bootstrapper), *starter.Cfg, c.CP.Runner)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Getting bootstrapper")
|
||||
return nil, errors.Wrap(err, "getting control plane bootstrapper")
|
||||
}
|
||||
|
||||
joinCmd, err := cpBs.GenerateToken(*starter.Cfg)
|
||||
|
|
|
@ -132,6 +132,7 @@ func TestFunctional(t *testing.T) {
|
|||
{"UpdateContextCmd", validateUpdateContextCmd},
|
||||
{"DockerEnv", validateDockerEnv},
|
||||
{"NodeLabels", validateNodeLabels},
|
||||
{"MultiNode", validateMultiNode},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
|
@ -187,6 +188,38 @@ func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {
|
|||
|
||||
}
|
||||
|
||||
func validateMultiNode(ctx context.Context, t *testing.T, profile string) {
|
||||
if NoneDriver() {
|
||||
t.Skip("none driver does not support multinode")
|
||||
}
|
||||
|
||||
// TODO: remove this skip once docker multinode is fixed
|
||||
if KicDriver() {
|
||||
t.Skip("docker driver multinode is currently broken :(")
|
||||
}
|
||||
|
||||
// Add a node to the current cluster
|
||||
addArgs := []string{"node", "add", "-p", profile}
|
||||
rr, err := Run(t, exec.CommandContext(ctx, Target(), addArgs...))
|
||||
if err != nil {
|
||||
t.Errorf("failed to add node to current cluster. args %q : %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "status"))
|
||||
if err != nil {
|
||||
t.Errorf("failed to run minikube status. args %q : %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func validateStartWithProxy(ctx context.Context, t *testing.T, profile string) {
|
||||
srv, err := startHTTPProxy(t)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue