Remove all minikube dependencies from drivers (#4933)

* Remove all minikube dependencies in driver code

* removing all default config

* okay we need some defaults

* code comments

* hyperkit builds now

* sleep for an appropriate amount of time

* remove constant in favor of string

* try goproxy for travis

* try goproxy for travis

* try goproxy for travis

* let's not try goproxy for now

* let's try goproxy once again

* maybe use the correct url for the proxy

* fix go mod
pull/5045/head
Sharif Elgamal 2019-08-12 14:42:11 -07:00 committed by GitHub
parent bca5f01b12
commit a817bffab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 26 deletions

View File

@ -375,7 +375,7 @@ out/minikube-installer.exe: out/minikube-windows-amd64.exe
mv out/windows_tmp/minikube-installer.exe out/minikube-installer.exe
rm -rf out/windows_tmp
out/docker-machine-driver-hyperkit: pkg/minikube/translate/translations.go
out/docker-machine-driver-hyperkit:
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
$(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make $@)
else
@ -441,7 +441,7 @@ release-minikube: out/minikube checksum
gsutil cp out/minikube-$(GOOS)-$(GOARCH) $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH)
gsutil cp out/minikube-$(GOOS)-$(GOARCH).sha256 $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH).sha256
out/docker-machine-driver-kvm2: pkg/minikube/translate/translations.go
out/docker-machine-driver-kvm2:
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
docker inspect -f '{{.Id}} {{.RepoTags}}' $(KVM_BUILD_IMAGE) || $(MAKE) kvm-image
$(call DOCKER,$(KVM_BUILD_IMAGE),/usr/bin/make $@ COMMIT=$(COMMIT))

View File

@ -40,9 +40,6 @@ import (
hyperkit "github.com/moby/hyperkit/go"
"github.com/pkg/errors"
pkgdrivers "k8s.io/minikube/pkg/drivers"
"k8s.io/minikube/pkg/minikube/constants"
commonutil "k8s.io/minikube/pkg/util"
)
const (
@ -77,7 +74,6 @@ func NewDriver(hostName, storePath string) *Driver {
SSHUser: "docker",
},
CommonDriver: &pkgdrivers.CommonDriver{},
DiskSize: commonutil.CalculateSizeInMB(constants.DefaultDiskSize),
}
}
@ -121,7 +117,7 @@ func (d *Driver) Create() error {
// DriverName returns the name of the driver
func (d *Driver) DriverName() string {
return constants.DriverHyperkit
return "hyperkit"
}
// GetSSHHostname returns hostname for use with ssh
@ -227,7 +223,7 @@ func (d *Driver) Start() error {
h.Memory = d.Memory
h.UUID = d.UUID
// This should stream logs from hyperkit, but doesn't seem to work.
logger := golog.New(os.Stderr, constants.DriverHyperkit, golog.LstdFlags)
logger := golog.New(os.Stderr, "hyperkit", golog.LstdFlags)
h.SetLogger(logger)
if vsockPorts, err := d.extractVSockPorts(); err != nil {
@ -269,12 +265,25 @@ func (d *Driver) Start() error {
d.IPAddress, err = GetIPAddressByMACAddress(mac)
if err != nil {
return &commonutil.RetriableError{Err: err}
return &tempError{err}
}
return nil
}
if err := commonutil.RetryAfter(30, getIP, 2*time.Second); err != nil {
// Implement a retry loop without calling any minikube code
for i := 0; i < 30; i++ {
log.Debugf("Attempt %d", i)
err = getIP()
if err == nil {
break
}
if _, ok := err.(*tempError); !ok {
return err
}
time.Sleep(2 * time.Second)
}
if err != nil {
return fmt.Errorf("IP address never found in dhcp leases file %v", err)
}
log.Debugf("IP: %s", d.IPAddress)
@ -294,6 +303,14 @@ func (d *Driver) Start() error {
return nil
}
type tempError struct {
Err error
}
func (t tempError) Error() string {
return "Temporary error: " + t.Err.Error()
}
//recoverFromUncleanShutdown searches for an existing hyperkit.pid file in
//the machine directory. If it can't find it, a clean shutdown is assumed.
//If it finds the pid file, it checks for a running hyperkit process with that pid

View File

@ -25,10 +25,6 @@ import (
"syscall"
"time"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/util"
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/log"
"github.com/docker/machine/libmachine/state"
@ -102,14 +98,8 @@ func NewDriver(hostName, storePath string) *Driver {
SSHUser: "docker",
},
CommonDriver: &pkgdrivers.CommonDriver{},
Boot2DockerURL: constants.DefaultISOURL,
CPU: constants.DefaultCPUS,
DiskSize: util.CalculateSizeInMB(constants.DefaultDiskSize),
Memory: util.CalculateSizeInMB(constants.DefaultMemorySize),
PrivateNetwork: defaultPrivateNetworkName,
Network: defaultNetworkName,
DiskPath: filepath.Join(constants.GetMinipath(), "machines", config.GetMachineName(), fmt.Sprintf("%s.rawdisk", config.GetMachineName())),
ISO: filepath.Join(constants.GetMinipath(), "machines", config.GetMachineName(), "boot2docker.iso"),
ConnectionURI: qemusystem,
}
}
@ -224,7 +214,7 @@ func (d *Driver) GetSSHHostname() (string, error) {
// DriverName returns the name of the driver
func (d *Driver) DriverName() string {
return constants.DriverKvm2
return "kvm2"
}
// Kill stops a host forcefully, including any containers that we are managing.