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 modpull/5045/head
parent
bca5f01b12
commit
a817bffab1
14
Makefile
14
Makefile
|
|
@ -375,7 +375,7 @@ out/minikube-installer.exe: out/minikube-windows-amd64.exe
|
||||||
mv out/windows_tmp/minikube-installer.exe out/minikube-installer.exe
|
mv out/windows_tmp/minikube-installer.exe out/minikube-installer.exe
|
||||||
rm -rf out/windows_tmp
|
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)
|
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
|
||||||
$(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make $@)
|
$(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make $@)
|
||||||
else
|
else
|
||||||
|
|
@ -441,18 +441,18 @@ 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) $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH)
|
||||||
gsutil cp out/minikube-$(GOOS)-$(GOARCH).sha256 $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH).sha256
|
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)
|
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
|
||||||
docker inspect -f '{{.Id}} {{.RepoTags}}' $(KVM_BUILD_IMAGE) || $(MAKE) kvm-image
|
docker inspect -f '{{.Id}} {{.RepoTags}}' $(KVM_BUILD_IMAGE) || $(MAKE) kvm-image
|
||||||
$(call DOCKER,$(KVM_BUILD_IMAGE),/usr/bin/make $@ COMMIT=$(COMMIT))
|
$(call DOCKER,$(KVM_BUILD_IMAGE),/usr/bin/make $@ COMMIT=$(COMMIT))
|
||||||
# make extra sure that we are linking with the older version of libvirt (1.3.1)
|
# make extra sure that we are linking with the older version of libvirt (1.3.1)
|
||||||
test "`strings $@ | grep '^LIBVIRT_[0-9]' | sort | tail -n 1`" = "LIBVIRT_1.2.9"
|
test "`strings $@ | grep '^LIBVIRT_[0-9]' | sort | tail -n 1`" = "LIBVIRT_1.2.9"
|
||||||
else
|
else
|
||||||
go build \
|
go build \
|
||||||
-installsuffix "static" \
|
-installsuffix "static" \
|
||||||
-ldflags="$(KVM2_LDFLAGS)" \
|
-ldflags="$(KVM2_LDFLAGS)" \
|
||||||
-tags "libvirt.1.3.1 without_lxc" \
|
-tags "libvirt.1.3.1 without_lxc" \
|
||||||
-o $(BUILD_DIR)/docker-machine-driver-kvm2 \
|
-o $(BUILD_DIR)/docker-machine-driver-kvm2 \
|
||||||
k8s.io/minikube/cmd/drivers/kvm
|
k8s.io/minikube/cmd/drivers/kvm
|
||||||
endif
|
endif
|
||||||
chmod +X $@
|
chmod +X $@
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,6 @@ import (
|
||||||
hyperkit "github.com/moby/hyperkit/go"
|
hyperkit "github.com/moby/hyperkit/go"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
pkgdrivers "k8s.io/minikube/pkg/drivers"
|
pkgdrivers "k8s.io/minikube/pkg/drivers"
|
||||||
|
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
|
||||||
commonutil "k8s.io/minikube/pkg/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -77,7 +74,6 @@ func NewDriver(hostName, storePath string) *Driver {
|
||||||
SSHUser: "docker",
|
SSHUser: "docker",
|
||||||
},
|
},
|
||||||
CommonDriver: &pkgdrivers.CommonDriver{},
|
CommonDriver: &pkgdrivers.CommonDriver{},
|
||||||
DiskSize: commonutil.CalculateSizeInMB(constants.DefaultDiskSize),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +117,7 @@ func (d *Driver) Create() error {
|
||||||
|
|
||||||
// DriverName returns the name of the driver
|
// DriverName returns the name of the driver
|
||||||
func (d *Driver) DriverName() string {
|
func (d *Driver) DriverName() string {
|
||||||
return constants.DriverHyperkit
|
return "hyperkit"
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSSHHostname returns hostname for use with ssh
|
// GetSSHHostname returns hostname for use with ssh
|
||||||
|
|
@ -227,7 +223,7 @@ func (d *Driver) Start() error {
|
||||||
h.Memory = d.Memory
|
h.Memory = d.Memory
|
||||||
h.UUID = d.UUID
|
h.UUID = d.UUID
|
||||||
// This should stream logs from hyperkit, but doesn't seem to work.
|
// 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)
|
h.SetLogger(logger)
|
||||||
|
|
||||||
if vsockPorts, err := d.extractVSockPorts(); err != nil {
|
if vsockPorts, err := d.extractVSockPorts(); err != nil {
|
||||||
|
|
@ -269,12 +265,25 @@ func (d *Driver) Start() error {
|
||||||
|
|
||||||
d.IPAddress, err = GetIPAddressByMACAddress(mac)
|
d.IPAddress, err = GetIPAddressByMACAddress(mac)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &commonutil.RetriableError{Err: err}
|
return &tempError{err}
|
||||||
}
|
}
|
||||||
return nil
|
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)
|
return fmt.Errorf("IP address never found in dhcp leases file %v", err)
|
||||||
}
|
}
|
||||||
log.Debugf("IP: %s", d.IPAddress)
|
log.Debugf("IP: %s", d.IPAddress)
|
||||||
|
|
@ -294,6 +303,14 @@ func (d *Driver) Start() error {
|
||||||
return nil
|
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
|
//recoverFromUncleanShutdown searches for an existing hyperkit.pid file in
|
||||||
//the machine directory. If it can't find it, a clean shutdown is assumed.
|
//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
|
//If it finds the pid file, it checks for a running hyperkit process with that pid
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,6 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"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/drivers"
|
||||||
"github.com/docker/machine/libmachine/log"
|
"github.com/docker/machine/libmachine/log"
|
||||||
"github.com/docker/machine/libmachine/state"
|
"github.com/docker/machine/libmachine/state"
|
||||||
|
|
@ -102,14 +98,8 @@ func NewDriver(hostName, storePath string) *Driver {
|
||||||
SSHUser: "docker",
|
SSHUser: "docker",
|
||||||
},
|
},
|
||||||
CommonDriver: &pkgdrivers.CommonDriver{},
|
CommonDriver: &pkgdrivers.CommonDriver{},
|
||||||
Boot2DockerURL: constants.DefaultISOURL,
|
|
||||||
CPU: constants.DefaultCPUS,
|
|
||||||
DiskSize: util.CalculateSizeInMB(constants.DefaultDiskSize),
|
|
||||||
Memory: util.CalculateSizeInMB(constants.DefaultMemorySize),
|
|
||||||
PrivateNetwork: defaultPrivateNetworkName,
|
PrivateNetwork: defaultPrivateNetworkName,
|
||||||
Network: defaultNetworkName,
|
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,
|
ConnectionURI: qemusystem,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -224,7 +214,7 @@ func (d *Driver) GetSSHHostname() (string, error) {
|
||||||
|
|
||||||
// DriverName returns the name of the driver
|
// DriverName returns the name of the driver
|
||||||
func (d *Driver) DriverName() string {
|
func (d *Driver) DriverName() string {
|
||||||
return constants.DriverKvm2
|
return "kvm2"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kill stops a host forcefully, including any containers that we are managing.
|
// Kill stops a host forcefully, including any containers that we are managing.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue