Skip to content

Commit

Permalink
Don't load Minikube on boot when using the none driver
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosdiez committed Apr 17, 2019
1 parent 3746fb9 commit 32a2897
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@ func prepareHostEnvironment(api libmachine.API, kc cfg.KubernetesConfig) bootstr
console.OutStyle("option", "%s.%s=%s", eo.Component, eo.Key, eo.Value)
}
// Loads cached images, generates config files, download binaries
if err := bs.UpdateCluster(kc); err != nil {

autostart_cluster := viper.GetString(vmDriver) != constants.DriverNone

if err := bs.UpdateCluster(kc, autostart_cluster); err != nil {
exit.WithError("Failed to update cluster", err)
}
if err := bs.SetupCerts(kc); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/bootstrapper/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Bootstrapper interface {
// PullImages pulls images necessary for a cluster. Success should not be required.
PullImages(config.KubernetesConfig) error
StartCluster(config.KubernetesConfig) error
UpdateCluster(config.KubernetesConfig) error
UpdateCluster(config.KubernetesConfig, bool) error
RestartCluster(config.KubernetesConfig) error
DeleteCluster(config.KubernetesConfig) error
// LogCommands returns a map of log type to a command which will display that log.
Expand Down
10 changes: 8 additions & 2 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func NewKubeletConfig(k8s config.KubernetesConfig, r cruntime.Manager) (string,
}

// UpdateCluster updates the cluster
func (k *Bootstrapper) UpdateCluster(cfg config.KubernetesConfig) error {
func (k *Bootstrapper) UpdateCluster(cfg config.KubernetesConfig, autostart_cluster bool) error {
_, images := constants.GetKubeadmCachedImages(cfg.ImageRepository, cfg.KubernetesVersion)
if cfg.ShouldLoadCachedImages {
if err := machine.LoadImages(k.c, images, constants.ImageCacheDir); err != nil {
Expand Down Expand Up @@ -464,13 +464,19 @@ func (k *Bootstrapper) UpdateCluster(cfg config.KubernetesConfig) error {
}
err = k.c.Run(`
sudo systemctl daemon-reload &&
sudo systemctl enable kubelet &&
sudo systemctl start kubelet
`)
if err != nil {
return errors.Wrap(err, "starting kubelet")
}

if autostart_cluster {
err = k.c.Run(`sudo systemctl enable kubelet`)
if err != nil {
return errors.Wrap(err, "making kubelet start on boot")
}
}

return nil
}

Expand Down

0 comments on commit 32a2897

Please sign in to comment.