diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ec7b9b32c..7be657f9c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,8 +2,11 @@ name: CI on: [pull_request] + jobs: docker_ubuntu_16_04: + env: + ELAPSED: time runs-on: ubuntu-16.04 steps: - uses: actions/checkout@v2 @@ -20,17 +23,32 @@ jobs: - name: run integration test run: | mkdir -p /tmp/testhome + + START_TIME=$(date -u +%s) + MINIKUBE_HOME=/tmp/testhome ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt + + END_TIME=$(date -u +%s) + ELAPSED=$(($END_TIME-$START_TIME)) + min=$((${ELAPSED}/60)) + sec=$((${ELAPSED}%60)) + ELAPSED="${min} min $sec seconds " + + echo ::set-env name=ELAPSED::${ELAPSED} - name: generate gopogh report run: | export PATH=${PATH}:`go env GOPATH`/bin go tool test2json -t < ./report/testout.txt > ./report/testout.json || true - gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/ || true + STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/) || true + report="Docker_Ubuntu_16_04 : Completed with ${STAT} in ${ELAPSED}" + echo ${report} - uses: actions/upload-artifact@v1 with: name: docker_on_ubuntu_16_04_report path: report docker_ubuntu_18_04: + env: + ELAPSED: time runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 @@ -47,17 +65,31 @@ jobs: - name: run integration test run: | mkdir -p /tmp/testhome + START_TIME=$(date -u +%s) + MINIKUBE_HOME=/tmp/testhome ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt + + END_TIME=$(date -u +%s) + ELAPSED=$(($END_TIME-$START_TIME)) + min=$((${ELAPSED}/60)) + sec=$((${ELAPSED}%60)) + ELAPSED="${min} min $sec seconds" + + echo ::set-env name=ELAPSED::${ELAPSED} - name: generate gopogh report run: | export PATH=${PATH}:`go env GOPATH`/bin go tool test2json -t < ./report/testout.txt > ./report/testout.json || true - gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/ || true + STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/) || true + report="Docker_Ubuntu_18_04 : Completed with ${STAT} in ${ELAPSED}" + echo ${report} - uses: actions/upload-artifact@v1 with: name: docker_on_ubuntu_18_04_report path: report docker_macos: + env: + ELAPSED: time runs-on: macos-latest steps: - uses: actions/checkout@v2 @@ -79,17 +111,32 @@ jobs: - name: run integration test run: | mkdir -p /tmp/testhome + + START_TIME=$(date -u +%s) + MINIKUBE_HOME=/tmp/testhome ./out/e2e-darwin-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -test.v -binary=./out/minikube-darwin-amd64 2>&1 | tee ./report/testout.txt + + END_TIME=$(date -u +%s) + ELAPSED=$(($END_TIME-$START_TIME)) + min=$((${ELAPSED}/60)) + sec=$((${ELAPSED}%60)) + ELAPSED="${min} min $sec seconds" + + echo ::set-env name=ELAPSED::${ELAPSED} - name: generate gopogh report run: | export PATH=${PATH}:`go env GOPATH`/bin go tool test2json -t < ./report/testout.txt > ./report/testout.json || true - gopogh -in ./report/testout.json -out ./report/testout.html -name "docker macos" -repo github.com/kubernetes/minikube/ || true + STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "docker macos" -repo github.com/kubernetes/minikube/) || true + report="Docker_mac_os : Completed with ${STAT} in ${ELAPSED}" + echo ${report} - uses: actions/upload-artifact@v1 with: name: docker_on_macos_report path: ./report none_ubuntu16_04: + env: + ELAPSED: time runs-on: ubuntu-16.04 steps: - uses: actions/checkout@v2 @@ -106,17 +153,32 @@ jobs: - name: run integration test run: | mkdir -p /tmp/testhome + + START_TIME=$(date -u +%s) + MINIKUBE_HOME=/tmp/testhome sudo -E ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=none -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt + + END_TIME=$(date -u +%s) + ELAPSED=$(($END_TIME-$START_TIME)) + min=$((${ELAPSED}/60)) + sec=$((${ELAPSED}%60)) + ELAPSED="${min} min $sec seconds" + + echo ::set-env name=ELAPSED::${ELAPSED} - name: generate gopogh report run: | export PATH=${PATH}:`go env GOPATH`/bin go tool test2json -t < ./report/testout.txt > ./report/testout.json || true - gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/ || true + STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/) || true + report="None_Ubuntu_16_04 : Completed with ${STAT} in ${ELAPSED}" + echo ${report} - uses: actions/upload-artifact@v1 with: name: none_on_ubuntu_16_04 path: report none_ubuntu_18_04: + env: + ELAPSED: time runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 @@ -132,13 +194,60 @@ jobs: - name: run integration test run: | mkdir -p /tmp/testhome + + START_TIME=$(date -u +%s) + MINIKUBE_HOME=/tmp/testhome sudo -E ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=none -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt + + END_TIME=$(date -u +%s) + ELAPSED=$(($END_TIME-$START_TIME)) + min=$((${ELAPSED}/60)) + sec=$((${ELAPSED}%60)) + ELAPSED="${min} min $sec seconds" + + echo ::set-env name=ELAPSED::${ELAPSED} - name: generate gopogh report run: | export PATH=${PATH}:`go env GOPATH`/bin go tool test2json -t < ./report/testout.txt > ./report/testout.json || true - gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/ || true + STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/) || true + report="None_Ubuntu_18_04 : Completed with ${STAT} in ${ELAPSED}" + echo ${report} - uses: actions/upload-artifact@v1 with: name: none_on_ubuntu_latest_report path: report + podman_ubuntu_18_04: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: install podman + run: | + . /etc/os-release + sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" + wget -q https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add - + sudo apt-key add - < Release.key || true + sudo apt-get update -qq + sudo apt-get -qq -y install podman + - name: build binaries + run : | + make minikube-linux-amd64 + make e2e-linux-amd64 + - name: install gopogh + run: | + cd /tmp + GO111MODULE="on" go get github.com/medyagh/gopogh@v0.0.17 || true + cd - + - name: run integration test + run: | + mkdir -p /tmp/testhome + MINIKUBE_HOME=/tmp/testhome sudo -E ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=podman -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt + - name: generate gopogh report + run: | + export PATH=${PATH}:`go env GOPATH`/bin + go tool test2json -t < ./report/testout.txt > ./report/testout.json || true + gopogh -in ./report/testout.json -out ./report/testout.html -name "docker ubuntu" -repo github.com/kubernetes/minikube/ || true + - uses: actions/upload-artifact@v1 + with: + name: podman_on_ubuntu_latest_report + path: report diff --git a/Makefile b/Makefile index bfc0a8656e..2ecaf23b03 100755 --- a/Makefile +++ b/Makefile @@ -19,11 +19,14 @@ VERSION_BUILD ?= 2 RAW_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).${VERSION_BUILD} VERSION ?= v$(RAW_VERSION) +KUBERNETES_VERSION ?= $(shell egrep "^var DefaultKubernetesVersion" pkg/minikube/constants/constants.go | cut -d \" -f2) + # Default to .0 for higher cache hit rates, as build increments typically don't require new ISO versions ISO_VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).0 # Dashes are valid in semver, but not Linux packaging. Use ~ to delimit alpha/beta DEB_VERSION ?= $(subst -,~,$(RAW_VERSION)) RPM_VERSION ?= $(DEB_VERSION) +KIC_VERSION ?= 0.0.5 # used by hack/jenkins/release_build_and_upload.sh and KVM_BUILD_IMAGE, see also BUILD_IMAGE below GO_VERSION ?= 1.13.4 @@ -505,10 +508,19 @@ storage-provisioner-image: out/storage-provisioner-$(GOARCH) ## Build storage-pr .PHONY: kic-base-image kic-base-image: ## builds the base image used for kic. - docker rmi -f $(REGISTRY)/kicbase:v0.0.5-snapshot || true - docker build -f ./hack/images/kicbase.Dockerfile -t $(REGISTRY)/kicbase:v0.0.5-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) . + docker rmi -f $(REGISTRY)/kicbase:v$(KIC_VERSION)-snapshot || true + docker build -f ./hack/images/kicbase.Dockerfile -t $(REGISTRY)/kicbase:v$(KIC_VERSION)-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) --target base . +.PHONY: kic-preloaded-base-image +kic-preloaded-base-image: generate-preloaded-images-tar ## builds the base image used for kic. + docker rmi -f $(REGISTRY)/kicbase:v$(KIC_VERSION)-k8s-${KUBERNETES_VERSION} || true + docker build -f ./hack/images/kicbase.Dockerfile -t $(REGISTRY)/kicbase:v$(KIC_VERSION)-k8s-${KUBERNETES_VERSION} --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) --build-arg KUBERNETES_VERSION=${KUBERNETES_VERSION} . + +.PHONY: generate-preloaded-images-tar +generate-preloaded-images-tar: out/minikube + go run ./hack/preload-images/preload_images.go -kubernetes-version ${KUBERNETES_VERSION} + .PHONY: push-storage-provisioner-image push-storage-provisioner-image: storage-provisioner-image ## Push storage-provisioner docker image using gcloud diff --git a/cmd/minikube/cmd/config/profile.go b/cmd/minikube/cmd/config/profile.go index 67203ebdbf..7784024089 100644 --- a/cmd/minikube/cmd/config/profile.go +++ b/cmd/minikube/cmd/config/profile.go @@ -23,7 +23,6 @@ import ( "github.com/spf13/viper" pkgConfig "k8s.io/minikube/pkg/minikube/config" pkg_config "k8s.io/minikube/pkg/minikube/config" - "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/exit" "k8s.io/minikube/pkg/minikube/kubeconfig" "k8s.io/minikube/pkg/minikube/out" @@ -87,7 +86,7 @@ var ProfileCmd = &cobra.Command{ out.SuccessT("Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.", out.V{"profile_name": profile}) out.SuccessT("To connect to this cluster, use: kubectl --context={{.profile_name}}", out.V{"profile_name": profile}) } else { - err := kubeconfig.SetCurrentContext(profile, constants.KubeconfigPath) + err := kubeconfig.SetCurrentContext(profile, kubeconfig.PathFromEnv()) if err != nil { out.ErrT(out.Sad, `Error while setting kubectl current context : {{.error}}`, out.V{"error": err}) } diff --git a/cmd/minikube/cmd/env.go b/cmd/minikube/cmd/docker-env.go similarity index 50% rename from cmd/minikube/cmd/env.go rename to cmd/minikube/cmd/docker-env.go index 030aa410cb..e831e048d9 100644 --- a/cmd/minikube/cmd/env.go +++ b/cmd/minikube/cmd/docker-env.go @@ -26,15 +26,11 @@ import ( "os" "strconv" "strings" - "text/template" "github.com/docker/machine/libmachine/drivers" - "github.com/docker/machine/libmachine/shell" "github.com/docker/machine/libmachine/state" - "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" - "k8s.io/minikube/pkg/drivers/kic" "k8s.io/minikube/pkg/drivers/kic/oci" "k8s.io/minikube/pkg/minikube/cluster" "k8s.io/minikube/pkg/minikube/config" @@ -44,71 +40,25 @@ import ( "k8s.io/minikube/pkg/minikube/localpath" "k8s.io/minikube/pkg/minikube/machine" "k8s.io/minikube/pkg/minikube/out" + "k8s.io/minikube/pkg/minikube/shell" ) -var envTmpl = fmt.Sprintf("{{ .Prefix }}%s{{ .Delimiter }}{{ .DockerTLSVerify }}{{ .Suffix }}{{ .Prefix }}%s{{ .Delimiter }}{{ .DockerHost }}{{ .Suffix }}{{ .Prefix }}%s{{ .Delimiter }}{{ .DockerCertPath }}{{ .Suffix }}{{ .Prefix }}%s{{ .Delimiter }}{{ .MinikubeDockerdProfile }}{{ .Suffix }}{{ if .NoProxyVar }}{{ .Prefix }}{{ .NoProxyVar }}{{ .Delimiter }}{{ .NoProxyValue }}{{ .Suffix }}{{end}}{{ .UsageHint }}", constants.DockerTLSVerifyEnv, constants.DockerHostEnv, constants.DockerCertPathEnv, constants.MinikubeActiveDockerdEnv) +var dockerEnvTmpl = fmt.Sprintf("{{ .Prefix }}%s{{ .Delimiter }}{{ .DockerTLSVerify }}{{ .Suffix }}{{ .Prefix }}%s{{ .Delimiter }}{{ .DockerHost }}{{ .Suffix }}{{ .Prefix }}%s{{ .Delimiter }}{{ .DockerCertPath }}{{ .Suffix }}{{ .Prefix }}%s{{ .Delimiter }}{{ .MinikubeDockerdProfile }}{{ .Suffix }}{{ if .NoProxyVar }}{{ .Prefix }}{{ .NoProxyVar }}{{ .Delimiter }}{{ .NoProxyValue }}{{ .Suffix }}{{end}}{{ .UsageHint }}", constants.DockerTLSVerifyEnv, constants.DockerHostEnv, constants.DockerCertPathEnv, constants.MinikubeActiveDockerdEnv) -const ( - fishSetPfx = "set -gx " - fishSetSfx = "\"\n" - fishSetDelim = " \"" - - fishUnsetPfx = "set -e " - fishUnsetSfx = "\n" - - psSetPfx = "$Env:" - psSetSfx = "\"\n" - psSetDelim = " = \"" - - psUnsetPfx = `Remove-Item Env:\\` - psUnsetSfx = "\n" - - cmdSetPfx = "SET " - cmdSetSfx = "\n" - cmdSetDelim = "=" - - cmdUnsetPfx = "SET " - cmdUnsetSfx = "\n" - cmdUnsetDelim = "=" - - emacsSetPfx = "(setenv \"" - emacsSetSfx = "\")\n" - emacsSetDelim = "\" \"" - - emacsUnsetPfx = "(setenv \"" - emacsUnsetSfx = ")\n" - emacsUnsetDelim = "\" nil" - - bashSetPfx = "export " - bashSetSfx = "\"\n" - bashSetDelim = "=\"" - - bashUnsetPfx = "unset " - bashUnsetSfx = "\n" - - nonePfx = "" - noneSfx = "\n" - noneDelim = "=" -) - -// ShellConfig represents the shell config -type ShellConfig struct { - Prefix string - Delimiter string - Suffix string +// DockerShellConfig represents the shell config for Docker +type DockerShellConfig struct { + shell.Config DockerCertPath string DockerHost string DockerTLSVerify string MinikubeDockerdProfile string - UsageHint string NoProxyVar string NoProxyValue string } var ( noProxy bool - forceShell string - unset bool + dockerUnset bool defaultNoProxyGetter NoProxyGetter ) @@ -120,45 +70,18 @@ type NoProxyGetter interface { // EnvNoProxyGetter gets the no_proxy variable, using environment type EnvNoProxyGetter struct{} -func generateUsageHint(profile, sh string) string { +// dockerShellCfgSet generates context variables for "docker-env" +func dockerShellCfgSet(ec DockerEnvConfig, envMap map[string]string) *DockerShellConfig { + profile := ec.profile const usgPlz = "To point your shell to minikube's docker-daemon, run:" var usgCmd = fmt.Sprintf("minikube -p %s docker-env", profile) - var usageHintMap = map[string]string{ - "bash": fmt.Sprintf(` -# %s -# eval $(%s) -`, usgPlz, usgCmd), - "fish": fmt.Sprintf(` -# %s -# eval (%s) -`, usgPlz, usgCmd), - "powershell": fmt.Sprintf(`# %s -# & %s | Invoke-Expression -`, usgPlz, usgCmd), - "cmd": fmt.Sprintf(`REM %s -REM @FOR /f "tokens=*" %%i IN ('%s') DO @%%i -`, usgPlz, usgCmd), - "emacs": fmt.Sprintf(`;; %s -;; (with-temp-buffer (shell-command "%s" (current-buffer)) (eval-buffer)) -`, usgPlz, usgCmd), - } - - hint, ok := usageHintMap[sh] - if !ok { - return usageHintMap["bash"] - } - return hint -} - -// shellCfgSet generates context variables for "docker-env" -func shellCfgSet(ec EnvConfig, envMap map[string]string) *ShellConfig { - s := &ShellConfig{ - DockerCertPath: envMap[constants.DockerCertPathEnv], - DockerHost: envMap[constants.DockerHostEnv], - DockerTLSVerify: envMap[constants.DockerTLSVerifyEnv], - MinikubeDockerdProfile: envMap[constants.MinikubeActiveDockerdEnv], - UsageHint: generateUsageHint(ec.profile, ec.shell), + s := &DockerShellConfig{ + Config: *shell.CfgSet(ec.EnvConfig, usgPlz, usgCmd), } + s.DockerCertPath = envMap[constants.DockerCertPathEnv] + s.DockerHost = envMap[constants.DockerHostEnv] + s.DockerTLSVerify = envMap[constants.DockerTLSVerifyEnv] + s.MinikubeDockerdProfile = envMap[constants.MinikubeActiveDockerdEnv] if ec.noProxy { noProxyVar, noProxyValue := defaultNoProxyGetter.GetNoProxyVar() @@ -177,33 +100,6 @@ func shellCfgSet(ec EnvConfig, envMap map[string]string) *ShellConfig { s.NoProxyValue = noProxyValue } - switch ec.shell { - case "fish": - s.Prefix = fishSetPfx - s.Suffix = fishSetSfx - s.Delimiter = fishSetDelim - case "powershell": - s.Prefix = psSetPfx - s.Suffix = psSetSfx - s.Delimiter = psSetDelim - case "cmd": - s.Prefix = cmdSetPfx - s.Suffix = cmdSetSfx - s.Delimiter = cmdSetDelim - case "emacs": - s.Prefix = emacsSetPfx - s.Suffix = emacsSetSfx - s.Delimiter = emacsSetDelim - case "none": - s.Prefix = nonePfx - s.Suffix = noneSfx - s.Delimiter = noneDelim - s.UsageHint = "" - default: - s.Prefix = bashSetPfx - s.Suffix = bashSetSfx - s.Delimiter = bashSetDelim - } return s } @@ -236,7 +132,7 @@ func isDockerActive(d drivers.Driver) (bool, error) { return err == nil && s == "active", nil } -// envCmd represents the docker-env command +// dockerEnvCmd represents the docker-env command var dockerEnvCmd = &cobra.Command{ Use: "docker-env", Short: "Sets up docker env variables; similar to '$(docker-machine env)'", @@ -282,57 +178,68 @@ var dockerEnvCmd = &cobra.Command{ exit.WithError("Error getting host IP", err) } - ec := EnvConfig{ - profile: profile, - driver: host.DriverName, - shell: forceShell, - hostIP: hostIP, - certsDir: localpath.MakeMiniPath("certs"), - noProxy: noProxy, + sh := shell.EnvConfig{ + Shell: shell.ForceShell, } - if ec.shell == "" { - ec.shell, err = shell.Detect() + 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) + if err != nil { + exit.WithCodeT(exit.Failure, "Error getting port binding for '{{.driver_name}} driver: {{.error}}", out.V{"driver_name": host.DriverName, "error": err}) + } + } + + ec := DockerEnvConfig{ + EnvConfig: sh, + profile: profile, + driver: host.DriverName, + hostIP: hostIP, + port: port, + certsDir: localpath.MakeMiniPath("certs"), + noProxy: noProxy, + } + + if ec.Shell == "" { + ec.Shell, err = shell.Detect() if err != nil { exit.WithError("Error detecting shell", err) } } - if unset { - if err := unsetScript(ec, os.Stdout); err != nil { + if dockerUnset { + if err := dockerUnsetScript(ec, os.Stdout); err != nil { exit.WithError("Error generating unset output", err) } return } - if err := setScript(ec, os.Stdout); err != nil { + if err := dockerSetScript(ec, os.Stdout); err != nil { exit.WithError("Error generating set output", err) } }, } -// EnvConfig encapsulates all external inputs into shell generation -type EnvConfig struct { +// DockerEnvConfig encapsulates all external inputs into shell generation for Docker +type DockerEnvConfig struct { + shell.EnvConfig profile string - shell string driver string hostIP string + port int certsDir string noProxy bool } -// setScript writes out a shell-compatible 'docker-env' script -func setScript(ec EnvConfig, w io.Writer) error { - tmpl := template.Must(template.New("envConfig").Parse(envTmpl)) - envVars, err := dockerEnvVars(ec) - if err != nil { - return err - } - return tmpl.Execute(w, shellCfgSet(ec, envVars)) +// dockerSetScript writes out a shell-compatible 'docker-env' script +func dockerSetScript(ec DockerEnvConfig, w io.Writer) error { + envVars := dockerEnvVars(ec) + return shell.SetScript(ec.EnvConfig, w, dockerEnvTmpl, dockerShellCfgSet(ec, envVars)) } -// setScript writes out a shell-compatible 'docker-env unset' script -func unsetScript(ec EnvConfig, w io.Writer) error { +// dockerSetScript writes out a shell-compatible 'docker-env unset' script +func dockerUnsetScript(ec DockerEnvConfig, w io.Writer) error { vars := []string{ constants.DockerTLSVerifyEnv, constants.DockerHostEnv, @@ -347,29 +254,7 @@ func unsetScript(ec EnvConfig, w io.Writer) error { } } - var sb strings.Builder - switch ec.shell { - case "fish": - for _, v := range vars { - sb.WriteString(fmt.Sprintf("%s%s%s", fishUnsetPfx, v, fishUnsetSfx)) - } - case "powershell": - sb.WriteString(fmt.Sprintf("%s%s%s", psUnsetPfx, strings.Join(vars, " Env:\\\\"), psUnsetSfx)) - case "cmd": - for _, v := range vars { - sb.WriteString(fmt.Sprintf("%s%s%s%s", cmdUnsetPfx, v, cmdUnsetDelim, cmdUnsetSfx)) - } - case "emacs": - for _, v := range vars { - sb.WriteString(fmt.Sprintf("%s%s%s%s", emacsUnsetPfx, v, emacsUnsetDelim, emacsUnsetSfx)) - } - case "none": - sb.WriteString(fmt.Sprintf("%s%s%s", nonePfx, strings.Join(vars, " "), noneSfx)) - default: - sb.WriteString(fmt.Sprintf("%s%s%s", bashUnsetPfx, strings.Join(vars, " "), bashUnsetSfx)) - } - _, err := w.Write([]byte(sb.String())) - return err + return shell.UnsetScript(ec.EnvConfig, w, vars) } // dockerURL returns a the docker endpoint URL for an ip/port pair. @@ -378,27 +263,20 @@ func dockerURL(ip string, port int) string { } // dockerEnvVars gets the necessary docker env variables to allow the use of minikube's docker daemon -func dockerEnvVars(ec EnvConfig) (map[string]string, error) { +func dockerEnvVars(ec DockerEnvConfig) map[string]string { env := map[string]string{ constants.DockerTLSVerifyEnv: "1", - constants.DockerHostEnv: dockerURL(ec.hostIP, constants.DockerDaemonPort), + constants.DockerHostEnv: dockerURL(ec.hostIP, ec.port), constants.DockerCertPathEnv: ec.certsDir, constants.MinikubeActiveDockerdEnv: ec.profile, } - if driver.IsKIC(ec.driver) { // for kic we need to find out what port docker allocated during creation - port, err := oci.HostPortBinding(ec.driver, ec.profile, constants.DockerDaemonPort) - if err != nil { - return nil, errors.Wrapf(err, "get hostbind port for %d", constants.DockerDaemonPort) - } - env[constants.DockerCertPathEnv] = dockerURL(kic.DefaultBindIPV4, port) - } - return env, nil + return env } func init() { defaultNoProxyGetter = &EnvNoProxyGetter{} dockerEnvCmd.Flags().BoolVar(&noProxy, "no-proxy", false, "Add machine IP to NO_PROXY environment variable") - dockerEnvCmd.Flags().StringVar(&forceShell, "shell", "", "Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect") - dockerEnvCmd.Flags().BoolVarP(&unset, "unset", "u", false, "Unset variables instead of setting them") + dockerEnvCmd.Flags().StringVar(&shell.ForceShell, "shell", "", "Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect") + dockerEnvCmd.Flags().BoolVarP(&dockerUnset, "unset", "u", false, "Unset variables instead of setting them") } diff --git a/cmd/minikube/cmd/env_test.go b/cmd/minikube/cmd/docker-env_test.go similarity index 73% rename from cmd/minikube/cmd/env_test.go rename to cmd/minikube/cmd/docker-env_test.go index 72a0018ac9..6423236cec 100644 --- a/cmd/minikube/cmd/env_test.go +++ b/cmd/minikube/cmd/docker-env_test.go @@ -32,15 +32,32 @@ func (f FakeNoProxyGetter) GetNoProxyVar() (string, string) { return f.NoProxyVar, f.NoProxyValue } -func TestGenerateScripts(t *testing.T) { +func TestGenerateDockerScripts(t *testing.T) { var tests = []struct { - config EnvConfig + shell string + config DockerEnvConfig noProxyGetter *FakeNoProxyGetter wantSet string wantUnset string }{ { - EnvConfig{profile: "bash", shell: "bash", driver: "kvm2", hostIP: "127.0.0.1", certsDir: "/certs"}, + "bash", + DockerEnvConfig{profile: "dockerdrver", driver: "docker", hostIP: "127.0.0.1", port: 32842, certsDir: "/certs"}, + nil, + `export DOCKER_TLS_VERIFY="1" +export DOCKER_HOST="tcp://127.0.0.1:32842" +export DOCKER_CERT_PATH="/certs" +export MINIKUBE_ACTIVE_DOCKERD="dockerdrver" + +# To point your shell to minikube's docker-daemon, run: +# eval $(minikube -p dockerdrver docker-env) +`, + `unset DOCKER_TLS_VERIFY DOCKER_HOST DOCKER_CERT_PATH MINIKUBE_ACTIVE_DOCKERD +`, + }, + { + "bash", + DockerEnvConfig{profile: "bash", driver: "kvm2", hostIP: "127.0.0.1", port: 2376, certsDir: "/certs"}, nil, `export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://127.0.0.1:2376" @@ -54,7 +71,8 @@ export MINIKUBE_ACTIVE_DOCKERD="bash" `, }, { - EnvConfig{profile: "ipv6", shell: "bash", driver: "kvm2", hostIP: "fe80::215:5dff:fe00:a903", certsDir: "/certs"}, + "bash", + DockerEnvConfig{profile: "ipv6", driver: "kvm2", hostIP: "fe80::215:5dff:fe00:a903", port: 2376, certsDir: "/certs"}, nil, `export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://[fe80::215:5dff:fe00:a903]:2376" @@ -68,7 +86,8 @@ export MINIKUBE_ACTIVE_DOCKERD="ipv6" `, }, { - EnvConfig{profile: "fish", shell: "fish", driver: "kvm2", hostIP: "127.0.0.1", certsDir: "/certs"}, + "fish", + DockerEnvConfig{profile: "fish", driver: "kvm2", hostIP: "127.0.0.1", port: 2376, certsDir: "/certs"}, nil, `set -gx DOCKER_TLS_VERIFY "1" set -gx DOCKER_HOST "tcp://127.0.0.1:2376" @@ -85,7 +104,8 @@ set -e MINIKUBE_ACTIVE_DOCKERD `, }, { - EnvConfig{profile: "powershell", shell: "powershell", driver: "hyperv", hostIP: "192.168.0.1", certsDir: "/certs"}, + "powershell", + DockerEnvConfig{profile: "powershell", driver: "hyperv", hostIP: "192.168.0.1", port: 2376, certsDir: "/certs"}, nil, `$Env:DOCKER_TLS_VERIFY = "1" $Env:DOCKER_HOST = "tcp://192.168.0.1:2376" @@ -99,7 +119,8 @@ $Env:MINIKUBE_ACTIVE_DOCKERD = "powershell" `, }, { - EnvConfig{profile: "cmd", shell: "cmd", driver: "hyperv", hostIP: "192.168.0.1", certsDir: "/certs"}, + "cmd", + DockerEnvConfig{profile: "cmd", driver: "hyperv", hostIP: "192.168.0.1", port: 2376, certsDir: "/certs"}, nil, `SET DOCKER_TLS_VERIFY=1 SET DOCKER_HOST=tcp://192.168.0.1:2376 @@ -116,7 +137,8 @@ SET MINIKUBE_ACTIVE_DOCKERD= `, }, { - EnvConfig{profile: "emacs", shell: "emacs", driver: "hyperv", hostIP: "192.168.0.1", certsDir: "/certs"}, + "emacs", + DockerEnvConfig{profile: "emacs", driver: "hyperv", hostIP: "192.168.0.1", port: 2376, certsDir: "/certs"}, nil, `(setenv "DOCKER_TLS_VERIFY" "1") (setenv "DOCKER_HOST" "tcp://192.168.0.1:2376") @@ -132,7 +154,8 @@ SET MINIKUBE_ACTIVE_DOCKERD= `, }, { - EnvConfig{profile: "bash-no-proxy", shell: "bash", driver: "kvm2", hostIP: "127.0.0.1", certsDir: "/certs", noProxy: true}, + "bash", + DockerEnvConfig{profile: "bash-no-proxy", driver: "kvm2", hostIP: "127.0.0.1", port: 2376, certsDir: "/certs", noProxy: true}, &FakeNoProxyGetter{"NO_PROXY", "127.0.0.1"}, `export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://127.0.0.1:2376" @@ -148,7 +171,8 @@ export NO_PROXY="127.0.0.1" `, }, { - EnvConfig{profile: "bash-no-proxy-lower", shell: "bash", driver: "kvm2", hostIP: "127.0.0.1", certsDir: "/certs", noProxy: true}, + "bash", + DockerEnvConfig{profile: "bash-no-proxy-lower", driver: "kvm2", hostIP: "127.0.0.1", port: 2376, certsDir: "/certs", noProxy: true}, &FakeNoProxyGetter{"no_proxy", "127.0.0.1"}, `export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://127.0.0.1:2376" @@ -164,7 +188,8 @@ export no_proxy="127.0.0.1" `, }, { - EnvConfig{profile: "powershell-no-proxy-idempotent", shell: "powershell", driver: "hyperv", hostIP: "192.168.0.1", certsDir: "/certs", noProxy: true}, + "powershell", + DockerEnvConfig{profile: "powershell-no-proxy-idempotent", driver: "hyperv", hostIP: "192.168.0.1", port: 2376, certsDir: "/certs", noProxy: true}, &FakeNoProxyGetter{"no_proxy", "192.168.0.1"}, `$Env:DOCKER_TLS_VERIFY = "1" $Env:DOCKER_HOST = "tcp://192.168.0.1:2376" @@ -179,7 +204,8 @@ $Env:no_proxy = "192.168.0.1" `, }, { - EnvConfig{profile: "sh-no-proxy-add", shell: "bash", driver: "kvm2", hostIP: "127.0.0.1", certsDir: "/certs", noProxy: true}, + "bash", + DockerEnvConfig{profile: "sh-no-proxy-add", driver: "kvm2", hostIP: "127.0.0.1", port: 2376, certsDir: "/certs", noProxy: true}, &FakeNoProxyGetter{"NO_PROXY", "192.168.0.1,10.0.0.4"}, `export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://127.0.0.1:2376" @@ -197,10 +223,11 @@ export NO_PROXY="192.168.0.1,10.0.0.4,127.0.0.1" } for _, tc := range tests { t.Run(tc.config.profile, func(t *testing.T) { + tc.config.EnvConfig.Shell = tc.shell defaultNoProxyGetter = tc.noProxyGetter var b []byte buf := bytes.NewBuffer(b) - if err := setScript(tc.config, buf); err != nil { + if err := dockerSetScript(tc.config, buf); err != nil { t.Errorf("setScript(%+v) error: %v", tc.config, err) } got := buf.String() @@ -209,7 +236,7 @@ export NO_PROXY="192.168.0.1,10.0.0.4,127.0.0.1" } buf = bytes.NewBuffer(b) - if err := unsetScript(tc.config, buf); err != nil { + if err := dockerUnsetScript(tc.config, buf); err != nil { t.Errorf("unsetScript(%+v) error: %v", tc.config, err) } got = buf.String() diff --git a/cmd/minikube/cmd/kubectl.go b/cmd/minikube/cmd/kubectl.go index 0a5eaea659..c880fecf7d 100644 --- a/cmd/minikube/cmd/kubectl.go +++ b/cmd/minikube/cmd/kubectl.go @@ -28,7 +28,6 @@ import ( "github.com/spf13/viper" "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/constants" - "k8s.io/minikube/pkg/minikube/exit" "k8s.io/minikube/pkg/minikube/machine" "k8s.io/minikube/pkg/minikube/out" ) @@ -55,19 +54,14 @@ minikube kubectl -- get pods --namespace kube-system`, out.ErrLn("Error loading profile config: %v", err) } - binary := "kubectl" - if runtime.GOOS == "windows" { - binary = "kubectl.exe" - } - version := constants.DefaultKubernetesVersion if cc != nil { version = cc.KubernetesConfig.KubernetesVersion } - path, err := machine.CacheBinary(binary, version, runtime.GOOS, runtime.GOARCH) + path, err := cacheKubectlBinary(version) if err != nil { - exit.WithError("Failed to download kubectl", err) + out.ErrLn("Error caching kubectl: %v", err) } glog.Infof("Running %s %v", path, args) @@ -88,3 +82,12 @@ minikube kubectl -- get pods --namespace kube-system`, } }, } + +func cacheKubectlBinary(k8sVerison string) (string, error) { + binary := "kubectl" + if runtime.GOOS == "windows" { + binary = "kubectl.exe" + } + + return machine.CacheBinary(binary, k8sVerison, runtime.GOOS, runtime.GOARCH) +} diff --git a/cmd/minikube/cmd/podman-env.go b/cmd/minikube/cmd/podman-env.go new file mode 100644 index 0000000000..5c4f6e06af --- /dev/null +++ b/cmd/minikube/cmd/podman-env.go @@ -0,0 +1,226 @@ +/* +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. +*/ + +// Part of this code is heavily inspired/copied by the following file: +// github.com/docker/machine/commands/env.go + +package cmd + +import ( + "fmt" + "io" + "os" + "os/exec" + "strings" + + "github.com/docker/machine/libmachine/drivers" + "github.com/docker/machine/libmachine/host" + "github.com/docker/machine/libmachine/ssh" + "github.com/docker/machine/libmachine/state" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "k8s.io/minikube/pkg/minikube/cluster" + "k8s.io/minikube/pkg/minikube/config" + "k8s.io/minikube/pkg/minikube/constants" + "k8s.io/minikube/pkg/minikube/driver" + "k8s.io/minikube/pkg/minikube/exit" + "k8s.io/minikube/pkg/minikube/machine" + "k8s.io/minikube/pkg/minikube/out" + "k8s.io/minikube/pkg/minikube/shell" +) + +var podmanEnvTmpl = fmt.Sprintf("{{ .Prefix }}%s{{ .Delimiter }}{{ .VarlinkBridge }}{{ .Suffix }}{{ .UsageHint }}", constants.PodmanVarlinkBridgeEnv) + +// PodmanShellConfig represents the shell config for Podman +type PodmanShellConfig struct { + shell.Config + VarlinkBridge string +} + +var ( + podmanUnset bool +) + +// podmanShellCfgSet generates context variables for "podman-env" +func podmanShellCfgSet(ec PodmanEnvConfig, envMap map[string]string) *PodmanShellConfig { + profile := ec.profile + const usgPlz = "To point your shell to minikube's podman service, run:" + var usgCmd = fmt.Sprintf("minikube -p %s podman-env", profile) + s := &PodmanShellConfig{ + Config: *shell.CfgSet(ec.EnvConfig, usgPlz, usgCmd), + } + s.VarlinkBridge = envMap[constants.PodmanVarlinkBridgeEnv] + + return s +} + +// isPodmanAvailable checks if Podman is available +func isPodmanAvailable(host *host.Host) (bool, error) { + // we need both "varlink bridge" and "podman varlink" + if _, err := host.RunSSHCommand("which varlink"); err != nil { + return false, err + } + if _, err := host.RunSSHCommand("which podman"); err != nil { + return false, err + } + return true, nil +} + +func createExternalSSHClient(d drivers.Driver) (*ssh.ExternalClient, error) { + sshBinaryPath, err := exec.LookPath("ssh") + if err != nil { + return &ssh.ExternalClient{}, err + } + + addr, err := d.GetSSHHostname() + if err != nil { + return &ssh.ExternalClient{}, err + } + + port, err := d.GetSSHPort() + if err != nil { + return &ssh.ExternalClient{}, err + } + + auth := &ssh.Auth{} + if d.GetSSHKeyPath() != "" { + auth.Keys = []string{d.GetSSHKeyPath()} + } + + return ssh.NewExternalClient(sshBinaryPath, d.GetSSHUsername(), addr, port, auth) +} + +// podmanEnvCmd represents the podman-env command +var podmanEnvCmd = &cobra.Command{ + Use: "podman-env", + Short: "Sets up podman env variables; similar to '$(podman-machine env)'", + Long: `Sets up podman env variables; similar to '$(podman-machine env)'.`, + Run: func(cmd *cobra.Command, args []string) { + api, err := machine.NewAPIClient() + if err != nil { + exit.WithError("Error getting client", err) + } + defer api.Close() + + profile := viper.GetString(config.MachineProfile) + cc, err := config.Load(profile) + if err != nil { + exit.WithError("Error getting config", err) + } + host, err := cluster.CheckIfHostExistsAndLoad(api, cc.Name) + if err != nil { + exit.WithError("Error getting host", err) + } + if host.Driver.DriverName() == driver.None { + exit.UsageT(`'none' driver does not support 'minikube podman-env' command`) + } + + hostSt, err := cluster.GetHostStatus(api, cc.Name) + if err != nil { + exit.WithError("Error getting host status", err) + } + if hostSt != state.Running.String() { + exit.WithCodeT(exit.Unavailable, `'{{.profile}}' is not running`, out.V{"profile": profile}) + } + ok, err := isPodmanAvailable(host) + if err != nil { + exit.WithError("Error getting service status", err) + } + + if !ok { + exit.WithCodeT(exit.Unavailable, `The podman service within '{{.profile}}' is not active`, out.V{"profile": profile}) + } + + client, err := createExternalSSHClient(host.Driver) + if err != nil { + exit.WithError("Error getting ssh client", err) + } + + sh := shell.EnvConfig{ + Shell: shell.ForceShell, + } + ec := PodmanEnvConfig{ + EnvConfig: sh, + profile: profile, + driver: host.DriverName, + client: client, + } + + if ec.Shell == "" { + ec.Shell, err = shell.Detect() + if err != nil { + exit.WithError("Error detecting shell", err) + } + } + + if podmanUnset { + if err := podmanUnsetScript(ec, os.Stdout); err != nil { + exit.WithError("Error generating unset output", err) + } + return + } + + if err := podmanSetScript(ec, os.Stdout); err != nil { + exit.WithError("Error generating set output", err) + } + }, +} + +// PodmanEnvConfig encapsulates all external inputs into shell generation for Podman +type PodmanEnvConfig struct { + shell.EnvConfig + profile string + driver string + client *ssh.ExternalClient +} + +// podmanSetScript writes out a shell-compatible 'podman-env' script +func podmanSetScript(ec PodmanEnvConfig, w io.Writer) error { + envVars, err := podmanEnvVars(ec) + if err != nil { + return err + } + return shell.SetScript(ec.EnvConfig, w, podmanEnvTmpl, podmanShellCfgSet(ec, envVars)) +} + +// podmanUnsetScript writes out a shell-compatible 'podman-env unset' script +func podmanUnsetScript(ec PodmanEnvConfig, w io.Writer) error { + vars := []string{ + constants.PodmanVarlinkBridgeEnv, + } + return shell.UnsetScript(ec.EnvConfig, w, vars) +} + +// podmanBridge returns the command to use in a var for accessing the podman varlink bridge over ssh +func podmanBridge(client *ssh.ExternalClient) string { + command := []string{client.BinaryPath} + command = append(command, client.BaseArgs...) + command = append(command, "--", "sudo", "varlink", "-A", `\'podman varlink \\\$VARLINK_ADDRESS\'`, "bridge") + return strings.Join(command, " ") +} + +// podmanEnvVars gets the necessary podman env variables to allow the use of minikube's podman service +func podmanEnvVars(ec PodmanEnvConfig) (map[string]string, error) { // nolint result 1 (error) is always nil + env := map[string]string{ + constants.PodmanVarlinkBridgeEnv: podmanBridge(ec.client), + } + return env, nil +} + +func init() { + podmanEnvCmd.Flags().StringVar(&shell.ForceShell, "shell", "", "Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect") + podmanEnvCmd.Flags().BoolVarP(&podmanUnset, "unset", "u", false, "Unset variables instead of setting them") +} diff --git a/cmd/minikube/cmd/podman-env_test.go b/cmd/minikube/cmd/podman-env_test.go new file mode 100644 index 0000000000..2e090541fb --- /dev/null +++ b/cmd/minikube/cmd/podman-env_test.go @@ -0,0 +1,80 @@ +/* +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 cmd + +import ( + "bytes" + "testing" + + "github.com/docker/machine/libmachine/ssh" + "github.com/google/go-cmp/cmp" +) + +func newFakeClient() *ssh.ExternalClient { + return &ssh.ExternalClient{ + BaseArgs: []string{"root@host"}, + BinaryPath: "/usr/bin/ssh", + } +} + +func TestGeneratePodmanScripts(t *testing.T) { + var tests = []struct { + shell string + config PodmanEnvConfig + noProxyGetter *FakeNoProxyGetter + wantSet string + wantUnset string + }{ + { + "bash", + PodmanEnvConfig{profile: "bash", driver: "kvm2", client: newFakeClient()}, + nil, + `export PODMAN_VARLINK_BRIDGE="/usr/bin/ssh root@host -- sudo varlink -A \'podman varlink \\\$VARLINK_ADDRESS\' bridge" + +# To point your shell to minikube's podman service, run: +# eval $(minikube -p bash podman-env) +`, + `unset PODMAN_VARLINK_BRIDGE +`, + }, + } + for _, tc := range tests { + t.Run(tc.config.profile, func(t *testing.T) { + tc.config.EnvConfig.Shell = tc.shell + defaultNoProxyGetter = tc.noProxyGetter + var b []byte + buf := bytes.NewBuffer(b) + if err := podmanSetScript(tc.config, buf); err != nil { + t.Errorf("setScript(%+v) error: %v", tc.config, err) + } + got := buf.String() + if diff := cmp.Diff(tc.wantSet, got); diff != "" { + t.Errorf("setScript(%+v) mismatch (-want +got):\n%s\n\nraw output:\n%s\nquoted: %q", tc.config, diff, got, got) + } + + buf = bytes.NewBuffer(b) + if err := podmanUnsetScript(tc.config, buf); err != nil { + t.Errorf("unsetScript(%+v) error: %v", tc.config, err) + } + got = buf.String() + if diff := cmp.Diff(tc.wantUnset, got); diff != "" { + t.Errorf("unsetScript(%+v) mismatch (-want +got):\n%s\n\nraw output:\n%s\nquoted: %q", tc.config, diff, got, got) + } + + }) + } +} diff --git a/cmd/minikube/cmd/root.go b/cmd/minikube/cmd/root.go index ef6fb3e29e..a83a2a446d 100644 --- a/cmd/minikube/cmd/root.go +++ b/cmd/minikube/cmd/root.go @@ -180,6 +180,7 @@ func init() { Message: translate.T("Images Commands:"), Commands: []*cobra.Command{ dockerEnvCmd, + podmanEnvCmd, cacheCmd, }, }, diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 5e633d1b2f..1e949d2801 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -73,59 +73,61 @@ import ( ) const ( - isoURL = "iso-url" - memory = "memory" - cpus = "cpus" - humanReadableDiskSize = "disk-size" - nfsSharesRoot = "nfs-shares-root" - nfsShare = "nfs-share" - kubernetesVersion = "kubernetes-version" - hostOnlyCIDR = "host-only-cidr" - containerRuntime = "container-runtime" - criSocket = "cri-socket" - networkPlugin = "network-plugin" - enableDefaultCNI = "enable-default-cni" - hypervVirtualSwitch = "hyperv-virtual-switch" - kvmNetwork = "kvm-network" - kvmQemuURI = "kvm-qemu-uri" - kvmGPU = "kvm-gpu" - kvmHidden = "kvm-hidden" - minikubeEnvPrefix = "MINIKUBE" - defaultMemorySize = "2000mb" - installAddons = "install-addons" - defaultDiskSize = "20000mb" - keepContext = "keep-context" - createMount = "mount" - featureGates = "feature-gates" - apiServerName = "apiserver-name" - apiServerPort = "apiserver-port" - dnsDomain = "dns-domain" - serviceCIDR = "service-cluster-ip-range" - imageRepository = "image-repository" - imageMirrorCountry = "image-mirror-country" - mountString = "mount-string" - disableDriverMounts = "disable-driver-mounts" - cacheImages = "cache-images" - uuid = "uuid" - vpnkitSock = "hyperkit-vpnkit-sock" - vsockPorts = "hyperkit-vsock-ports" - embedCerts = "embed-certs" - noVTXCheck = "no-vtx-check" - downloadOnly = "download-only" - dnsProxy = "dns-proxy" - hostDNSResolver = "host-dns-resolver" - waitUntilHealthy = "wait" - force = "force" - dryRun = "dry-run" - interactive = "interactive" - waitTimeout = "wait-timeout" - nativeSSH = "native-ssh" - minimumMemorySize = "1024mb" - minimumCPUS = 2 - minimumDiskSize = "2000mb" - autoUpdate = "auto-update-drivers" - hostOnlyNicType = "host-only-nic-type" - natNicType = "nat-nic-type" + isoURL = "iso-url" + memory = "memory" + cpus = "cpus" + humanReadableDiskSize = "disk-size" + nfsSharesRoot = "nfs-shares-root" + nfsShare = "nfs-share" + kubernetesVersion = "kubernetes-version" + hostOnlyCIDR = "host-only-cidr" + containerRuntime = "container-runtime" + criSocket = "cri-socket" + networkPlugin = "network-plugin" + enableDefaultCNI = "enable-default-cni" + hypervVirtualSwitch = "hyperv-virtual-switch" + hypervUseExternalSwitch = "hyperv-use-external-switch" + hypervExternalAdapter = "hyperv-external-adapter" + kvmNetwork = "kvm-network" + kvmQemuURI = "kvm-qemu-uri" + kvmGPU = "kvm-gpu" + kvmHidden = "kvm-hidden" + minikubeEnvPrefix = "MINIKUBE" + defaultMemorySize = "2000mb" + installAddons = "install-addons" + defaultDiskSize = "20000mb" + keepContext = "keep-context" + createMount = "mount" + featureGates = "feature-gates" + apiServerName = "apiserver-name" + apiServerPort = "apiserver-port" + dnsDomain = "dns-domain" + serviceCIDR = "service-cluster-ip-range" + imageRepository = "image-repository" + imageMirrorCountry = "image-mirror-country" + mountString = "mount-string" + disableDriverMounts = "disable-driver-mounts" + cacheImages = "cache-images" + uuid = "uuid" + vpnkitSock = "hyperkit-vpnkit-sock" + vsockPorts = "hyperkit-vsock-ports" + embedCerts = "embed-certs" + noVTXCheck = "no-vtx-check" + downloadOnly = "download-only" + dnsProxy = "dns-proxy" + hostDNSResolver = "host-dns-resolver" + waitUntilHealthy = "wait" + force = "force" + dryRun = "dry-run" + interactive = "interactive" + waitTimeout = "wait-timeout" + nativeSSH = "native-ssh" + minimumMemorySize = "1024mb" + minimumCPUS = 2 + minimumDiskSize = "2000mb" + autoUpdate = "auto-update-drivers" + hostOnlyNicType = "host-only-nic-type" + natNicType = "nat-nic-type" ) var ( @@ -227,6 +229,8 @@ func initDriverFlags() { // hyperv startCmd.Flags().String(hypervVirtualSwitch, "", "The hyperv virtual switch name. Defaults to first found. (hyperv driver only)") + startCmd.Flags().Bool(hypervUseExternalSwitch, false, "Whether to use external switch over Default Switch if virtual switch not explicitly specified. (hyperv driver only)") + startCmd.Flags().String(hypervExternalAdapter, "", "External Adapter on which external switch will be created if no external switch is found. (hyperv driver only)") } // initNetworkingFlags inits the commandline flags for connectivity related flags for start @@ -480,6 +484,9 @@ func handleDownloadOnly(cacheGroup *errgroup.Group, k8sVersion string) { if err := doCacheBinaries(k8sVersion); err != nil { exit.WithError("Failed to cache binaries", err) } + if _, err := cacheKubectlBinary(k8sVersion); err != nil { + exit.WithError("Failed to cache kubectl", err) + } waitCacheRequiredImages(cacheGroup) if err := saveImagesToTarFromConfig(); err != nil { exit.WithError("Failed to cache images to tar", err) @@ -740,11 +747,11 @@ func validateUser(drvName string) { useForce := viper.GetBool(force) - if driver.BareMetal(drvName) && u.Uid != "0" && !useForce { + if driver.NeedsRoot(drvName) && u.Uid != "0" && !useForce { exit.WithCodeT(exit.Permissions, `The "{{.driver_name}}" driver requires root privileges. Please run minikube using 'sudo minikube --vm-driver={{.driver_name}}'.`, out.V{"driver_name": drvName}) } - if driver.BareMetal(drvName) || u.Uid != "0" { + if driver.NeedsRoot(drvName) || u.Uid != "0" { return } @@ -808,16 +815,18 @@ func validateFlags(cmd *cobra.Command, drvName string) { validateDiskSize() validateMemorySize() - if driver.BareMetal(drvName) { - if viper.GetString(config.MachineProfile) != constants.DefaultMachineName { - exit.WithCodeT(exit.Config, "The 'none' driver does not support multiple profiles: https://minikube.sigs.k8s.io/docs/reference/drivers/none/") - } - + if !driver.HasResourceLimits(drvName) { // both podman and none need root and they both cant specify resources if cmd.Flags().Changed(cpus) { - out.WarningT("The 'none' driver does not respect the --cpus flag") + out.WarningT("The '{{.name}}' driver does not respect the --cpus flag", out.V{"name": drvName}) } if cmd.Flags().Changed(memory) { - out.WarningT("The 'none' driver does not respect the --memory flag") + out.WarningT("The '{{.name}}' driver does not respect the --memory flag", out.V{"name": drvName}) + } + } + + if driver.BareMetal(drvName) { + if viper.GetString(config.MachineProfile) != constants.DefaultMachineName { + exit.WithCodeT(exit.Config, "The '{{.name}} driver does not support multiple profiles: https://minikube.sigs.k8s.io/docs/reference/drivers/none/", out.V{"name": drvName}) } runtime := viper.GetString(containerRuntime) @@ -943,36 +952,38 @@ func generateCfgFromFlags(cmd *cobra.Command, k8sVersion string, drvName string) } cfg := config.MachineConfig{ - Name: viper.GetString(config.MachineProfile), - KeepContext: viper.GetBool(keepContext), - EmbedCerts: viper.GetBool(embedCerts), - MinikubeISO: viper.GetString(isoURL), - Memory: pkgutil.CalculateSizeInMB(viper.GetString(memory)), - CPUs: viper.GetInt(cpus), - DiskSize: pkgutil.CalculateSizeInMB(viper.GetString(humanReadableDiskSize)), - VMDriver: drvName, - HyperkitVpnKitSock: viper.GetString(vpnkitSock), - HyperkitVSockPorts: viper.GetStringSlice(vsockPorts), - NFSShare: viper.GetStringSlice(nfsShare), - NFSSharesRoot: viper.GetString(nfsSharesRoot), - DockerEnv: dockerEnv, - DockerOpt: dockerOpt, - InsecureRegistry: insecureRegistry, - RegistryMirror: registryMirror, - HostOnlyCIDR: viper.GetString(hostOnlyCIDR), - HypervVirtualSwitch: viper.GetString(hypervVirtualSwitch), - KVMNetwork: viper.GetString(kvmNetwork), - KVMQemuURI: viper.GetString(kvmQemuURI), - KVMGPU: viper.GetBool(kvmGPU), - KVMHidden: viper.GetBool(kvmHidden), - Downloader: pkgutil.DefaultDownloader{}, - DisableDriverMounts: viper.GetBool(disableDriverMounts), - UUID: viper.GetString(uuid), - NoVTXCheck: viper.GetBool(noVTXCheck), - DNSProxy: viper.GetBool(dnsProxy), - HostDNSResolver: viper.GetBool(hostDNSResolver), - HostOnlyNicType: viper.GetString(hostOnlyNicType), - NatNicType: viper.GetString(natNicType), + Name: viper.GetString(config.MachineProfile), + KeepContext: viper.GetBool(keepContext), + EmbedCerts: viper.GetBool(embedCerts), + MinikubeISO: viper.GetString(isoURL), + Memory: pkgutil.CalculateSizeInMB(viper.GetString(memory)), + CPUs: viper.GetInt(cpus), + DiskSize: pkgutil.CalculateSizeInMB(viper.GetString(humanReadableDiskSize)), + VMDriver: drvName, + HyperkitVpnKitSock: viper.GetString(vpnkitSock), + HyperkitVSockPorts: viper.GetStringSlice(vsockPorts), + NFSShare: viper.GetStringSlice(nfsShare), + NFSSharesRoot: viper.GetString(nfsSharesRoot), + DockerEnv: dockerEnv, + DockerOpt: dockerOpt, + InsecureRegistry: insecureRegistry, + RegistryMirror: registryMirror, + HostOnlyCIDR: viper.GetString(hostOnlyCIDR), + HypervVirtualSwitch: viper.GetString(hypervVirtualSwitch), + HypervUseExternalSwitch: viper.GetBool(hypervUseExternalSwitch), + HypervExternalAdapter: viper.GetString(hypervExternalAdapter), + KVMNetwork: viper.GetString(kvmNetwork), + KVMQemuURI: viper.GetString(kvmQemuURI), + KVMGPU: viper.GetBool(kvmGPU), + KVMHidden: viper.GetBool(kvmHidden), + Downloader: pkgutil.DefaultDownloader{}, + DisableDriverMounts: viper.GetBool(disableDriverMounts), + UUID: viper.GetString(uuid), + NoVTXCheck: viper.GetBool(noVTXCheck), + DNSProxy: viper.GetBool(dnsProxy), + HostDNSResolver: viper.GetBool(hostDNSResolver), + HostOnlyNicType: viper.GetString(hostOnlyNicType), + NatNicType: viper.GetString(natNicType), KubernetesConfig: config.KubernetesConfig{ KubernetesVersion: k8sVersion, ClusterName: viper.GetString(config.MachineProfile), @@ -1083,6 +1094,13 @@ func startHost(api libmachine.API, mc config.MachineConfig) (*host.Host, bool) { host, err := cluster.StartHost(api, mc) if err != nil { + // If virtual machine does not exist due to user interrupt cancel(i.e. Ctrl + C), initialize exists flag + if err == cluster.ErrorMachineNotExist { + // If Machine does not exist, of course the machine does not have kubeadm config files + // In order not to determine the machine has kubeadm config files, initialize exists flag + // ※ If exists flag is true, minikube determines the machine has kubeadm config files + return host, false + } exit.WithError("Unable to start VM. Please investigate and run 'minikube delete' if possible", err) } return host, exists diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index f9f90b7917..5bf8894f67 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -26,7 +26,6 @@ import ( "github.com/spf13/viper" "k8s.io/minikube/pkg/minikube/cluster" pkg_config "k8s.io/minikube/pkg/minikube/config" - "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/exit" "k8s.io/minikube/pkg/minikube/kubeconfig" "k8s.io/minikube/pkg/minikube/machine" @@ -82,7 +81,7 @@ func runStop(cmd *cobra.Command, args []string) { out.T(out.WarningType, "Unable to kill mount process: {{.error}}", out.V{"error": err}) } - err = kubeconfig.UnsetCurrentContext(profile, constants.KubeconfigPath) + err = kubeconfig.UnsetCurrentContext(profile, kubeconfig.PathFromEnv()) if err != nil { exit.WithError("update config", err) } diff --git a/cmd/minikube/cmd/update-context.go b/cmd/minikube/cmd/update-context.go index e7e4a9aea6..5a5dac761b 100644 --- a/cmd/minikube/cmd/update-context.go +++ b/cmd/minikube/cmd/update-context.go @@ -17,13 +17,10 @@ limitations under the License. package cmd import ( - "os" - "github.com/spf13/cobra" "github.com/spf13/viper" "k8s.io/minikube/pkg/minikube/cluster" "k8s.io/minikube/pkg/minikube/config" - "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/exit" "k8s.io/minikube/pkg/minikube/kubeconfig" "k8s.io/minikube/pkg/minikube/machine" @@ -47,13 +44,7 @@ var updateContextCmd = &cobra.Command{ if err != nil { exit.WithError("Error host driver ip status", err) } - var updated bool - kubeConfigPath := os.Getenv("KUBECONFIG") - if kubeConfigPath == "" { - updated, err = kubeconfig.UpdateIP(ip, machineName, constants.KubeconfigPath) - } else { - updated, err = kubeconfig.UpdateIP(ip, machineName, kubeConfigPath) - } + updated, err := kubeconfig.UpdateIP(ip, machineName, kubeconfig.PathFromEnv()) if err != nil { exit.WithError("update config", err) } diff --git a/deploy/addons/helm-tiller/helm-tiller-dp.tmpl b/deploy/addons/helm-tiller/helm-tiller-dp.tmpl index c130220e79..49ae46166e 100644 --- a/deploy/addons/helm-tiller/helm-tiller-dp.tmpl +++ b/deploy/addons/helm-tiller/helm-tiller-dp.tmpl @@ -46,7 +46,7 @@ spec: value: kube-system - name: TILLER_HISTORY_MAX value: "0" - image: gcr.io/kubernetes-helm/tiller:v2.14.3 + image: gcr.io/kubernetes-helm/tiller:v2.16.1 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 diff --git a/deploy/iso/minikube-iso/board/coreos/minikube/linux_defconfig b/deploy/iso/minikube-iso/board/coreos/minikube/linux_defconfig index ace0239843..592eb6053e 100644 --- a/deploy/iso/minikube-iso/board/coreos/minikube/linux_defconfig +++ b/deploy/iso/minikube-iso/board/coreos/minikube/linux_defconfig @@ -28,6 +28,7 @@ CONFIG_CGROUP_PERF=y CONFIG_USER_NS=y CONFIG_BLK_DEV_INITRD=y CONFIG_BPF_SYSCALL=y +CONFIG_CGROUP_BPF=y # CONFIG_COMPAT_BRK is not set CONFIG_PROFILING=y CONFIG_SMP=y diff --git a/deploy/minikube/releases.json b/deploy/minikube/releases.json index 33c0ec3afe..b6335c82cc 100644 --- a/deploy/minikube/releases.json +++ b/deploy/minikube/releases.json @@ -1,4 +1,12 @@ [ + { + "name": "v1.7.2", + "checksums": { + "darwin": "fcfb05f44620e54ce81fe8ac415196230ceb42c4007171533ef2049b7d4e8646", + "linux": "9f543f464b4d93a259f7d5a7578edff1316370d45b5a0679b86ed7a61b01634d", + "windows": "cbbe30445baffa9a3d77834d4e24c1ec595ecc2b7933db21109aa90aa79eaddd" + } + }, { "name": "v1.7.1", "checksums": { diff --git a/go.mod b/go.mod index 346a954e35..e4798d896c 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.13 require ( github.com/Parallels/docker-machine-parallels v1.3.0 - github.com/Sirupsen/logrus v0.0.0-20170822132746-89742aefa4b2 // indirect github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/blang/semver v3.5.0+incompatible github.com/c4milo/gotoolkit v0.0.0-20170318115440-bcc06269efa9 // indirect @@ -22,9 +21,8 @@ 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-containerregistry v0.0.0-20180731221751-697ee0b3d46e + github.com/google/go-containerregistry v0.0.0-20200131185320-aec8da010de2 github.com/googleapis/gnostic v0.3.0 // indirect - github.com/gorilla/mux v1.7.3 // indirect github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect github.com/hashicorp/go-getter v1.4.0 github.com/hashicorp/go-multierror v0.0.0-20160811015721-8c5f0ad93604 // indirect @@ -67,9 +65,9 @@ require ( github.com/xeipuuv/gojsonschema v0.0.0-20160623135812-c539bca196be github.com/zchee/go-vmnet v0.0.0-20161021174912-97ebf9174097 golang.org/x/build v0.0.0-20190927031335-2835ba2e683f - golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 + golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e - golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 + golang.org/x/sys v0.0.0-20191010194322-b09406accb47 golang.org/x/text v0.3.2 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect k8s.io/api v0.17.2 @@ -83,8 +81,10 @@ require ( replace ( git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 + github.com/docker/docker => github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7 github.com/docker/machine => github.com/machine-drivers/machine v0.7.1-0.20191109154235-b39d5b50de51 github.com/hashicorp/go-getter => github.com/afbjorklund/go-getter v1.4.1-0.20190910175809-eb9f6c26742c + github.com/samalba/dockerclient => github.com/sayboras/dockerclient v0.0.0-20191231050035-015626177a97 k8s.io/api => k8s.io/api v0.17.2 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.2 k8s.io/apimachinery => k8s.io/apimachinery v0.17.2 diff --git a/go.sum b/go.sum index 40b885f371..a5032159c7 100644 --- a/go.sum +++ b/go.sum @@ -9,14 +9,21 @@ cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTj cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v38.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= +github.com/Azure/go-autorest/autorest/adal v0.8.1/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc= +github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= @@ -29,6 +36,9 @@ github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd h1:sjQovDkwrZp github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= +github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/hcsshim v0.0.0-20190417211021-672e52e9209d h1:u64+IetywsPQ0gJ/4cXBJ/KiXV9xTKRMoaCOzW9PI3g= github.com/Microsoft/hcsshim v0.0.0-20190417211021-672e52e9209d/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OpenPeeDeeP/depguard v1.0.0/go.mod h1:7/4sitnI9YlQgTLLk734QlzXT8DuHVnAyztLplQjk+o= @@ -41,8 +51,6 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Rican7/retry v0.1.0/go.mod h1:FgOROf8P5bebcC1DS0PdOQiqGUridaZvikzUmkFW6gg= -github.com/Sirupsen/logrus v0.0.0-20170822132746-89742aefa4b2 h1:k1A7eIeUk6rnX2yuagwljW/pDezkK8oSpvPumT9zdZY= -github.com/Sirupsen/logrus v0.0.0-20170822132746-89742aefa4b2/go.mod h1:rmk17hk6i8ZSAJkSDa7nOxamrG+SP4P0mm+DAvExv4U= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= @@ -64,6 +72,8 @@ github.com/aws/aws-sdk-go v1.15.78 h1:LaXy6lWR0YK7LKyuU0QWy2ws/LWTPfYV/UgfiBu4tv github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.16.26 h1:GWkl3rkRO/JGRTWoLLIqwf7AWC4/W/1hMOUZqmX0js4= github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.27.1 h1:MXnqY6SlWySaZAqNnXThOvjRFdiiOuKtC6i7baFdNdU= +github.com/aws/aws-sdk-go v1.27.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/bazelbuild/bazel-gazelle v0.18.2/go.mod h1:D0ehMSbS+vesFsLGiD6JXu3mVEzOlfUl8wNnq+x/9p0= github.com/bazelbuild/bazel-gazelle v0.19.1-0.20191105222053-70208cbdc798/go.mod h1:rPwzNHUqEzngx1iVBfO/2X2npKaT3tqPqqHW6rVsn/A= github.com/bazelbuild/buildtools v0.0.0-20190731111112-f720930ceb60/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU= @@ -106,6 +116,8 @@ github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2 github.com/container-storage-interface/spec v1.2.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= github.com/containerd/console v0.0.0-20170925154832-84eeaae905fa/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/containerd v1.0.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0 h1:xjvXQWABwS2uiv3TWgQt5Uth60Gu86LTGZXMJkjc7rY= +github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= github.com/coredns/corefile-migration v1.0.4/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E= @@ -130,14 +142,18 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017 h1:2HQmlpI3yI9deH18Q6xiSOIjXD4sLI55Y/gfpa8/558= +github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0 h1:w3NnFcKR5241cfmQU5ZZAsf0xcpId6mWOupTvJlUX2U= -github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo= -github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7 h1:Cvj7S8I4Xpx78KAl6TwTmMHuHlZ/0SM60NUneGJQ7IE= +github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.6.3 h1:zI2p9+1NQYdnG6sMU26EX4aVGlqbInSQxQXLvzJ4RPQ= +github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= github.com/docker/go-connections v0.3.0 h1:3lOnM9cSzgGwx8VfK/NGOW5fLQ0GjIlCkaktF+n1M6o= github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= @@ -291,8 +307,8 @@ github.com/google/cadvisor v0.35.0/go.mod h1:1nql6U13uTHaLYB8rLS5x9IJc2qT6Xd/Tr1 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-containerregistry v0.0.0-20180731221751-697ee0b3d46e h1:Hm0cmAopLRcMPePDVUo93UC2JGtNWPlZKo8OIzyPbhQ= -github.com/google/go-containerregistry v0.0.0-20180731221751-697ee0b3d46e/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk= +github.com/google/go-containerregistry v0.0.0-20200131185320-aec8da010de2 h1:/z0FoA29APs30PljxT6GoZQekF5c1cYhow2osFsj1XU= +github.com/google/go-containerregistry v0.0.0-20200131185320-aec8da010de2/go.mod h1:Wtl/v6YdQxv397EREtzwgd9+Ud7Q5D8XMbi3Zazgkrs= 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-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= @@ -313,6 +329,7 @@ github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.2.2/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0= github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -347,6 +364,8 @@ github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCO github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk= +github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -374,6 +393,7 @@ github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Ao github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/johanneswuerbach/nfsexports v0.0.0-20181204082207-1aa528dcb345 h1:XP1VL9iOZu4yz/rq8zj+yvB23XEY5erXRzp8JYmkWu0= github.com/johanneswuerbach/nfsexports v0.0.0-20181204082207-1aa528dcb345/go.mod h1:+c1/kUpg2zlkoWqTOvzDs36Wpbm3Gd1nlmtXAEB0WGU= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -415,6 +435,8 @@ github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM52 github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -467,6 +489,8 @@ github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vq github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2 h1:g+4J5sZg6osfvEfkRZxJ1em0VT95/UOZgi/l7zi1/oE= +github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= github.com/mesos/mesos-go v0.0.9/go.mod h1:kPYCMQ9gsOXVAle1OsoY4I1+9kPu8GHkf88aV59fDr4= github.com/mholt/certmagic v0.6.2-0.20190624175158-6a42ef9fe8c2/go.mod h1:g4cOPxcjV0oFq3qwpjSA30LReKD8AoIfwAY9VvG35NY= github.com/miekg/dns v1.1.3/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -498,6 +522,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE= github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mozilla/tls-observatory v0.0.0-20180409132520-8791a200eb40/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= @@ -526,7 +552,9 @@ github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v1.0.0-rc9 h1:/k06BMULKF5hidyoZymkoDCzdJzltZpz/UU4LguQVtc= github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs= @@ -581,9 +609,10 @@ github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/ github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/samalba/dockerclient v0.0.0-20160414174713-91d7393ff859 h1:XRl74t6xHKI5EVIjDI5nPlHRq0bHED9/TjQuD8/UMkE= -github.com/samalba/dockerclient v0.0.0-20160414174713-91d7393ff859/go.mod h1:yeYR4SlaRZJct6lwNRKR+qd0CocnxxWDE7Vh5dxsn/w= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sayboras/dockerclient v0.0.0-20191231050035-015626177a97 h1:DWY4yZN6w+FSKMeqBBXaalT8zmCn4DVwBGopShnlwFE= +github.com/sayboras/dockerclient v0.0.0-20191231050035-015626177a97/go.mod h1:mUmEoqt0b+uQg57s006FsvL4mybi+N5wINLDBGtaPTY= +github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= @@ -596,6 +625,7 @@ github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOms github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -656,6 +686,7 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= github.com/valyala/quicktemplate v1.1.1/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/vdemeester/k8s-pkg-credentialprovider v0.0.0-20200107171650-7c61ffa44238/go.mod h1:JwQJCMWpUDqjZrB5jpw0f5VbN7U95zxFy1ZDpoEarGo= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/vishvananda/netlink v1.0.0/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= @@ -701,6 +732,9 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -711,8 +745,11 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -738,6 +775,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI= @@ -781,9 +819,12 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -824,9 +865,15 @@ golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190909030654-5b82db07426d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200115165105-de0b1760071a h1:bEJ3JL2YUH3tt9KX9dsy0WUF3WOrhjtNjK93o0svepY= +golang.org/x/tools v0.0.0-20200115165105-de0b1760071a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= @@ -856,6 +903,8 @@ google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.1 h1:q4XQuHFC6I28BKZpo6IYyb3mNO+l7lSOxRuYTCiDfXk= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -899,6 +948,7 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= k8s.io/api v0.17.2 h1:NF1UFXcKN7/OOv1uxdRz3qfra8AHsPav5M93hlV9+Dc= k8s.io/api v0.17.2/go.mod h1:BS9fjjLc4CMuqfSO8vgbHPKMt5+SF0ET6u/RVDihTo4= k8s.io/apiextensions-apiserver v0.17.2/go.mod h1:4KdMpjkEjjDI2pPfBA15OscyNldHWdBCfsWMDWAmSTs= @@ -911,12 +961,14 @@ k8s.io/client-go v0.17.2/go.mod h1:QAzRgsa0C2xl4/eVpeVAZMvikCn8Nm81yqVx3Kk9XYI= k8s.io/cloud-provider v0.17.2/go.mod h1:9rEcGqEsUFHxC83oMUGBcsXTBpRVNVPX/U+nyQJTvHU= k8s.io/cluster-bootstrap v0.17.2 h1:KVjK1WviylwbBwC+3L51xKmGN3A+WmzW8rhtcfWdUqQ= k8s.io/cluster-bootstrap v0.17.2/go.mod h1:qiazpAM05fjAc+PEkrY8HSUhKlJSMBuLnVUSO6nvZL4= +k8s.io/code-generator v0.17.2 h1:pTwl3rLB1fUyxmvEzmVPMM0tBSdUehd7z+bDzpj4lPE= k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= k8s.io/component-base v0.17.2 h1:0XHf+cerTvL9I5Xwn9v+0jmqzGAZI7zNydv4tL6Cw6A= k8s.io/component-base v0.17.2/go.mod h1:zMPW3g5aH7cHJpKYQ/ZsGMcgbsA/VyhEugF3QT1awLs= k8s.io/cri-api v0.17.2/go.mod h1:BzAkbBHHp81d+aXzbiIcUbilLkbXa40B8mUHOk6EX3s= k8s.io/csi-translation-lib v0.17.2/go.mod h1:NrhnhXJg/V6cHRTdPbmxvBuV3rJSqXsdLBE5JSRzcVI= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20190822140433-26a664648505 h1:ZY6yclUKVbZ+SdWnkfY+Je5vrMpKOxmGeKRbsXVmqYM= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/heapster v1.2.0-beta.1/go.mod h1:h1uhptVXMwC8xtZBYsPXKVi8fpdlYkTs6k949KozGrM= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/hack/images/kicbase.Dockerfile b/hack/images/kicbase.Dockerfile index 836f359a66..58fe4bb55b 100644 --- a/hack/images/kicbase.Dockerfile +++ b/hack/images/kicbase.Dockerfile @@ -2,9 +2,9 @@ ARG COMMIT_SHA # using base image created by kind https://github.com/kubernetes-sigs/kind # which is an ubuntu 19.10 with an entry-point that helps running systemd # could be changed to any debian that can run systemd -FROM kindest/base:v20200122-2dfe64b2 +FROM kindest/base:v20200122-2dfe64b2 as base USER root -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ sudo \ dnsutils \ openssh-server \ @@ -34,12 +34,22 @@ USER root # https://github.com/kubernetes-sigs/kind/blob/master/images/base/files/usr/local/bin/entrypoint RUN mkdir -p /kind RUN rm -rf \ - /var/cache/debconf/* \ - /var/lib/apt/lists/* \ - /var/log/* \ - /tmp/* \ - /var/tmp/* \ - /usr/share/doc/* \ - /usr/share/man/* \ - /usr/share/local/* \ -RUN echo "kic! Build: ${COMMIT_SHA} Time :$(date)" > "/kic.txt" + /var/cache/debconf/* \ + /var/lib/apt/lists/* \ + /var/log/* \ + /tmp/* \ + /var/tmp/* \ + /usr/share/doc/* \ + /usr/share/man/* \ + /usr/share/local/* \ + RUN echo "kic! Build: ${COMMIT_SHA} Time :$(date)" > "/kic.txt" + + +FROM busybox +ARG KUBERNETES_VERSION +COPY out/preloaded-images-k8s-$KUBERNETES_VERSION.tar /preloaded-images.tar +RUN tar xvf /preloaded-images.tar -C / + +FROM base +COPY --from=1 /var/lib/docker /var/lib/docker +COPY --from=1 /var/lib/minikube/binaries /var/lib/minikube/binaries diff --git a/hack/jenkins/common.sh b/hack/jenkins/common.sh index fce0f103a2..2570c4cfc7 100755 --- a/hack/jenkins/common.sh +++ b/hack/jenkins/common.sh @@ -27,8 +27,13 @@ readonly TEST_ROOT="${HOME}/minikube-integration" readonly TEST_HOME="${TEST_ROOT}/${OS_ARCH}-${VM_DRIVER}-${MINIKUBE_LOCATION}-$$-${COMMIT}" export GOPATH="$HOME/go" +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.4" "/usr/local" || true + + echo ">> Starting at $(date)" echo "" echo "arch: ${OS_ARCH}" @@ -42,6 +47,7 @@ echo "uptime: $(uptime)" # Setting KUBECONFIG prevents the version ceck from erroring out due to permission issues echo "kubectl: $(env KUBECONFIG=${TEST_HOME} kubectl version --client --short=true)" echo "docker: $(docker version --format '{{ .Client.Version }}')" +echo "podman: $(sudo podman version --format '{{.Version}}' || true)" echo "go: $(go version || true)" @@ -235,7 +241,6 @@ cleanup_stale_routes || true mkdir -p "${TEST_HOME}" export MINIKUBE_HOME="${TEST_HOME}/.minikube" -export KUBECONFIG="${TEST_HOME}/kubeconfig" # Build the gvisor image so that we can integration test changes to pkg/gvisor @@ -303,7 +308,8 @@ min=$(($elapsed/60)) sec=$(tail -c 3 <<< $((${elapsed}00/60))) elapsed=$min.$sec -JOB_GCS_BUCKET="minikube-builds/logs/${MINIKUBE_LOCATION}/${JOB_NAME}" +SHORT_COMMIT=${COMMIT:0:7} +JOB_GCS_BUCKET="minikube-builds/logs/${MINIKUBE_LOCATION}/${SHORT_COMMIT}/${JOB_NAME}" echo ">> Copying ${TEST_OUT} to gs://${JOB_GCS_BUCKET}out.txt" gsutil -qm cp "${TEST_OUT}" "gs://${JOB_GCS_BUCKET}out.txt" @@ -319,7 +325,7 @@ touch "${JSON_OUT}" echo ">> Running go test2json" go tool test2json -t < "${TEST_OUT}" > "${JSON_OUT}" || true echo ">> Installing gopogh" -cd /tmp +cd $(mktemp -d) GO111MODULE="on" go get -u github.com/medyagh/gopogh@v0.0.17 || true cd - echo ">> Running gopogh" @@ -340,6 +346,7 @@ gsutil -qm cp "${JSON_OUT}" "gs://${JOB_GCS_BUCKET}.json" || true echo ">> uploading ${HTML_OUT}" gsutil -qm cp "${HTML_OUT}" "gs://${JOB_GCS_BUCKET}.html" || true + public_log_url="https://storage.googleapis.com/${JOB_GCS_BUCKET}.txt" if grep -q html "$HTML_OUT"; then public_log_url="https://storage.googleapis.com/${JOB_GCS_BUCKET}.html" @@ -347,7 +354,7 @@ fi echo ">> Cleaning up after ourselves ..." ${SUDO_PREFIX}${MINIKUBE_BIN} tunnel --cleanup || true -${SUDO_PREFIX}${MINIKUBE_BIN} delete --all >/dev/null 2>/dev/null || true +${SUDO_PREFIX}${MINIKUBE_BIN} delete --all --purge >/dev/null 2>/dev/null || true cleanup_stale_routes || true ${SUDO_PREFIX} rm -Rf "${MINIKUBE_HOME}" || true diff --git a/hack/jenkins/linux_integration_tests_docker.sh b/hack/jenkins/linux_integration_tests_docker.sh index 6adcccb4b9..fb912d2391 100755 --- a/hack/jenkins/linux_integration_tests_docker.sh +++ b/hack/jenkins/linux_integration_tests_docker.sh @@ -32,4 +32,7 @@ JOB_NAME="Docker_Linux" mkdir -p cron && gsutil -qm rsync "gs://minikube-builds/${MINIKUBE_LOCATION}/cron" cron || echo "FAILED TO GET CRON FILES" sudo install cron/cleanup_and_reboot_Linux.sh /etc/cron.hourly/cleanup_and_reboot || echo "FAILED TO INSTALL CLEANUP" +# removing possible left over docker containers from previous runs +docker rm -f -v $(docker ps -aq) >/dev/null 2>&1 || true + source ./common.sh diff --git a/hack/jenkins/linux_integration_tests_none.sh b/hack/jenkins/linux_integration_tests_none.sh index b3a05d4744..7c52bb1800 100755 --- a/hack/jenkins/linux_integration_tests_none.sh +++ b/hack/jenkins/linux_integration_tests_none.sh @@ -44,8 +44,8 @@ docker rm -f $(docker ps -aq) >/dev/null 2>&1 || true sudo rm -rf /data/* # Cleanup old Kubernetes configs sudo rm -rf /etc/kubernetes/* -# Cleanup old minikube files -sudo rm -rf /var/lib/minikube/* +sudo rm -rf /var/lib/minikube/* + # Stop any leftover kubelets systemctl is-active --quiet kubelet \ && echo "stopping kubelet" \ diff --git a/hack/jenkins/linux_integration_tests_podman.sh b/hack/jenkins/linux_integration_tests_podman.sh new file mode 100755 index 0000000000..1dfbdb4456 --- /dev/null +++ b/hack/jenkins/linux_integration_tests_podman.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# 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. + + +# This script runs the integration tests on a Linux machine for the KVM Driver + +# The script expects the following env variables: +# MINIKUBE_LOCATION: GIT_COMMIT from upstream build. +# COMMIT: Actual commit ID from upstream build +# EXTRA_BUILD_ARGS (optional): Extra args to be passed into the minikube integrations tests +# access_token: The Github API access token. Injected by the Jenkins credential provider. + +set -e + +OS_ARCH="linux-amd64" +VM_DRIVER="podman" +JOB_NAME="Podman_Linux" + +mkdir -p cron && gsutil -qm rsync "gs://minikube-builds/${MINIKUBE_LOCATION}/cron" cron || echo "FAILED TO GET CRON FILES" +sudo install cron/cleanup_and_reboot_Linux.sh /etc/cron.hourly/cleanup_and_reboot || echo "FAILED TO INSTALL CLEANUP" +SUDO_PREFIX="sudo -E " + +EXTRA_ARGS="--container-runtime=containerd" + +# remove possible left over podman containers +sudo podman rm -f -v $(sudo podman ps -aq) || true + +source ./common.sh diff --git a/hack/jenkins/minikube_set_pending.sh b/hack/jenkins/minikube_set_pending.sh index ffffc5e72c..2c2c394668 100755 --- a/hack/jenkins/minikube_set_pending.sh +++ b/hack/jenkins/minikube_set_pending.sh @@ -41,6 +41,7 @@ jobs=( 'KVM_Linux' 'none_Linux' 'Docker_Linux' + 'Podman_Linux' ) # retry_github_status provides reliable github status updates @@ -77,8 +78,9 @@ function retry_github_status() { done } +SHORT_COMMIT=${ghprbActualCommit:0:7} for j in ${jobs[@]}; do retry_github_status "${ghprbActualCommit}" "${j}" "pending" "${access_token}" \ - "https://storage.googleapis.com/minikube-builds/logs/${ghprbPullId}/${j}.pending" + "https://storage.googleapis.com/minikube-builds/logs/${ghprbPullId}/${SHORT_COMMIT}/${j}.pending" done diff --git a/hack/jenkins/windows_integration_test_hyperv.ps1 b/hack/jenkins/windows_integration_test_hyperv.ps1 index a829786eb6..4c8835d0cf 100644 --- a/hack/jenkins/windows_integration_test_hyperv.ps1 +++ b/hack/jenkins/windows_integration_test_hyperv.ps1 @@ -25,6 +25,8 @@ $env:result=$lastexitcode If($env:result -eq 0){$env:status="success"} Else {$env:status="failure"} +# $env:SHORT_COMMIT=$env:COMMIT.substring(0, 7) +# to be used later to implement https://github.com/kubernetes/minikube/issues/6593 $env:target_url="https://storage.googleapis.com/minikube-builds/logs/$env:MINIKUBE_LOCATION/Hyper-V_Windows.txt" $json = "{`"state`": `"$env:status`", `"description`": `"Jenkins`", `"target_url`": `"$env:target_url`", `"context`": `"Hyper-V_Windows`"}" Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT`?access_token=$env:access_token" -Body $json -ContentType "application/json" -Method Post -usebasicparsing diff --git a/hack/jenkins/windows_integration_test_virtualbox.ps1 b/hack/jenkins/windows_integration_test_virtualbox.ps1 index 8e4d0ae48a..5cc4e157b1 100644 --- a/hack/jenkins/windows_integration_test_virtualbox.ps1 +++ b/hack/jenkins/windows_integration_test_virtualbox.ps1 @@ -25,6 +25,8 @@ $env:result=$lastexitcode If($env:result -eq 0){$env:status="success"} Else {$env:status="failure"} +# $env:SHORT_COMMIT=$env:COMMIT.substring(0, 7) +# to be used later $env:target_url="https://storage.googleapis.com/minikube-builds/logs/$env:MINIKUBE_LOCATION/VirtualBox_Windows.txt" $json = "{`"state`": `"$env:status`", `"description`": `"Jenkins`", `"target_url`": `"$env:target_url`", `"context`": `"VirtualBox_Windows`"}" Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT`?access_token=$env:access_token" -Body $json -ContentType "application/json" -Method Post -usebasicparsing diff --git a/hack/preload-images/preload_images.go b/hack/preload-images/preload_images.go new file mode 100644 index 0000000000..82fdba5b41 --- /dev/null +++ b/hack/preload-images/preload_images.go @@ -0,0 +1,107 @@ +/* +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 main + +import ( + "flag" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/pkg/errors" +) + +const ( + profile = "generate-preloaded-images-tar" + minikubePath = "out/minikube" +) + +var ( + kubernetesVersion = "" + tarballFilename = "" +) + +func init() { + flag.StringVar(&kubernetesVersion, "kubernetes-version", "", "desired kubernetes version, for example `v1.17.2`") + flag.Parse() + tarballFilename = fmt.Sprintf("preloaded-images-k8s-%s.tar", kubernetesVersion) +} + +func main() { + if err := executePreloadImages(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +func executePreloadImages() error { + defer func() { + if err := deleteMinikube(); err != nil { + fmt.Println(err) + } + }() + if err := startMinikube(); err != nil { + return err + } + if err := createImageTarball(); err != nil { + return err + } + return copyTarballToHost() +} + +func startMinikube() error { + cmd := exec.Command(minikubePath, "start", "-p", profile, "--memory", "4000", "--kubernetes-version", kubernetesVersion, "--wait=false") + cmd.Stdout = os.Stdout + return cmd.Run() +} + +func createImageTarball() error { + cmd := exec.Command(minikubePath, "ssh", "-p", profile, "--", "sudo", "tar", "cvf", tarballFilename, "/var/lib/docker", "/var/lib/minikube/binaries") + cmd.Stdout = os.Stdout + return cmd.Run() +} + +func copyTarballToHost() error { + sshKey, err := runCmd([]string{minikubePath, "ssh-key", "-p", profile}) + if err != nil { + return errors.Wrap(err, "getting ssh-key") + } + + ip, err := runCmd([]string{minikubePath, "ip", "-p", profile}) + if err != nil { + return errors.Wrap(err, "getting ip") + } + + dest := filepath.Join("out/", tarballFilename) + args := []string{"scp", "-o", "StrictHostKeyChecking=no", "-i", sshKey, fmt.Sprintf("docker@%s:/home/docker/%s", ip, tarballFilename), dest} + _, err = runCmd(args) + return err +} + +func deleteMinikube() error { + cmd := exec.Command(minikubePath, "delete", "-p", profile) + cmd.Stdout = os.Stdout + return cmd.Run() +} + +func runCmd(command []string) (string, error) { + cmd := exec.Command(command[0], command[1:]...) + output, err := cmd.Output() + return strings.Trim(string(output), "\n "), err +} diff --git a/pkg/addons/kubectl.go b/pkg/addons/kubectl.go index 1e3fbe2a97..97abf8023d 100644 --- a/pkg/addons/kubectl.go +++ b/pkg/addons/kubectl.go @@ -17,11 +17,13 @@ limitations under the License. package addons import ( + "fmt" "os/exec" "path" "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/constants" + "k8s.io/minikube/pkg/minikube/vmpath" ) var ( @@ -41,7 +43,7 @@ func kubectlCommand(profile string, files []string, enable bool) (*exec.Cmd, err kubectlAction = "delete" } - args := []string{"KUBECONFIG=/var/lib/minikube/kubeconfig", kubectlBinary, kubectlAction} + args := []string{fmt.Sprintf("KUBECONFIG=%s", path.Join(vmpath.GuestPersistentDir, "kubeconfig")), kubectlBinary, kubectlAction} for _, f := range files { args = append(args, []string{"-f", f}...) } @@ -63,5 +65,5 @@ func kubernetesVersion(profile string) (string, error) { } func kubectlBinaryPath(version string) string { - return path.Join("/var/lib/minikube/binaries", version, "kubectl") + return path.Join(vmpath.GuestPersistentDir, "binaries", version, "kubectl") } diff --git a/pkg/drivers/kic/kic.go b/pkg/drivers/kic/kic.go index 13d7de7fb6..bb76fbd5ef 100644 --- a/pkg/drivers/kic/kic.go +++ b/pkg/drivers/kic/kic.go @@ -36,7 +36,7 @@ import ( "k8s.io/minikube/pkg/minikube/constants" ) -// Driver represents a kic driver https://minikube.sigs.k8s.io/docs/reference/drivers/kic/ +// Driver represents a kic driver https://minikube.sigs.k8s.io/docs/reference/drivers/docker type Driver struct { *drivers.BaseDriver *pkgdrivers.CommonDriver @@ -76,15 +76,15 @@ func (d *Driver) Create() error { // control plane specific options params.PortMappings = append(params.PortMappings, oci.PortMapping{ - ListenAddress: DefaultBindIPV4, + ListenAddress: oci.DefaultBindIPV4, ContainerPort: constants.APIServerPort, }, oci.PortMapping{ - ListenAddress: DefaultBindIPV4, + ListenAddress: oci.DefaultBindIPV4, ContainerPort: constants.SSHPort, }, oci.PortMapping{ - ListenAddress: DefaultBindIPV4, + ListenAddress: oci.DefaultBindIPV4, ContainerPort: constants.DockerDaemonPort, }, ) @@ -138,12 +138,12 @@ func (d *Driver) GetIP() (string, error) { // GetExternalIP returns an IP which is accissble from outside func (d *Driver) GetExternalIP() (string, error) { - return DefaultBindIPV4, nil + return oci.DefaultBindIPV4, nil } // GetSSHHostname returns hostname for use with ssh func (d *Driver) GetSSHHostname() (string, error) { - return DefaultBindIPV4, nil + return oci.DefaultBindIPV4, nil } // GetSSHPort returns port for use with ssh @@ -186,7 +186,7 @@ func (d *Driver) GetState() (state.State, error) { cmd := exec.Command(d.NodeConfig.OCIBinary, "inspect", "-f", "{{.State.Status}}", d.MachineName) out, err := cmd.CombinedOutput() - o := strings.Trim(string(out), "\n") + o := strings.TrimSpace(string(out)) if err != nil { return state.Error, errors.Wrapf(err, "get container %s status", d.MachineName) } @@ -222,7 +222,7 @@ func (d *Driver) Remove() error { } cmd := exec.Command(d.NodeConfig.OCIBinary, "rm", "-f", "-v", d.MachineName) o, err := cmd.CombinedOutput() - out := strings.Trim(string(o), "\n") + out := strings.TrimSpace(string(o)) if err != nil { if strings.Contains(out, "is already in progress") { log.Warnf("Docker engine is stuck. please restart docker daemon on your computer.", d.MachineName) diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index 9f8ddd6048..9442eda7bc 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -18,6 +18,7 @@ package oci import ( "os" + "path/filepath" "strconv" "bufio" @@ -26,6 +27,7 @@ import ( "github.com/golang/glog" "github.com/pkg/errors" "k8s.io/minikube/pkg/minikube/constants" + "k8s.io/minikube/pkg/minikube/localpath" "fmt" "os/exec" @@ -39,8 +41,6 @@ func CreateContainerNode(p CreateParams) error { } runArgs := []string{ - fmt.Sprintf("--cpus=%s", p.CPUs), - fmt.Sprintf("--memory=%s", p.Memory), "-d", // run the container detached "-t", // allocate a tty for entrypoint logs // running containers in a container requires privileged @@ -53,7 +53,6 @@ func CreateContainerNode(p CreateParams) error { "--tmpfs", "/tmp", // various things depend on working /tmp "--tmpfs", "/run", // systemd wants a writable /run // logs,pods be stroed on filesystem vs inside container, - "--volume", "/var", // some k8s things want /lib/modules "-v", "/lib/modules:/lib/modules:ro", "--hostname", p.Name, // make hostname match container name @@ -64,6 +63,23 @@ func CreateContainerNode(p CreateParams) error { "--label", fmt.Sprintf("%s=%s", nodeRoleKey, p.Role), } + // volume path in minikube home folder to mount to /var + hostVarVolPath := filepath.Join(localpath.MiniPath(), "machines", p.Name, "var") + if err := os.MkdirAll(hostVarVolPath, 0711); err != nil { + return errors.Wrapf(err, "create var dir %s", hostVarVolPath) + } + + if p.OCIBinary == Podman { // enable execing in /var + // podman mounts var/lib with no-exec by default https://github.com/containers/libpod/issues/5103 + runArgs = append(runArgs, "--volume", fmt.Sprintf("%s:/var:exec", hostVarVolPath)) + } + if p.OCIBinary == Docker { + runArgs = append(runArgs, "--volume", "/var") + // setting resource limit in privileged mode is only supported by docker + // podman error: "Error: invalid configuration, cannot set resources with rootless containers not using cgroups v2 unified mode" + runArgs = append(runArgs, fmt.Sprintf("--cpus=%s", p.CPUs), fmt.Sprintf("--memory=%s", p.Memory)) + } + for key, val := range p.Envs { runArgs = append(runArgs, "-e", fmt.Sprintf("%s=%s", key, val)) } @@ -113,6 +129,10 @@ func createContainer(ociBinary string, image string, opts ...createOpt) ([]strin } // construct the actual docker run argv args := []string{"run"} + // to run nested container from privileged container in podman https://bugzilla.redhat.com/show_bug.cgi?id=1687713 + if ociBinary == Podman { + args = append(args, "--cgroup-manager", "cgroupfs") + } args = append(args, runArgs...) args = append(args, image) args = append(args, o.ContainerArgs...) @@ -159,12 +179,24 @@ func HostPortBinding(ociBinary string, ociID string, contPort int) (int, error) if err := PointToHostDockerDaemon(); err != nil { return 0, errors.Wrap(err, "point host docker-daemon") } - cmd := exec.Command(ociBinary, "inspect", "-f", fmt.Sprintf("'{{(index (index .NetworkSettings.Ports \"%d/tcp\") 0).HostPort}}'", contPort), ociID) - out, err := cmd.CombinedOutput() - if err != nil { - return 0, errors.Wrapf(err, "getting host-bind port %d for container ID %q, output %s", contPort, ociID, out) + var out []byte + var err error + if ociBinary == Podman { + //podman inspect -f "{{range .NetworkSettings.Ports}}{{if eq .ContainerPort "80"}}{{.HostPort}}{{end}}{{end}}" + cmd := exec.Command(ociBinary, "inspect", "-f", fmt.Sprintf("{{range .NetworkSettings.Ports}}{{if eq .ContainerPort %s}}{{.HostPort}}{{end}}{{end}}", fmt.Sprint(contPort)), ociID) + out, err = cmd.CombinedOutput() + if err != nil { + return 0, errors.Wrapf(err, "get host-bind port %d for %q, output %s", contPort, ociID, out) + } + } else { + cmd := exec.Command(ociBinary, "inspect", "-f", fmt.Sprintf("'{{(index (index .NetworkSettings.Ports \"%d/tcp\") 0).HostPort}}'", contPort), ociID) + out, err = cmd.CombinedOutput() + if err != nil { + return 0, errors.Wrapf(err, "get host-bind port %d for %q, output %s", contPort, ociID, out) + } } - o := strings.Trim(string(out), "\n") + + o := strings.TrimSpace(string(out)) o = strings.Trim(o, "'") p, err := strconv.Atoi(o) if err != nil { @@ -175,11 +207,35 @@ func HostPortBinding(ociBinary string, ociID string, contPort int) (int, error) // ContainerIPs returns ipv4,ipv6, error of a container by their name func ContainerIPs(ociBinary string, name string) (string, string, error) { + if ociBinary == Podman { + return podmanConttainerIP(name) + } + return dockerContainerIP(name) +} + +// podmanConttainerIP returns ipv4, ipv6 of container or error +func podmanConttainerIP(name string) (string, string, error) { + cmd := exec.Command(Podman, "inspect", + "-f", "{{.NetworkSettings.IPAddress}}", + name) + out, err := cmd.CombinedOutput() + if err != nil { + return "", "", errors.Wrapf(err, "podman inspect ip %s", name) + } + output := strings.TrimSpace(string(out)) + if err == nil && output == "" { // podman returns empty for 127.0.0.1 + return DefaultBindIPV4, "", nil + } + return output, "", nil +} + +// dockerContainerIP returns ipv4, ipv6 of container or error +func dockerContainerIP(name string) (string, string, error) { if err := PointToHostDockerDaemon(); err != nil { return "", "", errors.Wrap(err, "point host docker-daemon") } // retrieve the IP address of the node using docker inspect - lines, err := inspect(ociBinary, name, "{{range .NetworkSettings.Networks}}{{.IPAddress}},{{.GlobalIPv6Address}}{{end}}") + lines, err := inspect(Docker, name, "{{range .NetworkSettings.Networks}}{{.IPAddress}},{{.GlobalIPv6Address}}{{end}}") if err != nil { return "", "", errors.Wrap(err, "inspecting NetworkSettings.Networks") } @@ -191,7 +247,6 @@ func ContainerIPs(ociBinary string, name string) (string, string, error) { return "", "", errors.Errorf("container addresses should have 2 values, got %d values: %+v", len(ips), ips) } return ips[0], ips[1], nil - } // ContainerID returns id of a container name diff --git a/pkg/drivers/kic/oci/types.go b/pkg/drivers/kic/oci/types.go index 786cf3980b..70ffbe5dbb 100644 --- a/pkg/drivers/kic/oci/types.go +++ b/pkg/drivers/kic/oci/types.go @@ -17,8 +17,10 @@ limitations under the License. package oci const ( - Docker = "docker" - Podman = "podman" + // DefaultBindIPV4 is The default IP the container will listen on. + DefaultBindIPV4 = "127.0.0.1" + Docker = "docker" + Podman = "podman" // ClusterLabelKey is applied to each node docker container for identification ClusterLabelKey = "io.x-k8s.kic.cluster" // NodeRoleKey is used to identify if it is control plane or worker diff --git a/pkg/drivers/kic/types.go b/pkg/drivers/kic/types.go index 317ee956f0..f3082952a5 100644 --- a/pkg/drivers/kic/types.go +++ b/pkg/drivers/kic/types.go @@ -23,8 +23,7 @@ const ( DefaultNetwork = "bridge" // DefaultPodCIDR is The CIDR to be used for pods inside the node. DefaultPodCIDR = "10.244.0.0/16" - // DefaultBindIPV4 is The default IP the container will bind to. - DefaultBindIPV4 = "127.0.0.1" + // BaseImage is the base image is used to spin up kic containers. it uses same base-image as kind. BaseImage = "gcr.io/k8s-minikube/kicbase:v0.0.5@sha256:3ddd8461dfb5c3e452ccc44d87750b87a574ec23fc425da67dccc1f0c57d428a" // OverlayImage is the cni plugin used for overlay image, created by kind. diff --git a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha1.go b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha1.go index cd90b31f23..36b4500dcc 100644 --- a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha1.go +++ b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha1.go @@ -34,7 +34,7 @@ networking: serviceSubnet: {{.ServiceCIDR}} etcd: dataDir: {{.EtcdDataDir}} -nodeName: {{.NodeName}} +nodeName: "{{.NodeName}}" apiServerCertSANs: ["127.0.0.1", "localhost", "{{.AdvertiseAddress}}"] {{if .ImageRepository}}imageRepository: {{.ImageRepository}} {{end}}{{if .CRISocket}}criSocket: {{.CRISocket}} diff --git a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha3.go b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha3.go index 8dfadae215..bcc5374924 100644 --- a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha3.go +++ b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1alpha3.go @@ -35,7 +35,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: {{if .CRISocket}}{{.CRISocket}}{{else}}/var/run/dockershim.sock{{end}} - name: {{.NodeName}} + name: "{{.NodeName}}" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta1.go b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta1.go index 3a271bce75..9ed28762a3 100644 --- a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta1.go +++ b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta1.go @@ -35,7 +35,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: {{if .CRISocket}}{{.CRISocket}}{{else}}/var/run/dockershim.sock{{end}} - name: {{.NodeName}} + name: "{{.NodeName}}" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta2.go b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta2.go index 38cfc61956..aa93eebf83 100644 --- a/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta2.go +++ b/pkg/minikube/bootstrapper/bsutil/ktmpl/v1beta2.go @@ -35,7 +35,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: {{if .CRISocket}}{{.CRISocket}}{{else}}/var/run/dockershim.sock{{end}} - name: {{.NodeName}} + name: "{{.NodeName}}" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-api-port.yaml index e44ab4c92a..7d94020c6f 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-api-port.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] criSocket: /run/containerd/containerd.sock apiServerExtraArgs: diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-pod-network-cidr.yaml index ed91117f73..f66eec734e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd-pod-network-cidr.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] criSocket: /run/containerd/containerd.sock apiServerExtraArgs: diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd.yaml index ed91117f73..f66eec734e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/containerd.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] criSocket: /run/containerd/containerd.sock apiServerExtraArgs: diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio-options-gates.yaml index c15e619508..30b1986325 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio-options-gates.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] criSocket: /var/run/crio/crio.sock apiServerExtraArgs: diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio.yaml index eb4fd3fd1c..4693643125 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/crio.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] criSocket: /var/run/crio/crio.sock apiServerExtraArgs: diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/default.yaml index 8e3e566bc2..5c2861101e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/default.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] apiServerExtraArgs: enable-admission-plugins: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota" diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/image-repository.yaml index 6e08604263..7d383865f8 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/image-repository.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] imageRepository: test/repo apiServerExtraArgs: diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/options.yaml index a3d5c82303..26fbfead4b 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.11/options.yaml @@ -11,7 +11,7 @@ networking: serviceSubnet: 10.96.0.0/12 etcd: dataDir: /var/lib/minikube/etcd -nodeName: mk +nodeName: "mk" apiServerCertSANs: ["127.0.0.1", "localhost", "1.1.1.1"] apiServerExtraArgs: enable-admission-plugins: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota" diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-api-port.yaml index fee7f3684f..2d3b56a491 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-pod-network-cidr.yaml index c3399153f9..cd04ce60b1 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd.yaml index 9beec13a4d..b2aa65d11e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio-options-gates.yaml index 88253bcb48..b953ced7c5 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio.yaml index 4a3555c9af..9b181b1f6d 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/default.yaml index 7ccd2edf28..2c4e3340e0 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/dns.yaml index 96bf607d65..6b2f57fbf6 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/image-repository.yaml index f0b48f62e1..9c768ee4f7 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/options.yaml index 22809c5ce9..7c6a569290 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.12/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-api-port.yaml index 3106e329d1..ca79adb98e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-pod-network-cidr.yaml index 279a7c20a3..743f190e33 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd.yaml index 6994f8d92b..6f38c75780 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio-options-gates.yaml index 1304deaa3e..a02324c8e8 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio.yaml index a333a25399..2262455339 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/default.yaml index afc4d8a821..d5f310fa24 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/dns.yaml index 89d56b7bfd..918690b57c 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/image-repository.yaml index 3fc3446ce4..4203bc4e65 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/options.yaml index 9a4466840e..fea2a9129c 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.13/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1alpha3 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-api-port.yaml index 95c1fb0c59..f3d67f70d3 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-pod-network-cidr.yaml index 53077ef4eb..9f0b9fb6c8 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd.yaml index 7b7a6b5443..f855d4fbee 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio-options-gates.yaml index 9fdfe4f679..05ee0c5308 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio.yaml index 6c69bdc90d..6198962775 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/default.yaml index d14ce69bc4..b61d8b7eb6 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/dns.yaml index 2056fb7631..325faa8ab2 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/image-repository.yaml index 132612747a..85ac925260 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/options.yaml index 1505f69920..0457996a35 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.14/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-api-port.yaml index d9402c815f..459e6550ef 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-pod-network-cidr.yaml index 9a11e84292..35f6926fb7 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd.yaml index 24901912b6..5a913e464f 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio-options-gates.yaml index 9a278fc9f5..d17c78f1c8 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio.yaml index ccfed491fe..0336f010b8 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/default.yaml index 7ae97e1ea8..4e0b6afbff 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/dns.yaml index 12d3d16b98..f4f2827b2f 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/image-repository.yaml index 02fac89c94..ec78e07f72 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/options.yaml index fe17557c4e..a6940de86b 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.15/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-api-port.yaml index 948cbfa1e5..09c722181f 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-pod-network-cidr.yaml index 672c3838c4..b02eaa4dc2 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd.yaml index bee7e4b3b6..4e21301d59 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio-options-gates.yaml index c332938f11..5e0024092a 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio.yaml index 1d684b48e7..6c40259c4e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/default.yaml index a5f29b0f7e..1066fd3f89 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/dns.yaml index a05a319a92..b200db813a 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/image-repository.yaml index 89465d9e4c..8bc51fe09e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/options.yaml index 24403f0d9d..e998a04596 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.16/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta1 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-api-port.yaml index 1687279613..c25bea22bf 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-pod-network-cidr.yaml index 1687246733..a1aa0ae4dd 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd.yaml index 5887f5b6aa..e64528e4a0 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio-options-gates.yaml index bb9911f57f..9e425ce706 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio.yaml index ba380dc9f9..549e5ccf68 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/default.yaml index 2f6a47b705..f691ad6b7e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/dns.yaml index 0005dc6939..bf0ac3e903 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/image-repository.yaml index 50ba184b28..89b3cf0488 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/options.yaml index ca68e6e39f..e88b0edb8e 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.17/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-api-port.yaml index e5eb8d2d5e..c17d4e81fe 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-pod-network-cidr.yaml index 8d3cd1d2c9..72d5fb43a1 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd.yaml index eba01c91f2..74c90ddfe4 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio-options-gates.yaml index 1c46d2e7ec..0b5ca1a18b 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio.yaml index bd29ae5875..d4847d210f 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/default.yaml index a3f4deab94..ec44e426f2 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/dns.yaml index de9851d204..ac413fdb55 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/image-repository.yaml index acd3b6d111..1cab2c7c59 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/options.yaml index e8b7b28d05..bd9d4183b9 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.18/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-api-port.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-api-port.yaml index 30dd50136c..4b00967bdd 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-api-port.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-api-port.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-pod-network-cidr.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-pod-network-cidr.yaml index fd1b6aba43..f1268b0747 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-pod-network-cidr.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd-pod-network-cidr.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd.yaml index acde6e12ec..ffa93b5025 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/containerd.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /run/containerd/containerd.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio-options-gates.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio-options-gates.yaml index 9faec4d821..2ef9296c57 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio-options-gates.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio-options-gates.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio.yaml index f4025a2de6..adf406b493 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/crio/crio.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/default.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/default.yaml index dbc01e3c63..2bce5f4977 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/default.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/default.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/dns.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/dns.yaml index a8644fa298..222eb70dcb 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/dns.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/dns.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/image-repository.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/image-repository.yaml index 1cf68cf362..b049277a30 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/image-repository.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/image-repository.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/options.yaml b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/options.yaml index 40f7706995..4aa5cddd34 100644 --- a/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/options.yaml +++ b/pkg/minikube/bootstrapper/bsutil/testdata/v1.19/options.yaml @@ -12,7 +12,7 @@ bootstrapTokens: - authentication nodeRegistration: criSocket: /var/run/dockershim.sock - name: mk + name: "mk" taints: [] --- apiVersion: kubeadm.k8s.io/v1beta2 diff --git a/pkg/minikube/bootstrapper/certs.go b/pkg/minikube/bootstrapper/certs.go index ed5738a03e..bb4bde2a38 100644 --- a/pkg/minikube/bootstrapper/certs.go +++ b/pkg/minikube/bootstrapper/certs.go @@ -32,7 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/clientcmd/api" "k8s.io/client-go/tools/clientcmd/api/latest" - "k8s.io/minikube/pkg/drivers/kic" + "k8s.io/minikube/pkg/drivers/kic/oci" "k8s.io/minikube/pkg/minikube/assets" "k8s.io/minikube/pkg/minikube/command" "k8s.io/minikube/pkg/minikube/config" @@ -169,7 +169,7 @@ func generateCerts(k8s config.KubernetesConfig, n config.Node) error { apiServerIPs := append( k8s.APIServerIPs, - []net.IP{net.ParseIP(n.IP), serviceIP, net.ParseIP(kic.DefaultBindIPV4), net.ParseIP("10.0.0.1")}...) + []net.IP{net.ParseIP(n.IP), serviceIP, net.ParseIP(oci.DefaultBindIPV4), net.ParseIP("10.0.0.1")}...) apiServerNames := append(k8s.APIServerNames, k8s.APIServerName) apiServerAlternateNames := append( apiServerNames, diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index 452287951b..a083b02617 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -210,9 +210,9 @@ func (k *Bootstrapper) StartCluster(cfg config.MachineConfig) error { return errors.Wrapf(err, "init failed. output: %q", rr.Output()) } - if driver.IsKIC(cfg.VMDriver) { + if cfg.VMDriver == driver.Docker { if err := k.applyKicOverlay(cfg); err != nil { - return errors.Wrap(err, "applying kic overlay network") + return errors.Wrap(err, "apply kic overlay") } } @@ -276,7 +276,7 @@ func (k *Bootstrapper) WaitForCluster(cfg config.MachineConfig, timeout time.Dur ip := cp.IP port := cp.Port if driver.IsKIC(cfg.VMDriver) { - ip = kic.DefaultBindIPV4 + ip = oci.DefaultBindIPV4 port, err = oci.HostPortBinding(cfg.VMDriver, cfg.Name, port) if err != nil { return errors.Wrapf(err, "get host-bind port %d for container %s", port, cfg.Name) @@ -344,7 +344,7 @@ func (k *Bootstrapper) restartCluster(cfg config.MachineConfig) error { ip := n.IP port := n.Port if driver.IsKIC(cfg.VMDriver) { - ip = kic.DefaultBindIPV4 + ip = oci.DefaultBindIPV4 port, err = oci.HostPortBinding(cfg.VMDriver, cfg.Name, port) if err != nil { return errors.Wrapf(err, "get host-bind port %d for container %s", port, cfg.Name) @@ -471,7 +471,7 @@ func (k *Bootstrapper) UpdateCluster(cfg config.MachineConfig) error { // applyKicOverlay applies the CNI plugin needed to make kic work func (k *Bootstrapper) applyKicOverlay(cfg config.MachineConfig) error { cmd := exec.Command("sudo", - path.Join("/var/lib/minikube/binaries", cfg.KubernetesConfig.KubernetesVersion, "kubectl"), "create", "--kubeconfig=/var/lib/minikube/kubeconfig", + path.Join(vmpath.GuestPersistentDir, "binaries", cfg.KubernetesConfig.KubernetesVersion, "kubectl"), "create", fmt.Sprintf("--kubeconfig=%s", path.Join(vmpath.GuestPersistentDir, "kubeconfig")), "-f", "-") b := bytes.Buffer{} if err := kicCNIConfig.Execute(&b, struct{ ImageName string }{ImageName: kic.OverlayImage}); err != nil { diff --git a/pkg/minikube/cluster/cluster_test.go b/pkg/minikube/cluster/cluster_test.go index 14c809360c..4c81ed58b6 100644 --- a/pkg/minikube/cluster/cluster_test.go +++ b/pkg/minikube/cluster/cluster_test.go @@ -41,8 +41,8 @@ type MockDownloader struct{} func (d MockDownloader) GetISOFileURI(isoURL string) string { return "" } func (d MockDownloader) CacheMinikubeISOFromURL(isoURL string) error { return nil } -func createMockDriverHost(c config.MachineConfig) interface{} { - return nil +func createMockDriverHost(c config.MachineConfig) (interface{}, error) { + return nil, nil } func RegisterMockDriver(t *testing.T) { @@ -146,6 +146,49 @@ func TestStartHostExists(t *testing.T) { } } +func TestStartHostErrMachineNotExist(t *testing.T) { + RegisterMockDriver(t) + api := tests.NewMockAPI(t) + // Create an incomplete host with machine does not exist error(i.e. User Interrupt Cancel) + api.NotExistError = true + h, err := createHost(api, defaultMachineConfig) + if err != nil { + t.Fatalf("Error creating host: %v", err) + } + + md := &tests.MockDetector{Provisioner: &tests.MockProvisioner{}} + provision.SetDetector(md) + + mc := defaultMachineConfig + mc.Name = h.Name + + // This should pass with creating host, while machine does not exist. + h, err = StartHost(api, mc) + if err != nil { + if err != ErrorMachineNotExist { + t.Fatalf("Error starting host: %v", err) + } + } + + mc.Name = h.Name + + // Second call. This should pass without calling Create because the host exists already. + h, err = StartHost(api, mc) + if err != nil { + t.Fatalf("Error starting host: %v", err) + } + + if h.Name != viper.GetString("profile") { + t.Fatalf("GetMachineName()=%q, want %q", viper.GetString("profile"), h.Name) + } + if s, _ := h.Driver.GetState(); s != state.Running { + t.Fatalf("Machine not started.") + } + if !md.Provisioner.Provisioned { + t.Fatalf("Expected provision to be called") + } +} + func TestStartStoppedHost(t *testing.T) { RegisterMockDriver(t) api := tests.NewMockAPI(t) @@ -309,6 +352,21 @@ func TestDeleteHostErrorDeletingFiles(t *testing.T) { } } +func TestDeleteHostErrMachineNotExist(t *testing.T) { + RegisterMockDriver(t) + api := tests.NewMockAPI(t) + // Create an incomplete host with machine does not exist error(i.e. User Interrupt Cancel) + api.NotExistError = true + _, err := createHost(api, defaultMachineConfig) + if err != nil { + t.Errorf("createHost failed: %v", err) + } + + if err := DeleteHost(api, viper.GetString("profile")); err == nil { + t.Fatal("Expected error deleting host.") + } +} + func TestGetHostStatus(t *testing.T) { RegisterMockDriver(t) api := tests.NewMockAPI(t) diff --git a/pkg/minikube/cluster/fix.go b/pkg/minikube/cluster/fix.go index 8ba2dd83c7..061be57c40 100644 --- a/pkg/minikube/cluster/fix.go +++ b/pkg/minikube/cluster/fix.go @@ -23,6 +23,8 @@ import ( "strings" "time" + "github.com/docker/machine/drivers/virtualbox" + "github.com/docker/machine/libmachine" "github.com/docker/machine/libmachine/host" "github.com/docker/machine/libmachine/provision" @@ -46,6 +48,11 @@ const ( maxClockDesyncSeconds = 2.1 ) +var ( + // ErrorMachineNotExist is returned when virtual machine does not exist due to user interrupt cancel(i.e. Ctrl + C) + ErrorMachineNotExist = errors.New("machine does not exist") +) + // fixHost fixes up a previously configured VM so that it is ready to run Kubernetes func fixHost(api libmachine.API, mc config.MachineConfig) (*host.Host, error) { out.T(out.Waiting, "Reconfiguring existing host ...") @@ -62,8 +69,35 @@ func fixHost(api libmachine.API, mc config.MachineConfig) (*host.Host, error) { } s, err := h.Driver.GetState() - if err != nil { - return h, errors.Wrap(err, "Error getting state for host") + if err != nil || s == state.Stopped || s == state.None { + // If virtual machine does not exist due to user interrupt cancel(i.e. Ctrl + C), recreate virtual machine + me, err := machineExists(h.Driver.DriverName(), s, err) + if !me { + // If the error is that virtual machine does not exist error, handle error(recreate virtual machine) + if err == ErrorMachineNotExist { + // remove virtual machine + if err := h.Driver.Remove(); err != nil { + // skip returning error since it may be before docker image pulling(so, no host exist) + if h.Driver.DriverName() != driver.Docker { + return nil, errors.Wrap(err, "host remove") + } + } + // remove machine config directory + if err := api.Remove(mc.Name); err != nil { + return nil, errors.Wrap(err, "api remove") + } + // recreate virtual machine + out.T(out.Meh, "machine '{{.name}}' does not exist. Proceeding ahead with recreating VM.", out.V{"name": mc.Name}) + h, err = createHost(api, mc) + if err != nil { + return nil, errors.Wrap(err, "Error recreating VM") + } + // return ErrMachineNotExist err to initialize preExists flag + return h, ErrorMachineNotExist + } + // If the error is not that virtual machine does not exist error, return error + return nil, errors.Wrap(err, "Error getting state for host") + } } if s == state.Running { @@ -161,3 +195,66 @@ func adjustGuestClock(h hostRunner, t time.Time) error { glog.Infof("clock set: %s (err=%v)", out, err) return err } + +// machineExists checks if virtual machine does not exist +// if the virtual machine exists, return true +func machineExists(vmDriver string, s state.State, err error) (bool, error) { + switch vmDriver { + case driver.HyperKit: + if s == state.Stopped || err.Error() == "connection is shut down" { + return false, ErrorMachineNotExist + } + return true, err + case driver.HyperV: + if s == state.None { + return false, ErrorMachineNotExist + } + return true, err + case driver.KVM2: + if s == state.None || s == state.Stopped { + return false, ErrorMachineNotExist + } + return true, err + case driver.None: + if s == state.Stopped { + return false, ErrorMachineNotExist + } + return true, err + case driver.Parallels: + if err.Error() == "machine does not exist" { + return false, ErrorMachineNotExist + } + return true, err + case driver.VirtualBox: + if err == virtualbox.ErrMachineNotExist { + return false, ErrorMachineNotExist + } + return true, err + case driver.VMware: + if s == state.None || s == state.Stopped { + return false, ErrorMachineNotExist + } + return true, err + case driver.VMwareFusion: + if s == state.Stopped { + return false, ErrorMachineNotExist + } + return true, err + case driver.Docker: + if s == state.Error { + // if the kic image is not present on the host machine, when user cancel `minikube start`, state.Error will be return + return false, ErrorMachineNotExist + } else if s == state.None { + // if the kic image is present on the host machine, when user cancel `minikube start`, state.None will be return + return false, ErrorMachineNotExist + } + return true, err + case driver.Mock: + if s == state.Error { + return false, ErrorMachineNotExist + } + return true, err + default: + return true, err + } +} diff --git a/pkg/minikube/cluster/ip.go b/pkg/minikube/cluster/ip.go index 8ea0cb5b10..e1d8e97db2 100644 --- a/pkg/minikube/cluster/ip.go +++ b/pkg/minikube/cluster/ip.go @@ -25,7 +25,7 @@ import ( "github.com/docker/machine/libmachine" "github.com/docker/machine/libmachine/host" "github.com/pkg/errors" - "k8s.io/minikube/pkg/drivers/kic" + "k8s.io/minikube/pkg/drivers/kic/oci" "k8s.io/minikube/pkg/minikube/driver" ) @@ -84,7 +84,7 @@ func GetHostDriverIP(api libmachine.API, machineName string) (net.IP, error) { return nil, errors.Wrap(err, "getting IP") } if driver.IsKIC(host.DriverName) { - ipStr = kic.DefaultBindIPV4 + ipStr = oci.DefaultBindIPV4 } ip := net.ParseIP(ipStr) if ip == nil { diff --git a/pkg/minikube/cluster/start.go b/pkg/minikube/cluster/start.go index 7f30942238..c7669e9966 100644 --- a/pkg/minikube/cluster/start.go +++ b/pkg/minikube/cluster/start.go @@ -114,7 +114,10 @@ func createHost(api libmachine.API, cfg config.MachineConfig) (*host.Host, error if def.Empty() { return nil, fmt.Errorf("unsupported/missing driver: %s", cfg.VMDriver) } - dd := def.Config(cfg) + dd, err := def.Config(cfg) + if err != nil { + return nil, errors.Wrap(err, "config") + } data, err := json.Marshal(dd) if err != nil { return nil, errors.Wrap(err, "marshal") @@ -195,7 +198,7 @@ func commandRunner(h *host.Host) (command.Runner, error) { } if driver.IsKIC(d) { glog.Infof("Returning KICRunner for %q driver", d) - return command.NewKICRunner(h.Name, "docker"), nil + return command.NewKICRunner(h.Name, d), nil } glog.Infof("Creating SSH client and returning SSHRunner for %q driver", d) diff --git a/pkg/minikube/command/kic_runner.go b/pkg/minikube/command/kic_runner.go index 3fe57bb17d..2d00a15251 100644 --- a/pkg/minikube/command/kic_runner.go +++ b/pkg/minikube/command/kic_runner.go @@ -30,6 +30,7 @@ import ( "github.com/golang/glog" "github.com/pkg/errors" "golang.org/x/crypto/ssh/terminal" + "k8s.io/minikube/pkg/drivers/kic/oci" "k8s.io/minikube/pkg/minikube/assets" ) @@ -126,7 +127,7 @@ func (k *kicRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) { // Copy copies a file and its permissions func (k *kicRunner) Copy(f assets.CopyableFile) error { - assetName := f.GetAssetName() + src := f.GetAssetName() if _, err := os.Stat(f.GetAssetName()); os.IsNotExist(err) { fc := make([]byte, f.GetLength()) // Read asset file into a []byte if _, err := f.Read(fc); err != nil { @@ -147,25 +148,37 @@ func (k *kicRunner) Copy(f assets.CopyableFile) error { if err := tmpFile.Close(); err != nil { return errors.Wrap(err, "close temporary file") } - assetName = tmpFile.Name() + src = tmpFile.Name() } - // based of format of "docker cp containerName:destination" - destination := fmt.Sprintf("%s:%s/%s", k.nameOrID, f.GetTargetDir(), f.GetTargetName()) - perms, err := strconv.ParseInt(f.GetPermissions(), 8, 0) if err != nil { - return errors.Wrapf(err, "error converting permissions %s to integer", f.GetPermissions()) + return errors.Wrapf(err, "converting permissions %s to integer", f.GetPermissions()) } // Rely on cp -a to propagate permissions - if err := os.Chmod(assetName, os.FileMode(perms)); err != nil { + if err := os.Chmod(src, os.FileMode(perms)); err != nil { return errors.Wrapf(err, "chmod") } - if out, err := exec.Command(k.ociBin, "cp", "-a", assetName, destination).CombinedOutput(); err != nil { - return errors.Wrapf(err, "error copying %s into node, output: %s", f.GetAssetName(), string(out)) + dest := fmt.Sprintf("%s:%s", k.nameOrID, path.Join(f.GetTargetDir(), f.GetTargetName())) + if k.ociBin == oci.Podman { + return copyToPodman(src, dest) } + return copyToDocker(src, dest) +} +// Podman cp command doesn't match docker and doesn't have -a +func copyToPodman(src string, dest string) error { + if out, err := exec.Command(oci.Podman, "cp", src, dest).CombinedOutput(); err != nil { + return errors.Wrapf(err, "podman copy %s into %s, output: %s", src, dest, string(out)) + } + return nil +} + +func copyToDocker(src string, dest string) error { + if out, err := exec.Command(oci.Docker, "cp", "-a", src, dest).CombinedOutput(); err != nil { + return errors.Wrapf(err, "docker copy %s into %s, output: %s", src, dest, string(out)) + } return nil } diff --git a/pkg/minikube/config/types.go b/pkg/minikube/config/types.go index 1b3b3b19c9..b05ff2e970 100644 --- a/pkg/minikube/config/types.go +++ b/pkg/minikube/config/types.go @@ -32,39 +32,41 @@ type Profile struct { // MachineConfig contains the parameters used to start a cluster. type MachineConfig struct { - Name string - KeepContext bool // used by start and profile command to or not to switch kubectl's current context - EmbedCerts bool // used by kubeconfig.Setup - MinikubeISO string - Memory int - CPUs int - DiskSize int - VMDriver string - HyperkitVpnKitSock string // Only used by the Hyperkit driver - HyperkitVSockPorts []string // Only used by the Hyperkit driver - DockerEnv []string // Each entry is formatted as KEY=VALUE. - InsecureRegistry []string - RegistryMirror []string - HostOnlyCIDR string // Only used by the virtualbox driver - HypervVirtualSwitch string - KVMNetwork string // Only used by the KVM driver - KVMQemuURI string // Only used by kvm2 - KVMGPU bool // Only used by kvm2 - KVMHidden bool // Only used by kvm2 - Downloader util.ISODownloader `json:"-"` - DockerOpt []string // Each entry is formatted as KEY=VALUE. - DisableDriverMounts bool // Only used by virtualbox - NFSShare []string - NFSSharesRoot string - UUID string // Only used by hyperkit to restore the mac address - NoVTXCheck bool // Only used by virtualbox - DNSProxy bool // Only used by virtualbox - HostDNSResolver bool // Only used by virtualbox - HostOnlyNicType string // Only used by virtualbox - NatNicType string // Only used by virtualbox - KubernetesConfig KubernetesConfig - Nodes []Node - Addons map[string]bool + Name string + KeepContext bool // used by start and profile command to or not to switch kubectl's current context + EmbedCerts bool // used by kubeconfig.Setup + MinikubeISO string + Memory int + CPUs int + DiskSize int + VMDriver string + HyperkitVpnKitSock string // Only used by the Hyperkit driver + HyperkitVSockPorts []string // Only used by the Hyperkit driver + DockerEnv []string // Each entry is formatted as KEY=VALUE. + InsecureRegistry []string + RegistryMirror []string + HostOnlyCIDR string // Only used by the virtualbox driver + HypervVirtualSwitch string + HypervUseExternalSwitch bool + HypervExternalAdapter string + KVMNetwork string // Only used by the KVM driver + KVMQemuURI string // Only used by kvm2 + KVMGPU bool // Only used by kvm2 + KVMHidden bool // Only used by kvm2 + Downloader util.ISODownloader `json:"-"` + DockerOpt []string // Each entry is formatted as KEY=VALUE. + DisableDriverMounts bool // Only used by virtualbox + NFSShare []string + NFSSharesRoot string + UUID string // Only used by hyperkit to restore the mac address + NoVTXCheck bool // Only used by virtualbox + DNSProxy bool // Only used by virtualbox + HostDNSResolver bool // Only used by virtualbox + HostOnlyNicType string // Only used by virtualbox + NatNicType string // Only used by virtualbox + KubernetesConfig KubernetesConfig + Nodes []Node + Addons map[string]bool } // KubernetesConfig contains the parameters used to configure the VM Kubernetes. diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index 72349d31c9..5fab19f816 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -27,90 +27,81 @@ import ( ) const ( + // DefaultKubernetesVersion is the default kubernetes version + DefaultKubernetesVersion = "v1.17.2" + // NewestKubernetesVersion is the newest Kubernetes version to test against + NewestKubernetesVersion = "v1.17.2" + // OldestKubernetesVersion is the oldest Kubernetes version to test against + OldestKubernetesVersion = "v1.11.10" + // DefaultMachineName is the default name for the VM + DefaultMachineName = "minikube" + // DefaultNodeName is the default name for the kubeadm node within the VM + DefaultNodeName = "minikube" + // DockerDaemonPort is the port Docker daemon listening inside a minikube node (vm or container). DockerDaemonPort = 2376 - // SSHPort is the SSH serviceport on the node vm and container - SSHPort = 22 // APIServerPort is the default API server port APIServerPort = 8443 + // SSHPort is the SSH serviceport on the node vm and container + SSHPort = 22 + // APIServerName is the default API server name APIServerName = "minikubeCA" // ClusterDNSDomain is the default DNS domain ClusterDNSDomain = "cluster.local" // DefaultServiceCIDR is The CIDR to be used for service cluster IPs DefaultServiceCIDR = "10.96.0.0/12" - // DockerTLSVerifyEnv is used for docker daemon settings - DockerTLSVerifyEnv = "DOCKER_TLS_VERIFY" + // DockerHostEnv is used for docker daemon settings DockerHostEnv = "DOCKER_HOST" // DockerCertPathEnv is used for docker daemon settings DockerCertPathEnv = "DOCKER_CERT_PATH" + // DockerTLSVerifyEnv is used for docker daemon settings + DockerTLSVerifyEnv = "DOCKER_TLS_VERIFY" // MinikubeActiveDockerdEnv holds the docker daemon which user's shell is pointing at // value would be profile or empty if pointing to the user's host daemon. - // DockerDaemonEnvs has list of environment variables to control docker daemon shell is using - MinikubeActiveDockerdEnv = "MINIKUBE_ACTIVE_DOCKERD" + // PodmanVarlinkBridgeEnv is used for podman settings + PodmanVarlinkBridgeEnv = "PODMAN_VARLINK_BRIDGE" ) -var DockerDaemonEnvs = [3]string{DockerHostEnv, DockerTLSVerifyEnv, DockerCertPathEnv} - -// DefaultMinipath is the default Minikube path (under the home directory) -var DefaultMinipath = filepath.Join(homedir.HomeDir(), ".minikube") - -// KubeconfigPath is the path to the Kubernetes client config -var KubeconfigPath = clientcmd.RecommendedHomeFile - -// KubeconfigEnvVar is the env var to check for the Kubernetes client config -var KubeconfigEnvVar = clientcmd.RecommendedConfigPathEnvVar - -// DefaultMachineName is the default name for the VM -const DefaultMachineName = "minikube" - -// DefaultNodeName is the default name for the kubeadm node within the VM -const DefaultNodeName = "minikube" - -// MountProcessFileName is the filename of the mount process -var MountProcessFileName = ".mount-process" - -const ( - // SHASuffix is the suffix of a SHA-256 checksum file - SHASuffix = ".sha256" -) - -// DefaultISOURL is the default location of the minikube.iso file -var DefaultISOURL = fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", minikubeVersion.GetISOPath(), minikubeVersion.GetISOVersion()) - -// DefaultISOSHAURL is the default location of the minikube.iso.sha256 file -var DefaultISOSHAURL = DefaultISOURL + SHASuffix - -// DefaultKubernetesVersion is the default kubernetes version -var DefaultKubernetesVersion = "v1.17.2" - -// NewestKubernetesVersion is the newest Kubernetes version to test against -var NewestKubernetesVersion = "v1.17.2" - -// OldestKubernetesVersion is the oldest Kubernetes version to test against -var OldestKubernetesVersion = "v1.11.10" - -const ( +var ( // IsMinikubeChildProcess is the name of "is minikube child process" variable IsMinikubeChildProcess = "IS_MINIKUBE_CHILD_PROCESS" -) - -// ImageRepositories contains all known image repositories -var ImageRepositories = map[string][]string{ - "global": {""}, - "cn": {"registry.cn-hangzhou.aliyuncs.com/google_containers"}, -} - -// KubernetesReleaseBinaries are Kubernetes release binaries required for -// kubeadm (kubelet, kubeadm) and the addon manager (kubectl) -var KubernetesReleaseBinaries = []string{"kubelet", "kubeadm", "kubectl"} - -// ImageCacheDir is the path to the image cache directory -var ImageCacheDir = localpath.MakeMiniPath("cache", "images") - -const ( // GvisorConfigTomlTargetName is the go-bindata target name for the gvisor config.toml GvisorConfigTomlTargetName = "gvisor-config.toml" + // MountProcessFileName is the filename of the mount process + MountProcessFileName = ".mount-process" + // SHASuffix is the suffix of a SHA-256 checksum file + +) + +var ( + SHASuffix = ".sha256" + // DefaultISOURL is the default location of the minikube.iso file + DefaultISOURL = fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", minikubeVersion.GetISOPath(), minikubeVersion.GetISOVersion()) + // DefaultISOSHAURL is the default location of the minikube.iso.sha256 file + DefaultISOSHAURL = DefaultISOURL + SHASuffix + + // DockerDaemonEnvs is list of docker-daemon related environment variables. + DockerDaemonEnvs = [3]string{DockerHostEnv, DockerTLSVerifyEnv, DockerCertPathEnv} + + // DefaultMinipath is the default Minikube path (under the home directory) + DefaultMinipath = filepath.Join(homedir.HomeDir(), ".minikube") + // KubeconfigEnvVar is the env var to check for the Kubernetes client config + + KubeconfigEnvVar = clientcmd.RecommendedConfigPathEnvVar + // KubeconfigPath is the path to the Kubernetes client config + KubeconfigPath = clientcmd.RecommendedHomeFile + // ImageRepositories contains all known image repositories + + ImageRepositories = map[string][]string{ + "global": {""}, + "cn": {"registry.cn-hangzhou.aliyuncs.com/google_containers"}, + } + // KubernetesReleaseBinaries are Kubernetes release binaries required for + // kubeadm (kubelet, kubeadm) and the addon manager (kubectl) + KubernetesReleaseBinaries = []string{"kubelet", "kubeadm", "kubectl"} + // ImageCacheDir is the path to the image cache directory + ImageCacheDir = localpath.MakeMiniPath("cache", "images") ) diff --git a/pkg/minikube/driver/driver.go b/pkg/minikube/driver/driver.go index c00e7adb31..9791b0ab8b 100644 --- a/pkg/minikube/driver/driver.go +++ b/pkg/minikube/driver/driver.go @@ -28,6 +28,8 @@ import ( ) const ( + // Podman is Kubernetes in container using podman driver + Podman = "podman" // Docker is Kubernetes in container using docker driver Docker = "docker" // Mock driver @@ -85,7 +87,7 @@ func Supported(name string) bool { // IsKIC checks if the driver is a kubernetes in continer func IsKIC(name string) bool { - return name == Docker + return name == Docker || name == Podman } // IsMock checks if the driver is a mock @@ -106,6 +108,16 @@ func BareMetal(name string) bool { return name == None || name == Mock } +// NeedsRoot returns true if driver needs to run with root privileges +func NeedsRoot(name string) bool { + return name == None || name == Podman +} + +// HasResourceLimits returns true if driver can set resource limits such as memory size or CPU count. +func HasResourceLimits(name string) bool { + return name == None || name == Podman +} + // FlagHints are hints for what default options should be used for this driver type FlagHints struct { ExtraOptions []string diff --git a/pkg/minikube/driver/driver_darwin.go b/pkg/minikube/driver/driver_darwin.go index 4310aab742..f951177677 100644 --- a/pkg/minikube/driver/driver_darwin.go +++ b/pkg/minikube/driver/driver_darwin.go @@ -26,6 +26,7 @@ var supportedDrivers = []string{ HyperKit, VMware, Docker, + Podman, } func VBoxManagePath() string { diff --git a/pkg/minikube/driver/driver_linux.go b/pkg/minikube/driver/driver_linux.go index 7eb79539bf..dea2a80e18 100644 --- a/pkg/minikube/driver/driver_linux.go +++ b/pkg/minikube/driver/driver_linux.go @@ -29,6 +29,7 @@ var supportedDrivers = []string{ VMware, None, Docker, + Podman, } // VBoxManagePath returns the path to the VBoxManage command diff --git a/pkg/minikube/image/cache.go b/pkg/minikube/image/cache.go index 3a29e0ba8d..69eaf5b5e0 100644 --- a/pkg/minikube/image/cache.go +++ b/pkg/minikube/image/cache.go @@ -139,7 +139,7 @@ func saveToTarFile(iname, rawDest string) error { if err != nil { return errors.Wrap(err, "newtag") } - err = tarball.Write(tag, img, &tarball.WriteOptions{}, f) + err = tarball.Write(tag, img, f) if err != nil { return errors.Wrap(err, "write") } diff --git a/pkg/minikube/image/image.go b/pkg/minikube/image/image.go index 553105e87f..5a61f840e4 100644 --- a/pkg/minikube/image/image.go +++ b/pkg/minikube/image/image.go @@ -39,7 +39,7 @@ func DigestByDockerLib(imgClient *client.Client, imgName string) string { ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() img, _, err := imgClient.ImageInspectWithRaw(ctx, imgName) - if err != nil && !client.IsErrImageNotFound(err) { + if err != nil && !client.IsErrNotFound(err) { glog.Infof("couldn't find image digest %s from local daemon: %v ", imgName, err) return "" } diff --git a/pkg/minikube/machine/cache_binaries.go b/pkg/minikube/machine/cache_binaries.go index 86102647ff..e075f8d08c 100644 --- a/pkg/minikube/machine/cache_binaries.go +++ b/pkg/minikube/machine/cache_binaries.go @@ -63,7 +63,7 @@ func KubernetesReleaseURLSHA1(binaryName, version, osName, archName string) stri // CacheBinary will cache a binary on the host func CacheBinary(binary, version, osName, archName string) (string, error) { - targetDir := localpath.MakeMiniPath("cache", version) + targetDir := localpath.MakeMiniPath("cache", osName, version) targetFilepath := path.Join(targetDir, binary) url := KubernetesReleaseURL(binary, version, osName, archName) diff --git a/pkg/minikube/machine/cache_binaries_test.go b/pkg/minikube/machine/cache_binaries_test.go index 098483ce51..a0ad859662 100644 --- a/pkg/minikube/machine/cache_binaries_test.go +++ b/pkg/minikube/machine/cache_binaries_test.go @@ -83,22 +83,36 @@ func TestCopyBinary(t *testing.T) { } func TestCacheBinariesForBootstrapper(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 os.RemoveAll(minikubeHome) + var tc = []struct { version, clusterBootstrapper string + minikubeHome string err bool }{ { version: "v1.16.0", clusterBootstrapper: bootstrapper.Kubeadm, + err: false, + minikubeHome: minikubeHome, }, { version: "invalid version", clusterBootstrapper: bootstrapper.Kubeadm, err: true, + minikubeHome: minikubeHome, }, } for _, test := range tc { t.Run(test.version, func(t *testing.T) { + os.Setenv("MINIKUBE_HOME", test.minikubeHome) err := CacheBinariesForBootstrapper(test.version, test.clusterBootstrapper) if err != nil && !test.err { t.Fatalf("Got unexpected error %v", err) diff --git a/pkg/minikube/machine/cache_images.go b/pkg/minikube/machine/cache_images.go index 21f8850310..3e426a90c8 100644 --- a/pkg/minikube/machine/cache_images.go +++ b/pkg/minikube/machine/cache_images.go @@ -76,7 +76,7 @@ func LoadImages(cc *config.MachineConfig, runner command.Runner, images []string return errors.Wrap(err, "runtime") } - imgClient, err := client.NewEnvClient() // image client + imgClient, err := client.NewClientWithOpts(client.FromEnv) // image client if err != nil { glog.Infof("couldn't get a local image daemon which might be ok: %v", err) imgClient = nil diff --git a/pkg/minikube/machine/client.go b/pkg/minikube/machine/client.go index ba79fe4745..0121c92358 100644 --- a/pkg/minikube/machine/client.go +++ b/pkg/minikube/machine/client.go @@ -154,8 +154,9 @@ func CommandRunner(h *host.Host) (command.Runner, error) { if driver.BareMetal(h.Driver.DriverName()) { return command.NewExecRunner(), nil } - if h.Driver.DriverName() == driver.Docker { - return command.NewKICRunner(h.Name, "docker"), nil + + if driver.IsKIC(h.Driver.DriverName()) { + return command.NewKICRunner(h.Name, h.Driver.DriverName()), nil } client, err := sshutil.NewSSHClient(h.Driver) if err != nil { diff --git a/pkg/minikube/registry/drvs/docker/docker.go b/pkg/minikube/registry/drvs/docker/docker.go index 0d912150de..38cc95acb7 100644 --- a/pkg/minikube/registry/drvs/docker/docker.go +++ b/pkg/minikube/registry/drvs/docker/docker.go @@ -43,7 +43,7 @@ func init() { } } -func configure(mc config.MachineConfig) interface{} { +func configure(mc config.MachineConfig) (interface{}, error) { return kic.NewDriver(kic.Config{ MachineName: mc.Name, StorePath: localpath.MiniPath(), @@ -52,22 +52,22 @@ func configure(mc config.MachineConfig) interface{} { Memory: mc.Memory, OCIBinary: oci.Docker, APIServerPort: mc.Nodes[0].Port, - }) - + }), nil } func status() registry.State { - _, err := exec.LookPath("docker") + _, err := exec.LookPath(oci.Docker) if err != nil { - return registry.State{Error: err, Installed: false, Healthy: false, Fix: "Docker is required.", Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/kic/"} + return registry.State{Error: err, Installed: false, Healthy: false, Fix: "Docker is required.", Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/docker/"} } - // Allow no more than 2 seconds for querying state - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + + // Allow no more than 3 seconds for docker info + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() - err = exec.CommandContext(ctx, "docker", "info").Run() + err = exec.CommandContext(ctx, oci.Docker, "info").Run() if err != nil { - return registry.State{Error: err, Installed: true, Healthy: false, Fix: "Docker is not running. Try: restarting docker desktop."} + return registry.State{Error: err, Installed: true, Healthy: false, Fix: "Docker is not running or is responding too slow. Try: restarting docker desktop."} } return registry.State{Installed: true, Healthy: true} diff --git a/pkg/minikube/registry/drvs/hyperkit/hyperkit.go b/pkg/minikube/registry/drvs/hyperkit/hyperkit.go index cc544488f6..50a4e5a408 100644 --- a/pkg/minikube/registry/drvs/hyperkit/hyperkit.go +++ b/pkg/minikube/registry/drvs/hyperkit/hyperkit.go @@ -57,7 +57,7 @@ func init() { } } -func configure(config cfg.MachineConfig) interface{} { +func configure(config cfg.MachineConfig) (interface{}, error) { u := config.UUID if u == "" { u = uuid.NewUUID().String() @@ -79,7 +79,7 @@ func configure(config cfg.MachineConfig) interface{} { VpnKitSock: config.HyperkitVpnKitSock, VSockPorts: config.HyperkitVSockPorts, Cmdline: "loglevel=3 console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes random.trust_cpu=on hw_rng_model=virtio base host=" + config.Name, - } + }, nil } func status() registry.State { diff --git a/pkg/minikube/registry/drvs/hyperv/hyperv.go b/pkg/minikube/registry/drvs/hyperv/hyperv.go index 877c81555d..9f15d0c470 100644 --- a/pkg/minikube/registry/drvs/hyperv/hyperv.go +++ b/pkg/minikube/registry/drvs/hyperv/hyperv.go @@ -27,6 +27,7 @@ import ( "github.com/docker/machine/drivers/hyperv" "github.com/docker/machine/libmachine/drivers" + "github.com/pkg/errors" cfg "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/driver" @@ -35,7 +36,8 @@ import ( ) const ( - docURL = "https://minikube.sigs.k8s.io/docs/reference/drivers/hyperv/" + docURL = "https://minikube.sigs.k8s.io/docs/reference/drivers/hyperv/" + defaultExternalSwitchName = "minikube" ) func init() { @@ -50,16 +52,31 @@ func init() { } } -func configure(config cfg.MachineConfig) interface{} { +func configure(config cfg.MachineConfig) (interface{}, error) { d := hyperv.NewDriver(config.Name, localpath.MiniPath()) d.Boot2DockerURL = config.Downloader.GetISOFileURI(config.MinikubeISO) d.VSwitch = config.HypervVirtualSwitch + if d.VSwitch == "" && config.HypervUseExternalSwitch { + switchName, adapter, err := chooseSwitch(config.HypervExternalAdapter) + if err != nil { + return nil, errors.Wrapf(err, "failed to choose switch for Hyper-V driver") + } + if config.HypervExternalAdapter == "" && switchName == "" { + // create a switch on the returned adapter + switchName = defaultExternalSwitchName + err := createVMSwitch(switchName, adapter) + if err != nil { + return "", err + } + } + d.VSwitch = switchName + } d.MemSize = config.Memory d.CPU = config.CPUs d.DiskSize = config.DiskSize d.SSHUser = "docker" d.DisableDynamicMemory = true // default to disable dynamic memory as minikube is unlikely to work properly with dynamic memory - return d + return d, nil } func status() registry.State { diff --git a/pkg/minikube/registry/drvs/hyperv/powershell.go b/pkg/minikube/registry/drvs/hyperv/powershell.go new file mode 100644 index 0000000000..d93dfc2a05 --- /dev/null +++ b/pkg/minikube/registry/drvs/hyperv/powershell.go @@ -0,0 +1,64 @@ +// +build windows + +/* +Copyright 2018 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 hyperv + +import ( + "bufio" + "bytes" + "os/exec" + "strings" + + "github.com/golang/glog" +) + +var powershell string + +func init() { + powershell, _ = exec.LookPath("powershell") +} + +func cmdOut(args ...string) (string, error) { + args = append([]string{"-NoProfile", "-NonInteractive"}, args...) + cmd := exec.Command(powershell, args...) + glog.Infof("[executing ==>] : %v %v", powershell, strings.Join(args, " ")) + var stdout bytes.Buffer + var stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + err := cmd.Run() + glog.Infof("[stdout =====>] : %s", stdout.String()) + glog.Infof("[stderr =====>] : %s", stderr.String()) + return stdout.String(), err +} + +func cmd(args ...string) error { + _, err := cmdOut(args...) + return err +} + +func parseLines(stdout string) []string { + var resp []string + + s := bufio.NewScanner(strings.NewReader(stdout)) + for s.Scan() { + resp = append(resp, s.Text()) + } + + return resp +} diff --git a/pkg/minikube/registry/drvs/hyperv/vswitch.go b/pkg/minikube/registry/drvs/hyperv/vswitch.go new file mode 100644 index 0000000000..012b169025 --- /dev/null +++ b/pkg/minikube/registry/drvs/hyperv/vswitch.go @@ -0,0 +1,202 @@ +// +build windows + +/* +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 hyperv + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/pkg/errors" +) + +type netAdapter struct { + InterfaceGUID string `json:"interfaceGuid"` + InterfaceDescription string +} + +type vmSwitch struct { + Name string + NetAdapterInterfaceGuid []string +} + +// returns network adapters matching to the given filtering condition +func getNetAdapters(physical bool, condition string) ([]netAdapter, error) { + cmdlet := []string{"Get-NetAdapter"} + if physical { + cmdlet = append(cmdlet, "-Physical") + } + cmd := []string{strings.Join(cmdlet, " ")} + if condition != "" { + cmd = append(cmd, fmt.Sprintf("Where-Object {%s}", condition)) + } + cmd = append(cmd, "Select-Object -Property InterfaceGuid, InterfaceDescription") + stdout, err := cmdOut(fmt.Sprintf("ConvertTo-Json @(%s)", strings.Join(cmd, " | "))) + if err != nil { + return nil, err + } + + var adapters []netAdapter + err = json.Unmarshal([]byte(strings.TrimSpace(stdout)), &adapters) + if err != nil { + return nil, err + } + + return adapters, nil +} + +// returns Hyper-V switches matching to the given filtering condition +func getVMSwitch(condition string) ([]vmSwitch, error) { + cmd := []string{"Hyper-V\\Get-VMSwitch"} + if condition != "" { + cmd = append(cmd, fmt.Sprintf("Where-Object {%s}", condition)) + } + cmd = append(cmd, "Select-Object -Property Name, NetAdapterInterfaceGuid") + stdout, err := cmdOut(fmt.Sprintf("ConvertTo-Json @(%s)", strings.Join(cmd, " | "))) + if err != nil { + return nil, err + } + + var vmSwitches []vmSwitch + err = json.Unmarshal([]byte(strings.TrimSpace(stdout)), &vmSwitches) + if err != nil { + return nil, err + } + + return vmSwitches, nil +} + +// returns Hyper-V switches which connects to the adapter of the given GUID +func findConnectedVMSwitch(adapterGUID string) (string, error) { + foundSwitches, err := getVMSwitch(fmt.Sprintf("($_.SwitchType -eq 2) -And ($_.NetAdapterInterfaceGuid -contains \"%s\")", adapterGUID)) + if err != nil { + return "", err + } + + if len(foundSwitches) > 0 { + return foundSwitches[0].Name, nil + } + + return "", nil +} + +// returns "up" net adapters in the order Physical LAN adapters then other adapters +func getOrderedAdapters() ([]netAdapter, error) { + // look for "Up" adapters and prefer physical LAN over other options + lanAdapters, err := getNetAdapters(true, "($_.Status -eq \"Up\") -And ($_.PhysicalMediaType -like \"*802.3*\")") + if err != nil { + return nil, err + } + + upAdapters, err := getNetAdapters(true, "$_.Status -eq \"Up\"") + if err != nil { + return nil, err + } + + var orderedAdapters []netAdapter + adapterGuids := map[string]interface{}{} + + // all adapters will be checked in the following order: + // 1. Connected physical LAN adapters + // 2. Any other connected adapters + for _, adapter := range lanAdapters { + if _, ok := adapterGuids[adapter.InterfaceGUID]; !ok { + adapterGuids[adapter.InterfaceGUID] = nil + orderedAdapters = append(orderedAdapters, adapter) + } + } + + for _, adapter := range upAdapters { + if _, ok := adapterGuids[adapter.InterfaceGUID]; !ok { + adapterGuids[adapter.InterfaceGUID] = nil + orderedAdapters = append(orderedAdapters, adapter) + } + } + + return orderedAdapters, nil +} + +// create a new VM switch of the given name and network adapter +func createVMSwitch(switchName string, adapter netAdapter) error { + err := cmd(fmt.Sprintf("Hyper-V\\New-VMSwitch -Name \"%s\" -NetAdapterInterfaceDescription \"%s\"", switchName, adapter.InterfaceDescription)) + if err != nil { + return errors.Wrapf(err, "failed to create VM switch %s with adapter %s", switchName, adapter.InterfaceGUID) + } + + return nil +} + +// choose VM switch connected to an adapter. If adapter name is not specified, +// it tries to use an "up" LAN adapter then other adapters for external network +func chooseSwitch(adapterName string) (string, netAdapter, error) { + var adapter netAdapter + if adapterName != "" { + foundAdapters, err := getNetAdapters(false, fmt.Sprintf("($_.InterfaceDescription -eq \"%s\")", adapterName)) + if err != nil { + return "", netAdapter{}, err + } + + if len(foundAdapters) == 0 { + return "", netAdapter{}, errors.Errorf("adapter %s not found", adapterName) + } + + adapter = foundAdapters[0] + foundSwitch, err := findConnectedVMSwitch(adapter.InterfaceGUID) + return foundSwitch, adapter, err + } + + adapters, err := getOrderedAdapters() + if err != nil { + return "", netAdapter{}, err + } + + if len(adapters) == 0 { + return "", netAdapter{}, errors.Errorf("no connected adapter available") + } + + externalVMSwitches, err := getVMSwitch("($_.SwitchType -eq 2)") + if err != nil { + return "", netAdapter{}, errors.Wrapf(err, "failed to list external VM switches") + } + + if len(externalVMSwitches) > 0 { + // it doesn't seem like Windows allows one VM switch for each adapter + adapterSwitches := map[string][]string{} + for _, vmSwitch := range externalVMSwitches { + for _, connectedAdapter := range vmSwitch.NetAdapterInterfaceGuid { + var switches []string + key := strings.ToUpper(fmt.Sprintf("{%s}", connectedAdapter)) + if _, ok := adapterSwitches[key]; ok { + switches = adapterSwitches[key] + } + switches = append(switches, vmSwitch.Name) + adapterSwitches[key] = switches + } + } + + for _, adapter := range adapters { + if switches, ok := adapterSwitches[adapter.InterfaceGUID]; ok && len(switches) > 0 { + return switches[0], adapter, nil + } + } + } + + adapter = adapters[0] + return "", adapter, nil +} diff --git a/pkg/minikube/registry/drvs/init.go b/pkg/minikube/registry/drvs/init.go index e585c4b5d5..bca12775c3 100644 --- a/pkg/minikube/registry/drvs/init.go +++ b/pkg/minikube/registry/drvs/init.go @@ -24,6 +24,7 @@ import ( _ "k8s.io/minikube/pkg/minikube/registry/drvs/kvm2" _ "k8s.io/minikube/pkg/minikube/registry/drvs/none" _ "k8s.io/minikube/pkg/minikube/registry/drvs/parallels" + _ "k8s.io/minikube/pkg/minikube/registry/drvs/podman" _ "k8s.io/minikube/pkg/minikube/registry/drvs/virtualbox" _ "k8s.io/minikube/pkg/minikube/registry/drvs/vmware" _ "k8s.io/minikube/pkg/minikube/registry/drvs/vmwarefusion" diff --git a/pkg/minikube/registry/drvs/kvm2/kvm2.go b/pkg/minikube/registry/drvs/kvm2/kvm2.go index 52c5766b2d..dedad73bfb 100644 --- a/pkg/minikube/registry/drvs/kvm2/kvm2.go +++ b/pkg/minikube/registry/drvs/kvm2/kvm2.go @@ -67,7 +67,7 @@ type kvmDriver struct { ConnectionURI string } -func configure(mc config.MachineConfig) interface{} { +func configure(mc config.MachineConfig) (interface{}, error) { name := mc.Name return kvmDriver{ BaseDriver: &drivers.BaseDriver{ @@ -86,7 +86,7 @@ func configure(mc config.MachineConfig) interface{} { GPU: mc.KVMGPU, Hidden: mc.KVMHidden, ConnectionURI: mc.KVMQemuURI, - } + }, nil } // defaultURI returns the QEMU URI to connect to for health checks diff --git a/pkg/minikube/registry/drvs/none/none.go b/pkg/minikube/registry/drvs/none/none.go index 371663d7d8..aa8523cab6 100644 --- a/pkg/minikube/registry/drvs/none/none.go +++ b/pkg/minikube/registry/drvs/none/none.go @@ -42,12 +42,12 @@ func init() { } } -func configure(mc config.MachineConfig) interface{} { +func configure(mc config.MachineConfig) (interface{}, error) { return none.NewDriver(none.Config{ MachineName: mc.Name, StorePath: localpath.MiniPath(), ContainerRuntime: mc.KubernetesConfig.ContainerRuntime, - }) + }), nil } func status() registry.State { diff --git a/pkg/minikube/registry/drvs/parallels/parallels.go b/pkg/minikube/registry/drvs/parallels/parallels.go index 63c769376c..de319ec8fb 100644 --- a/pkg/minikube/registry/drvs/parallels/parallels.go +++ b/pkg/minikube/registry/drvs/parallels/parallels.go @@ -44,13 +44,13 @@ func init() { } -func configure(config cfg.MachineConfig) interface{} { +func configure(config cfg.MachineConfig) (interface{}, error) { d := parallels.NewDriver(config.Name, localpath.MiniPath()).(*parallels.Driver) d.Boot2DockerURL = config.Downloader.GetISOFileURI(config.MinikubeISO) d.Memory = config.Memory d.CPU = config.CPUs d.DiskSize = config.DiskSize - return d + return d, nil } func status() registry.State { diff --git a/pkg/minikube/registry/drvs/podman/podman.go b/pkg/minikube/registry/drvs/podman/podman.go new file mode 100644 index 0000000000..a8e19dbbc0 --- /dev/null +++ b/pkg/minikube/registry/drvs/podman/podman.go @@ -0,0 +1,98 @@ +/* +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 podman + +import ( + "context" + "fmt" + "os/exec" + "strings" + "time" + + "github.com/blang/semver" + "github.com/docker/machine/libmachine/drivers" + "github.com/golang/glog" + "k8s.io/minikube/pkg/drivers/kic" + "k8s.io/minikube/pkg/drivers/kic/oci" + "k8s.io/minikube/pkg/minikube/config" + "k8s.io/minikube/pkg/minikube/driver" + "k8s.io/minikube/pkg/minikube/localpath" + "k8s.io/minikube/pkg/minikube/registry" +) + +// minReqPodmanVer is required the mininum version of podman to be installed for podman driver. +var minReqPodmanVer = semver.Version{Major: 1, Minor: 7, Patch: 0} + +func init() { + if err := registry.Register(registry.DriverDef{ + Name: driver.Podman, + Config: configure, + Init: func() drivers.Driver { return kic.NewDriver(kic.Config{OCIBinary: oci.Podman}) }, + Status: status, + Priority: registry.Experimental, + }); err != nil { + panic(fmt.Sprintf("register failed: %v", err)) + } +} + +func configure(mc config.MachineConfig) (interface{}, error) { + return kic.NewDriver(kic.Config{ + MachineName: mc.Name, + StorePath: localpath.MiniPath(), + ImageDigest: strings.Split(kic.BaseImage, "@")[0], // for podman does not support docker images references with both a tag and digest. + CPU: mc.CPUs, + Memory: mc.Memory, + OCIBinary: oci.Podman, + APIServerPort: mc.Nodes[0].Port, + }), nil +} + +func status() registry.State { + _, err := exec.LookPath(oci.Podman) + if err != nil { + return registry.State{Error: err, Installed: false, Healthy: false, Fix: "Podman is required.", Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/podman/"} + } + + // Allow no more than 2 seconds for version command + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + + cmd := exec.CommandContext(ctx, oci.Podman, "version", "-f", "{{.Version}}") + o, err := cmd.CombinedOutput() + output := string(o) + if err != nil { + return registry.State{Error: err, Installed: true, Healthy: false, Fix: "Cant verify mininim required version for podman . See podman website for installation guide.", Doc: "https://podman.io/getting-started/installation.html"} + } + + v, err := semver.Make(output) + if err != nil { + return registry.State{Error: err, Installed: true, Healthy: false, Fix: "Cant verify mininim required version for podman . See podman website for installation guide.", Doc: "https://podman.io/getting-started/installation.html"} + } + + if v.LT(minReqPodmanVer) { + glog.Warningf("Warning ! mininim required version for podman is %s. your version is %q. minikube might not work. use at your own risk. To install latest version please see https://podman.io/getting-started/installation.html ", minReqPodmanVer.String(), v.String()) + } + // Allow no more than 3 seconds for querying state + ctx, cancel = context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + err = exec.CommandContext(ctx, oci.Podman, "info").Run() + if err != nil { + return registry.State{Error: err, Installed: true, Healthy: false, Fix: "Podman is not running or taking too long to respond. Try: restarting podman."} + } + + return registry.State{Installed: true, Healthy: true} +} diff --git a/pkg/minikube/registry/drvs/virtualbox/virtualbox.go b/pkg/minikube/registry/drvs/virtualbox/virtualbox.go index 60931a38f7..bfba0e42db 100644 --- a/pkg/minikube/registry/drvs/virtualbox/virtualbox.go +++ b/pkg/minikube/registry/drvs/virtualbox/virtualbox.go @@ -49,7 +49,7 @@ func init() { } } -func configure(mc config.MachineConfig) interface{} { +func configure(mc config.MachineConfig) (interface{}, error) { d := virtualbox.NewDriver(mc.Name, localpath.MiniPath()) d.Boot2DockerURL = mc.Downloader.GetISOFileURI(mc.MinikubeISO) d.Memory = mc.Memory @@ -62,7 +62,7 @@ func configure(mc config.MachineConfig) interface{} { d.HostOnlyNicType = mc.HostOnlyNicType d.DNSProxy = mc.DNSProxy d.HostDNSResolver = mc.HostDNSResolver - return d + return d, nil } func status() registry.State { diff --git a/pkg/minikube/registry/drvs/vmware/vmware.go b/pkg/minikube/registry/drvs/vmware/vmware.go index 318a73c80b..885063cde2 100644 --- a/pkg/minikube/registry/drvs/vmware/vmware.go +++ b/pkg/minikube/registry/drvs/vmware/vmware.go @@ -39,7 +39,7 @@ func init() { } } -func configure(mc config.MachineConfig) interface{} { +func configure(mc config.MachineConfig) (interface{}, error) { d := vmwcfg.NewConfig(mc.Name, localpath.MiniPath()) d.Boot2DockerURL = mc.Downloader.GetISOFileURI(mc.MinikubeISO) d.Memory = mc.Memory @@ -49,7 +49,7 @@ func configure(mc config.MachineConfig) interface{} { // TODO(frapposelli): push these defaults upstream to fixup this driver d.SSHPort = 22 d.ISO = d.ResolveStorePath("boot2docker.iso") - return d + return d, nil } func status() registry.State { diff --git a/pkg/minikube/registry/drvs/vmwarefusion/vmwarefusion.go b/pkg/minikube/registry/drvs/vmwarefusion/vmwarefusion.go index 6fd6972e1e..bb5ed4196b 100644 --- a/pkg/minikube/registry/drvs/vmwarefusion/vmwarefusion.go +++ b/pkg/minikube/registry/drvs/vmwarefusion/vmwarefusion.go @@ -44,7 +44,7 @@ func init() { } } -func configure(config cfg.MachineConfig) interface{} { +func configure(config cfg.MachineConfig) (interface{}, error) { d := vmwarefusion.NewDriver(config.Name, localpath.MiniPath()).(*vmwarefusion.Driver) d.Boot2DockerURL = config.Downloader.GetISOFileURI(config.MinikubeISO) d.Memory = config.Memory @@ -54,7 +54,7 @@ func configure(config cfg.MachineConfig) interface{} { // TODO(philips): push these defaults upstream to fixup this driver d.SSHPort = 22 d.ISO = d.ResolveStorePath("boot2docker.iso") - return d + return d, nil } func status() registry.State { diff --git a/pkg/minikube/registry/registry.go b/pkg/minikube/registry/registry.go index a506a28aeb..159c7a4568 100644 --- a/pkg/minikube/registry/registry.go +++ b/pkg/minikube/registry/registry.go @@ -60,7 +60,7 @@ type Registry interface { } // Configurator emits a struct to be marshalled into JSON for Machine Driver -type Configurator func(config.MachineConfig) interface{} +type Configurator func(config.MachineConfig) (interface{}, error) // Loader is a function that loads a byte stream and creates a driver. type Loader func() drivers.Driver diff --git a/pkg/minikube/shell/shell.go b/pkg/minikube/shell/shell.go new file mode 100644 index 0000000000..9e61a03e90 --- /dev/null +++ b/pkg/minikube/shell/shell.go @@ -0,0 +1,192 @@ +/* +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. +*/ + +// Part of this code is heavily inspired/copied by the following file: +// github.com/docker/machine/commands/env.go + +package shell + +import ( + "fmt" + "io" + "strings" + "text/template" + + "github.com/docker/machine/libmachine/shell" +) + +const ( + fishSetPfx = "set -gx " + fishSetSfx = "\"\n" + fishSetDelim = " \"" + + fishUnsetPfx = "set -e " + fishUnsetSfx = "\n" + + psSetPfx = "$Env:" + psSetSfx = "\"\n" + psSetDelim = " = \"" + + psUnsetPfx = `Remove-Item Env:\\` + psUnsetSfx = "\n" + + cmdSetPfx = "SET " + cmdSetSfx = "\n" + cmdSetDelim = "=" + + cmdUnsetPfx = "SET " + cmdUnsetSfx = "\n" + cmdUnsetDelim = "=" + + emacsSetPfx = "(setenv \"" + emacsSetSfx = "\")\n" + emacsSetDelim = "\" \"" + + emacsUnsetPfx = "(setenv \"" + emacsUnsetSfx = ")\n" + emacsUnsetDelim = "\" nil" + + bashSetPfx = "export " + bashSetSfx = "\"\n" + bashSetDelim = "=\"" + + bashUnsetPfx = "unset " + bashUnsetSfx = "\n" + + nonePfx = "" + noneSfx = "\n" + noneDelim = "=" +) + +// Config represents the shell config +type Config struct { + Prefix string + Delimiter string + Suffix string + UsageHint string +} + +var ( + // ForceShell forces a shell name + ForceShell string +) + +// Detect detects user's current shell. +func Detect() (string, error) { + return shell.Detect() +} + +func generateUsageHint(sh, usgPlz, usgCmd string) string { + var usageHintMap = map[string]string{ + "bash": fmt.Sprintf(` +# %s +# eval $(%s) +`, usgPlz, usgCmd), + "fish": fmt.Sprintf(` +# %s +# eval (%s) +`, usgPlz, usgCmd), + "powershell": fmt.Sprintf(`# %s +# & %s | Invoke-Expression +`, usgPlz, usgCmd), + "cmd": fmt.Sprintf(`REM %s +REM @FOR /f "tokens=*" %%i IN ('%s') DO @%%i +`, usgPlz, usgCmd), + "emacs": fmt.Sprintf(`;; %s +;; (with-temp-buffer (shell-command "%s" (current-buffer)) (eval-buffer)) +`, usgPlz, usgCmd), + } + + hint, ok := usageHintMap[sh] + if !ok { + return usageHintMap["bash"] + } + return hint +} + +// CfgSet generates context variables for shell +func CfgSet(ec EnvConfig, plz, cmd string) *Config { + s := &Config{ + UsageHint: generateUsageHint(ec.Shell, plz, cmd), + } + + switch ec.Shell { + case "fish": + s.Prefix = fishSetPfx + s.Suffix = fishSetSfx + s.Delimiter = fishSetDelim + case "powershell": + s.Prefix = psSetPfx + s.Suffix = psSetSfx + s.Delimiter = psSetDelim + case "cmd": + s.Prefix = cmdSetPfx + s.Suffix = cmdSetSfx + s.Delimiter = cmdSetDelim + case "emacs": + s.Prefix = emacsSetPfx + s.Suffix = emacsSetSfx + s.Delimiter = emacsSetDelim + case "none": + s.Prefix = nonePfx + s.Suffix = noneSfx + s.Delimiter = noneDelim + s.UsageHint = "" + default: + s.Prefix = bashSetPfx + s.Suffix = bashSetSfx + s.Delimiter = bashSetDelim + } + return s +} + +// EnvConfig encapsulates all external inputs into shell generation +type EnvConfig struct { + Shell string +} + +// SetScript writes out a shell-compatible set script +func SetScript(ec EnvConfig, w io.Writer, envTmpl string, data interface{}) error { + tmpl := template.Must(template.New("envConfig").Parse(envTmpl)) + return tmpl.Execute(w, data) +} + +// UnsetScript writes out a shell-compatible unset script +func UnsetScript(ec EnvConfig, w io.Writer, vars []string) error { + var sb strings.Builder + switch ec.Shell { + case "fish": + for _, v := range vars { + sb.WriteString(fmt.Sprintf("%s%s%s", fishUnsetPfx, v, fishUnsetSfx)) + } + case "powershell": + sb.WriteString(fmt.Sprintf("%s%s%s", psUnsetPfx, strings.Join(vars, " Env:\\\\"), psUnsetSfx)) + case "cmd": + for _, v := range vars { + sb.WriteString(fmt.Sprintf("%s%s%s%s", cmdUnsetPfx, v, cmdUnsetDelim, cmdUnsetSfx)) + } + case "emacs": + for _, v := range vars { + sb.WriteString(fmt.Sprintf("%s%s%s%s", emacsUnsetPfx, v, emacsUnsetDelim, emacsUnsetSfx)) + } + case "none": + sb.WriteString(fmt.Sprintf("%s%s%s", nonePfx, strings.Join(vars, " "), noneSfx)) + default: + sb.WriteString(fmt.Sprintf("%s%s%s", bashUnsetPfx, strings.Join(vars, " "), bashUnsetSfx)) + } + _, err := w.Write([]byte(sb.String())) + return err +} diff --git a/pkg/minikube/tests/api_mock.go b/pkg/minikube/tests/api_mock.go index 976d3cdd0e..d0d0fdd17e 100644 --- a/pkg/minikube/tests/api_mock.go +++ b/pkg/minikube/tests/api_mock.go @@ -33,10 +33,11 @@ import ( // MockAPI is a struct used to mock out libmachine.API type MockAPI struct { FakeStore - CreateError bool - RemoveError bool - SaveCalled bool - t *testing.T + CreateError bool + RemoveError bool + NotExistError bool + SaveCalled bool + t *testing.T } // NewMockAPI returns a new MockAPI @@ -109,6 +110,12 @@ func (api *MockAPI) Create(h *host.Host) error { if ok { drv.T = api.t } + if api.NotExistError { + // initialize api.NotExistError + api.NotExistError = false + // reproduce ErrMachineNotExist + drv.NotExistError = true + } return h.Driver.Create() } diff --git a/pkg/minikube/tests/driver_mock.go b/pkg/minikube/tests/driver_mock.go index 1ed8c7d111..14d5b2f59d 100644 --- a/pkg/minikube/tests/driver_mock.go +++ b/pkg/minikube/tests/driver_mock.go @@ -29,12 +29,13 @@ import ( // MockDriver is a struct used to mock out libmachine.Driver type MockDriver struct { drivers.BaseDriver - CurrentState state.State - RemoveError bool - HostError bool - Port int - IP string - T *testing.T + CurrentState state.State + RemoveError bool + NotExistError bool + HostError bool + Port int + IP string + T *testing.T } // Logf logs mock interactions @@ -49,6 +50,11 @@ func (d *MockDriver) Logf(format string, args ...interface{}) { // Create creates a MockDriver instance func (d *MockDriver) Create() error { d.Logf("MockDriver.Create") + if d.NotExistError { + d.Logf("MockDriver.Create but machine does not exist") + d.CurrentState = state.Error + return nil + } d.CurrentState = state.Running return nil } @@ -91,6 +97,11 @@ func (d *MockDriver) GetSSHKeyPath() string { // GetState returns the state of the driver func (d *MockDriver) GetState() (state.State, error) { d.Logf("MockDriver.GetState: %v", d.CurrentState) + if d.NotExistError { + d.CurrentState = state.Error + // don't use cluster.ErrorMachineNotExist to avoid import cycle + return d.CurrentState, errors.New("machine does not exist") + } return d.CurrentState, nil } diff --git a/site/config.toml b/site/config.toml index 34c9169819..48f74bb609 100644 --- a/site/config.toml +++ b/site/config.toml @@ -95,7 +95,7 @@ weight = 1 [params] copyright = "The Kubernetes Authors -- " # The latest release of minikube -latest_release = "1.7.1" +latest_release = "1.7.2" privacy_policy = "" diff --git a/site/content/en/docs/Reference/Commands/pause.md b/site/content/en/docs/Reference/Commands/pause.md index c35ab6bfdd..5850a5617d 100644 --- a/site/content/en/docs/Reference/Commands/pause.md +++ b/site/content/en/docs/Reference/Commands/pause.md @@ -11,7 +11,7 @@ description: > The pause command allows you to freeze containers using the Linux [cgroup freezer](https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt). Once frozen, processes will no longer consume CPU cycles, but will remain in memory. -By default, the pause command will pause the Kubernetes control plane (kube-system namespace), leaving your applications running. This reduces the background CPU usage of a minikube cluster to a negligable 2-3% of a CPU. +By default, the pause command will pause the Kubernetes control plane (kube-system namespace), leaving your applications running. This reduces the background CPU usage of a minikube cluster to a negligible 2-3% of a CPU. ### Usage diff --git a/site/content/en/docs/Reference/Configuration/kubernetes.md b/site/content/en/docs/Reference/Configuration/kubernetes.md index 074fef1654..8781b3f710 100644 --- a/site/content/en/docs/Reference/Configuration/kubernetes.md +++ b/site/content/en/docs/Reference/Configuration/kubernetes.md @@ -25,7 +25,7 @@ minikube follows the [Kubernetes Version and Version Skew Support Policy](https: As of September 2019, this means that minikube supports and actively tests against the latest builds of: -* v1.16 (default +* v1.16 (default) * v1.15 * v1.14 * v1.13 diff --git a/site/content/en/docs/Tasks/podman_service.md b/site/content/en/docs/Tasks/podman_service.md new file mode 100644 index 0000000000..87a5e1b678 --- /dev/null +++ b/site/content/en/docs/Tasks/podman_service.md @@ -0,0 +1,34 @@ +--- +title: "Using the Podman service" +linkTitle: "Using the Podman service" +weight: 6 +date: 2020-01-20 +description: > + How to access the Podman service within minikube +--- + +## Prerequisites + +You should be using minikube with the container runtime set to CRI-O. It uses the same storage as Podman. + +## Method 1: Without minikube registry addon + +When using a single VM of Kubernetes it's really handy to reuse the Podman service inside the VM; as this means you don't have to build on your host machine and push the image into a container registry - you can just build inside the same container storage as minikube which speeds up local experiments. + +To be able to work with the podman client on your mac/linux host use the podman-env command in your shell: + +```shell +eval $(minikube podman-env) +``` + +You should now be able to use podman on the command line on your host mac/linux machine talking to the podman service inside the minikube VM: + +```shell +podman-remote help +``` + +Remember to turn off the _imagePullPolicy:Always_, as otherwise Kubernetes won't use images you built locally. + +## Related Documentation + +- [docker_registry.md](Using the Docker registry) diff --git a/test/integration/aaa_download_only_test.go b/test/integration/aaa_download_only_test.go index 3232ba1fce..d253cd7d8e 100644 --- a/test/integration/aaa_download_only_test.go +++ b/test/integration/aaa_download_only_test.go @@ -25,6 +25,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "testing" "time" @@ -83,12 +84,26 @@ func TestDownloadOnly(t *testing.T) { // checking binaries downloaded (kubelet,kubeadm) for _, bin := range constants.KubernetesReleaseBinaries { - fp := filepath.Join(localpath.MiniPath(), "cache", v, bin) + fp := filepath.Join(localpath.MiniPath(), "cache", "linux", v, bin) _, err := os.Stat(fp) if err != nil { t.Errorf("expected the file for binary exist at %q but got error %v", fp, err) } } + + // If we are on darwin/windows, check to make sure OS specific kubectl has been downloaded + // as well for the `minikube kubectl` command + if runtime.GOOS == "linux" { + return + } + binary := "kubectl" + if runtime.GOOS == "windows" { + binary = "kubectl.exe" + } + fp := filepath.Join(localpath.MiniPath(), "cache", runtime.GOOS, v, binary) + if _, err := os.Stat(fp); err != nil { + t.Errorf("expected the file for binary exist at %q but got error %v", fp, err) + } }) } diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index c3a83abe6e..b0053972d1 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -110,6 +110,7 @@ func TestFunctional(t *testing.T) { {"MySQL", validateMySQL}, {"FileSync", validateFileSync}, {"UpdateContextCmd", validateUpdateContextCmd}, + {"DockerEnv", validateDockerEnv}, } for _, tc := range tests { tc := tc @@ -121,6 +122,36 @@ func TestFunctional(t *testing.T) { }) } +// check functionality of minikube after evaling docker-env +func validateDockerEnv(ctx context.Context, t *testing.T, profile string) { + mctx, cancel := context.WithTimeout(ctx, 13*time.Second) + defer cancel() + // we should be able to get minikube status with a bash which evaled docker-env + c := exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" docker-env) && "+Target()+" status -p "+profile) + rr, err := Run(t, c) + if err != nil { + t.Fatalf("Failed to do minikube status after eval-ing docker-env %s", err) + } + if !strings.Contains(rr.Output(), "Running") { + t.Fatalf("Expected status output to include 'Running' after eval docker-env but got \n%s", rr.Output()) + } + + mctx, cancel = context.WithTimeout(ctx, 13*time.Second) + defer cancel() + // do a eval $(minikube -p profile docker-env) and check if we are point to docker inside minikube + c = exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" docker-env) && docker images") + rr, err = Run(t, c) + if err != nil { + t.Fatalf("Failed to test eval docker-evn %s", err) + } + + expectedImgInside := "gcr.io/k8s-minikube/storage-provisioner" + if !strings.Contains(rr.Output(), expectedImgInside) { + t.Fatalf("Expected 'docker ps' to have %q from docker-daemon inside minikube. the docker ps output is:\n%q\n", expectedImgInside, rr.Output()) + } + +} + func validateStartWithProxy(ctx context.Context, t *testing.T, profile string) { srv, err := startHTTPProxy(t) if err != nil { @@ -340,14 +371,14 @@ func validateCacheCmd(ctx context.Context, t *testing.T, profile string) { } t.Run("cache", func(t *testing.T) { t.Run("add", func(t *testing.T) { - for _, img := range []string{"busybox", "busybox:1.28.4-glibc", "k8s.gcr.io/pause:latest"} { + for _, img := range []string{"busybox:latest", "busybox:1.28.4-glibc", "k8s.gcr.io/pause:latest"} { _, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "add", img)) if err != nil { t.Errorf("Failed to cache image %q", img) } } }) - t.Run("delete busybox:1.28.4-glibc", func(t *testing.T) { + t.Run("delete_busybox:1.28.4-glibc", func(t *testing.T) { _, err := Run(t, exec.CommandContext(ctx, Target(), "cache", "delete", "busybox:1.28.4-glibc")) if err != nil { t.Errorf("failed to delete image busybox:1.28.4-glibc from cache: %v", err) @@ -367,7 +398,7 @@ func validateCacheCmd(ctx context.Context, t *testing.T, profile string) { } }) - t.Run("verify cache inside node", func(t *testing.T) { + t.Run("verify_cache_inside_node", func(t *testing.T) { rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "sudo", "crictl", "images")) if err != nil { t.Errorf("failed to get images by %q ssh %v", rr.Command(), err) @@ -378,7 +409,7 @@ func validateCacheCmd(ctx context.Context, t *testing.T, profile string) { }) - t.Run("cache reload", func(t *testing.T) { // deleting image inside minikube node manually and expecting reload to bring it back + t.Run("cache_reload", func(t *testing.T) { // deleting image inside minikube node manually and expecting reload to bring it back img := "busybox:latest" // deleting image inside minikube node manually rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "sudo", "docker", "rmi", img)) // for some reason crictl rmi doesn't work diff --git a/test/integration/guest_env_test.go b/test/integration/guest_env_test.go index 29bf60ab5f..8f57ac0ab6 100644 --- a/test/integration/guest_env_test.go +++ b/test/integration/guest_env_test.go @@ -24,6 +24,8 @@ import ( "os/exec" "testing" "time" + + "k8s.io/minikube/pkg/minikube/vmpath" ) func TestGuestEnvironment(t *testing.T) { @@ -59,7 +61,7 @@ func TestGuestEnvironment(t *testing.T) { "/var/lib/docker", "/var/lib/cni", "/var/lib/kubelet", - "/var/lib/minikube", + vmpath.GuestPersistentDir, "/var/lib/toolbox", "/var/lib/boot2docker", } { diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index a9a4d2a361..03fe3caa7c 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -154,12 +154,12 @@ func TestStartStop(t *testing.T) { t.Errorf("%s failed: %v", rr.Args, err) } - rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "config", "get-contexts")) + rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "config", "get-contexts", profile)) if err != nil { - t.Fatalf("%s failed: %v", rr.Args, err) + t.Logf("config context error: %v (may be ok)", err) } - if notDeleted := strings.Contains(rr.Output(), profile); notDeleted { - t.Errorf(" kubeconfig of %s is not deleted = %t; want = %t", profile, notDeleted, false) + if rr.ExitCode != 1 { + t.Errorf("wanted exit code 1, got %d. output: %s", rr.ExitCode, rr.Output()) } } })