changing string driver name to checked type
parent
6aa51c1abb
commit
6d57b28fdd
|
@ -56,7 +56,7 @@ associated files.`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the case of "none", we want to uninstall Kubernetes as there is no VM to delete
|
// In the case of "none", we want to uninstall Kubernetes as there is no VM to delete
|
||||||
if err == nil && cc.MachineConfig.VMDriver == "none" {
|
if err == nil && cc.MachineConfig.VMDriver == constants.DriverNone {
|
||||||
kc := cc.KubernetesConfig
|
kc := cc.KubernetesConfig
|
||||||
bsName := viper.GetString(cmdcfg.Bootstrapper)
|
bsName := viper.GetString(cmdcfg.Bootstrapper)
|
||||||
console.OutStyle(console.Resetting, "Uninstalling Kubernetes %s using %s ...", kc.KubernetesVersion, bsName)
|
console.OutStyle(console.Resetting, "Uninstalling Kubernetes %s using %s ...", kc.KubernetesVersion, bsName)
|
||||||
|
|
|
@ -35,6 +35,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/minikube/pkg/minikube/cluster"
|
"k8s.io/minikube/pkg/minikube/cluster"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/exit"
|
"k8s.io/minikube/pkg/minikube/exit"
|
||||||
"k8s.io/minikube/pkg/minikube/machine"
|
"k8s.io/minikube/pkg/minikube/machine"
|
||||||
)
|
)
|
||||||
|
@ -342,7 +343,7 @@ var dockerEnvCmd = &cobra.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit.WithError("Error getting host", err)
|
exit.WithError("Error getting host", err)
|
||||||
}
|
}
|
||||||
if host.Driver.DriverName() == "none" {
|
if host.Driver.DriverName() == constants.DriverNone {
|
||||||
exit.Usage(`'none' driver does not support 'minikube docker-env' command`)
|
exit.Usage(`'none' driver does not support 'minikube docker-env' command`)
|
||||||
}
|
}
|
||||||
hostSt, err := cluster.GetHostStatus(api)
|
hostSt, err := cluster.GetHostStatus(api)
|
||||||
|
|
|
@ -102,7 +102,7 @@ var mountCmd = &cobra.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit.WithError("Error loading api", err)
|
exit.WithError("Error loading api", err)
|
||||||
}
|
}
|
||||||
if host.Driver.DriverName() == "none" {
|
if host.Driver.DriverName() == constants.DriverNone {
|
||||||
exit.Usage(`'none' driver does not support 'minikube mount' command`)
|
exit.Usage(`'none' driver does not support 'minikube mount' command`)
|
||||||
}
|
}
|
||||||
var ip net.IP
|
var ip net.IP
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"k8s.io/minikube/pkg/minikube/cluster"
|
"k8s.io/minikube/pkg/minikube/cluster"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/console"
|
"k8s.io/minikube/pkg/minikube/console"
|
||||||
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/exit"
|
"k8s.io/minikube/pkg/minikube/exit"
|
||||||
"k8s.io/minikube/pkg/minikube/machine"
|
"k8s.io/minikube/pkg/minikube/machine"
|
||||||
)
|
)
|
||||||
|
@ -42,7 +43,7 @@ var sshCmd = &cobra.Command{
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit.WithError("Error getting host", err)
|
exit.WithError("Error getting host", err)
|
||||||
}
|
}
|
||||||
if host.Driver.DriverName() == "none" {
|
if host.Driver.DriverName() == constants.DriverNone {
|
||||||
exit.Usage("'none' driver does not support 'minikube ssh' command")
|
exit.Usage("'none' driver does not support 'minikube ssh' command")
|
||||||
}
|
}
|
||||||
err = cluster.CreateSSHShell(api, args)
|
err = cluster.CreateSSHShell(api, args)
|
||||||
|
|
|
@ -27,10 +27,11 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/util/net"
|
"k8s.io/apimachinery/pkg/util/net"
|
||||||
pkgdrivers "k8s.io/minikube/pkg/drivers" // TODO(tstromberg): Extract CommandRunner into its own package
|
pkgdrivers "k8s.io/minikube/pkg/drivers" // TODO(tstromberg): Extract CommandRunner into its own package
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
||||||
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/cruntime"
|
"k8s.io/minikube/pkg/minikube/cruntime"
|
||||||
)
|
)
|
||||||
|
|
||||||
const driverName = "none"
|
const driverName = constants.DriverNone
|
||||||
|
|
||||||
// cleanupPaths are paths to be removed by cleanup, and are used by both kubeadm and minikube.
|
// cleanupPaths are paths to be removed by cleanup, and are used by both kubeadm and minikube.
|
||||||
var cleanupPaths = []string{
|
var cleanupPaths = []string{
|
||||||
|
|
|
@ -72,7 +72,7 @@ func init() {
|
||||||
|
|
||||||
// CacheISO downloads and caches ISO.
|
// CacheISO downloads and caches ISO.
|
||||||
func CacheISO(config cfg.MachineConfig) error {
|
func CacheISO(config cfg.MachineConfig) error {
|
||||||
if config.VMDriver != "none" {
|
if config.MachineConfig.VMDriver == constants.DriverNone {
|
||||||
if err := config.Downloader.CacheMinikubeISOFromURL(config.MinikubeISO); err != nil {
|
if err := config.Downloader.CacheMinikubeISOFromURL(config.MinikubeISO); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ func configureHost(h *host.Host, e *engine.Options) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.Driver.DriverName() != "none" {
|
if h.Driver.DriverName() != constants.DriverNone {
|
||||||
if err := h.ConfigureAuth(); err != nil {
|
if err := h.ConfigureAuth(); err != nil {
|
||||||
return &util.RetriableError{Err: errors.Wrap(err, "Error configuring auth on host")}
|
return &util.RetriableError{Err: errors.Wrap(err, "Error configuring auth on host")}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := registry.Register(registry.DriverDef{
|
if err := registry.Register(registry.DriverDef{
|
||||||
Name: "none",
|
Name: constants.DriverNone,
|
||||||
Builtin: true,
|
Builtin: true,
|
||||||
ConfigCreator: createNoneHost,
|
ConfigCreator: createNoneHost,
|
||||||
DriverCreator: func() drivers.Driver {
|
DriverCreator: func() drivers.Driver {
|
||||||
|
|
|
@ -189,7 +189,7 @@ func (api *LocalClient) Create(h *host.Host) error {
|
||||||
{
|
{
|
||||||
"waiting",
|
"waiting",
|
||||||
func() error {
|
func() error {
|
||||||
if h.Driver.DriverName() == "none" {
|
if h.Driver.DriverName() == constants.DriverNone {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return mcnutils.WaitFor(drivers.MachineInState(h.Driver, state.Running))
|
return mcnutils.WaitFor(drivers.MachineInState(h.Driver, state.Running))
|
||||||
|
@ -198,7 +198,7 @@ func (api *LocalClient) Create(h *host.Host) error {
|
||||||
{
|
{
|
||||||
"provisioning",
|
"provisioning",
|
||||||
func() error {
|
func() error {
|
||||||
if h.Driver.DriverName() == "none" {
|
if h.Driver.DriverName() == constants.DriverNone {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
pv := provision.NewBuildrootProvisioner(h.Driver)
|
pv := provision.NewBuildrootProvisioner(h.Driver)
|
||||||
|
|
Loading…
Reference in New Issue