Skip to content

Commit

Permalink
Rename the error as 'ErrContainerRuntimeNotRunning', and move it to p…
Browse files Browse the repository at this point in the history
…ackage cruntime.
  • Loading branch information
hetong07 committed Feb 8, 2021
1 parent 18580c2 commit c19451e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 0 additions & 3 deletions pkg/drivers/kic/oci/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ func (f *FailFastError) Error() string {
return f.Err.Error()
}

// ErrDockerRuntimeNotRunning is thrown when docker runtime is not running
var ErrDockerRuntimeNotRunning = &FailFastError{errors.New("docker runtime is not running")}

// ErrWindowsContainers is thrown when docker been configured to run windows containers instead of Linux
var ErrWindowsContainers = &FailFastError{errors.New("docker container type is windows")}

Expand Down
3 changes: 1 addition & 2 deletions pkg/minikube/bootstrapper/bsutil/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/blang/semver"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/ktmpl"
"k8s.io/minikube/pkg/minikube/cni"
"k8s.io/minikube/pkg/minikube/config"
Expand Down Expand Up @@ -65,7 +64,7 @@ func GenerateKubeadmYAML(cc config.ClusterConfig, n config.Node, r cruntime.Mana
cgroupDriver, err := r.CGroupDriver()
if err != nil {
if !r.Active() {
return nil, oci.ErrDockerRuntimeNotRunning
return nil, cruntime.ErrContainerRuntimeNotRunning
}
return nil, errors.Wrap(err, "getting cgroup driver")
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/minikube/cruntime/cruntime.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import (
"os/exec"

"github.com/blang/semver"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
Expand Down Expand Up @@ -142,6 +144,9 @@ type ListOptions struct {
Namespaces []string
}

// ErrContainerRuntimeNotRunning is thrown when docker runtime is not running
var ErrContainerRuntimeNotRunning = &oci.FailFastError{Err: errors.New("container runtime is not running")}

// New returns an appropriately configured runtime
func New(c Config) (Manager, error) {
sm := sysinit.New(c.Runner)
Expand Down
4 changes: 2 additions & 2 deletions pkg/minikube/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ func setupKubeAdm(mAPI libmachine.API, cfg config.ClusterConfig, n config.Node,
// update cluster and set up certs

if err := bs.UpdateCluster(cfg); err != nil {
if errors.Is(err, oci.ErrDockerRuntimeNotRunning) {
exit.Message(reason.EnvDockerUnavailable, "Docker runtime is not running.")
if errors.Is(err, cruntime.ErrContainerRuntimeNotRunning) {
exit.Message(reason.EnvDockerUnavailable, "Container runtime is not running.")
}
exit.Error(reason.KubernetesInstallFailed, "Failed to update cluster", err)
}
Expand Down

0 comments on commit c19451e

Please sign in to comment.