Skip to content

Commit

Permalink
Merge pull request #10112 from afbjorklund/none-restart
Browse files Browse the repository at this point in the history
Remove systemd dependency from none driver
  • Loading branch information
medyagh authored Jan 8, 2021
2 parents 857e0a2 + b856a47 commit 0d56927
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions pkg/drivers/none/none.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var cleanupPaths = []string{
vmpath.GuestPersistentDir,
}

// Driver is a driver designed to run kubeadm w/o VM management, and assumes systemctl.
// Driver is a driver designed to run kubeadm w/o VM management.
// https://minikube.sigs.k8s.io/docs/reference/drivers/none/
type Driver struct {
*drivers.BaseDriver
Expand Down Expand Up @@ -192,7 +192,10 @@ func (d *Driver) Remove() error {

// Restart a host
func (d *Driver) Restart() error {
return restartKubelet(d.exec)
if err := sysinit.New(d.exec).Restart("kubelet"); err != nil {
return err
}
return nil
}

// Start a host
Expand Down Expand Up @@ -234,13 +237,3 @@ func (d *Driver) Stop() error {
func (d *Driver) RunSSHCommandFromDriver() error {
return fmt.Errorf("driver does not support ssh commands")
}

// restartKubelet restarts the kubelet
func restartKubelet(cr command.Runner) error {
klog.Infof("restarting kubelet.service ...")
c := exec.Command("sudo", "systemctl", "restart", "kubelet.service")
if _, err := cr.RunCmd(c); err != nil {
return err
}
return nil
}

0 comments on commit 0d56927

Please sign in to comment.