Skip to content

Commit

Permalink
Merge branch 'master' into powershell-env-bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tstromberg committed Feb 7, 2020
2 parents 5d59e83 + 10ef863 commit c195d5a
Show file tree
Hide file tree
Showing 32 changed files with 265 additions and 151 deletions.
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func dockerURL(ip string, port int) string {
return fmt.Sprintf("tcp://%s", net.JoinHostPort(ip, strconv.Itoa(port)))
}

// dockerEnvVars gets the necessary docker env variables to allow the use of docker through minikube's vm
// dockerEnvVars gets the necessary docker env variables to allow the use of minikube's docker daemon
func dockerEnvVars(ec EnvConfig) (map[string]string, error) {
env := map[string]string{
constants.DockerTLSVerifyEnv: "1",
Expand Down
24 changes: 6 additions & 18 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func runStart(cmd *cobra.Command, args []string) {
updateDriver(driverName)
}

k8sVersion, isUpgrade := getKubernetesVersion(existing)
k8sVersion := getKubernetesVersion(existing)
mc, n, err := generateCfgFromFlags(cmd, k8sVersion, driverName)
if err != nil {
exit.WithError("Failed to generate config", err)
Expand Down Expand Up @@ -365,7 +365,7 @@ func runStart(cmd *cobra.Command, args []string) {
bs := setupKubeAdm(machineAPI, mc, n)

// pull images or restart cluster
bootstrapCluster(bs, cr, mRunner, mc, preExists, isUpgrade)
bootstrapCluster(bs, cr, mRunner, mc)
configureMounts()

// enable addons, both old and new!
Expand Down Expand Up @@ -1187,9 +1187,8 @@ func tryRegistry(r command.Runner) {
}

// getKubernetesVersion ensures that the requested version is reasonable
func getKubernetesVersion(old *config.MachineConfig) (string, bool) {
func getKubernetesVersion(old *config.MachineConfig) string {
paramVersion := viper.GetString(kubernetesVersion)
isUpgrade := false

if paramVersion == "" { // if the user did not specify any version then ...
if old != nil { // .. use the old version from config (if any)
Expand All @@ -1207,7 +1206,7 @@ func getKubernetesVersion(old *config.MachineConfig) (string, bool) {
nv := version.VersionPrefix + nvs.String()

if old == nil || old.KubernetesConfig.KubernetesVersion == "" {
return nv, isUpgrade
return nv
}

oldestVersion, err := semver.Make(strings.TrimPrefix(constants.OldestKubernetesVersion, version.VersionPrefix))
Expand Down Expand Up @@ -1249,11 +1248,7 @@ func getKubernetesVersion(old *config.MachineConfig) (string, bool) {
if defaultVersion.GT(nvs) {
out.T(out.ThumbsUp, "Kubernetes {{.new}} is now available. If you would like to upgrade, specify: --kubernetes-version={{.new}}", out.V{"new": defaultVersion})
}

if nvs.GT(ovs) {
isUpgrade = true
}
return nv, isUpgrade
return nv
}

// setupKubeAdm adds any requested files into the VM before Kubernetes is started
Expand Down Expand Up @@ -1296,14 +1291,7 @@ func configureRuntimes(runner cruntime.CommandRunner, drvName string, k8s config
}

// bootstrapCluster starts Kubernetes using the chosen bootstrapper
func bootstrapCluster(bs bootstrapper.Bootstrapper, r cruntime.Manager, runner command.Runner, mc config.MachineConfig, preexisting bool, isUpgrade bool) {
if isUpgrade || !preexisting {
out.T(out.Pulling, "Pulling images ...")
if err := bs.PullImages(mc.KubernetesConfig); err != nil {
out.T(out.FailureType, "Unable to pull images, which may be OK: {{.error}}", out.V{"error": err})
}
}

func bootstrapCluster(bs bootstrapper.Bootstrapper, r cruntime.Manager, runner command.Runner, mc config.MachineConfig) {
out.T(out.Launch, "Launching Kubernetes ... ")
if err := bs.StartCluster(mc); err != nil {
exit.WithLogEntries("Error starting cluster", err, logs.FindProblems(r, bs, runner))
Expand Down
12 changes: 1 addition & 11 deletions cmd/minikube/cmd/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,41 @@ func TestGetKuberneterVersion(t *testing.T) {
description string
expectedVersion string
paramVersion string
upgrade bool
cfg *cfg.MachineConfig
}{
{
description: "kubernetes-version not given, no config",
expectedVersion: constants.DefaultKubernetesVersion,
paramVersion: "",
upgrade: false,
},
{
description: "kubernetes-version not given, config available",
expectedVersion: "v1.15.0",
paramVersion: "",
upgrade: false,
cfg: &cfg.MachineConfig{KubernetesConfig: cfg.KubernetesConfig{KubernetesVersion: "v1.15.0"}},
},
{
description: "kubernetes-version given, no config",
expectedVersion: "v1.15.0",
paramVersion: "v1.15.0",
upgrade: false,
},
{
description: "kubernetes-version given, config available",
expectedVersion: "v1.16.0",
paramVersion: "v1.16.0",
upgrade: true,
cfg: &cfg.MachineConfig{KubernetesConfig: cfg.KubernetesConfig{KubernetesVersion: "v1.15.0"}},
},
}

for _, test := range tests {
t.Run(test.description, func(t *testing.T) {
viper.SetDefault(kubernetesVersion, test.paramVersion)
version, upgrade := getKubernetesVersion(test.cfg)
version := getKubernetesVersion(test.cfg)

// check whether we are getting the expected version
if version != test.expectedVersion {
t.Fatalf("test failed because the expected version %s is not returned", test.expectedVersion)
}

// check whether the upgrade flag is correct
if test.upgrade != upgrade {
t.Fatalf("test failed expected upgrade is %t", test.upgrade)
}
})
}
}
Expand Down
8 changes: 8 additions & 0 deletions deploy/minikube/releases.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[
{
"name": "v1.7.1",
"checksums": {
"darwin": "ac6b1eb8ff6a98f0f4a8f26fddd7a9fd8dbdd7a5029cf87a9315399d31e4f6ce",
"linux": "1313da4fce807f2d5cd4664d8a59422067a3377ddd37fa66df9aa0bb228e154b",
"windows": "640ad4ba69926be2ea64140a5d6d80122f030c8bf75ae4afeca11eeff865feac"
}
},
{
"name": "v1.7.0",
"checksums": {
Expand Down
2 changes: 0 additions & 2 deletions pkg/minikube/bootstrapper/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ type LogOptions struct {

// Bootstrapper contains all the methods needed to bootstrap a kubernetes cluster
type Bootstrapper interface {
// PullImages pulls images necessary for a cluster. Success should not be required.
PullImages(config.KubernetesConfig) error
StartCluster(config.MachineConfig) error
UpdateCluster(config.MachineConfig) error
DeleteCluster(config.KubernetesConfig) error
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/bootstrapper/bsutil/kubeadm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func getExtraOptsPodCidr() []config.ExtraOption {

func recentReleases() ([]string, error) {
// test the 6 most recent releases
versions := []string{"v1.17", "v1.16", "v1.15", "v1.14", "v1.13", "v1.12", "v1.11"}
versions := []string{"v1.19", "v1.18", "v1.17", "v1.16", "v1.15", "v1.14", "v1.13", "v1.12", "v1.11"}
foundNewest := false
foundDefault := false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ kubernetesVersion: v1.19.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ kubernetesVersion: v1.19.0
networking:
dnsDomain: cluster.local
podSubnet: "192.168.32.0/20"
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ kubernetesVersion: v1.19.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ kubernetesVersion: v1.19.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
2 changes: 1 addition & 1 deletion pkg/minikube/bootstrapper/bsutil/testdata/v1.19/crio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ kubernetesVersion: v1.19.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ kubernetesVersion: v1.19.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ kubernetesVersion: v1.19.0
networking:
dnsDomain: cluster.local
podSubnet: ""
serviceSubnet: 10.96.0.0/12
serviceSubnet: 10.96.0.0/12
17 changes: 0 additions & 17 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,23 +390,6 @@ func (k *Bootstrapper) DeleteCluster(k8s config.KubernetesConfig) error {
return nil
}

// PullImages downloads images that will be used by Kubernetes
func (k *Bootstrapper) PullImages(k8s config.KubernetesConfig) error {
version, err := bsutil.ParseKubernetesVersion(k8s.KubernetesVersion)
if err != nil {
return errors.Wrap(err, "parsing kubernetes version")
}
if version.LT(semver.MustParse("1.11.0")) {
return fmt.Errorf("pull command is not supported by kubeadm v%s", version)
}

rr, err := k.c.RunCmd(exec.Command("/bin/bash", "-c", fmt.Sprintf("%s config images pull --config %s", bsutil.InvokeKubeadm(k8s.KubernetesVersion), bsutil.KubeadmYamlPath)))
if err != nil {
return errors.Wrapf(err, "running cmd: %q", rr.Command())
}
return nil
}

// SetupCerts sets up certificates within the cluster.
func (k *Bootstrapper) SetupCerts(k8s config.KubernetesConfig, n config.Node) error {
return bootstrapper.SetupCerts(k.c, k8s, n)
Expand Down
2 changes: 1 addition & 1 deletion site/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ weight = 1
[params]
copyright = "The Kubernetes Authors -- "
# The latest release of minikube
latest_release = "1.6.2"
latest_release = "1.7.1"

privacy_policy = ""

Expand Down
8 changes: 8 additions & 0 deletions site/content/en/docs/Reference/Commands/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ Lists all available minikube addons as well as their current statuses (enabled/d
```
minikube addons list [flags]
```

### Options

```
-h, --help help for list
-o, --output string minikube addons list --output OUTPUT. json, list (default "list")
```

## minikube addons open

Opens the addon w/ADDON_NAME within minikube (example: minikube addons open dashboard). For a list of available addons use: minikube addons list
Expand Down
8 changes: 8 additions & 0 deletions site/content/en/docs/Reference/Commands/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ minikube cache list [flags]
For the list of accessible variables for the template, see the struct values here: https://godoc.org/k8s.io/minikube/cmd/minikube/cmd#CacheListTemplate (default "{{.CacheImage}}\n")
-h, --help help for list
```

## minikube cache reload

reloads images previously added using the 'cache add' subcommand

```
minikube cache reload [flags]
```
20 changes: 4 additions & 16 deletions site/content/en/docs/Reference/Commands/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ config modifies minikube config files using subcommands like "minikube config se
Configurable fields:

* vm-driver
* container-runtime
* feature-gates
* v
* cpus
Expand All @@ -33,26 +34,13 @@ Configurable fields:
* bootstrapper
* ShowDriverDeprecationNotification
* ShowBootstrapperDeprecationNotification
* dashboard
* addon-manager
* default-storageclass
* efk
* ingress
* registry
* registry-creds
* freshpod
* default-storageclass
* storage-provisioner
* storage-provisioner-gluster
* metrics-server
* nvidia-driver-installer
* nvidia-gpu-device-plugin
* logviewer
* gvisor
* insecure-registry
* hyperv-virtual-switch
* disable-driver-mounts
* cache
* embed-certs
* native-ssh


### subcommands

Expand Down
2 changes: 1 addition & 1 deletion site/content/en/docs/Reference/Commands/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ minikube logs [flags]
```
-f, --follow Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
-h, --help help for logs
-n, --length int Number of lines back to go within the log (default 50)
-n, --length int Number of lines back to go within the log (default 60)
--problems Show only log entries which point to known problems
```

Expand Down
46 changes: 46 additions & 0 deletions site/content/en/docs/Reference/Commands/pause.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: "pause"
linkTitle: "pause"
weight: 1
date: 2020-02-05
description: >
pause the Kubernetes control plane or other namespaces
---

### Overview

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.

### Usage

```
minikube pause [flags]
```

### Options

```
-n, ----namespaces strings namespaces to pause (default [kube-system,kubernetes-dashboard,storage-gluster,istio-operator])
-A, --all-namespaces If set, pause all namespaces
-h, --help help for pause
```

### Options inherited from parent commands

```
--alsologtostderr log to standard error as well as files
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--logtostderr log to standard error instead of files
-p, --profile string The name of the minikube VM being used. This can be set to allow having multiple instances of minikube independently. (default "minikube")
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level log level for V logs
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO

* [unpause](unpause.md)

Loading

0 comments on commit c195d5a

Please sign in to comment.