addres review comments
parent
43cf3fa826
commit
7f3b2c2a7b
|
@ -44,5 +44,4 @@ spec:
|
|||
mountPath: /usr/local/etc/haproxy/haproxy.cfg
|
||||
readOnly: true
|
||||
- name: lua-script
|
||||
mountPath: /etc/haproxy/unpause.lua
|
||||
---
|
||||
mountPath: /etc/haproxy/unpause.lua
|
|
@ -18,7 +18,6 @@ package addons
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
"sort"
|
||||
|
@ -47,6 +46,7 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/reason"
|
||||
"k8s.io/minikube/pkg/minikube/storageclass"
|
||||
"k8s.io/minikube/pkg/minikube/style"
|
||||
"k8s.io/minikube/pkg/minikube/sysinit"
|
||||
"k8s.io/minikube/pkg/util/retry"
|
||||
)
|
||||
|
||||
|
@ -210,8 +210,7 @@ https://github.com/kubernetes/minikube/issues/7332`, out.V{"driver_name": cc.Dri
|
|||
}
|
||||
|
||||
if name == "auto-pause" && !enable { // needs to be disabled before deleting the service file in the internal disable
|
||||
cmd := exec.Command("sudo", "systemctl", "disable", "--now", "auto-pause")
|
||||
if _, err := runner.RunCmd(cmd); err != nil {
|
||||
if err := sysinit.New(runner).DisableNow("auto-pause"); err != nil {
|
||||
klog.ErrorS(err, "failed to disable", "service", "auto-pause")
|
||||
}
|
||||
}
|
||||
|
@ -453,12 +452,9 @@ func enableOrDisableAutoPause(cc *config.ClusterConfig, name string, val string)
|
|||
return errors.Wrapf(err, "parsing bool: %s", name)
|
||||
}
|
||||
co := mustload.Running(cc.Name)
|
||||
r := co.CP.Runner
|
||||
if enable {
|
||||
cmd := exec.Command("sudo", "systemctl", "enable", "--now", "auto-pause")
|
||||
if _, err := r.RunCmd(cmd); err != nil {
|
||||
if err := sysinit.New(co.CP.Runner).EnableNow("auto-pause"); err != nil {
|
||||
klog.ErrorS(err, "failed to enable", "service", "auto-pause")
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,11 +117,21 @@ func (s *OpenRC) Disable(svc string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// DisableNow not implemented for openRC
|
||||
func (s *OpenRC) DisableNow(svc string) error {
|
||||
return fmt.Errorf("DisableNow not implemented for OpenRC! PRs to fix are welcomed.")
|
||||
}
|
||||
|
||||
// Enable does nothing
|
||||
func (s *OpenRC) Enable(svc string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EnableNow not implemented for openRC
|
||||
func (s *OpenRC) EnableNow(svc string) error {
|
||||
return fmt.Errorf("EnableNow not implemented for OpenRC! PRs to fix are welcomed.")
|
||||
}
|
||||
|
||||
// Restart restarts a service
|
||||
func (s *OpenRC) Restart(svc string) error {
|
||||
rr, err := s.r.RunCmd(exec.Command("sudo", "service", svc, "restart"))
|
||||
|
|
|
@ -41,9 +41,15 @@ type Manager interface {
|
|||
// Disable disables a service
|
||||
Disable(string) error
|
||||
|
||||
// Disable disables a service and stops it right after.
|
||||
DisableNow(string) error
|
||||
|
||||
// Enable enables a service
|
||||
Enable(string) error
|
||||
|
||||
// EnableNow enables a service and starts it right after.
|
||||
EnableNow(string) error
|
||||
|
||||
// Start starts a service idempotently
|
||||
Start(string) error
|
||||
|
||||
|
|
|
@ -52,6 +52,12 @@ func (s *Systemd) Disable(svc string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// DisableNow disables a service and stops it too (not waiting for next restart)
|
||||
func (s *Systemd) DisableNow(svc string) error {
|
||||
_, err := s.r.RunCmd(exec.Command("sudo", "systemctl", "disable", "--now", svc))
|
||||
return err
|
||||
}
|
||||
|
||||
// Enable enables a service
|
||||
func (s *Systemd) Enable(svc string) error {
|
||||
if svc == "kubelet" {
|
||||
|
@ -61,6 +67,15 @@ func (s *Systemd) Enable(svc string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Enable enables a service and then activates it too (not waiting for next start)
|
||||
func (s *Systemd) EnableNow(svc string) error {
|
||||
if svc == "kubelet" {
|
||||
return errors.New("please don't enable kubelet as it creates a race condition; if it starts on systemd boot it will pick up /etc/hosts before we have time to configure /etc/hosts")
|
||||
}
|
||||
_, err := s.r.RunCmd(exec.Command("sudo", "systemctl", "enable", "--now", svc))
|
||||
return err
|
||||
}
|
||||
|
||||
// Start starts a service
|
||||
func (s *Systemd) Start(svc string) error {
|
||||
if err := s.daemonReload(); err != nil {
|
||||
|
|
Loading…
Reference in New Issue