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

Remove systemd dependency from none driver #10112

Merged
merged 1 commit into from
Jan 8, 2021
Merged
Changes from all 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
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
}