Skip to content

Commit

Permalink
More cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorenc authored and dlorenc committed Jun 14, 2017
1 parent 2486a8b commit 09f683b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 32 deletions.
2 changes: 0 additions & 2 deletions cmd/minikube/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -56,7 +55,6 @@ const (

var (
enableUpdateNotification = true
clientType machine.ClientType
)

var viperWhiteList = []string{
Expand Down
22 changes: 2 additions & 20 deletions pkg/minikube/machine/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down
1 change: 0 additions & 1 deletion pkg/minikube/machine/client_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

var driverMap = map[string]driverGetter{
"vmwarefusion": getVMWareFusionDriver,
"xhyve": getXhyveDriver,
"virtualbox": getVirtualboxDriver,
}

Expand Down
8 changes: 0 additions & 8 deletions pkg/minikube/machine/client_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
5 changes: 4 additions & 1 deletion pkg/minikube/machine/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 09f683b

Please sign in to comment.