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

Don't disable other container engines when --vm_driver=none #4545

Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 5 additions & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,11 @@ func configureRuntimes(runner cruntime.CommandRunner) cruntime.Manager {
exit.WithError(fmt.Sprintf("Failed runtime for %+v", config), err)
}

err = cr.Enable()
disableOthers := true
if viper.GetString(vmDriver) == constants.DriverNone {
disableOthers = false
}
err = cr.Enable(disableOthers)
if err != nil {
exit.WithError("Failed to enable container runtime", err)
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/minikube/cruntime/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ func (r *Containerd) Available() error {
}

// Enable idempotently enables containerd on a host
func (r *Containerd) Enable() error {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
func (r *Containerd) Enable(disableOtherContainerEngines bool) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer shorter variable names for a short scope, such as disableOthers. Leave the long variable names for globals.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, although I agree, I can't do it. We have a function called disableOthers already.
I can't think about another good short name.
Do you have any suggestions ?

if disableOtherContainerEngines {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
}
}
if err := populateCRIConfig(r.Runner, r.SocketPath()); err != nil {
return err
Expand Down
8 changes: 5 additions & 3 deletions pkg/minikube/cruntime/crio.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ func (r *CRIO) Active() bool {
}

// Enable idempotently enables CRIO on a host
func (r *CRIO) Enable() error {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
func (r *CRIO) Enable(disableOtherContainerEngines bool) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets change disableOtherContainerEngines to disOthers

if disableOtherContainerEngines {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
}
}
if err := populateCRIConfig(r.Runner, r.SocketPath()); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/cruntime/cruntime.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Manager interface {
// Version retrieves the current version of this runtime
Version() (string, error)
// Enable idempotently enables this runtime on a host
Enable() error
Enable(bool) error
// Disable idempotently disables this runtime on a host
Disable() error
// Active returns whether or not a runtime is active on a host
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/cruntime/cruntime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func TestEnable(t *testing.T) {
if err != nil {
t.Fatalf("New(%s): %v", tc.runtime, err)
}
err = cr.Enable()
err = cr.Enable(true)
if err != nil {
t.Errorf("%s disable unexpected error: %v", tc.runtime, err)
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/minikube/cruntime/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ func (r *Docker) Active() bool {
}

// Enable idempotently enables Docker on a host
func (r *Docker) Enable() error {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
func (r *Docker) Enable(disableOtherContainerEngines bool) error {
if disableOtherContainerEngines {
if err := disableOthers(r, r.Runner); err != nil {
glog.Warningf("disableOthers: %v", err)
}
}
return r.Runner.Run("sudo systemctl start docker")
}
Expand Down