More cleanup.
parent
2486a8b612
commit
09f683bb1d
|
@ -33,7 +33,6 @@ import (
|
|||
"k8s.io/minikube/cmd/util"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/machine"
|
||||
"k8s.io/minikube/pkg/minikube/notify"
|
||||
)
|
||||
|
||||
|
@ -56,7 +55,6 @@ const (
|
|||
|
||||
var (
|
||||
enableUpdateNotification = true
|
||||
clientType machine.ClientType
|
||||
)
|
||||
|
||||
var viperWhiteList = []string{
|
||||
|
|
|
@ -49,25 +49,7 @@ import (
|
|||
|
||||
type driverGetter func([]byte) (drivers.Driver, error)
|
||||
|
||||
type ClientType int
|
||||
type clientFactory interface {
|
||||
NewClient(string, string) libmachine.API
|
||||
}
|
||||
|
||||
type localClientFactory struct{}
|
||||
|
||||
func (*localClientFactory) NewClient(storePath, certsDir string) libmachine.API {
|
||||
return &LocalClient{
|
||||
certsDir: certsDir,
|
||||
storePath: storePath,
|
||||
Filestore: persist.NewFilestore(storePath, certsDir, certsDir),
|
||||
legacyClient: (&rpcClientFactory{}).NewClient(storePath, certsDir),
|
||||
}
|
||||
}
|
||||
|
||||
type rpcClientFactory struct{}
|
||||
|
||||
func (*rpcClientFactory) NewClient(storePath, certsDir string) libmachine.API {
|
||||
func NewRPCClient(storePath, certsDir string) libmachine.API {
|
||||
c := libmachine.NewClient(storePath, certsDir)
|
||||
c.SSHClientType = ssh.Native
|
||||
return c
|
||||
|
@ -82,7 +64,7 @@ func NewAPIClient() (libmachine.API, error) {
|
|||
certsDir: certsDir,
|
||||
storePath: storePath,
|
||||
Filestore: persist.NewFilestore(storePath, certsDir, certsDir),
|
||||
legacyClient: (&rpcClientFactory{}).NewClient(storePath, certsDir),
|
||||
legacyClient: NewRPCClient(storePath, certsDir),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import (
|
|||
|
||||
var driverMap = map[string]driverGetter{
|
||||
"vmwarefusion": getVMWareFusionDriver,
|
||||
"xhyve": getXhyveDriver,
|
||||
"virtualbox": getVirtualboxDriver,
|
||||
}
|
||||
|
||||
|
|
|
@ -28,18 +28,10 @@ import (
|
|||
)
|
||||
|
||||
var driverMap = map[string]driverGetter{
|
||||
"kvm": getKVMDriver,
|
||||
"virtualbox": getVirtualboxDriver,
|
||||
"none": getNoneDriver,
|
||||
}
|
||||
|
||||
func getKVMDriver(rawDriver []byte) (drivers.Driver, error) {
|
||||
return nil, errors.New(`
|
||||
The KVM driver is not included in minikube yet. Please follow the direction at
|
||||
https://github.com/kubernetes/minikube/blob/master/DRIVERS.md#kvm-driver
|
||||
`)
|
||||
}
|
||||
|
||||
func getNoneDriver(rawDriver []byte) (drivers.Driver, error) {
|
||||
var driver drivers.Driver
|
||||
driver = &none.Driver{}
|
||||
|
|
|
@ -116,7 +116,10 @@ func TestGetDriver(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLocalClientNewHost(t *testing.T) {
|
||||
c := (&localClientFactory{}).NewClient("", "")
|
||||
c, err := NewAPIClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var tests = []struct {
|
||||
description string
|
||||
|
|
Loading…
Reference in New Issue