Merge branch 'master' of github.com:kubernetes/minikube into m2
commit
74b1f34715
|
|
@ -3,7 +3,7 @@
|
|||
os: linux
|
||||
language: go
|
||||
go:
|
||||
- 1.13.6
|
||||
- 1.13.8
|
||||
env:
|
||||
global:
|
||||
- GOPROXY=https://proxy.golang.org
|
||||
|
|
@ -11,7 +11,7 @@ matrix:
|
|||
include:
|
||||
- language: go
|
||||
name: Code Lint
|
||||
go: 1.13.6
|
||||
go: 1.13.8
|
||||
env:
|
||||
- TESTSUITE=lintall
|
||||
before_install:
|
||||
|
|
@ -20,7 +20,7 @@ matrix:
|
|||
|
||||
- language: go
|
||||
name: Unit Test
|
||||
go: 1.13.6
|
||||
go: 1.13.8
|
||||
env:
|
||||
- TESTSUITE=unittest
|
||||
before_install:
|
||||
|
|
@ -29,7 +29,7 @@ matrix:
|
|||
|
||||
- language: go
|
||||
name: Build
|
||||
go: 1.13.6
|
||||
go: 1.13.8
|
||||
script: make
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
|
|
|||
24
CHANGELOG.md
24
CHANGELOG.md
|
|
@ -2,19 +2,22 @@
|
|||
|
||||
## Version 1.8.2 - 2020-03-13
|
||||
|
||||
Bug Fixes:
|
||||
Shiny new improvements:
|
||||
|
||||
* allow setting api-server port for docker/podman drivers [#6991](https://github.com/kubernetes/minikube/pull/6991)
|
||||
* Update NewestKubernetesVersion to 1.18.0-beta.2 [#6988](https://github.com/kubernetes/minikube/pull/6988)
|
||||
* Add warning if disk image is missing features [#6978](https://github.com/kubernetes/minikube/pull/6978)
|
||||
|
||||
Captivating bug fixes:
|
||||
|
||||
* Hyper-V: Round suggested memory alloc by 100MB for VM's [#6987](https://github.com/kubernetes/minikube/pull/6987)
|
||||
* Merge repositories.json after extracting preloaded tarball so that reference store isn't lost [#6985](https://github.com/kubernetes/minikube/pull/6985)
|
||||
* Fix dockerd internal port changing on restart [#7021](https://github.com/kubernetes/minikube/pull/7021)
|
||||
* none: Skip driver preload and image caching [#7015](https://github.com/kubernetes/minikube/pull/7015)
|
||||
* preload: fix bug for windows file separators [#6968](https://github.com/kubernetes/minikube/pull/6968)
|
||||
|
||||
|
||||
Documentation:
|
||||
* Add doc for running ebpf based tools in minikube [#6914](https://github.com/kubernetes/minikube/pull/6914)
|
||||
|
||||
|
||||
New Features:
|
||||
* Update NewestKubernetesVersion to 1.18.0-beta.2 [#6988](https://github.com/kubernetes/minikube/pull/6988)
|
||||
* allow setting api-server port for docker/podman drivers [#6991](https://github.com/kubernetes/minikube/pull/6991)
|
||||
* Block on preload download [#7003](https://github.com/kubernetes/minikube/pull/7003)
|
||||
* Check if lz4 is available before trying to use it [#6941](https://github.com/kubernetes/minikube/pull/6941)
|
||||
* Allow backwards compatibility with 1.6 and earlier configs [#6969](https://github.com/kubernetes/minikube/pull/6969)
|
||||
|
||||
Huge thank you for this release towards our contributors:
|
||||
- Anders F Björklund
|
||||
|
|
@ -25,7 +28,6 @@ Huge thank you for this release towards our contributors:
|
|||
- Sharif Elgamal
|
||||
- Thomas Strömberg
|
||||
|
||||
|
||||
## Version 1.8.1 - 2020-03-06
|
||||
|
||||
Minor bug fix:
|
||||
|
|
|
|||
8
Makefile
8
Makefile
|
|
@ -31,7 +31,7 @@ DEB_VERSION ?= $(subst -,~,$(RAW_VERSION))
|
|||
RPM_VERSION ?= $(DEB_VERSION)
|
||||
|
||||
# used by hack/jenkins/release_build_and_upload.sh and KVM_BUILD_IMAGE, see also BUILD_IMAGE below
|
||||
GO_VERSION ?= 1.13.6
|
||||
GO_VERSION ?= 1.13.8
|
||||
|
||||
INSTALL_SIZE ?= $(shell du out/minikube-windows-amd64.exe | cut -f1)
|
||||
BUILDROOT_BRANCH ?= 2019.02.9
|
||||
|
|
@ -42,8 +42,8 @@ COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
|
|||
COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}")
|
||||
|
||||
HYPERKIT_BUILD_IMAGE ?= karalabe/xgo-1.12.x
|
||||
# NOTE: "latest" as of 2019-08-15. kube-cross images aren't updated as often as Kubernetes
|
||||
BUILD_IMAGE ?= k8s.gcr.io/kube-cross:v$(GO_VERSION)-1
|
||||
# NOTE: "latest" as of 2020-02-26. kube-cross images aren't updated as often as Kubernetes
|
||||
BUILD_IMAGE ?= us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:v$(GO_VERSION)-1
|
||||
ISO_BUILD_IMAGE ?= $(REGISTRY)/buildroot-image
|
||||
KVM_BUILD_IMAGE ?= $(REGISTRY)/kvm-build-image:$(GO_VERSION)
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ out/minikube$(IS_EXE): $(SOURCE_GENERATED) $(SOURCE_FILES) go.mod
|
|||
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
|
||||
$(call DOCKER,$(BUILD_IMAGE),GOOS=$(GOOS) GOARCH=$(GOARCH) /usr/bin/make $@)
|
||||
else
|
||||
go build -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS)" -o $@ k8s.io/minikube/cmd/minikube
|
||||
go build $(MINIKUBE_GOFLAGS) -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS)" -o $@ k8s.io/minikube/cmd/minikube
|
||||
endif
|
||||
|
||||
out/minikube-windows-amd64.exe: out/minikube-windows-amd64
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ var addonsOpenCmd = &cobra.Command{
|
|||
if err != nil {
|
||||
exit.WithError("Error getting control plane", err)
|
||||
}
|
||||
if !machine.IsHostRunning(api, driver.MachineName(*cc, cp)) {
|
||||
if !machine.IsRunning(api, driver.MachineName(*cc, cp)) {
|
||||
os.Exit(1)
|
||||
}
|
||||
addon, ok := assets.Addons[addonName] // validate addon input
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ var printProfilesTable = func() {
|
|||
if err != nil {
|
||||
exit.WithError("error getting primary control plane", err)
|
||||
}
|
||||
p.Status, err = machine.GetHostStatus(api, driver.MachineName(*p.Config, cp))
|
||||
p.Status, err = machine.Status(api, driver.MachineName(*p.Config, cp))
|
||||
if err != nil {
|
||||
glog.Warningf("error getting host status for %s: %v", p.Name, err)
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ var printProfilesJSON = func() {
|
|||
if err != nil {
|
||||
exit.WithError("error getting primary control plane", err)
|
||||
}
|
||||
status, err := machine.GetHostStatus(api, driver.MachineName(*v.Config, cp))
|
||||
status, err := machine.Status(api, driver.MachineName(*v.Config, cp))
|
||||
if err != nil {
|
||||
glog.Warningf("error getting host status for %s: %v", v.Name, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ var dashboardCmd = &cobra.Command{
|
|||
exit.WithCodeT(exit.NoInput, "kubectl not found in PATH, but is required for the dashboard. Installation guide: https://kubernetes.io/docs/tasks/tools/install-kubectl/")
|
||||
}
|
||||
|
||||
if !machine.IsHostRunning(api, machineName) {
|
||||
if !machine.IsRunning(api, machineName) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ func DeleteProfiles(profiles []*config.Profile) []error {
|
|||
err := deleteProfile(profile)
|
||||
|
||||
if err != nil {
|
||||
mm, loadErr := machine.Load(profile.Name)
|
||||
mm, loadErr := machine.LoadMachine(profile.Name)
|
||||
|
||||
if !profile.IsValid() || (loadErr != nil || !mm.IsValid()) {
|
||||
invalidProfileDeletionErrs := deleteInvalidProfile(profile)
|
||||
|
|
@ -208,7 +208,6 @@ func deleteProfileContainersAndVolumes(name string) {
|
|||
|
||||
func deleteProfile(profile *config.Profile) error {
|
||||
viper.Set(config.ProfileName, profile.Name)
|
||||
|
||||
deleteProfileContainersAndVolumes(profile.Name)
|
||||
|
||||
api, err := machine.NewAPIClient()
|
||||
|
|
@ -217,6 +216,7 @@ func deleteProfile(profile *config.Profile) error {
|
|||
return DeletionError{Err: delErr, Errtype: Fatal}
|
||||
}
|
||||
defer api.Close()
|
||||
|
||||
cc, err := config.Load(profile.Name)
|
||||
if err != nil && !config.IsNotExist(err) {
|
||||
delErr := profileDeletionErr(profile.Name, fmt.Sprintf("error loading profile config: %v", err))
|
||||
|
|
@ -328,7 +328,7 @@ func uninstallKubernetes(api libmachine.API, cc config.ClusterConfig, n config.N
|
|||
return DeletionError{Err: fmt.Errorf("unable to get bootstrapper: %v", err), Errtype: Fatal}
|
||||
}
|
||||
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, driver.MachineName(cc, n))
|
||||
host, err := machine.LoadHost(api, driver.MachineName(cc, n))
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ var dockerEnvCmd = &cobra.Command{
|
|||
}
|
||||
for _, n := range cc.Nodes {
|
||||
machineName := driver.MachineName(*cc, n)
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, machineName)
|
||||
host, err := machine.LoadHost(api, machineName)
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host", err)
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ var dockerEnvCmd = &cobra.Command{
|
|||
exit.UsageT(`'none' driver does not support 'minikube docker-env' command`)
|
||||
}
|
||||
|
||||
hostSt, err := machine.GetHostStatus(api, machineName)
|
||||
hostSt, err := machine.Status(api, machineName)
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host status", err)
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ var dockerEnvCmd = &cobra.Command{
|
|||
port := constants.DockerDaemonPort
|
||||
if driver.IsKIC(host.DriverName) { // for kic we need to find what port docker/podman chose for us
|
||||
hostIP = oci.DefaultBindIPV4
|
||||
port, err = oci.HostPortBinding(host.DriverName, profile, port)
|
||||
port, err = oci.ForwardedPort(host.DriverName, profile, port)
|
||||
if err != nil {
|
||||
exit.WithCodeT(exit.Failure, "Error getting port binding for '{{.driver_name}} driver: {{.error}}", out.V{"driver_name": host.DriverName, "error": err})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ var nodeStartCmd = &cobra.Command{
|
|||
exit.WithError("creating api client", err)
|
||||
}
|
||||
|
||||
if machine.IsHostRunning(api, name) {
|
||||
if machine.IsRunning(api, name) {
|
||||
out.T(out.Check, "{{.name}} is already running", out.V{"name": name})
|
||||
os.Exit(0)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func runPause(cmd *cobra.Command, args []string) {
|
|||
glog.Infof("config: %+v", cc)
|
||||
|
||||
for _, n := range cc.Nodes {
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, driver.MachineName(*cc, n))
|
||||
host, err := machine.LoadHost(api, driver.MachineName(*cc, n))
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ var podmanEnvCmd = &cobra.Command{
|
|||
}
|
||||
for _, n := range cc.Nodes {
|
||||
machineName := driver.MachineName(*cc, n)
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, machineName)
|
||||
host, err := machine.LoadHost(api, machineName)
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host", err)
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ var podmanEnvCmd = &cobra.Command{
|
|||
exit.UsageT(`'none' driver does not support 'minikube podman-env' command`)
|
||||
}
|
||||
|
||||
hostSt, err := machine.GetHostStatus(api, machineName)
|
||||
hostSt, err := machine.Status(api, machineName)
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host status", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ var serviceCmd = &cobra.Command{
|
|||
exit.WithError("Error getting control plane", err)
|
||||
}
|
||||
machineName := driver.MachineName(*cfg, cp)
|
||||
if !machine.IsHostRunning(api, machineName) {
|
||||
if !machine.IsRunning(api, machineName) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ func startKicServiceTunnel(svc, configName string) {
|
|||
exit.WithError("error creating clientset", err)
|
||||
}
|
||||
|
||||
port, err := oci.HostPortBinding(oci.Docker, configName, 22)
|
||||
port, err := oci.ForwardedPort(oci.Docker, configName, 22)
|
||||
if err != nil {
|
||||
exit.WithError("error getting ssh port", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ var serviceListCmd = &cobra.Command{
|
|||
if err != nil {
|
||||
exit.WithError("Error getting primary control plane", err)
|
||||
}
|
||||
if !machine.IsHostRunning(api, driver.MachineName(*cfg, cp)) {
|
||||
if !machine.IsRunning(api, driver.MachineName(*cfg, cp)) {
|
||||
exit.WithCodeT(exit.Unavailable, "profile {{.name}} is not running.", out.V{"name": profileName})
|
||||
}
|
||||
serviceURLs, err := service.GetServiceURLs(api, serviceListNamespace, serviceURLTemplate)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ var sshCmd = &cobra.Command{
|
|||
exit.WithError("", err)
|
||||
}
|
||||
}
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, driver.MachineName(*cc, *n))
|
||||
host, err := machine.LoadHost(api, driver.MachineName(*cc, *n))
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -867,6 +867,13 @@ func generateCfgFromFlags(cmd *cobra.Command, k8sVersion string, drvName string)
|
|||
kubeNodeName = "m01"
|
||||
}
|
||||
|
||||
return createNode(cmd, k8sVersion, kubeNodeName, drvName,
|
||||
repository, selectedEnableDefaultCNI, selectedNetworkPlugin)
|
||||
}
|
||||
|
||||
func createNode(cmd *cobra.Command, k8sVersion, kubeNodeName, drvName, repository string,
|
||||
selectedEnableDefaultCNI bool, selectedNetworkPlugin string) (config.ClusterConfig, config.Node, error) {
|
||||
|
||||
sysLimit, containerLimit, err := memoryLimits(drvName)
|
||||
if err != nil {
|
||||
glog.Warningf("Unable to query memory limits: %v", err)
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@ var statusCmd = &cobra.Command{
|
|||
|
||||
cc, err := config.Load(viper.GetString(config.ProfileName))
|
||||
if err != nil {
|
||||
if config.IsNotExist(err) {
|
||||
exit.WithCodeT(exitCode(&Status{}), `The "{{.name}}" cluster does not exist!`, out.V{"name": viper.GetString(config.ProfileName)})
|
||||
}
|
||||
exit.WithError("getting config", err)
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +171,7 @@ func status(api libmachine.API, name string, controlPlane bool) (*Status, error)
|
|||
Kubeconfig: Nonexistent,
|
||||
}
|
||||
|
||||
hs, err := machine.GetHostStatus(api, name)
|
||||
hs, err := machine.Status(api, name)
|
||||
glog.Infof("%s host status = %q (err=%v)", name, hs, err)
|
||||
if err != nil {
|
||||
return st, errors.Wrap(err, "host")
|
||||
|
|
@ -217,7 +220,7 @@ func status(api libmachine.API, name string, controlPlane bool) (*Status, error)
|
|||
}
|
||||
}
|
||||
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, name)
|
||||
host, err := machine.LoadHost(api, name)
|
||||
if err != nil {
|
||||
return st, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ var tunnelCmd = &cobra.Command{
|
|||
}()
|
||||
|
||||
if runtime.GOOS == "darwin" && cfg.Driver == oci.Docker {
|
||||
port, err := oci.HostPortBinding(oci.Docker, cfg.Name, 22)
|
||||
port, err := oci.ForwardedPort(oci.Docker, cfg.Name, 22)
|
||||
if err != nil {
|
||||
exit.WithError("error getting ssh port", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ var unpauseCmd = &cobra.Command{
|
|||
|
||||
for _, n := range cc.Nodes {
|
||||
machineName := driver.MachineName(*cc, n)
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, machineName)
|
||||
host, err := machine.LoadHost(api, machineName)
|
||||
if err != nil {
|
||||
exit.WithError("Error getting host", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@ sha256 f2d578b743fb9faa5b3477b7cf4b33d00501087043a53b27754f14bbe741f891 v1.2.6.t
|
|||
sha256 6165ae2ad669d9ec6d317492d30a1511365bd31ad29efae757f19c1828bf75b3 v1.2.8.tar.gz
|
||||
sha256 a0965e1492fca558629826f1aa89a9675de3d451cec67540400b30c0bf6ac387 v1.2.10.tar.gz
|
||||
sha256 318886ea1efdec36f088fd6a0a0fe2b2f0ebdfd0066bdb4bd284bad12abc0a41 v1.2.12.tar.gz
|
||||
sha256 0811057ab67b78ce911416e793edaeb14b3f1e105d67b8e67b6302e0eab572e4 v1.2.13.tar.gz
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
# containerd
|
||||
#
|
||||
################################################################################
|
||||
CONTAINERD_BIN_VERSION = v1.2.12
|
||||
CONTAINERD_BIN_COMMIT = 35bd7a5f69c13e1563af8a93431411cd9ecf5021
|
||||
CONTAINERD_BIN_VERSION = v1.2.13
|
||||
CONTAINERD_BIN_COMMIT = 7ad184331fa3e55e52b890ea95e65ba581ae3429
|
||||
CONTAINERD_BIN_SITE = https://github.com/containerd/containerd/archive
|
||||
CONTAINERD_BIN_SOURCE = $(CONTAINERD_BIN_VERSION).tar.gz
|
||||
CONTAINERD_BIN_DEPENDENCIES = host-go libgpgme
|
||||
|
|
|
|||
|
|
@ -15,3 +15,5 @@ sha256 12277eff64363f51ba2f20dd258bdc2c3248022996c0251921193ec6fd179e52 docker-
|
|||
sha256 82a362af7689038c51573e0fd0554da8703f0d06f4dfe95dd5bda5acf0ae45fb docker-18.09.9.tgz
|
||||
sha256 50cdf38749642ec43d6ac50f4a3f1f7f6ac688e8d8b4e1c5b7be06e1a82f06e9 docker-19.03.5.tgz
|
||||
sha256 34ff89ce917796594cd81149b1777d07786d297ffd0fef37a796b5897052f7cc docker-19.03.6.tgz
|
||||
sha256 033e97ae6b31e21c598fd089ea034c08d75dc744ceb787898d63dfc4e45ead03 docker-19.03.7.tgz
|
||||
sha256 7f4115dc6a3c19c917f8b9664d7b51c904def1c984e082c4600097433323cf6f docker-19.03.8.tgz
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
DOCKER_BIN_VERSION = 19.03.6
|
||||
DOCKER_BIN_VERSION = 19.03.8
|
||||
DOCKER_BIN_SITE = https://download.docker.com/linux/static/stable/x86_64
|
||||
DOCKER_BIN_SOURCE = docker-$(DOCKER_BIN_VERSION).tgz
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export KUBECONFIG="${TEST_HOME}/kubeconfig"
|
|||
export PATH=$PATH:"/usr/local/bin/:/usr/local/go/bin/:$GOPATH/bin"
|
||||
|
||||
# installing golang so we could do go get for gopogh
|
||||
sudo ./installers/check_install_golang.sh "1.13.6" "/usr/local" || true
|
||||
sudo ./installers/check_install_golang.sh "1.13.8" "/usr/local" || true
|
||||
|
||||
docker rm -f -v $(docker ps -aq) >/dev/null 2>&1 || true
|
||||
docker volume prune -f || true
|
||||
|
|
|
|||
|
|
@ -145,8 +145,8 @@ func enableOrDisableAddon(cc *config.ClusterConfig, name string, val string) err
|
|||
}
|
||||
|
||||
mName := driver.MachineName(*cc, cp)
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, mName)
|
||||
if err != nil || !machine.IsHostRunning(api, mName) {
|
||||
host, err := machine.LoadHost(api, mName)
|
||||
if err != nil || !machine.IsRunning(api, mName) {
|
||||
glog.Warningf("%q is not running, writing %s=%v to disk and skipping enablement (err=%v)", mName, addon.Name(), enable, err)
|
||||
return nil
|
||||
}
|
||||
|
|
@ -247,7 +247,7 @@ func enableOrDisableStorageClasses(cc *config.ClusterConfig, name string, val st
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "getting control plane")
|
||||
}
|
||||
if !machine.IsHostRunning(api, driver.MachineName(*cc, cp)) {
|
||||
if !machine.IsRunning(api, driver.MachineName(*cc, cp)) {
|
||||
glog.Warningf("%q is not running, writing %s=%v to disk and skipping enablement", driver.MachineName(*cc, cp), name, val)
|
||||
return enableOrDisableAddon(cc, name, val)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ func (d *Driver) GetSSHHostname() (string, error) {
|
|||
|
||||
// GetSSHPort returns port for use with ssh
|
||||
func (d *Driver) GetSSHPort() (int, error) {
|
||||
p, err := oci.HostPortBinding(d.OCIBinary, d.MachineName, constants.SSHPort)
|
||||
p, err := oci.ForwardedPort(d.OCIBinary, d.MachineName, constants.SSHPort)
|
||||
if err != nil {
|
||||
return p, errors.Wrap(err, "get ssh host-port")
|
||||
}
|
||||
|
|
@ -226,7 +226,7 @@ func (d *Driver) GetState() (state.State, error) {
|
|||
}
|
||||
o := strings.TrimSpace(string(out))
|
||||
if err != nil {
|
||||
return state.Error, errors.Wrapf(err, "get container %s status", d.MachineName)
|
||||
return state.Error, errors.Wrapf(err, "%s: %s", strings.Join(cmd.Args, " "), o)
|
||||
}
|
||||
switch o {
|
||||
case "running":
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@ func dockerGatewayIP() (net.IP, error) {
|
|||
return ip, nil
|
||||
}
|
||||
|
||||
// HostPortBinding will return port mapping for a container using cli.
|
||||
// example : HostPortBinding("docker", "minikube", "22")
|
||||
// ForwardedPort will return port mapping for a container using cli.
|
||||
// example : ForwardedPort("docker", "minikube", "22")
|
||||
// will return the docker assigned port:
|
||||
// 32769, nil
|
||||
// only supports TCP ports
|
||||
func HostPortBinding(ociBinary string, ociID string, contPort int) (int, error) {
|
||||
func ForwardedPort(ociBinary string, ociID string, contPort int) (int, error) {
|
||||
var out []byte
|
||||
var err error
|
||||
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ func (k *Bootstrapper) WaitForNode(cfg config.ClusterConfig, n config.Node, time
|
|||
port := n.Port
|
||||
if driver.IsKIC(cfg.Driver) {
|
||||
ip = oci.DefaultBindIPV4
|
||||
port, err := oci.HostPortBinding(cfg.Driver, driver.MachineName(cfg, n), port)
|
||||
port, err := oci.ForwardedPort(cfg.Driver, driver.MachineName(cfg, n), port)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "get host-bind port %d for container %s", port, cfg.Name)
|
||||
}
|
||||
|
|
@ -352,7 +352,7 @@ func (k *Bootstrapper) restartCluster(cfg config.ClusterConfig) error {
|
|||
port := cp.Port
|
||||
if driver.IsKIC(cfg.Driver) {
|
||||
ip = oci.DefaultBindIPV4
|
||||
port, err = oci.HostPortBinding(cfg.Driver, driver.MachineName(cfg, cp), port)
|
||||
port, err = oci.ForwardedPort(cfg.Driver, driver.MachineName(cfg, cp), port)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "get host-bind port %d for container %s", port, driver.MachineName(cfg, cp))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ func GetVMHostIP(host *host.Host) (net.IP, error) {
|
|||
|
||||
// GetHostDriverIP gets the ip address of the current minikube cluster
|
||||
func GetHostDriverIP(api libmachine.API, machineName string) (net.IP, error) {
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, machineName)
|
||||
host, err := machine.LoadHost(api, machineName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ import (
|
|||
// KubernetesContainerPrefix is the prefix of each kubernetes container
|
||||
const KubernetesContainerPrefix = "k8s_"
|
||||
|
||||
// ErrISOFeature is the error returned when disk image is missing features
|
||||
type ErrISOFeature struct {
|
||||
missing string
|
||||
}
|
||||
|
||||
// NewErrISOFeature creates a new ErrISOFeature
|
||||
func NewErrISOFeature(missing string) *ErrISOFeature {
|
||||
return &ErrISOFeature{
|
||||
missing: missing,
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ import (
|
|||
func TestMergeReferenceStores(t *testing.T) {
|
||||
initial := ReferenceStore{
|
||||
Repositories: map[string]repository{
|
||||
"image1": repository{
|
||||
"image1": {
|
||||
"r1": "d1",
|
||||
"r2": "d2",
|
||||
},
|
||||
"image2": repository{
|
||||
"image2": {
|
||||
"r1": "d1",
|
||||
"r2": "d2",
|
||||
},
|
||||
|
|
@ -38,11 +38,11 @@ func TestMergeReferenceStores(t *testing.T) {
|
|||
|
||||
afterPreload := ReferenceStore{
|
||||
Repositories: map[string]repository{
|
||||
"image1": repository{
|
||||
"image1": {
|
||||
"r1": "updated",
|
||||
"r2": "updated",
|
||||
},
|
||||
"image3": repository{
|
||||
"image3": {
|
||||
"r3": "d3",
|
||||
},
|
||||
},
|
||||
|
|
@ -50,15 +50,15 @@ func TestMergeReferenceStores(t *testing.T) {
|
|||
|
||||
expected := ReferenceStore{
|
||||
Repositories: map[string]repository{
|
||||
"image1": repository{
|
||||
"image1": {
|
||||
"r1": "updated",
|
||||
"r2": "updated",
|
||||
},
|
||||
"image2": repository{
|
||||
"image2": {
|
||||
"r1": "d1",
|
||||
"r2": "d2",
|
||||
},
|
||||
"image3": repository{
|
||||
"image3": {
|
||||
"r3": "d3",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ func CacheAndLoadImages(images []string) error {
|
|||
}
|
||||
for _, n := range c.Nodes {
|
||||
m := driver.MachineName(*c, n)
|
||||
status, err := GetHostStatus(api, m)
|
||||
status, err := Status(api, m)
|
||||
if err != nil {
|
||||
glog.Warningf("skipping loading cache for profile %s", pName)
|
||||
glog.Errorf("error getting status for %s: %v", pName, err)
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ func TestDeleteHostErrMachineNotExist(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetHostStatus(t *testing.T) {
|
||||
func TestStatus(t *testing.T) {
|
||||
RegisterMockDriver(t)
|
||||
api := tests.NewMockAPI(t)
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ func TestGetHostStatus(t *testing.T) {
|
|||
m := driver.MachineName(cc, config.Node{Name: "minikube"})
|
||||
|
||||
checkState := func(expected string, machineName string) {
|
||||
s, err := GetHostStatus(api, machineName)
|
||||
s, err := Status(api, machineName)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error getting status: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ func DeleteHost(api libmachine.API, machineName string) error {
|
|||
}
|
||||
|
||||
// Get the status of the host. Ensure that it exists before proceeding ahead.
|
||||
status, err := GetHostStatus(api, machineName)
|
||||
status, err := Status(api, machineName)
|
||||
if err != nil {
|
||||
// Warn, but proceed
|
||||
out.WarningT("Unable to get the status of the {{.name}} cluster.", out.V{"name": machineName})
|
||||
out.WarningT(`Unable to get host status for "{{.name}}": {{.error}}`, out.V{"name": machineName, "error": err})
|
||||
}
|
||||
|
||||
if status == state.None.String() {
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// GetHostStatus gets the status of the host VM.
|
||||
func GetHostStatus(api libmachine.API, machineName string) (string, error) {
|
||||
// Status returns the status of a libmachine host
|
||||
func Status(api libmachine.API, machineName string) (string, error) {
|
||||
exists, err := api.Exists(machineName)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "%s exists", machineName)
|
||||
|
|
@ -46,9 +46,9 @@ func GetHostStatus(api libmachine.API, machineName string) (string, error) {
|
|||
return s.String(), nil
|
||||
}
|
||||
|
||||
// IsHostRunning asserts that this profile's primary host is in state "Running"
|
||||
func IsHostRunning(api libmachine.API, name string) bool {
|
||||
s, err := GetHostStatus(api, name)
|
||||
// IsRunning asserts that a libmachine host is in state "Running"
|
||||
func IsRunning(api libmachine.API, name string) bool {
|
||||
s, err := Status(api, name)
|
||||
if err != nil {
|
||||
glog.Warningf("host status for %q returned error: %v", name, err)
|
||||
return false
|
||||
|
|
@ -60,8 +60,8 @@ func IsHostRunning(api libmachine.API, name string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// CheckIfHostExistsAndLoad checks if a host exists, and loads it if it does
|
||||
func CheckIfHostExistsAndLoad(api libmachine.API, machineName string) (*host.Host, error) {
|
||||
// LoadHost returns a libmachine host by name
|
||||
func LoadHost(api libmachine.API, machineName string) (*host.Host, error) {
|
||||
glog.Infof("Checking if %q exists ...", machineName)
|
||||
exists, err := api.Exists(machineName)
|
||||
if err != nil {
|
||||
|
|
@ -71,9 +71,9 @@ func CheckIfHostExistsAndLoad(api libmachine.API, machineName string) (*host.Hos
|
|||
return nil, errors.Errorf("machine %q does not exist", machineName)
|
||||
}
|
||||
|
||||
host, err := api.Load(machineName)
|
||||
h, err := api.Load(machineName)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "loading machine %q", machineName)
|
||||
}
|
||||
return host, nil
|
||||
return h, nil
|
||||
}
|
||||
|
|
@ -17,17 +17,8 @@ limitations under the License.
|
|||
package machine
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/machine/libmachine"
|
||||
"github.com/docker/machine/libmachine/host"
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
"github.com/golang/glog"
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
)
|
||||
|
||||
// Machine contains information about a machine
|
||||
|
|
@ -63,37 +54,14 @@ func (h *Machine) IsValid() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// List return all valid and invalid machines
|
||||
// If a machine is valid or invalid is determined by the cluster.IsValid function
|
||||
func List(miniHome ...string) (validMachines []*Machine, inValidMachines []*Machine, err error) {
|
||||
pDirs, err := machineDirs(miniHome...)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
for _, n := range pDirs {
|
||||
p, err := Load(n)
|
||||
if err != nil {
|
||||
glog.Infof("%s not valid: %v", n, err)
|
||||
inValidMachines = append(inValidMachines, p)
|
||||
continue
|
||||
}
|
||||
if !p.IsValid() {
|
||||
inValidMachines = append(inValidMachines, p)
|
||||
continue
|
||||
}
|
||||
validMachines = append(validMachines, p)
|
||||
}
|
||||
return validMachines, inValidMachines, nil
|
||||
}
|
||||
|
||||
// Load loads a machine or throws an error if the machine could not be loaded.
|
||||
func Load(name string) (*Machine, error) {
|
||||
// LoadMachine returns a Machine abstracting a libmachine.Host
|
||||
func LoadMachine(name string) (*Machine, error) {
|
||||
api, err := NewAPIClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
h, err := CheckIfHostExistsAndLoad(api, name)
|
||||
h, err := LoadHost(api, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -104,45 +72,5 @@ func Load(name string) (*Machine, error) {
|
|||
} else {
|
||||
return nil, errors.New("host is nil")
|
||||
}
|
||||
|
||||
return &mm, nil
|
||||
}
|
||||
|
||||
func machineDirs(miniHome ...string) (dirs []string, err error) {
|
||||
miniPath := localpath.MiniPath()
|
||||
if len(miniHome) > 0 {
|
||||
miniPath = miniHome[0]
|
||||
}
|
||||
mRootDir := filepath.Join(miniPath, "machines")
|
||||
items, err := ioutil.ReadDir(mRootDir)
|
||||
for _, f := range items {
|
||||
if f.IsDir() {
|
||||
dirs = append(dirs, f.Name())
|
||||
}
|
||||
}
|
||||
return dirs, err
|
||||
}
|
||||
|
||||
// CreateSSHShell creates a new SSH shell / client
|
||||
func CreateSSHShell(api libmachine.API, cc config.ClusterConfig, n config.Node, args []string) error {
|
||||
machineName := driver.MachineName(cc, n)
|
||||
host, err := CheckIfHostExistsAndLoad(api, machineName)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "host exists and load")
|
||||
}
|
||||
|
||||
currentState, err := host.Driver.GetState()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "state")
|
||||
}
|
||||
|
||||
if currentState != state.Running {
|
||||
return errors.Errorf("%q is not running", machineName)
|
||||
}
|
||||
|
||||
client, err := host.CreateSSHClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Creating ssh client")
|
||||
}
|
||||
return client.Shell(args...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,61 +15,3 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
package machine
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
)
|
||||
|
||||
func TestListMachines(t *testing.T) {
|
||||
const (
|
||||
numberOfValidMachines = 2
|
||||
numberOfInValidMachines = 3
|
||||
totalNumberOfMachines = numberOfValidMachines + numberOfInValidMachines
|
||||
)
|
||||
|
||||
viper.Set(config.ProfileName, "")
|
||||
|
||||
testMinikubeDir := "./testdata/list-machines/.minikube"
|
||||
miniDir, err := filepath.Abs(testMinikubeDir)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("error getting dir path for %s : %v", testMinikubeDir, err)
|
||||
}
|
||||
|
||||
err = os.Setenv(localpath.MinikubeHome, miniDir)
|
||||
if err != nil {
|
||||
t.Errorf("error setting up test environment. could not set %s", localpath.MinikubeHome)
|
||||
}
|
||||
|
||||
files, _ := ioutil.ReadDir(filepath.Join(localpath.MiniPath(), "machines"))
|
||||
numberOfMachineDirs := len(files)
|
||||
|
||||
validMachines, inValidMachines, err := List()
|
||||
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if numberOfValidMachines != len(validMachines) {
|
||||
t.Errorf("expected %d valid machines, got %d", numberOfValidMachines, len(validMachines))
|
||||
}
|
||||
|
||||
if numberOfInValidMachines != len(inValidMachines) {
|
||||
t.Errorf("expected %d invalid machines, got %d", numberOfInValidMachines, len(inValidMachines))
|
||||
}
|
||||
|
||||
if totalNumberOfMachines != len(validMachines)+len(inValidMachines) {
|
||||
t.Errorf("expected %d total machines, got %d", totalNumberOfMachines, len(validMachines)+len(inValidMachines))
|
||||
}
|
||||
|
||||
if numberOfMachineDirs != len(validMachines)+len(inValidMachines) {
|
||||
t.Error("expected number of machine directories to be equal to the number of total machines")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
Copyright 2020 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 machine
|
||||
|
||||
import (
|
||||
"github.com/docker/machine/libmachine"
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
)
|
||||
|
||||
// CreateSSHShell creates a new SSH shell / client
|
||||
func CreateSSHShell(api libmachine.API, cc config.ClusterConfig, n config.Node, args []string) error {
|
||||
machineName := driver.MachineName(cc, n)
|
||||
host, err := LoadHost(api, machineName)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "host exists and load")
|
||||
}
|
||||
|
||||
currentState, err := host.Driver.GetState()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "state")
|
||||
}
|
||||
|
||||
if currentState != state.Running {
|
||||
return errors.Errorf("%q is not running", machineName)
|
||||
}
|
||||
|
||||
client, err := host.CreateSSHClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Creating ssh client")
|
||||
}
|
||||
return client.Shell(args...)
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ type URLs []SvcURL
|
|||
// GetServiceURLs returns a SvcURL object for every service in a particular namespace.
|
||||
// Accepts a template for formatting
|
||||
func GetServiceURLs(api libmachine.API, namespace string, t *template.Template) (URLs, error) {
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, viper.GetString(config.ProfileName))
|
||||
host, err := machine.LoadHost(api, viper.GetString(config.ProfileName))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ func GetServiceURLs(api libmachine.API, namespace string, t *template.Template)
|
|||
|
||||
// GetServiceURLsForService returns a SvcUrl object for a service in a namespace. Supports optional formatting.
|
||||
func GetServiceURLsForService(api libmachine.API, namespace, service string, t *template.Template) (SvcURL, error) {
|
||||
host, err := machine.CheckIfHostExistsAndLoad(api, viper.GetString(config.ProfileName))
|
||||
host, err := machine.LoadHost(api, viper.GetString(config.ProfileName))
|
||||
if err != nil {
|
||||
return SvcURL{}, errors.Wrap(err, "Error checking if api exist and loading it")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ type clusterInspector struct {
|
|||
|
||||
func (m *clusterInspector) getStateAndHost() (HostState, *host.Host, error) {
|
||||
|
||||
h, err := machine.CheckIfHostExistsAndLoad(m.machineAPI, m.machineName)
|
||||
h, err := machine.LoadHost(m.machineAPI, m.machineName)
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrapf(err, "error loading docker-machine host for: %s", m.machineName)
|
||||
|
|
|
|||
Loading…
Reference in New Issue