diff --git a/CHANGELOG.md b/CHANGELOG.md index 88b33fcef7..9bfa126053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,45 @@ # Release Notes +## Version 1.10.0-beta.2 - 2020-04-29 + +Improvements: + +* Upgrade default Kubernetes to v1.18.1 [#7714](https://github.com/kubernetes/minikube/pull/7714) +* Automatically apply CNI on multinode clusters [#7930](https://github.com/kubernetes/minikube/pull/7930) +* Add Metal LB addon [#7308](https://github.com/kubernetes/minikube/pull/7308) +* Add `(host|control-plane).minikube.internal` to /etc/hosts [#7247](https://github.com/kubernetes/minikube/pull/7247) +* Add "sudo" to podman calls [#7631](https://github.com/kubernetes/minikube/pull/7631) +* Add list option for "minikube node" command [#7851](https://github.com/kubernetes/minikube/pull/7851) +* Add option to force docker to use systemd as cgroup manager [#7815](https://github.com/kubernetes/minikube/pull/7815) +* Improve auto-select memory for multinode clusters [#7928](https://github.com/kubernetes/minikube/pull/7928) +* bump dashboard image v2.0.0 [#7849](https://github.com/kubernetes/minikube/pull/7849) +* Upgrade docker driver base image to v0.0.10 [#7858](https://github.com/kubernetes/minikube/pull/7858) +* docker-env: fall back to bash if can not detect shell. [#7887](https://github.com/kubernetes/minikube/pull/7887) + +Bug fixes: + +* docker/podman drivers: wait for service before open url [#7898](https://github.com/kubernetes/minikube/pull/7898) +* addon registry-alias: change hosts update container image [#7864](https://github.com/kubernetes/minikube/pull/7864) +* Fix sysctl fs.protected_regular=1 typo [#7882](https://github.com/kubernetes/minikube/pull/7882) +* change emoji for: notifying new kubernetes version is available [#7835](https://github.com/kubernetes/minikube/pull/7835) +* contained cni: rename default cni file to have higher priority [#7875](https://github.com/kubernetes/minikube/pull/7875) + +Huge thank you for this release towards our contributors: + +- Anders F Björklund +- Kenta Iso +- Marcin Niemira +- Medya Ghazizadeh +- Priya Wadhwa +- Radoslaw Smigielski +- Sharif Elgamal +- Thomas Strömberg +- Tobias Klauser +- Travis Mehlinger +- Zhongcheng Lao +- ZouYu +- priyawadhwa + ## Version 1.10.0-beta.1 - 2020-04-22 Improvements: diff --git a/Makefile b/Makefile index 563bdf597d..76ddba68d5 100755 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # Bump these on release - and please check ISO_VERSION for correctness. VERSION_MAJOR ?= 1 VERSION_MINOR ?= 10 -VERSION_BUILD ?= 0-beta.1 +VERSION_BUILD ?= 0-beta.2 RAW_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD) VERSION ?= v$(RAW_VERSION) diff --git a/cmd/minikube/cmd/tunnel.go b/cmd/minikube/cmd/tunnel.go index 6474e8fbf7..2f7fb45a9e 100644 --- a/cmd/minikube/cmd/tunnel.go +++ b/cmd/minikube/cmd/tunnel.go @@ -57,7 +57,6 @@ var tunnelCmd = &cobra.Command{ if err := manager.CleanupNotRunningTunnels(); err != nil { glog.Errorf("error cleaning up: %s", err) } - return } // Tunnel uses the k8s clientset to query the API server for services in the LoadBalancerEmulator. @@ -104,5 +103,5 @@ var tunnelCmd = &cobra.Command{ } func init() { - tunnelCmd.Flags().BoolVarP(&cleanup, "cleanup", "c", false, "call with cleanup=true to remove old tunnels") + tunnelCmd.Flags().BoolVarP(&cleanup, "cleanup", "c", true, "call with cleanup=true to remove old tunnels") } diff --git a/pkg/minikube/bootstrapper/bsutil/kubelet_test.go b/pkg/minikube/bootstrapper/bsutil/kubelet_test.go index 3689ac3533..f65ac02716 100644 --- a/pkg/minikube/bootstrapper/bsutil/kubelet_test.go +++ b/pkg/minikube/bootstrapper/bsutil/kubelet_test.go @@ -81,7 +81,7 @@ Wants=crio.service [Service] ExecStart= -ExecStart=/var/lib/minikube/binaries/v1.18.0/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=/var/run/crio/crio.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=/var/run/crio/crio.sock --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.100 --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m +ExecStart=/var/lib/minikube/binaries/v1.18.1/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=/var/run/crio/crio.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=/var/run/crio/crio.sock --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.100 --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m [Install] `, @@ -107,7 +107,7 @@ Wants=containerd.service [Service] ExecStart= -ExecStart=/var/lib/minikube/binaries/v1.18.0/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=unix:///run/containerd/containerd.sock --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.100 --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m +ExecStart=/var/lib/minikube/binaries/v1.18.1/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=unix:///run/containerd/containerd.sock --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.100 --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m [Install] `, @@ -140,7 +140,7 @@ Wants=containerd.service [Service] ExecStart= -ExecStart=/var/lib/minikube/binaries/v1.18.0/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=unix:///run/containerd/containerd.sock --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.200 --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m +ExecStart=/var/lib/minikube/binaries/v1.18.1/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=unix:///run/containerd/containerd.sock --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.200 --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m [Install] `, @@ -167,7 +167,7 @@ Wants=docker.socket [Service] ExecStart= -ExecStart=/var/lib/minikube/binaries/v1.18.0/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=docker --fail-swap-on=false --hostname-override=minikube --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.100 --pod-infra-container-image=docker-proxy-image.io/google_containers/pause:3.2 --pod-manifest-path=/etc/kubernetes/manifests +ExecStart=/var/lib/minikube/binaries/v1.18.1/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=docker --fail-swap-on=false --hostname-override=minikube --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.1.100 --pod-infra-container-image=docker-proxy-image.io/google_containers/pause:3.2 --pod-manifest-path=/etc/kubernetes/manifests [Install] `, diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index 332ec84979..ffecc9d717 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -27,9 +27,9 @@ import ( const ( // DefaultKubernetesVersion is the default kubernetes version - DefaultKubernetesVersion = "v1.18.0" + DefaultKubernetesVersion = "v1.18.1" // NewestKubernetesVersion is the newest Kubernetes version to test against - NewestKubernetesVersion = "v1.18.0" + NewestKubernetesVersion = "v1.18.1" // OldestKubernetesVersion is the oldest Kubernetes version to test against OldestKubernetesVersion = "v1.12.0" // DefaultClusterName is the default nane for the k8s cluster diff --git a/pkg/minikube/download/binary.go b/pkg/minikube/download/binary.go index 3c8157dcba..54b7662816 100644 --- a/pkg/minikube/download/binary.go +++ b/pkg/minikube/download/binary.go @@ -24,7 +24,6 @@ import ( "github.com/blang/semver" "github.com/golang/glog" - "github.com/hashicorp/go-getter" "github.com/pkg/errors" "k8s.io/minikube/pkg/minikube/localpath" ) @@ -58,28 +57,14 @@ func Binary(binary, version, osName, archName string) (string, error) { return targetFilepath, nil } - if err = os.MkdirAll(targetDir, 0777); err != nil { - return "", errors.Wrapf(err, "mkdir %s", targetDir) - } - - tmpDst := targetFilepath + ".download" - - client := &getter.Client{ - Src: url, - Dst: tmpDst, - Mode: getter.ClientModeFile, - Options: []getter.ClientOption{getter.WithProgress(DefaultProgressBar)}, - } - - glog.Infof("Downloading: %+v", client) - if err := client.Get(); err != nil { + if err := download(url, targetFilepath); err != nil { return "", errors.Wrapf(err, "download failed: %s", url) } if osName == runtime.GOOS && archName == runtime.GOARCH { - if err = os.Chmod(tmpDst, 0755); err != nil { + if err = os.Chmod(targetFilepath, 0755); err != nil { return "", errors.Wrapf(err, "chmod +x %s", targetFilepath) } } - return targetFilepath, os.Rename(tmpDst, targetFilepath) + return targetFilepath, nil } diff --git a/pkg/minikube/download/binary_test.go b/pkg/minikube/download/binary_test.go deleted file mode 100644 index 5a481405e2..0000000000 --- a/pkg/minikube/download/binary_test.go +++ /dev/null @@ -1,129 +0,0 @@ -/* -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 download - -import ( - "io/ioutil" - "os" - "runtime" - "testing" -) - -func TestCacheBinary(t *testing.T) { - oldMinikubeHome := os.Getenv("MINIKUBE_HOME") - defer os.Setenv("MINIKUBE_HOME", oldMinikubeHome) - - minikubeHome, err := ioutil.TempDir("/tmp", "") - if err != nil { - t.Fatalf("error during creating tmp dir: %v", err) - } - defer func() { //clean up tempdir - err := os.RemoveAll(minikubeHome) - if err != nil { - t.Errorf("failed to clean up temp folder %q", minikubeHome) - } - }() - - defer os.RemoveAll(minikubeHome) - noWritePermDir, err := ioutil.TempDir("/tmp", "") - if err != nil { - t.Fatalf("error during creating tmp dir: %v", err) - } - defer func() { //clean up tempdir - err := os.RemoveAll(noWritePermDir) - if err != nil { - t.Errorf("failed to clean up temp folder %q", noWritePermDir) - } - }() - err = os.Chmod(noWritePermDir, 0000) - if err != nil { - t.Fatalf("error (%v) during changing permissions of dir %v", err, noWritePermDir) - } - - var tc = []struct { - desc, version, osName, archName string - minikubeHome, binary, description string - err bool - }{ - { - desc: "ok kubeadm", - version: "v1.16.0", - osName: "linux", - archName: runtime.GOARCH, - binary: "kubeadm", - err: false, - minikubeHome: minikubeHome, - }, - { - desc: "minikube home in dir without perms and arm runtime", - version: "v1.16.0", - osName: runtime.GOOS, - archName: "arm", - binary: "kubectl", - err: true, - minikubeHome: noWritePermDir, - }, - { - desc: "minikube home in dir without perms", - version: "v1.16.0", - osName: runtime.GOOS, - archName: runtime.GOARCH, - binary: "kubectl", - err: true, - minikubeHome: noWritePermDir, - }, - { - desc: "binary foo", - version: "v1.16.0", - osName: runtime.GOOS, - archName: runtime.GOARCH, - binary: "foo", - err: true, - minikubeHome: minikubeHome, - }, - { - desc: "version 9000", - version: "v9000", - osName: runtime.GOOS, - archName: runtime.GOARCH, - binary: "foo", - err: true, - minikubeHome: minikubeHome, - }, - { - desc: "bad os", - version: "v1.16.0", - osName: "no-such-os", - archName: runtime.GOARCH, - binary: "kubectl", - err: true, - minikubeHome: minikubeHome, - }, - } - for _, test := range tc { - t.Run(test.desc, func(t *testing.T) { - os.Setenv("MINIKUBE_HOME", test.minikubeHome) - _, err := Binary(test.binary, test.version, test.osName, test.archName) - if err != nil && !test.err { - t.Fatalf("Got unexpected error %v", err) - } - if err == nil && test.err { - t.Fatalf("Expected error but got %v", err) - } - }) - } -} diff --git a/pkg/minikube/download/download.go b/pkg/minikube/download/download.go new file mode 100644 index 0000000000..45d7932d0e --- /dev/null +++ b/pkg/minikube/download/download.go @@ -0,0 +1,88 @@ +/* +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 download + +import ( + "flag" + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/golang/glog" + "github.com/hashicorp/go-getter" + "github.com/pkg/errors" +) + +var ( + mockMode = false +) + +// EnableMock allows tests to selectively enable if downloads are mocked +func EnableMock(b bool) { + mockMode = b +} + +// download is a well-configured atomic download function +func download(src string, dst string) error { + tmpDst := dst + ".download" + client := &getter.Client{ + Src: src, + Dst: tmpDst, + Dir: false, + Mode: getter.ClientModeFile, + Options: []getter.ClientOption{getter.WithProgress(DefaultProgressBar)}, + Getters: map[string]getter.Getter{ + "file": &getter.FileGetter{Copy: false}, + "http": &getter.HttpGetter{Netrc: false}, + "https": &getter.HttpGetter{Netrc: false}, + }, + } + + if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { + return errors.Wrap(err, "mkdir") + } + + // Don't bother with getter.MockGetter, as we don't provide a way to inspect the outcome + if mockMode { + glog.Infof("Mock download: %s -> %s", src, dst) + // Callers expect the file to exist + _, err := os.Create(dst) + return err + } + + // Politely prevent tests from shooting themselves in the foot + if withinUnitTest() { + return fmt.Errorf("unmocked download under test") + } + + glog.Infof("Downloading: %s -> %s", src, dst) + if err := client.Get(); err != nil { + return errors.Wrapf(err, "getter: %+v", client) + } + return os.Rename(tmpDst, dst) +} + +// withinUnitTset detects if we are in running within a unit-test +func withinUnitTest() bool { + // Nope, it's the integration test + if flag.Lookup("minikube-start-args") != nil || strings.HasPrefix(filepath.Base(os.Args[0]), "e2e-") { + return false + } + + return flag.Lookup("test.v") != nil || strings.HasSuffix(os.Args[0], "test") +} diff --git a/pkg/minikube/download/driver.go b/pkg/minikube/download/driver.go index 80fef9a6a9..65780be044 100644 --- a/pkg/minikube/download/driver.go +++ b/pkg/minikube/download/driver.go @@ -21,8 +21,6 @@ import ( "os" "github.com/blang/semver" - "github.com/golang/glog" - "github.com/hashicorp/go-getter" "github.com/pkg/errors" "k8s.io/minikube/pkg/minikube/out" ) @@ -35,25 +33,10 @@ func driverWithChecksumURL(name string, v semver.Version) string { // Driver downloads an arbitrary driver func Driver(name string, destination string, v semver.Version) error { out.T(out.FileDownload, "Downloading driver {{.driver}}:", out.V{"driver": name}) - - tmpDst := destination + ".download" - - url := driverWithChecksumURL(name, v) - client := &getter.Client{ - Src: url, - Dst: tmpDst, - Mode: getter.ClientModeFile, - Options: []getter.ClientOption{getter.WithProgress(DefaultProgressBar)}, + if err := download(driverWithChecksumURL(name, v), destination); err != nil { + return errors.Wrap(err, "download") } - glog.Infof("Downloading: %+v", client) - if err := client.Get(); err != nil { - return errors.Wrapf(err, "download failed: %s", url) - } // Give downloaded drivers a baseline decent file permission - err := os.Chmod(tmpDst, 0755) - if err != nil { - return err - } - return os.Rename(tmpDst, destination) + return os.Chmod(destination, 0755) } diff --git a/pkg/minikube/download/iso.go b/pkg/minikube/download/iso.go index 96f65ad62a..d4ca027a00 100644 --- a/pkg/minikube/download/iso.go +++ b/pkg/minikube/download/iso.go @@ -26,7 +26,6 @@ import ( "time" "github.com/golang/glog" - "github.com/hashicorp/go-getter" "github.com/juju/mutex" "github.com/pkg/errors" "k8s.io/minikube/pkg/minikube/localpath" @@ -134,19 +133,5 @@ func downloadISO(isoURL string, skipChecksum bool) error { urlWithChecksum = isoURL } - tmpDst := dst + ".download" - - opts := []getter.ClientOption{getter.WithProgress(DefaultProgressBar)} - client := &getter.Client{ - Src: urlWithChecksum, - Dst: tmpDst, - Mode: getter.ClientModeFile, - Options: opts, - } - - glog.Infof("full url: %s", urlWithChecksum) - if err := client.Get(); err != nil { - return errors.Wrap(err, isoURL) - } - return os.Rename(tmpDst, dst) + return download(urlWithChecksum, dst) } diff --git a/pkg/minikube/download/preload.go b/pkg/minikube/download/preload.go index aa2eef3768..316cfdf2ad 100644 --- a/pkg/minikube/download/preload.go +++ b/pkg/minikube/download/preload.go @@ -30,7 +30,6 @@ import ( "google.golang.org/api/option" "github.com/golang/glog" - "github.com/hashicorp/go-getter" "github.com/pkg/errors" "github.com/spf13/viper" "k8s.io/minikube/pkg/minikube/localpath" @@ -133,16 +132,7 @@ func Preload(k8sVersion, containerRuntime string) error { out.T(out.FileDownload, "Downloading Kubernetes {{.version}} preload ...", out.V{"version": k8sVersion}) url := remoteTarballURL(k8sVersion, containerRuntime) - tmpDst := targetPath + ".download" - client := &getter.Client{ - Src: url, - Dst: tmpDst, - Mode: getter.ClientModeFile, - Options: []getter.ClientOption{getter.WithProgress(DefaultProgressBar)}, - } - - glog.Infof("Downloading: %+v", client) - if err := client.Get(); err != nil { + if err := download(url, targetPath); err != nil { return errors.Wrapf(err, "download failed: %s", url) } @@ -150,10 +140,11 @@ func Preload(k8sVersion, containerRuntime string) error { return errors.Wrap(err, "saving checksum file") } - if err := verifyChecksum(k8sVersion, containerRuntime, tmpDst); err != nil { + if err := verifyChecksum(k8sVersion, containerRuntime, targetPath); err != nil { return errors.Wrap(err, "verify") } - return os.Rename(tmpDst, targetPath) + + return nil } func saveChecksumFile(k8sVersion, containerRuntime string) error { diff --git a/pkg/minikube/machine/cache_binaries_test.go b/pkg/minikube/machine/cache_binaries_test.go index f83fbfc832..997d43a772 100644 --- a/pkg/minikube/machine/cache_binaries_test.go +++ b/pkg/minikube/machine/cache_binaries_test.go @@ -25,6 +25,7 @@ import ( "k8s.io/minikube/pkg/minikube/assets" "k8s.io/minikube/pkg/minikube/bootstrapper" "k8s.io/minikube/pkg/minikube/command" + "k8s.io/minikube/pkg/minikube/download" ) type copyFailRunner struct { @@ -82,6 +83,8 @@ func TestCopyBinary(t *testing.T) { } func TestCacheBinariesForBootstrapper(t *testing.T) { + download.EnableMock(true) + oldMinikubeHome := os.Getenv("MINIKUBE_HOME") defer os.Setenv("MINIKUBE_HOME", oldMinikubeHome) diff --git a/pkg/minikube/machine/cluster_test.go b/pkg/minikube/machine/cluster_test.go index 01c99de92e..310f29e2eb 100644 --- a/pkg/minikube/machine/cluster_test.go +++ b/pkg/minikube/machine/cluster_test.go @@ -24,6 +24,7 @@ import ( // Driver used by testdata "k8s.io/minikube/pkg/minikube/constants" + "k8s.io/minikube/pkg/minikube/download" _ "k8s.io/minikube/pkg/minikube/registry/drvs/virtualbox" "github.com/docker/machine/libmachine/drivers" @@ -70,6 +71,8 @@ var defaultClusterConfig = config.ClusterConfig{ } func TestCreateHost(t *testing.T) { + download.EnableMock(true) + RegisterMockDriver(t) api := tests.NewMockAPI(t) @@ -113,6 +116,8 @@ func TestCreateHost(t *testing.T) { } func TestStartHostExists(t *testing.T) { + download.EnableMock(true) + RegisterMockDriver(t) api := tests.NewMockAPI(t) @@ -150,6 +155,8 @@ func TestStartHostExists(t *testing.T) { } func TestStartHostErrMachineNotExist(t *testing.T) { + download.EnableMock(true) + RegisterMockDriver(t) api := tests.NewMockAPI(t) // Create an incomplete host with machine does not exist error(i.e. User Interrupt Cancel) @@ -195,6 +202,8 @@ func TestStartHostErrMachineNotExist(t *testing.T) { } func TestStartStoppedHost(t *testing.T) { + download.EnableMock(true) + RegisterMockDriver(t) api := tests.NewMockAPI(t) // Create an initial host. @@ -230,6 +239,8 @@ func TestStartStoppedHost(t *testing.T) { } func TestStartHost(t *testing.T) { + download.EnableMock(true) + RegisterMockDriver(t) api := tests.NewMockAPI(t) @@ -258,6 +269,8 @@ func TestStartHost(t *testing.T) { } func TestStartHostConfig(t *testing.T) { + download.EnableMock(true) + RegisterMockDriver(t) api := tests.NewMockAPI(t) diff --git a/site/content/en/docs/commands/start.md b/site/content/en/docs/commands/start.md index ee0bad36bc..bcff3a72eb 100644 --- a/site/content/en/docs/commands/start.md +++ b/site/content/en/docs/commands/start.md @@ -65,9 +65,9 @@ minikube start [flags] --insecure-registry strings Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added. --install-addons If set, install addons. Defaults to true. (default true) --interactive Allow user prompts for more information (default true) - --iso-url strings Locations to fetch the minikube ISO from. (default [https://storage.googleapis.com/minikube/iso/minikube-v1.10.0-beta.1.iso,https://github.com/kubernetes/minikube/releases/download/v1.10.0-beta.1/minikube-v1.10.0-beta.1.iso,https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/iso/minikube-v1.10.0-beta.1.iso]) + --iso-url strings Locations to fetch the minikube ISO from. (default [https://storage.googleapis.com/minikube/iso/minikube-v1.10.0-beta.2.iso,https://github.com/kubernetes/minikube/releases/download/v1.10.0-beta.2/minikube-v1.10.0-beta.2.iso,https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/iso/minikube-v1.10.0-beta.2.iso]) --keep-context This will keep the existing kubectl context and will create a minikube context. - --kubernetes-version string The kubernetes version that the minikube VM will use (ex: v1.2.3, 'stable' for v1.18.0, 'latest' for v1.18.0). Defaults to 'stable'. + --kubernetes-version string The kubernetes version that the minikube VM will use (ex: v1.2.3, 'stable' for v1.18.1, 'latest' for v1.18.1). Defaults to 'stable'. --kvm-gpu Enable experimental NVIDIA GPU support in minikube --kvm-hidden Hide the hypervisor signature from the guest in minikube (kvm2 driver only) --kvm-network string The KVM network name. (kvm2 driver only) (default "default") diff --git a/site/content/en/docs/commands/tunnel.md b/site/content/en/docs/commands/tunnel.md index 72b73a316b..7fde8449d3 100644 --- a/site/content/en/docs/commands/tunnel.md +++ b/site/content/en/docs/commands/tunnel.md @@ -21,7 +21,7 @@ minikube tunnel [flags] ### Options ``` - -c, --cleanup call with cleanup=true to remove old tunnels + -c, --cleanup call with cleanup=true to remove old tunnels (default true) -h, --help help for tunnel ``` diff --git a/site/content/en/docs/handbook/accessing.md b/site/content/en/docs/handbook/accessing.md index 9b0aedae17..eabbd0b56e 100644 --- a/site/content/en/docs/handbook/accessing.md +++ b/site/content/en/docs/handbook/accessing.md @@ -131,6 +131,8 @@ If the `minikube tunnel` shuts down in an abrupt manner, it may leave orphaned n minikube tunnel --cleanup ```` +NOTE: `--cleanup` flag's default value is `true`. + ### Avoiding password prompts Adding a route requires root privileges for the user, and thus there are differences in how to run `minikube tunnel` depending on the OS. If you want to avoid entering the root password, consider setting NOPASSWD for "ip" and "route" commands: diff --git a/test/integration/docker_test.go b/test/integration/docker_test.go index 25d0da8eb4..e150f7ad30 100644 --- a/test/integration/docker_test.go +++ b/test/integration/docker_test.go @@ -75,7 +75,7 @@ func TestForceSystemd(t *testing.T) { defer CleanupWithLogs(t, profile, cancel) // Use the most verbose logging for the simplest test. If it fails, something is very wrong. - args := append([]string{"start", "-p", profile, "--force-systemd", "--alsologtostderr", "-v=5"}, StartArgs()...) + args := append([]string{"start", "-p", profile, "--memory=1800", "--force-systemd", "--alsologtostderr", "-v=5"}, StartArgs()...) rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) if err != nil { t.Errorf("failed to start minikube with args: %q : %v", rr.Command(), err) diff --git a/test/integration/driver_install_or_update_test.go b/test/integration/driver_install_or_update_test.go index cff536642c..3e85d5d156 100644 --- a/test/integration/driver_install_or_update_test.go +++ b/test/integration/driver_install_or_update_test.go @@ -20,6 +20,7 @@ import ( "fmt" "io/ioutil" "os" + "os/exec" "path/filepath" "runtime" "testing" @@ -147,7 +148,11 @@ func TestHyperKitDriverInstallOrUpdate(t *testing.T) { t.Fatalf("Expected new semver. test: %v, got: %v", tc.name, err) } - err = driver.InstallOrUpdate("hyperkit", dir, newerVersion, true, true) + if err := exec.Command("sudo", "-n", "ls").Run(); err != nil { + t.Skipf("password required to execute 'ls', skipping remaining test: %v", err) + } + + err = driver.InstallOrUpdate("hyperkit", dir, newerVersion, false, true) if err != nil { t.Fatalf("Failed to update driver to %v. test: %s, got: %v", newerVersion, tc.name, err) } diff --git a/test/integration/error_spam_test.go b/test/integration/error_spam_test.go index 254db00770..cb1d1ad6d4 100644 --- a/test/integration/error_spam_test.go +++ b/test/integration/error_spam_test.go @@ -34,6 +34,9 @@ var stderrWhitelist = []string{ `slow|long time|Restarting the docker service may improve`, // don't care if we can't push images to other profiles `cache_images.go:.*error getting status`, + // network flakiness on VirtualBox + // ! Unable to verify SSH connectivity: dial tcp 192.168.99.249:22: i/o timeout. Will retry... + `SSH.*i/o timeout.retry`, } // stderrWhitelistRe combines rootCauses into a single regex diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index 2350f322dd..e744020558 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -195,7 +195,7 @@ func validateStartWithProxy(ctx context.Context, t *testing.T, profile string) { // Use more memory so that we may reliably fit MySQL and nginx // changing api server so later in soft start we verify it didn't change - startArgs := append([]string{"start", "-p", profile, fmt.Sprintf("--apiserver-port=%d", apiPortTest), "--wait=true"}, StartArgs()...) + startArgs := append([]string{"start", "-p", profile, "--memory=2800", fmt.Sprintf("--apiserver-port=%d", apiPortTest), "--wait=true"}, StartArgs()...) c := exec.CommandContext(ctx, Target(), startArgs...) env := os.Environ() env = append(env, fmt.Sprintf("HTTP_PROXY=%s", srv.Addr)) diff --git a/test/integration/multinode_test.go b/test/integration/multinode_test.go index c4814cd415..a69f86a43b 100644 --- a/test/integration/multinode_test.go +++ b/test/integration/multinode_test.go @@ -57,7 +57,7 @@ func TestMultiNode(t *testing.T) { func validateMultiNodeStart(ctx context.Context, t *testing.T, profile string) { // Start a 2 node cluster with the --nodes param - startArgs := append([]string{"start", "-p", profile, "--wait=true", "--nodes=2"}, StartArgs()...) + startArgs := append([]string{"start", "-p", profile, "--wait=true", "--memory=2200", "--nodes=2"}, StartArgs()...) rr, err := Run(t, exec.CommandContext(ctx, Target(), startArgs...)) if err != nil { t.Fatalf("failed to start cluster. args %q : %v", rr.Command(), err) diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index 0b4a483ab2..b6764ea967 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -94,7 +94,7 @@ func TestStartStop(t *testing.T) { waitFlag = "--wait=apiserver,system_pods,default_sa" } - startArgs := append([]string{"start", "-p", profile, "--memory=2200", "--alsologtostderr", "-v=3", waitFlag}, tc.args...) + startArgs := append([]string{"start", "-p", profile, "--memory=2200", "--alsologtostderr", waitFlag}, tc.args...) startArgs = append(startArgs, StartArgs()...) startArgs = append(startArgs, fmt.Sprintf("--kubernetes-version=%s", tc.version)) diff --git a/test/integration/version_upgrade_test.go b/test/integration/version_upgrade_test.go index fa6a4d4653..f13c5b3d15 100644 --- a/test/integration/version_upgrade_test.go +++ b/test/integration/version_upgrade_test.go @@ -95,7 +95,7 @@ func TestVersionUpgrade(t *testing.T) { t.Errorf("FAILED: status = %q; want = %q", got, state.Stopped.String()) } - args = append([]string{"start", "-p", profile, fmt.Sprintf("--kubernetes-version=%s", constants.NewestKubernetesVersion), "--alsologtostderr", "-v=1"}, StartArgs()...) + args = append([]string{"start", "-p", profile, "--memory=2200", fmt.Sprintf("--kubernetes-version=%s", constants.NewestKubernetesVersion), "--alsologtostderr", "-v=1"}, StartArgs()...) rr, err = Run(t, exec.CommandContext(ctx, Target(), args...)) if err != nil { t.Errorf("failed to start minikube HEAD with newest k8s version. args: %s : %v", rr.Command(), err) @@ -121,13 +121,13 @@ func TestVersionUpgrade(t *testing.T) { } t.Logf("Attempting to downgrade Kubernetes (should fail)") - args = append([]string{"start", "-p", profile, fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion), "--alsologtostderr", "-v=1"}, StartArgs()...) + args = append([]string{"start", "-p", profile, "--memory=2200", fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion), "--alsologtostderr", "-v=1"}, StartArgs()...) if rr, err := Run(t, exec.CommandContext(ctx, tf.Name(), args...)); err == nil { t.Fatalf("downgrading kubernetes should not be allowed. expected to see error but got %v for %q", err, rr.Command()) } t.Logf("Attempting restart after unsuccessful downgrade") - args = append([]string{"start", "-p", profile, fmt.Sprintf("--kubernetes-version=%s", constants.NewestKubernetesVersion), "--alsologtostderr", "-v=1"}, StartArgs()...) + args = append([]string{"start", "-p", profile, "--memory=2200", fmt.Sprintf("--kubernetes-version=%s", constants.NewestKubernetesVersion), "--alsologtostderr", "-v=1"}, StartArgs()...) rr, err = Run(t, exec.CommandContext(ctx, Target(), args...)) if err != nil { t.Errorf("start after failed upgrade: %v", err)