Merge branch 'master' into DELETE_ALL_PROFILES

pull/4780/head
Marek Schwarz 2019-09-04 17:42:22 +02:00
commit 5b1528bdc9
29 changed files with 316 additions and 87 deletions

View File

@ -529,7 +529,7 @@ Huge thank you for this release towards our contributors:
* Updating e2e tests instructions [#3509](https://github.com/kubernetes/minikube/pull/3509)
* Defer dashboard deployment until "minikube dashboard" is executed [#3485](https://github.com/kubernetes/minikube/pull/3485)
* Change minikube-hostpath storage class addon from Reconcile to EnsureExists [#3497](https://github.com/kubernetes/minikube/pull/3497)
* Tell user given driver has been ignored if exising VM is different [#3374](https://github.com/kubernetes/minikube/pull/3374)
* Tell user given driver has been ignored if existing VM is different [#3374](https://github.com/kubernetes/minikube/pull/3374)
Thank you to all to everyone who contributed to this massive release:
@ -719,7 +719,7 @@ Huge Thank You for this release to our contributors:
## Version 0.28.1 - 7/16/2018
* vboxsf Host Mounting fixed (Linux Kernel version downgraded to 4.15 from 4.16) [#2986](https://github.com/kubernetes/minikube/pull/2986)
* cri-tools udpated to 1.11.1 [#2986](https://github.com/kubernetes/minikube/pull/2986)
* cri-tools updated to 1.11.1 [#2986](https://github.com/kubernetes/minikube/pull/2986)
* Feature Gates support added to kubeadm bootstrapper [#2951](https://github.com/kubernetes/minikube/pull/2951)
* Kubernetes 1.11 build support added [#2943](https://github.com/kubernetes/minikube/pull/2943)
* GPU support for kvm2 driver added [#2936](https://github.com/kubernetes/minikube/pull/2936)

View File

@ -14,10 +14,10 @@
# Bump these on release - and please check ISO_VERSION for correctness.
VERSION_MAJOR ?= 1
VERSION_MINOR ?= 3
VERSION_BUILD ?= 1
VERSION_MINOR ?= 4
VERSION_BUILD ?= 0-beta.0
# 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
ISO_VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).${VERSION_BUILD}
VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD)
DEB_VERSION ?= $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD)
@ -123,7 +123,7 @@ ifeq ($(IN_DOCKER),1)
endif
ifeq ($(GOOS),windows)
IS_EXE = ".exe"
IS_EXE = .exe
endif
@ -142,7 +142,7 @@ out/minikube-%: pkg/minikube/assets/assets.go pkg/minikube/translate/translation
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
$(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@)
else
GOOS="$(firstword $(subst -, ,$*))" GOARCH="$(lastword $(subst -, ,$*))" go build -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS)" -a -o $@ k8s.io/minikube/cmd/minikube
GOOS="$(firstword $(subst -, ,$*))" GOARCH="$(lastword $(subst -, ,$(subst $(IS_EXE), ,$*)))" go build -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS)" -a -o $@ k8s.io/minikube/cmd/minikube
endif
.PHONY: e2e-linux-amd64 e2e-darwin-amd64 e2e-windows-amd64.exe
@ -151,7 +151,7 @@ e2e-darwin-amd64: out/e2e-darwin-amd64
e2e-windows-amd64.exe: out/e2e-windows-amd64.exe
out/e2e-%: out/minikube-%
GOOS="$(firstword $(subst -, ,$*))" GOARCH="$(lastword $(subst -, ,$*))" go test -c k8s.io/minikube/test/integration --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS)" -o $@
GOOS="$(firstword $(subst -, ,$*))" GOARCH="$(lastword $(subst -, ,$(subst $(IS_EXE), ,$*)))" go test -c k8s.io/minikube/test/integration --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS)" -o $@
out/e2e-windows-amd64.exe: out/e2e-windows-amd64
cp $< $@
@ -179,7 +179,7 @@ linux-menuconfig:
$(MAKE) -C $(BUILD_DIR)/buildroot/output/build/linux-$(KERNEL_VERSION)/ savedefconfig
cp $(BUILD_DIR)/buildroot/output/build/linux-$(KERNEL_VERSION)/defconfig deploy/iso/minikube-iso/board/coreos/minikube/linux_defconfig
out/minikube.iso: $(shell find deploy/iso/minikube-iso -type f)
out/minikube.iso: $(shell find "deploy/iso/minikube-iso" -type f)
ifeq ($(IN_DOCKER),1)
$(MAKE) minikube_iso
else
@ -233,18 +233,26 @@ extract:
go run cmd/extract/extract.go
# Regenerates assets.go when template files have been updated
pkg/minikube/assets/assets.go: $(shell find deploy/addons -type f)
pkg/minikube/assets/assets.go: $(shell find "deploy/addons" -type f)
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
$(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@)
else ifeq ($(GOOS),windows)
which go-bindata || GO111MODULE=off GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...
PATH="$(PATH);$(GOPATH)/bin" go-bindata -nomemcopy -o $@ -pkg assets deploy/addons/...
-gofmt -s -w $@
else
which go-bindata || GO111MODULE=off GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...
PATH="$(PATH):$(GOPATH)/bin" go-bindata -nomemcopy -o $@ -pkg assets deploy/addons/...
-gofmt -s -w $@
endif
pkg/minikube/translate/translations.go: $(shell find translations/ -type f)
pkg/minikube/translate/translations.go: $(shell find "translations/" -type f)
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
$(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@)
else ifeq ($(GOOS),windows)
which go-bindata || GO111MODULE=off GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...
PATH="$(PATH);$(GOPATH)/bin" go-bindata -nomemcopy -o $@ -pkg translate translations/...
-gofmt -s -w $@
else
which go-bindata || GO111MODULE=off GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...
PATH="$(PATH):$(GOPATH)/bin" go-bindata -nomemcopy -o $@ -pkg translate translations/...
@ -333,7 +341,7 @@ reportcard:
mdlint:
@$(MARKDOWNLINT) $(MINIKUBE_MARKDOWN_FILES)
out/docs/minikube.md: $(shell find cmd) $(shell find pkg/minikube/constants) pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go
out/docs/minikube.md: $(shell find "cmd") $(shell find "pkg/minikube/constants") pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go
go run -ldflags="$(MINIKUBE_LDFLAGS)" -tags gendocs hack/help_text/gen_help_text.go
out/minikube_$(DEB_VERSION).deb: out/minikube-linux-amd64

1
OWNERS
View File

@ -6,6 +6,7 @@ reviewers:
- sharifelgamal
- RA489
- medyagh
- josedonizetti
approvers:
- tstromberg
- afbjorklund

View File

@ -97,5 +97,5 @@ var logsCmd = &cobra.Command{
func init() {
logsCmd.Flags().BoolVarP(&followLogs, "follow", "f", false, "Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.")
logsCmd.Flags().BoolVar(&showProblems, "problems", false, "Show only log entries which point to known problems")
logsCmd.Flags().IntVarP(&numberOfLines, "length", "n", 30, "Number of lines back to go within the log")
logsCmd.Flags().IntVarP(&numberOfLines, "length", "n", 60, "Number of lines back to go within the log")
}

View File

@ -37,7 +37,6 @@ import (
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/notify"
"k8s.io/minikube/pkg/minikube/translate"
)
@ -53,10 +52,6 @@ var dirs = [...]string{
constants.MakeMiniPath("logs"),
}
var (
enableUpdateNotification = true
)
var viperWhiteList = []string{
"v",
"alsologtostderr",
@ -92,10 +87,6 @@ var RootCmd = &cobra.Command{
exit.WithError("logdir set failed", err)
}
}
if enableUpdateNotification {
notify.MaybePrintUpdateTextFromGithub()
}
},
}

View File

@ -30,6 +30,8 @@ import (
"strings"
"time"
"k8s.io/minikube/pkg/minikube/notify"
"github.com/blang/semver"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
@ -107,13 +109,14 @@ const (
)
var (
registryMirror []string
dockerEnv []string
dockerOpt []string
insecureRegistry []string
apiServerNames []string
apiServerIPs []net.IP
extraOptions cfg.ExtraOptionSlice
registryMirror []string
dockerEnv []string
dockerOpt []string
insecureRegistry []string
apiServerNames []string
apiServerIPs []net.IP
extraOptions cfg.ExtraOptionSlice
enableUpdateNotification = true
)
func init() {
@ -216,6 +219,11 @@ var startCmd = &cobra.Command{
Short: "Starts a local kubernetes cluster",
Long: "Starts a local kubernetes cluster",
Run: runStart,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if enableUpdateNotification {
notify.MaybePrintUpdateTextFromGithub()
}
},
}
// platform generates a user-readable platform message
@ -253,6 +261,7 @@ func runStart(cmd *cobra.Command, args []string) {
prefix = fmt.Sprintf("[%s] ", viper.GetString(cfg.MachineProfile))
}
out.T(out.Happy, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version.GetVersion(), "platform": platform()})
displayEnviron(os.Environ())
// if --registry-mirror specified when run minikube start,
// take arg precedence over MINIKUBE_REGISTRY_MIRROR
@ -331,7 +340,18 @@ func runStart(cmd *cobra.Command, args []string) {
}
}
showKubectlConnectInfo(kubeconfig)
}
// displayEnviron makes the user aware of environment variables that will affect how minikube operates
func displayEnviron(env []string) {
for _, kv := range env {
bits := strings.SplitN(kv, "=", 2)
k := bits[0]
v := bits[1]
if strings.HasPrefix(k, "MINIKUBE_") || k == constants.KubeconfigEnvVar {
out.T(out.Option, "{{.key}}={{.value}}", out.V{"key": k, "value": v})
}
}
}
func setupKubeconfig(h *host.Host, c *cfg.Config) (*kubeconfig.Settings, error) {
@ -354,6 +374,7 @@ func setupKubeconfig(h *host.Host, c *cfg.Config) (*kubeconfig.Settings, error)
KeepContext: viper.GetBool(keepContext),
EmbedCerts: viper.GetBool(embedCerts),
}
kcs.SetPath(kubeconfig.PathFromEnv())
if err := kubeconfig.Update(kcs); err != nil {
return kcs, err
@ -957,18 +978,14 @@ func saveConfig(clusterCfg *cfg.Config) error {
}
func validateDriverVersion(vmDriver string) {
var (
driverExecutable string
driverDocumentation string
)
var driverExecutable string
driverDocumentation := fmt.Sprintf("%s%s#driver-installation", constants.DriverDocumentation, vmDriver)
switch vmDriver {
case constants.DriverKvm2:
driverExecutable = fmt.Sprintf("docker-machine-driver-%s", constants.DriverKvm2)
driverDocumentation = fmt.Sprintf("%s#%s", constants.DriverDocumentation, "kvm2-upgrade")
case constants.DriverHyperkit:
driverExecutable = fmt.Sprintf("docker-machine-driver-%s", constants.DriverHyperkit)
driverDocumentation = fmt.Sprintf("%s#%s", constants.DriverDocumentation, "hyperkit-upgrade")
default: // driver doesn't support version
return
}
@ -989,7 +1006,7 @@ func validateDriverVersion(vmDriver string) {
if len(v) == 0 && !viper.GetBool(force) {
exit.WithCodeT(
exit.Failure,
"Please upgrade the '{{.driver_executable}}'. {{.documentation_url}}",
"The installed version of '{{.driver_executable}}' is obsolete. Upgrade: {{.documentation_url}}",
out.V{"driver_executable": driverExecutable, "documentation_url": driverDocumentation},
)
}
@ -1008,8 +1025,8 @@ func validateDriverVersion(vmDriver string) {
if vmDriverVersion.LT(minikubeVersion) {
out.WarningT(
"There's a new version for '{{.driver_executable}}'. Please consider upgrading. {{.documentation_url}}",
out.V{"driver_executable": driverExecutable, "documentation_url": driverDocumentation},
"The installed version of '{{.driver_executable}}' ({{.driver_version}}) is no longer current. Upgrade: {{.documentation_url}}",
out.V{"driver_executable": driverExecutable, "driver_version": vmDriverVersion, "documentation_url": driverDocumentation},
)
}
}

1
go.mod
View File

@ -83,6 +83,7 @@ require (
)
replace (
git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999
k8s.io/api => k8s.io/kubernetes/staging/src/k8s.io/api v0.0.0-20190623232353-8c3b7d7679cc
k8s.io/apiextensions-apiserver => k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver v0.0.0-20190623232353-8c3b7d7679cc
k8s.io/apimachinery => k8s.io/kubernetes/staging/src/k8s.io/apimachinery v0.0.0-20190623232353-8c3b7d7679cc

2
go.sum
View File

@ -8,7 +8,7 @@ dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl
dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/Azure/azure-sdk-for-go v21.4.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=

View File

@ -126,7 +126,7 @@ Section "Install"
# Files added here should be removed by the uninstaller (see section "uninstall")
File "minikube.exe"
File "logo.ico"
File "update_path.ps1"
File "update_path.ps1"
# Add any other files for the install directory (license files, app data, etc) here
# Uninstaller - See function un.onInit and section "uninstall" for configuration
@ -173,7 +173,7 @@ Section "Uninstall"
RmDir /REBOOTOK "$SMPROGRAMS\${COMPANYNAME}"
# Remove uninstalled executable from PATH
nsExec::ExecToLog 'powershell -ExecutionPolicy Bypass -WindowStyle Hidden -File "$INSTDIR\update_path.ps1" -Remove -Path "$INSTDIR"' ; appends to the system path
nsExec::ExecToLog 'powershell -ExecutionPolicy Bypass -WindowStyle Hidden -File "$INSTDIR\update_path.ps1" -Remove -Path "$INSTDIR"' ; Removes minikube from System Path
# Remove files
Delete /REBOOTOK $INSTDIR\minikube.exe

View File

@ -142,7 +142,7 @@ func WaitForRCToStabilize(c kubernetes.Interface, ns, name string, timeout time.
return err
}
// WaitForDeploymentToStabilize waits till the Deployment has a matching generation/replica count between spec and status. used by integrationt tests
// WaitForDeploymentToStabilize waits till the Deployment has a matching generation/replica count between spec and status. used by integration tests
func WaitForDeploymentToStabilize(c kubernetes.Interface, ns, name string, timeout time.Duration) error {
options := meta.ListOptions{FieldSelector: fields.Set{
"metadata.name": name,

View File

@ -23,7 +23,6 @@ import (
"io"
"os"
"path"
"path/filepath"
"github.com/golang/glog"
"github.com/pkg/errors"
@ -80,7 +79,7 @@ func NewMemoryAssetTarget(d []byte, targetPath, permissions string) *MemoryAsset
// NewFileAsset creates a new FileAsset
func NewFileAsset(src, targetDir, targetName, permissions string) (*FileAsset, error) {
glog.Infof("NewFileAsset: %s -> %s", src, filepath.Join(targetDir, targetName))
glog.Infof("NewFileAsset: %s -> %s", src, path.Join(targetDir, targetName))
f, err := os.Open(src)
if err != nil {
return nil, errors.Wrapf(err, "Error opening file asset: %s", src)

View File

@ -19,10 +19,13 @@ package kubeadm
import (
"bytes"
"crypto/tls"
"fmt"
"net"
"net/http"
"path/filepath"
// WARNING: Do not use path/filepath in this package unless you want bizarre Windows paths
"path"
"runtime"
"strings"
"time"
@ -95,7 +98,7 @@ var PodsByLayer = []pod{
}
// yamlConfigPath is the path to the kubeadm configuration
var yamlConfigPath = filepath.Join(constants.GuestEphemeralDir, "kubeadm.yaml")
var yamlConfigPath = path.Join(constants.GuestEphemeralDir, "kubeadm.yaml")
// SkipAdditionalPreflights are additional preflights we skip depending on the runtime in use.
var SkipAdditionalPreflights = map[string][]string{}
@ -200,7 +203,7 @@ func createFlagsFromExtraArgs(extraOptions config.ExtraOptionSlice) string {
// etcdDataDir is where etcd data is stored.
func etcdDataDir() string {
return filepath.Join(constants.GuestPersistentDir, "etcd")
return path.Join(constants.GuestPersistentDir, "etcd")
}
// createCompatSymlinks creates compatibility symlinks to transition running services to new directory structures
@ -538,7 +541,7 @@ func NewKubeletConfig(k8s config.KubernetesConfig, r cruntime.Manager) ([]byte,
}{
ExtraOptions: convertToFlags(extraOpts),
ContainerRuntime: k8s.ContainerRuntime,
KubeletPath: filepath.Join(binRoot(k8s.KubernetesVersion), "kubelet"),
KubeletPath: path.Join(binRoot(k8s.KubernetesVersion), "kubelet"),
}
if err := kubeletSystemdTemplate.Execute(&b, opts); err != nil {
return nil, err
@ -700,7 +703,7 @@ func generateConfig(k8s config.KubernetesConfig, r cruntime.Manager) ([]byte, er
// NewKubeletService returns a generated systemd unit file for the kubelet
func NewKubeletService(cfg config.KubernetesConfig) ([]byte, error) {
var b bytes.Buffer
opts := struct{ KubeletPath string }{KubeletPath: filepath.Join(binRoot(cfg.KubernetesVersion), "kubelet")}
opts := struct{ KubeletPath string }{KubeletPath: path.Join(binRoot(cfg.KubernetesVersion), "kubelet")}
if err := kubeletServiceTemplate.Execute(&b, opts); err != nil {
return nil, errors.Wrap(err, "template execute")
}
@ -725,7 +728,7 @@ func configFiles(cfg config.KubernetesConfig, kubeadm []byte, kubelet []byte, ku
// binDir returns the persistent path binaries are stored in
func binRoot(version string) string {
return filepath.Join(constants.GuestPersistentDir, "binaries", version)
return path.Join(constants.GuestPersistentDir, "binaries", version)
}
// invokeKubeadm returns the invocation command for Kubeadm
@ -744,7 +747,7 @@ func transferBinaries(cfg config.KubernetesConfig, c command.Runner) error {
return errors.Wrapf(err, "downloading %s", name)
}
dst := filepath.Join(binRoot(cfg.KubernetesVersion), name)
dst := path.Join(binRoot(cfg.KubernetesVersion), name)
if err := machine.CopyBinary(c, src, dst); err != nil {
return errors.Wrapf(err, "copybinary %s -> %s", src, dst)
}

View File

@ -84,7 +84,7 @@ Wants=containerd.service
[Service]
ExecStart=
ExecStart=/var/lib/minikube/binaries/v1.15.2/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-dns=10.96.0.10 --cluster-domain=cluster.local --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=unix:///run/containerd/containerd.sock --kubeconfig=/etc/kubernetes/kubelet.conf --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m
ExecStart=/var/lib/minikube/binaries/v1.16.0-beta.1/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-dns=10.96.0.10 --cluster-domain=cluster.local --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock --fail-swap-on=false --hostname-override=minikube --image-service-endpoint=unix:///run/containerd/containerd.sock --kubeconfig=/etc/kubernetes/kubelet.conf --pod-manifest-path=/etc/kubernetes/manifests --runtime-request-timeout=15m
[Install]
`,
@ -103,7 +103,7 @@ Wants=docker.socket
[Service]
ExecStart=
ExecStart=/var/lib/minikube/binaries/v1.15.2/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-dns=10.96.0.10 --cluster-domain=cluster.local --container-runtime=docker --fail-swap-on=false --hostname-override=minikube --kubeconfig=/etc/kubernetes/kubelet.conf --pod-infra-container-image=docker-proxy-image.io/google_containers/pause:3.1 --pod-manifest-path=/etc/kubernetes/manifests
ExecStart=/var/lib/minikube/binaries/v1.16.0-beta.1/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver=cgroupfs --client-ca-file=/var/lib/minikube/certs/ca.crt --cluster-dns=10.96.0.10 --cluster-domain=cluster.local --container-runtime=docker --fail-swap-on=false --hostname-override=minikube --kubeconfig=/etc/kubernetes/kubelet.conf --pod-infra-container-image=docker-proxy-image.io/google_containers/pause:3.1 --pod-manifest-path=/etc/kubernetes/manifests
[Install]
`,

View File

@ -19,7 +19,7 @@ package command
import (
"fmt"
"io"
"path/filepath"
"path"
"k8s.io/minikube/pkg/minikube/assets"
)
@ -54,5 +54,5 @@ type Runner interface {
}
func getDeleteFileCommand(f assets.CopyableFile) string {
return fmt.Sprintf("sudo rm %s", filepath.Join(f.GetTargetDir(), f.GetTargetName()))
return fmt.Sprintf("sudo rm %s", path.Join(f.GetTargetDir(), f.GetTargetName()))
}

View File

@ -21,6 +21,7 @@ import (
"io"
"os"
"os/exec"
"path"
"path/filepath"
"strconv"
@ -76,7 +77,7 @@ func (*ExecRunner) Copy(f assets.CopyableFile) error {
if err := os.MkdirAll(f.GetTargetDir(), os.ModePerm); err != nil {
return errors.Wrapf(err, "error making dirs for %s", f.GetTargetDir())
}
targetPath := filepath.Join(f.GetTargetDir(), f.GetTargetName())
targetPath := path.Join(f.GetTargetDir(), f.GetTargetName())
if _, err := os.Stat(targetPath); err == nil {
if err := os.Remove(targetPath); err != nil {
return errors.Wrapf(err, "error removing file %s", targetPath)

View File

@ -21,7 +21,6 @@ import (
"fmt"
"io"
"path"
"path/filepath"
"sync"
"github.com/golang/glog"
@ -167,7 +166,7 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error {
// StdinPipe is closed. But let's use errgroup to make it explicit.
var g errgroup.Group
var copied int64
dst := filepath.Join(path.Join(f.GetTargetDir(), f.GetTargetName()))
dst := path.Join(path.Join(f.GetTargetDir(), f.GetTargetName()))
glog.Infof("Transferring %d bytes to %s", f.GetLength(), dst)
g.Go(func() error {

View File

@ -178,7 +178,7 @@ var DefaultISOURL = fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.i
var DefaultISOSHAURL = DefaultISOURL + SHASuffix
// DefaultKubernetesVersion is the default kubernetes version
var DefaultKubernetesVersion = "v1.15.2"
var DefaultKubernetesVersion = "v1.16.0-beta.1"
// NewestKubernetesVersion is the newest Kubernetes version to test against
var NewestKubernetesVersion = "v1.16.0-beta.1"

View File

@ -36,7 +36,7 @@ import (
// rootCauseRe is a regular expression that matches known failure root causes
var rootCauseRe = regexp.MustCompile(`^error: |eviction manager: pods.* evicted|unknown flag: --|forbidden.*no providers available|eviction manager:.*evicted|tls: bad certificate|kubelet.*no API client|kubelet.*No api server|STDIN.*127.0.0.1:8080`)
// ignoreRe is a regular expression that matches spurious errors to not surface
// ignoreCauseRe is a regular expression that matches spurious errors to not surface
var ignoreCauseRe = regexp.MustCompile("error: no objects passed to apply")
// importantPods are a list of pods to retrieve logs for, in addition to the bootstrapper logs.
@ -48,6 +48,7 @@ var importantPods = []string{
"kube-addon-manager",
"kubernetes-dashboard",
"storage-provisioner",
"kube-controller-manager",
}
// lookbackwardsCount is how far back to look in a log for problems. This should be large enough to
@ -161,7 +162,10 @@ func logCommands(r cruntime.Manager, bs bootstrapper.Bootstrapper, length int, f
glog.Warningf("No container was found matching %q", pod)
continue
}
cmds[pod] = r.ContainerLogCmd(ids[0], length, follow)
for _, i := range ids {
key := fmt.Sprintf("%s [%s]", pod, i)
cmds[key] = r.ContainerLogCmd(i, length, follow)
}
}
cmds[r.Name()] = r.SystemLogCmd(length)
// Works across container runtimes with good formatting

View File

@ -20,7 +20,6 @@ import (
"crypto"
"os"
"path"
"path/filepath"
"runtime"
"github.com/golang/glog"
@ -93,7 +92,7 @@ func CacheBinary(binary, version, osName, archName string) (string, error) {
// CopyBinary copies a locally cached binary to the guest VM
func CopyBinary(cr command.Runner, src string, dest string) error {
f, err := assets.NewFileAsset(src, filepath.Dir(dest), filepath.Base(dest), "0755")
f, err := assets.NewFileAsset(src, path.Dir(dest), path.Base(dest), "0755")
if err != nil {
return errors.Wrap(err, "new file asset")
}

View File

@ -25,6 +25,7 @@ import (
"runtime"
"strings"
"sync"
"time"
"github.com/golang/glog"
"github.com/google/go-containerregistry/pkg/authn"
@ -44,7 +45,7 @@ import (
)
// loadRoot is where images should be loaded from within the guest VM
var loadRoot = filepath.Join(constants.GuestPersistentDir, "images")
var loadRoot = path.Join(constants.GuestPersistentDir, "images")
var getWindowsVolumeName = getWindowsVolumeNameCmd
@ -75,8 +76,10 @@ func CacheImages(images []string, cacheDir string) error {
dst := filepath.Join(cacheDir, image)
dst = sanitizeCacheDir(dst)
if err := CacheImage(image, dst); err != nil {
glog.Errorf("CacheImage %s -> %s failed: %v", image, dst, err)
return errors.Wrapf(err, "caching image %s", dst)
}
glog.Infof("CacheImage %s -> %s succeeded", image, dst)
return nil
})
}
@ -143,7 +146,9 @@ func CacheAndLoadImages(images []string) error {
func sanitizeCacheDir(image string) string {
if runtime.GOOS == "windows" && hasWindowsDriveLetter(image) {
// not sanitize Windows drive letter.
return image[:2] + strings.Replace(image[2:], ":", "_", -1)
s := image[:2] + strings.Replace(image[2:], ":", "_", -1)
glog.Infof("windows sanitize: %s -> %s", image, s)
return s
}
return strings.Replace(image, ":", "_", -1)
}
@ -286,8 +291,14 @@ func getDstPath(dst string) (string, error) {
// CacheImage caches an image
func CacheImage(image, dst string) error {
glog.Infof("Attempting to cache image: %s at %s\n", image, dst)
start := time.Now()
glog.Infof("CacheImage: %s -> %s", image, dst)
defer func() {
glog.Infof("CacheImage: %s -> %s completed in %s", image, dst, time.Since(start))
}()
if _, err := os.Stat(dst); err == nil {
glog.Infof("%s exists", dst)
return nil
}
@ -331,14 +342,26 @@ func CacheImage(image, dst string) error {
if err != nil {
return err
}
glog.Infof("%s exists", dst)
return nil
}
func retrieveImage(ref name.Reference) (v1.Image, error) {
glog.Infof("retrieving image: %+v", ref)
img, err := daemon.Image(ref)
if err == nil {
glog.Infof("found %s locally; caching", ref.Name())
return img, err
}
return remote.Image(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain))
glog.Infof("daemon image for %+v: %v", img, err)
img, err = remote.Image(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain))
if err == nil {
return img, err
}
glog.Warningf("failed authn download for %+v (trying anon): %+v", ref, err)
img, err = remote.Image(ref)
if err != nil {
glog.Warningf("failed anon download for %+v: %+v", ref, err)
}
return img, err
}

View File

@ -67,7 +67,7 @@ func MaybePrintUpdateText(url string, lastUpdatePath string) {
}
url := "https://github.com/kubernetes/minikube/releases/tag/v" + latestVersion.String()
out.ErrT(out.WarningType, `minikube {{.version}} is available! Download it: {{.url}}`, out.V{"version": latestVersion, "url": url})
out.T(out.Tip, "To disable this notice, run: 'minikube config set WantUpdateNotification false'")
out.ErrT(out.Tip, "To disable this notice, run: 'minikube config set WantUpdateNotification false'")
}
}

View File

@ -55,8 +55,13 @@ func isInBlock(ip string, block string) (bool, error) {
return false, errors.Wrapf(err, "Error ip not in block")
}
// ExcludeIP will exclude the ip from the http(s)_proxy
// ExcludeIP takes ip or CIDR as string and excludes it from the http(s)_proxy
func ExcludeIP(ip string) error {
if netIP := net.ParseIP(ip); netIP == nil {
if _, _, err := net.ParseCIDR(ip); err != nil {
return fmt.Errorf("ExcludeIP(%v) requires IP or CIDR as a parameter", ip)
}
}
return updateEnv(ip, "NO_PROXY")
}

View File

@ -18,8 +18,11 @@ package proxy
import (
"fmt"
"net/http"
"os"
"testing"
"k8s.io/client-go/rest"
)
func TestIsValidEnv(t *testing.T) {
@ -33,11 +36,9 @@ func TestIsValidEnv(t *testing.T) {
}
for _, tc := range testCases {
t.Run(tc.env, func(t *testing.T) {
got := isValidEnv(tc.env)
if got != tc.want {
if got := isValidEnv(tc.env); got != tc.want {
t.Errorf("isValidEnv(\"%v\") got %v; want %v", tc.env, got, tc.want)
}
})
}
@ -55,9 +56,10 @@ func TestIsInBlock(t *testing.T) {
{"192.168.0.2", "192.168.0.1/32", false, false},
{"192.168.0.1", "192.168.0.1/18", true, false},
{"abcd", "192.168.0.1/18", false, true},
{"192.168.0.1", "foo", false, true},
}
for _, tc := range testCases {
t.Run(fmt.Sprintf("%s in %s", tc.ip, tc.block), func(t *testing.T) {
t.Run(fmt.Sprintf("%s in %s Want: %t WantAErr: %t", tc.ip, tc.block, tc.want, tc.wanntAErr), func(t *testing.T) {
got, err := isInBlock(tc.ip, tc.block)
gotErr := false
if err != nil {
@ -88,7 +90,7 @@ func TestUpdateEnv(t *testing.T) {
{"192.168.0.13", "NPROXY", true},
}
for _, tc := range testCases {
t.Run(fmt.Sprintf("%s in %s", tc.ip, tc.env), func(t *testing.T) {
t.Run(fmt.Sprintf("%s in %s WantAErr: %t", tc.ip, tc.env, tc.wantErr), func(t *testing.T) {
origVal := os.Getenv(tc.env)
gotErr := false
err := updateEnv(tc.ip, tc.env)
@ -124,6 +126,7 @@ func TestCheckEnv(t *testing.T) {
{"192.168.0.13", "NO_PROXY", true, "192.168.0.13/22"},
{"192.168.0.13", "NO_PROXY", true, "10.10.0.13,192.168.0.13"},
{"192.168.0.13", "NO_PROXY", false, "10.10.0.13/22"},
{"10.10.10.4", "NO_PROXY", true, "172.168.0.0/30,10.10.10.0/24"},
}
for _, tc := range testCases {
t.Run(fmt.Sprintf("%s in %s", tc.ip, tc.envName), func(t *testing.T) {
@ -135,17 +138,119 @@ func TestCheckEnv(t *testing.T) {
}
}()
// defer os.Setenv(tc.envName, originalEnv)
err := os.Setenv(tc.envName, tc.mockEnvValue) // setting up the test case
if err != nil {
if err := os.Setenv(tc.envName, tc.mockEnvValue); err != nil {
t.Error("Error setting env var for taste case")
}
got := checkEnv(tc.ip, tc.envName)
if got != tc.want {
if got := checkEnv(tc.ip, tc.envName); got != tc.want {
t.Errorf("CheckEnv(%v,%v) got %v ; want is %v", tc.ip, tc.envName, got, tc.want)
}
})
}
}
func TestIsIPExcluded(t *testing.T) {
var testCases = []struct {
ip, env string
excluded bool
}{
{"1.2.3.4", "7.7.7.7", false},
{"1.2.3.4", "1.2.3.4", true},
{"1.2.3.4", "", false},
{"foo", "", false},
{"foo", "bar", false},
{"foo", "1.2.3.4", false},
}
for _, tc := range testCases {
originalEnv := os.Getenv("NO_PROXY")
defer func() { // revert to pre-test env var
err := os.Setenv("NO_PROXY", originalEnv)
if err != nil {
t.Fatalf("Error reverting env NO_PROXY to its original value (%s) var after test ", originalEnv)
}
}()
t.Run(fmt.Sprintf("exclude %s NO_PROXY(%v)", tc.ip, tc.env), func(t *testing.T) {
if err := os.Setenv("NO_PROXY", tc.env); err != nil {
t.Errorf("Error during setting env: %v", err)
}
if excluded := IsIPExcluded(tc.ip); excluded != tc.excluded {
t.Fatalf("IsIPExcluded(%v) should return %v. NO_PROXY=%v", tc.ip, tc.excluded, tc.env)
}
})
}
}
func TestExcludeIP(t *testing.T) {
var testCases = []struct {
ip, env string
wantAErr bool
}{
{"1.2.3.4", "", false},
{"", "", true},
{"7.7.7.7", "7.7.7.7", false},
{"7.7.7.7", "1.2.3.4", false},
{"foo", "", true},
{"foo", "1.2.3.4", true},
}
originalEnv := os.Getenv("NO_PROXY")
defer func() { // revert to pre-test env var
err := os.Setenv("NO_PROXY", originalEnv)
if err != nil {
t.Fatalf("Error reverting env NO_PROXY to its original value (%s) var after test ", originalEnv)
}
}()
for _, tc := range testCases {
t.Run(fmt.Sprintf("exclude %s NO_PROXY(%s)", tc.ip, tc.env), func(t *testing.T) {
if err := os.Setenv("NO_PROXY", tc.env); err != nil {
t.Errorf("Error during setting env: %v", err)
}
err := ExcludeIP(tc.ip)
if err != nil && !tc.wantAErr {
t.Errorf("ExcludeIP(%v) returned unexpected error %v", tc.ip, err)
}
if err == nil && tc.wantAErr {
t.Errorf("ExcludeIP(%v) should return error but error is %v", tc.ip, err)
}
})
}
}
func TestUpdateTransport(t *testing.T) {
t.Run("new", func(t *testing.T) {
rc := rest.Config{}
c := UpdateTransport(&rc)
tr := &http.Transport{}
tr.RegisterProtocol("file", http.NewFileTransport(http.Dir("/tmp")))
rt := c.WrapTransport(tr)
if _, ok := rt.(http.RoundTripper); !ok {
t.Fatalf("Cannot cast rt(%v) to http.RoundTripper", rt)
}
})
t.Run("existing", func(t *testing.T) {
// rest config initialized with WrapTransport function
rc := rest.Config{WrapTransport: func(http.RoundTripper) http.RoundTripper {
rt := &http.Transport{}
rt.RegisterProtocol("file", http.NewFileTransport(http.Dir("/tmp")))
return rt
}}
transport := &http.Transport{}
transport.RegisterProtocol("file", http.NewFileTransport(http.Dir("/")))
c := UpdateTransport(&rc)
rt := c.WrapTransport(nil)
if rt == rc.WrapTransport(transport) {
t.Fatalf("Excpected to reuse existing RoundTripper(%v) but found %v", rt, transport)
}
})
t.Run("nil", func(t *testing.T) {
rc := rest.Config{}
c := UpdateTransport(&rc)
rt := c.WrapTransport(nil)
if rt != nil {
t.Fatalf("Expected RoundTripper nil for invocation WrapTransport(nil)")
}
})
}

View File

@ -30,6 +30,8 @@ cd minikube
make
```
Note: On Windows, this will only work in Git Bash or other terminals that support bash commands.
## Compiling minikube using Docker
To cross-compile to/from different operating systems:

View File

@ -56,7 +56,7 @@ As Kubernetes has full access to both your filesystem as well as your docker ima
* Many `minikube` commands are not supported, such as: `dashboard`, `mount`, `ssh`
* minikube with the `none` driver has a confusing permissions model, as some commands need to be run as root ("start"), and others by a regular user ("dashboard")
* CoreDNS detects resolver loop, goes into CrashLoopBackOff - [#3511](https://github.com/kubernetes/minikube/issues/3511)
* Some versions of Linux have a version of docker that is newer then what Kubernetes expects. To overwrite this, run minikube with the following parameters: `sudo -E minikube start --vm-driver=none --kubernetes-version v1.11.8 --extra-config kubeadm.ignore-preflight-errors=SystemVerification`
* Some versions of Linux have a version of docker that is newer than what Kubernetes expects. To overwrite this, run minikube with the following parameters: `sudo -E minikube start --vm-driver=none --kubernetes-version v1.11.8 --extra-config kubeadm.ignore-preflight-errors=SystemVerification`
* [Full list of open 'none' driver issues](https://github.com/kubernetes/minikube/labels/co%2Fnone-driver)

View File

@ -0,0 +1,72 @@
---
title: "Uninstall minikube"
linkTitle: "Uninstall minikube"
weight: 6
date: 2019-08-18
description: >
Reference on uninstalling minikube from your system completely.
---
# Uninstall minikube on Windows
Following are the ways you can install minikube on Windows. Depending on how you installed minikube, please follow the guide appropriately.
## Chocolatey
If you have installed minikube using Chocolatey package manager, follow the below steps to completely uninstall minikube from your system -
- Open a command prompt with Administrator privileges.
- We need to delete the cluster which was created by minikube - `minikube delete`
- Run, `choco uninstall minikube` to remove the minikube package from your system.
- Now, navigate to your User Folder - `C:\Users\YOUR_USER_NAME` (You can also find the path by expanding the environment variable `%USERPROFILE%`)
- In this folder, delete the `.minikube` folder.
## Windows Installer
If you have downloaded and installed minikube using the Windows Installer provided in our Releases, kindly follow the below steps -
- Open a command prompt with Administrator privileges.
- We need to delete the cluster which was created by minikube - `minikube delete`
- Now, open the Run dialog box (**Win+R**), type in `appwiz.cpl` and hit **Enter** key.
- In there, find an entry for the Minikube installer, right click on it & click on **Uninstall**.
- Follow the onscreen prompts to uninstall minikube from your system.
- Now, navigate to your User Folder - `C:\Users\YOUR_USER_NAME` (You can also find the path by expanding the environment variable `%USERPROFILE%`)
- In this folder, delete the `.minikube` folder.
## Binary/Direct
If you have downloaded just the binary and are using it to run minikube, please follow the below steps -
- Open a command prompt with Administrator privileges.
- We need to delete the cluster which was created by minikube - `minikube delete`
- Delete the minikube binary.
- Now, navigate to your User Folder - `C:\Users\YOUR_USER_NAME` (You can also find the path by expanding the environment variable `%USERPROFILE%`)
- In this folder, delete the `.minikube` folder.
# Uninstall minikube on Linux
## Binary/Direct
If you have installed minikube using the direct download method, follow the below steps to uninstall minikube completely from your system -
- In the shell, type in `minikube delete` to delete the minikube cluster.
- Remove the binary using `rm /usr/local/bin/minikube`
- Remove the directory containing the minikube configuration `rm -rf ~/.minikube`
## Debian/Ubuntu (Deb)
If you have installed minikube using the (deb) file, follow the below instructions -
- In the shell, type in `minikube delete` to delete the minikube cluster.
- Uninstall the minikube package completely - `sudo dpkg -P minikube`
- Remove the minikube configuration directory - `rm -rf ~/.minikube`
## Fedora/Red Hat (RPM)
If you have installed minikube using RPM, follow the below steps -
- In the shell, type in `minikube delete` to delete the minikube cluster.
- Uninstall the minikube package - `sudo rpm -e minikube`
- Remove the minikube configuration directory - `rm -rf ~/.minikube`
# Uninstall minikube on MacOS
## Binary/Direct
If you have installed minikube using the direct download method, follow the below steps to uninstall minikube completely from your system -
- In the shell, type in `minikube delete` to delete the minikube cluster.
- Remove the binary using `rm /usr/local/bin/minikube`
- Remove the directory containing the minikube configuration `rm -rf ~/.minikube`
## Brew
If you have installed minikube using the direct download method, follow the below steps to uninstall minikube completely from your system -
- In the shell, type in `minikube delete` to delete the minikube cluster.
- Uninstall the minikube package using `brew uninstall minikube`
- Remove the directory containing the minikube configuration `rm -rf ~/.minikube`

View File

@ -30,7 +30,6 @@ curl -Lo kubectl \
&& sudo install kubectl /usr/local/bin/
export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTREPORTERRORPROMPT=false
export MINIKUBE_HOME=$HOME
export CHANGE_MINIKUBE_NONE_USER=true
export KUBECONFIG=$HOME/.kube/config
@ -40,4 +39,3 @@ touch $KUBECONFIG
sudo -E minikube start --vm-driver=none
```

View File

@ -15,10 +15,10 @@ description: >
## Using the KVM2 driver
When using NVIDIA GPUs with the kvm2 vm-driver. We passthrough spare GPUs on the
When using NVIDIA GPUs with the kvm2 vm-driver, we passthrough spare GPUs on the
host to the minikube VM. Doing so has a few prerequisites:
- You must install the [kvm2 driver](drivers.md#kvm2-driver). If you already had
- You must install the [kvm2 driver](/docs/start/linux/#hypervisor-setup). If you already had
this installed make sure that you fetch the latest
`docker-machine-driver-kvm2` binary that has GPU support.
@ -44,7 +44,7 @@ host to the minikube VM. Doing so has a few prerequisites:
- Once you reboot the system after doing the above, you should be ready to use
GPUs with kvm2. Run the following command to start minikube:
```shell
minikube start --vm-driver kvm2 --gpu
minikube start --vm-driver kvm2 --kvm-gpu
```
This command will check if all the above conditions are satisfied and

View File

@ -22,6 +22,7 @@ import (
"context"
"fmt"
"os/exec"
"path"
"path/filepath"
"regexp"
"strings"
@ -50,7 +51,7 @@ type MinikubeRunner struct {
// Remove removes a file
func (m *MinikubeRunner) Remove(f assets.CopyableFile) error {
_, err := m.SSH(fmt.Sprintf("rm -rf %s", filepath.Join(f.GetTargetDir(), f.GetTargetName())))
_, err := m.SSH(fmt.Sprintf("rm -rf %s", path.Join(f.GetTargetDir(), f.GetTargetName())))
return err
}