Pass lint checks
parent
15daa48ed7
commit
7cb0cfdf79
|
@ -22,11 +22,11 @@ import (
|
|||
|
||||
"k8s.io/minikube/pkg/minikube/assets"
|
||||
pkgConfig "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
)
|
||||
|
||||
var minikubeConfig = pkgConfig.MinikubeConfig{
|
||||
"vm-driver": constants.KVM2,
|
||||
"vm-driver": driver.KVM2,
|
||||
"cpus": 12,
|
||||
"show-libmachine-logs": true,
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func TestFindSetting(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSetString(t *testing.T) {
|
||||
err := SetString(minikubeConfig, "vm-driver", constants.VirtualBox)
|
||||
err := SetString(minikubeConfig, "vm-driver", driver.VirtualBox)
|
||||
if err != nil {
|
||||
t.Fatalf("Couldn't set string: %v", err)
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ func TestDeleteProfileWithValidConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
if files, _ := ioutil.ReadDir(filepath.Join(localpath.MiniPath(), "machines")); len(files) != (numberOfMachineDirs - 1) {
|
||||
t.Fatal("Did not delete exactly one profile")
|
||||
t.Fatal("Did not delete exactly one machine")
|
||||
}
|
||||
|
||||
viper.Set(config.MachineProfile, "")
|
||||
|
@ -444,18 +444,14 @@ func TestDeleteAllProfiles(t *testing.T) {
|
|||
t.Errorf("error setting up test environment. could not set %s", localpath.MinikubeHome)
|
||||
}
|
||||
|
||||
files, _ := ioutil.ReadDir(filepath.Join(localpath.MiniPath(), "profiles"))
|
||||
numberOfProfileDirs := len(files)
|
||||
pFiles, _ := ioutil.ReadDir(filepath.Join(localpath.MiniPath(), "profiles"))
|
||||
mFiles, _ = ioutil.ReadDir(filepath.Join(localpath.MiniPath(), "machines"))
|
||||
|
||||
files, _ = ioutil.ReadDir(filepath.Join(localpath.MiniPath(), "machines"))
|
||||
numberOfMachineDirs := len(files)
|
||||
|
||||
if numberOfTotalProfileDirs != numberOfProfileDirs {
|
||||
t.Error("invalid testdata")
|
||||
if numberOfTotalProfileDirs != len(pFiles) {
|
||||
t.Error("got %d test profiles, expected %d: %s", numberOfTotalProfileDirs, len(pFiles), pFiles)
|
||||
}
|
||||
|
||||
if numberOfTotalMachineDirs != numberOfMachineDirs {
|
||||
t.Error("invalid testdata")
|
||||
t.Error("got %d test machines, expected %d: %s", numberOfTotalMachineDirs, len(mFiles), mFiles)
|
||||
}
|
||||
|
||||
validProfiles, inValidProfiles, err := config.ListProfiles()
|
||||
|
@ -465,7 +461,7 @@ func TestDeleteAllProfiles(t *testing.T) {
|
|||
}
|
||||
|
||||
if numberOfTotalProfileDirs != len(validProfiles)+len(inValidProfiles) {
|
||||
t.Error("invalid testdata")
|
||||
t.Error("ListProfiles length = %d, expected %d", len(validProfiles)+len(inValidProfiles), numberOfTotalProfileDirs)
|
||||
}
|
||||
|
||||
profiles := append(validProfiles, inValidProfiles...)
|
||||
|
|
|
@ -976,8 +976,7 @@ func validateNetwork(h *host.Host, r command.Runner) string {
|
|||
}
|
||||
}
|
||||
|
||||
// none driver does not need ssh access
|
||||
if h.Driver.DriverName() != constants.DriverNone {
|
||||
if driver.BareMetal(h.Driver.DriverName()) {
|
||||
sshAddr := fmt.Sprintf("%s:22", ip)
|
||||
conn, err := net.Dial("tcp", sshAddr)
|
||||
if err != nil {
|
||||
|
|
1
go.mod
1
go.mod
|
@ -25,7 +25,6 @@ require (
|
|||
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
|
||||
github.com/google/go-cmp v0.3.0
|
||||
github.com/google/go-github/v25 v25.0.2 // indirect
|
||||
github.com/gorilla/mux v1.7.1 // indirect
|
||||
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect
|
||||
github.com/hashicorp/go-getter v1.3.0
|
||||
|
|
3
go.sum
3
go.sum
|
@ -195,8 +195,6 @@ github.com/google/go-containerregistry v0.0.0-20180731221751-697ee0b3d46e h1:Hm0
|
|||
github.com/google/go-containerregistry v0.0.0-20180731221751-697ee0b3d46e/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk=
|
||||
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
|
||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-github/v25 v25.0.2 h1:MqXE7nOlIF91NJ/PXAcvS2dC+XXCDbY7RvJzjyEPAoU=
|
||||
github.com/google/go-github/v25 v25.0.2/go.mod h1:6z5pC69qHtrPJ0sXPsj4BLnd82b+r6sLB7qcBoRZqpw=
|
||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
||||
|
@ -558,7 +556,6 @@ golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5Tlb
|
|||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
|
|
@ -48,27 +48,3 @@ func Test_createDiskImage(t *testing.T) {
|
|||
t.Errorf("Disk size is %v, want %v", fi.Size(), sizeInBytes)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractVMDriverVersion(t *testing.T) {
|
||||
v := extractVMDriverVersion("")
|
||||
if len(v) != 0 {
|
||||
t.Error("Expected empty string")
|
||||
}
|
||||
|
||||
v = extractVMDriverVersion("random text")
|
||||
if len(v) != 0 {
|
||||
t.Error("Expected empty string")
|
||||
}
|
||||
|
||||
expectedVersion := "1.2.3"
|
||||
|
||||
v = extractVMDriverVersion("version: v1.2.3")
|
||||
if expectedVersion != v {
|
||||
t.Errorf("Expected version: %s, got: %s", expectedVersion, v)
|
||||
}
|
||||
|
||||
v = extractVMDriverVersion("version: 1.2.3")
|
||||
if expectedVersion != v {
|
||||
t.Errorf("Expected version: %s, got: %s", expectedVersion, v)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,6 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)
|
|||
return h, nil
|
||||
}
|
||||
|
||||
|
||||
// configureHost handles any post-powerup configuration required
|
||||
func configureHost(h *host.Host, e *engine.Options) error {
|
||||
start := time.Now()
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
)
|
||||
|
||||
type configTestCase struct {
|
||||
|
@ -51,7 +51,7 @@ var configTestCases = []configTestCase{
|
|||
"vm-driver": "kvm2"
|
||||
}`,
|
||||
config: map[string]interface{}{
|
||||
"vm-driver": constants.KVM2,
|
||||
"vm-driver": driver.KVM2,
|
||||
"cpus": 4,
|
||||
"disk-size": "20g",
|
||||
"v": 5,
|
||||
|
@ -132,7 +132,7 @@ func TestReadConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
expectedConfig := map[string]interface{}{
|
||||
"vm-driver": constants.KVM2,
|
||||
"vm-driver": driver.KVM2,
|
||||
"cpus": 4,
|
||||
"disk-size": "20g",
|
||||
"show-libmachine-logs": true,
|
||||
|
@ -151,7 +151,7 @@ func TestWriteConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
cfg := map[string]interface{}{
|
||||
"vm-driver": constants.KVM2,
|
||||
"vm-driver": driver.KVM2,
|
||||
"cpus": 4,
|
||||
"disk-size": "20g",
|
||||
"show-libmachine-logs": true,
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package driver
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package driver
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package driver
|
||||
|
||||
import "os/exec"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package driver
|
||||
|
||||
import (
|
||||
|
@ -10,8 +26,8 @@ import (
|
|||
|
||||
"github.com/blang/semver"
|
||||
"github.com/golang/glog"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/hashicorp/go-getter"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/out"
|
||||
"k8s.io/minikube/pkg/util"
|
||||
|
|
|
@ -27,9 +27,10 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers/plugin/localbinary"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
_ "k8s.io/minikube/pkg/minikube/drivers/virtualbox"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
_ "k8s.io/minikube/pkg/minikube/registry/drvs/virtualbox"
|
||||
)
|
||||
|
||||
const vboxConfig = `
|
||||
|
@ -77,12 +78,12 @@ func TestLocalClientNewHost(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
description: "host vbox correct",
|
||||
driver: constants.VirtualBox,
|
||||
driver: driver.VirtualBox,
|
||||
rawDriver: []byte(vboxConfig),
|
||||
},
|
||||
{
|
||||
description: "host vbox incorrect",
|
||||
driver: constants.VirtualBox,
|
||||
driver: driver.VirtualBox,
|
||||
rawDriver: []byte("?"),
|
||||
err: true,
|
||||
},
|
||||
|
@ -138,7 +139,7 @@ func TestRunDriver(t *testing.T) {
|
|||
defer os.RemoveAll(tempDir)
|
||||
|
||||
os.Setenv(localbinary.PluginEnvKey, localbinary.PluginEnvVal)
|
||||
os.Setenv(localbinary.PluginEnvDriverName, constants.VirtualBox)
|
||||
os.Setenv(localbinary.PluginEnvDriverName, driver.VirtualBox)
|
||||
|
||||
// Capture stdout and reset it later.
|
||||
old := os.Stdout
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"github.com/pborman/uuid"
|
||||
"k8s.io/minikube/pkg/drivers/hyperkit"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/docker/machine/drivers/hyperv"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package drvs
|
||||
|
||||
import (
|
||||
|
|
|
@ -23,15 +23,15 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := registry.Register(registry.DriverDef{
|
||||
Name: constants.KVM2,
|
||||
Name: driver.KVM2,
|
||||
Builtin: false,
|
||||
ConfigCreator: createKVM2Host,
|
||||
}); err != nil {
|
||||
|
@ -57,23 +57,24 @@ type kvmDriver struct {
|
|||
ConnectionURI string
|
||||
}
|
||||
|
||||
func createKVM2Host(config cfg.MachineConfig) interface{} {
|
||||
func createKVM2Host(mc config.MachineConfig) interface{} {
|
||||
name := config.GetMachineName()
|
||||
return &kvmDriver{
|
||||
BaseDriver: &drivers.BaseDriver{
|
||||
MachineName: cfg.GetMachineName(),
|
||||
MachineName: name,
|
||||
StorePath: localpath.MiniPath(),
|
||||
SSHUser: "docker",
|
||||
},
|
||||
Memory: config.Memory,
|
||||
CPU: config.CPUs,
|
||||
Network: config.KVMNetwork,
|
||||
Memory: mc.Memory,
|
||||
CPU: mc.CPUs,
|
||||
Network: mc.KVMNetwork,
|
||||
PrivateNetwork: "minikube-net",
|
||||
Boot2DockerURL: config.Downloader.GetISOFileURI(config.MinikubeISO),
|
||||
DiskSize: config.DiskSize,
|
||||
DiskPath: filepath.Join(localpath.MiniPath(), "machines", cfg.GetMachineName(), fmt.Sprintf("%s.rawdisk", cfg.GetMachineName())),
|
||||
ISO: filepath.Join(localpath.MiniPath(), "machines", cfg.GetMachineName(), "boot2docker.iso"),
|
||||
GPU: config.KVMGPU,
|
||||
Hidden: config.KVMHidden,
|
||||
ConnectionURI: config.KVMQemuURI,
|
||||
Boot2DockerURL: mc.Downloader.GetISOFileURI(mc.MinikubeISO),
|
||||
DiskSize: mc.DiskSize,
|
||||
DiskPath: filepath.Join(localpath.MiniPath(), "machines", name, fmt.Sprintf("%s.rawdisk", name)),
|
||||
ISO: filepath.Join(localpath.MiniPath(), "machines", name, "boot2docker.iso"),
|
||||
GPU: mc.KVMGPU,
|
||||
Hidden: mc.KVMHidden,
|
||||
ConnectionURI: mc.KVMQemuURI,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,19 +18,18 @@ package none
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"k8s.io/minikube/pkg/drivers/none"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := registry.Register(registry.DriverDef{
|
||||
Name: constants.None,
|
||||
Name: driver.None,
|
||||
Builtin: true,
|
||||
ConfigCreator: createNoneHost,
|
||||
DriverCreator: func() drivers.Driver {
|
||||
|
@ -42,11 +41,10 @@ func init() {
|
|||
}
|
||||
|
||||
// createNoneHost creates a none Driver from a MachineConfig
|
||||
func createNoneHost(config cfg.MachineConfig) interface{} {
|
||||
func createNoneHost(mc config.MachineConfig) interface{} {
|
||||
return none.NewDriver(none.Config{
|
||||
MachineName: cfg.GetMachineName(),
|
||||
MachineName: config.GetMachineName(),
|
||||
StorePath: localpath.MiniPath(),
|
||||
ContainerRuntime: config.ContainerRuntime,
|
||||
ContainerRuntime: mc.ContainerRuntime,
|
||||
})
|
||||
}
|
||||
0
|
|
@ -21,8 +21,8 @@ import (
|
|||
|
||||
"github.com/docker/machine/drivers/virtualbox"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
@ -31,7 +31,7 @@ const defaultVirtualboxNicType = "virtio"
|
|||
|
||||
func init() {
|
||||
err := registry.Register(registry.DriverDef{
|
||||
Name: constants.VirtualBox,
|
||||
Name: driver.VirtualBox,
|
||||
Builtin: true,
|
||||
ConfigCreator: createVirtualboxHost,
|
||||
DriverCreator: func() drivers.Driver {
|
||||
|
@ -43,20 +43,20 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
func createVirtualboxHost(config cfg.MachineConfig) interface{} {
|
||||
d := virtualbox.NewDriver(cfg.GetMachineName(), localpath.MiniPath())
|
||||
func createVirtualboxHost(mc config.MachineConfig) interface{} {
|
||||
d := virtualbox.NewDriver(config.GetMachineName(), localpath.MiniPath())
|
||||
|
||||
d.Boot2DockerURL = config.Downloader.GetISOFileURI(config.MinikubeISO)
|
||||
d.Memory = config.Memory
|
||||
d.CPU = config.CPUs
|
||||
d.DiskSize = config.DiskSize
|
||||
d.HostOnlyCIDR = config.HostOnlyCIDR
|
||||
d.NoShare = config.DisableDriverMounts
|
||||
d.NoVTXCheck = config.NoVTXCheck
|
||||
d.Boot2DockerURL = mc.Downloader.GetISOFileURI(mc.MinikubeISO)
|
||||
d.Memory = mc.Memory
|
||||
d.CPU = mc.CPUs
|
||||
d.DiskSize = mc.DiskSize
|
||||
d.HostOnlyCIDR = mc.HostOnlyCIDR
|
||||
d.NoShare = mc.DisableDriverMounts
|
||||
d.NoVTXCheck = mc.NoVTXCheck
|
||||
d.NatNicType = defaultVirtualboxNicType
|
||||
d.HostOnlyNicType = defaultVirtualboxNicType
|
||||
d.DNSProxy = config.DNSProxy
|
||||
d.HostDNSResolver = config.HostDNSResolver
|
||||
d.DNSProxy = mc.DNSProxy
|
||||
d.HostDNSResolver = mc.HostDNSResolver
|
||||
|
||||
return d
|
||||
}
|
||||
|
|
|
@ -20,15 +20,15 @@ import (
|
|||
"fmt"
|
||||
|
||||
vmwcfg "github.com/machine-drivers/docker-machine-driver-vmware/pkg/drivers/vmware/config"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
err := registry.Register(registry.DriverDef{
|
||||
Name: constants.VMware,
|
||||
Name: driver.VMware,
|
||||
Builtin: false,
|
||||
ConfigCreator: createVMwareHost,
|
||||
})
|
||||
|
@ -37,12 +37,12 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
func createVMwareHost(config cfg.MachineConfig) interface{} {
|
||||
d := vmwcfg.NewConfig(cfg.GetMachineName(), localpath.MiniPath())
|
||||
d.Boot2DockerURL = config.Downloader.GetISOFileURI(config.MinikubeISO)
|
||||
d.Memory = config.Memory
|
||||
d.CPU = config.CPUs
|
||||
d.DiskSize = config.DiskSize
|
||||
func createVMwareHost(mc config.MachineConfig) interface{} {
|
||||
d := vmwcfg.NewConfig(config.GetMachineName(), localpath.MiniPath())
|
||||
d.Boot2DockerURL = mc.Downloader.GetISOFileURI(mc.MinikubeISO)
|
||||
d.Memory = mc.Memory
|
||||
d.CPU = mc.CPUs
|
||||
d.DiskSize = mc.DiskSize
|
||||
|
||||
// TODO(frapposelli): push these defaults upstream to fixup this driver
|
||||
d.SSHPort = 22
|
||||
|
|
|
@ -24,14 +24,13 @@ import (
|
|||
"github.com/docker/machine/drivers/vmwarefusion"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := registry.Register(registry.DriverDef{
|
||||
Name: constants.VMwareFusion,
|
||||
Name: driver.VMwareFusion,
|
||||
Builtin: true,
|
||||
ConfigCreator: createVMwareFusionHost,
|
||||
DriverCreator: func() drivers.Driver {
|
||||
|
|
|
@ -19,8 +19,6 @@ package tests
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/docker/machine/libmachine/mcnflag"
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
|
@ -40,111 +38,111 @@ type MockDriver struct {
|
|||
}
|
||||
|
||||
// Logf logs mock interactions
|
||||
func (driver *MockDriver) Logf(format string, args ...interface{}) {
|
||||
if driver.T == nil {
|
||||
func (d *MockDriver) Logf(format string, args ...interface{}) {
|
||||
if d.T == nil {
|
||||
glog.Infof(format, args...)
|
||||
return
|
||||
}
|
||||
driver.T.Logf(format, args...)
|
||||
d.T.Logf(format, args...)
|
||||
}
|
||||
|
||||
// Create creates a MockDriver instance
|
||||
func (driver *MockDriver) Create() error {
|
||||
driver.Logf("MockDriver.Create")
|
||||
driver.CurrentState = state.Running
|
||||
func (d *MockDriver) Create() error {
|
||||
d.Logf("Mockd.Create")
|
||||
d.CurrentState = state.Running
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetIP returns the IP address
|
||||
func (driver *MockDriver) GetIP() (string, error) {
|
||||
driver.Logf("MockDriver.GetIP")
|
||||
if driver.IP != "" {
|
||||
return driver.IP, nil
|
||||
func (d *MockDriver) GetIP() (string, error) {
|
||||
d.Logf("Mockd.GetIP")
|
||||
if d.IP != "" {
|
||||
return d.IP, nil
|
||||
}
|
||||
if driver.BaseDriver.IPAddress != "" {
|
||||
return driver.BaseDriver.IPAddress, nil
|
||||
if d.BaseDriver.IPAddress != "" {
|
||||
return d.BaseDriver.IPAddress, nil
|
||||
}
|
||||
return "127.0.0.1", nil
|
||||
}
|
||||
|
||||
// GetCreateFlags returns the flags used to create a MockDriver
|
||||
func (driver *MockDriver) GetCreateFlags() []mcnflag.Flag {
|
||||
func (d *MockDriver) GetCreateFlags() []mcnflag.Flag {
|
||||
return []mcnflag.Flag{}
|
||||
}
|
||||
|
||||
// GetSSHPort returns the SSH port
|
||||
func (driver *MockDriver) GetSSHPort() (int, error) {
|
||||
return driver.Port, nil
|
||||
func (d *MockDriver) GetSSHPort() (int, error) {
|
||||
return d.Port, nil
|
||||
}
|
||||
|
||||
// GetSSHHostname returns the hostname for SSH
|
||||
func (driver *MockDriver) GetSSHHostname() (string, error) {
|
||||
if driver.HostError {
|
||||
func (d *MockDriver) GetSSHHostname() (string, error) {
|
||||
if d.HostError {
|
||||
return "", errors.New("error getting host")
|
||||
}
|
||||
return "localhost", nil
|
||||
}
|
||||
|
||||
// GetSSHKeyPath returns the key path for SSH
|
||||
func (driver *MockDriver) GetSSHKeyPath() string {
|
||||
return driver.BaseDriver.SSHKeyPath
|
||||
func (d *MockDriver) GetSSHKeyPath() string {
|
||||
return d.BaseDriver.SSHKeyPath
|
||||
}
|
||||
|
||||
// GetState returns the state of the driver
|
||||
func (driver *MockDriver) GetState() (state.State, error) {
|
||||
driver.Logf("MockDriver.GetState: %v", driver.CurrentState)
|
||||
return driver.CurrentState, nil
|
||||
func (d *MockDriver) GetState() (state.State, error) {
|
||||
d.Logf("Mockd.GetState: %v", d.CurrentState)
|
||||
return d.CurrentState, nil
|
||||
}
|
||||
|
||||
// GetURL returns the URL of the driver
|
||||
func (driver *MockDriver) GetURL() (string, error) {
|
||||
func (d *MockDriver) GetURL() (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Kill kills the machine
|
||||
func (driver *MockDriver) Kill() error {
|
||||
driver.Logf("MockDriver.Kill")
|
||||
driver.CurrentState = state.Stopped
|
||||
func (d *MockDriver) Kill() error {
|
||||
d.Logf("Mockd.Kill")
|
||||
d.CurrentState = state.Stopped
|
||||
return nil
|
||||
}
|
||||
|
||||
// Remove removes the machine
|
||||
func (driver *MockDriver) Remove() error {
|
||||
driver.Logf("MockDriver.Remove")
|
||||
if driver.RemoveError {
|
||||
func (d *MockDriver) Remove() error {
|
||||
d.Logf("Mockd.Remove")
|
||||
if d.RemoveError {
|
||||
return errors.New("error deleting machine")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Restart restarts the machine
|
||||
func (driver *MockDriver) Restart() error {
|
||||
driver.Logf("MockDriver.Restart")
|
||||
driver.CurrentState = state.Running
|
||||
func (d *MockDriver) Restart() error {
|
||||
d.Logf("Mockd.Restart")
|
||||
d.CurrentState = state.Running
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetConfigFromFlags sets the machine config
|
||||
func (driver *MockDriver) SetConfigFromFlags(opts drivers.DriverOptions) error {
|
||||
func (d *MockDriver) SetConfigFromFlags(opts drivers.DriverOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Start starts the machine
|
||||
func (driver *MockDriver) Start() error {
|
||||
driver.Logf("MockDriver.Start")
|
||||
driver.CurrentState = state.Running
|
||||
func (d *MockDriver) Start() error {
|
||||
d.Logf("Mockd.Start")
|
||||
d.CurrentState = state.Running
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop stops the machine
|
||||
func (driver *MockDriver) Stop() error {
|
||||
driver.Logf("MockDriver.Stop")
|
||||
driver.CurrentState = state.Stopped
|
||||
func (d *MockDriver) Stop() error {
|
||||
d.Logf("Mockd.Stop")
|
||||
d.CurrentState = state.Stopped
|
||||
return nil
|
||||
}
|
||||
|
||||
// DriverName returns the name of the driver
|
||||
func (driver *MockDriver) DriverName() string {
|
||||
driver.Logf("MockDriver.Name")
|
||||
return driver.Mock
|
||||
func (d *MockDriver) DriverName() string {
|
||||
d.Logf("Mockd.Name")
|
||||
return "mock"
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
|
||||
"github.com/blang/semver"
|
||||
|
||||
"k8s.io/minikube/pkg/drivers"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
)
|
||||
|
||||
func TestKVMDriverInstallOrUpdate(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue