提交 614b0d00 编写于 作者: T Thomas Stromberg

Merge branch 'master' into move-the-docs2

language: go
os: linux
env:
- GOPROXY=https://proxy.golang.org
matrix:
include:
- go: 1.12.7
......
# Minikube Release Notes
# Release Notes
## Version 1.3.0 - 2019-08-05
* Added a new command: profile list [#4811](https://github.com/kubernetes/minikube/pull/4811)
* Update latest kubernetes version to v1.15.2 [#4986](https://github.com/kubernetes/minikube/pull/4986)
* Update latest kubernetes version to v1.15.1 [#4915](https://github.com/kubernetes/minikube/pull/4915)
* logs: Add container status & cruntime logs [#4960](https://github.com/kubernetes/minikube/pull/4960)
* Automatically set flags for MINIKUBE_ prefixed env vars [#4607](https://github.com/kubernetes/minikube/pull/4607)
* hyperv: Run "sudo poweroff" before stopping VM [#4758](https://github.com/kubernetes/minikube/pull/4758)
* Decrease ReasonableStartTime from 10 minutes to 5 minutes [#4961](https://github.com/kubernetes/minikube/pull/4961)
* Remove ingress-nginx default backend [#4786](https://github.com/kubernetes/minikube/pull/4786)
* Upgrade nginx ingress to 0.25.0 [#4785](https://github.com/kubernetes/minikube/pull/4785)
* Bump k8s.io/kubernetes to 1.15.0 [#4719](https://github.com/kubernetes/minikube/pull/4719)
* Upgrade Docker, from 18.09.7 to 18.09.8 [#4818](https://github.com/kubernetes/minikube/pull/4818)
* Upgrade Docker, from 18.09.6 to 18.09.7 [#4657](https://github.com/kubernetes/minikube/pull/4657)
* Upgrade crio to 1.15.0 [#4703](https://github.com/kubernetes/minikube/pull/4703)
* Update crictl to v1.15.0 [#4761](https://github.com/kubernetes/minikube/pull/4761)
* Upgrade Podman to 1.4 [#4610](https://github.com/kubernetes/minikube/pull/4610)
* Upgrade libmachine to master [#4817](https://github.com/kubernetes/minikube/pull/4817)
* Add linux packaging for the kvm2 driver binary [#4556](https://github.com/kubernetes/minikube/pull/4556)
* Unset profile when it is deleted [#4922](https://github.com/kubernetes/minikube/pull/4922)
* more reliable stop for none driver [#4871](https://github.com/kubernetes/minikube/pull/4871)
* Fix regression caused by registry-proxy [#4805](https://github.com/kubernetes/minikube/pull/4805)
* Warn if hyperkit version is old [#4691](https://github.com/kubernetes/minikube/pull/4691)
* Add warn if kvm driver version is old [#4676](https://github.com/kubernetes/minikube/pull/4676)
* Add T versions of the console convenience functions [#4796](https://github.com/kubernetes/minikube/pull/4796)
* Remove deprecated drivers: kvm-old and xhyve [#4781](https://github.com/kubernetes/minikube/pull/4781)
* Don't disable other container engines when --vm_driver=none [#4545](https://github.com/kubernetes/minikube/pull/4545)
* Proxy: handle lower case proxy env vars [#4602](https://github.com/kubernetes/minikube/pull/4602)
* virtualbox: Make DNS settings configurable [#4619](https://github.com/kubernetes/minikube/pull/4619)
* Add support to custom qemu uri on kvm2 driver [#4401](https://github.com/kubernetes/minikube/pull/4401)
* Update Ingress-NGINX to 0.24.1 Release [#4583](https://github.com/kubernetes/minikube/pull/4583)
A big thanks goes out to our crew of merry contributors:
- Aida Ghazizadeh
- Anders F Björklund
- Ben Ebsworth
- Benjamin Howell
- cclauss
- Christophe VILA
- Deepjyoti Mondal
- fang duan
- Francis
- Gustavo Belfort
- Himanshu Pandey
- Jituri, Pranav
- josedonizetti
- Jose Donizetti
- Kazuki Suda
- Kyle Bai
- Marcos Diez
- Medya Ghazizadeh
- Nabarun Pal
- Om Kumar
- Pranav Jituri
- RA489
- serhat çetinkaya
- Sharif Elgamal
- Stuart P. Bentley
- Thomas Strömberg
- Zoltán Reegn
## Version 1.2.0 - 2019-06-24
......
......@@ -14,7 +14,7 @@
# Bump these on release - and please check ISO_VERSION for correctness.
VERSION_MAJOR ?= 1
VERSION_MINOR ?= 2
VERSION_MINOR ?= 3
VERSION_BUILD ?= 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
......@@ -57,7 +57,7 @@ GOLINT_GOGC ?= 8
GOLINT_OPTIONS = --deadline 4m \
--build-tags "${MINIKUBE_INTEGRATION_BUILD_TAGS}" \
--enable goimports,gocritic,golint,gocyclo,interfacer,misspell,nakedret,stylecheck,unconvert,unparam \
--exclude 'variable on range scope.*in function literal|ifElseChain'
--exclude 'variable on range scope.*in function literal|ifElseChain'
export GO111MODULE := on
......
......@@ -23,9 +23,7 @@ minikube's [primary goals](https://github.com/kubernetes/minikube/blob/master/do
:mega: **Please fill out our [fast 5-question survey](https://forms.gle/Gg3hG5ZySw8c1C24A)** so that we can learn how & why you use minikube, and what improvements we should make. Thank you! :dancers:
* 2019-06-24 - v1.2.0 released! [[download](https://github.com/kubernetes/minikube/releases/tag/v1.2.0)] [[release notes](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md#version-120---2019-06-24)]
* 2019-06-07 - v1.1.1 released! [[download](https://github.com/kubernetes/minikube/releases/tag/v1.1.1)] [[release notes](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md#version-111---2019-06-07)]
* 2019-05-21 - v1.1.0 released! [[download](https://github.com/kubernetes/minikube/releases/tag/v1.1.0)] [[release notes](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md#version-110---2019-05-21)]
* 2019-08-05 - v1.3.0 released! [[download](https://github.com/kubernetes/minikube/releases/tag/v1.3.0)] [[release notes](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md#version-130---2019-08-05)]
## Features
......
......@@ -17,10 +17,6 @@ limitations under the License.
package config
import (
"encoding/json"
"fmt"
"io"
"os"
"strings"
"github.com/golang/glog"
......@@ -302,7 +298,7 @@ func AddToConfigMap(name string, images []string) error {
return err
}
// Set the values
configFile, err := config.ReadConfig()
cfg, err := config.ReadConfig()
if err != nil {
return err
}
......@@ -310,16 +306,16 @@ func AddToConfigMap(name string, images []string) error {
for _, image := range images {
newImages[image] = nil
}
if values, ok := configFile[name].(map[string]interface{}); ok {
if values, ok := cfg[name].(map[string]interface{}); ok {
for key := range values {
newImages[key] = nil
}
}
if err = s.setMap(configFile, name, newImages); err != nil {
if err = s.setMap(cfg, name, newImages); err != nil {
return err
}
// Write the values
return WriteConfig(configFile)
return config.WriteConfig(constants.ConfigFile, cfg)
}
// DeleteFromConfigMap deletes entries from a map in the config file
......@@ -329,45 +325,20 @@ func DeleteFromConfigMap(name string, images []string) error {
return err
}
// Set the values
configFile, err := config.ReadConfig()
cfg, err := config.ReadConfig()
if err != nil {
return err
}
values, ok := configFile[name]
values, ok := cfg[name]
if !ok {
return nil
}
for _, image := range images {
delete(values.(map[string]interface{}), image)
}
if err = s.setMap(configFile, name, values.(map[string]interface{})); err != nil {
if err = s.setMap(cfg, name, values.(map[string]interface{})); err != nil {
return err
}
// Write the values
return WriteConfig(configFile)
}
// WriteConfig writes a minikube config to the JSON file
func WriteConfig(m config.MinikubeConfig) error {
f, err := os.Create(constants.ConfigFile)
if err != nil {
return fmt.Errorf("create %s: %s", constants.ConfigFile, err)
}
defer f.Close()
err = encode(f, m)
if err != nil {
return fmt.Errorf("encode %s: %s", constants.ConfigFile, err)
}
return nil
}
func encode(w io.Writer, m config.MinikubeConfig) error {
b, err := json.MarshalIndent(m, "", " ")
if err != nil {
return err
}
_, err = w.Write(b)
return err
return config.WriteConfig(constants.ConfigFile, cfg)
}
......@@ -20,46 +20,8 @@ import (
"bytes"
"fmt"
"testing"
"k8s.io/minikube/pkg/minikube/constants"
)
type configTestCase struct {
data string
config map[string]interface{}
}
var configTestCases = []configTestCase{
{
data: `{
"memory": 2
}`,
config: map[string]interface{}{
"memory": 2,
},
},
{
data: `{
"ReminderWaitPeriodInHours": 99,
"cpus": 4,
"disk-size": "20g",
"log_dir": "/etc/hosts",
"show-libmachine-logs": true,
"v": 5,
"vm-driver": "kvm2"
}`,
config: map[string]interface{}{
"vm-driver": constants.DriverKvm2,
"cpus": 4,
"disk-size": "20g",
"v": 5,
"show-libmachine-logs": true,
"log_dir": "/etc/hosts",
"ReminderWaitPeriodInHours": 99,
},
},
}
func TestHiddenPrint(t *testing.T) {
testCases := []struct {
TestString string
......@@ -90,17 +52,3 @@ func TestHiddenPrint(t *testing.T) {
}
}
}
func TestWriteConfig(t *testing.T) {
var b bytes.Buffer
for _, tt := range configTestCases {
err := encode(&b, tt.config)
if err != nil {
t.Errorf("Error encoding: %v", err)
}
if b.String() != tt.data {
t.Errorf("Did not write config correctly, \n\n expected:\n %+v \n\n actual:\n %+v", tt.data, b.String())
}
b.Reset()
}
}
......@@ -19,6 +19,7 @@ package config
import (
"github.com/spf13/cobra"
pkgConfig "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
)
......@@ -71,5 +72,5 @@ func Set(name string, value string) error {
}
// Write the value
return WriteConfig(config)
return pkgConfig.WriteConfig(constants.ConfigFile, config)
}
......@@ -19,6 +19,7 @@ package config
import (
"github.com/spf13/cobra"
pkgConfig "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
)
......@@ -48,5 +49,5 @@ func Unset(name string) error {
return err
}
delete(m, name)
return WriteConfig(m)
return pkgConfig.WriteConfig(constants.ConfigFile, m)
}
......@@ -129,7 +129,7 @@ var dashboardCmd = &cobra.Command{
if dashboardURLMode {
out.Ln(url)
} else {
out.ErrT(out.Celebrate, "Opening %s in your default browser...", out.V{"url": url})
out.ErrT(out.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})
if err = browser.OpenURL(url); err != nil {
exit.WithCodeT(exit.Software, "failed to open browser: {{.error}}", out.V{"error": err})
}
......
......@@ -169,6 +169,7 @@ func initKubernetesFlags() {
// initDriverFlags inits the commandline flags for vm drivers
func initDriverFlags() {
startCmd.Flags().String(vmDriver, constants.DefaultVMDriver, fmt.Sprintf("VM driver is one of: %v", constants.SupportedVMDrivers))
startCmd.Flags().Bool(disableDriverMounts, false, "Disables the filesystem mounts provided by the hypervisors")
// kvm2
startCmd.Flags().String(kvmNetwork, "default", "The KVM network name. (only supported with KVM driver)")
......@@ -222,13 +223,13 @@ func platform() string {
s.WriteString(fmt.Sprintf("%s %s", strings.Title(hi.Platform), hi.PlatformVersion))
glog.Infof("hostinfo: %+v", hi)
} else {
glog.Errorf("gopshost.Info returned error: %v", err)
glog.Warningf("gopshost.Info returned error: %v", err)
s.WriteString(runtime.GOOS)
}
vsys, vrole, err := gopshost.Virtualization()
if err != nil {
glog.Errorf("gopshost.Virtualization returned error: %v", err)
glog.Warningf("gopshost.Virtualization returned error: %v", err)
} else {
glog.Infof("virtualization: %s %s", vsys, vrole)
}
......@@ -259,12 +260,11 @@ func runStart(cmd *cobra.Command, args []string) {
registryMirror = viper.GetStringSlice("registry_mirror")
}
vmDriver := viper.GetString(vmDriver)
if err := cmdcfg.IsValidDriver(runtime.GOOS, vmDriver); err != nil {
if err := cmdcfg.IsValidDriver(runtime.GOOS, viper.GetString(vmDriver)); err != nil {
exit.WithCodeT(
exit.Failure,
"The driver '{{.driver}}' is not supported on {{.os}}",
out.V{"driver": vmDriver, "os": runtime.GOOS},
out.V{"driver": viper.GetString(vmDriver), "os": runtime.GOOS},
)
}
......
[
{
"name": "v1.3.0",
"checksums": {
"darwin": "5bda29e2d990bb8ac9da1767143e228772adc45507d22a49b5af70b03e7db682",
"linux": "5aa7c5f0b6dd09348f7e2435b9618f6a916fbb573580619b393b514258771eab",
"windows": "d808b6e42e6f53c9338d135a352bebd4469634f33646d06e7cad3569330225cb"
}
},
{
"name": "v1.2.0",
"checksums": {
......
......@@ -11,15 +11,16 @@ minikube defaults to the latest stable version of Kubernetes. You may select a d
`minikube start --kubernetes-version=v1.10.13`
minikube follows the [Kubernetes Version and Version Skew Support Policy](https://kubernetes.io/docs/setup/version-skew-policy/), so we guarantee support for the latest build for the last 3 minor Kubernetes releases. When practical, minikube extends this policy two additional minor releases so that users can emulate legacy environments.
minikube follows the [Kubernetes Version and Version Skew Support Policy](https://kubernetes.io/docs/setup/version-skew-policy/), so we guarantee support for the latest build for the last 3 minor Kubernetes releases. When practical, minikube extends this policy three additional minor releases so that users can emulate legacy environments.
As of April 2019, this means that minikube supports and actively tests against the latest builds of:
As of August 2019, this means that minikube supports and actively tests against the latest builds of:
* v1.14 (default)
* v1.13
* v1.12
* v1.11 (best effort)
* v1.10 (best effort)
* v1.15.x (default)
* v1.14.x
* v1.13.x
* v1.12.x
* v1.11.x (best effort)
* v1.10.x (best effort)
For more up to date information, see `OldestKubernetesVersion` and `NewestKubernetesVersion` in [constants.go](https://github.com/kubernetes/minikube/blob/master/pkg/minikube/constants/constants.go)
......
......@@ -9,11 +9,12 @@ require (
github.com/blang/semver v3.5.0+incompatible
github.com/c4milo/gotoolkit v0.0.0-20170318115440-bcc06269efa9 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cheggaaa/pb v1.0.27
github.com/cloudfoundry-attic/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect
github.com/docker/docker v1.13.1 // indirect
github.com/docker/go-units v0.3.3
github.com/docker/machine v0.16.1-0.20190718054102-a555e4f7a8f5
github.com/docker/machine v0.7.1-0.20190718054102-a555e4f7a8f5 // version is 0.7.1 to pin to a555e4f7a8f5
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
......@@ -34,8 +35,8 @@ require (
github.com/johanneswuerbach/nfsexports v0.0.0-20181204082207-1aa528dcb345
github.com/libvirt/libvirt-go v3.4.0+incompatible
github.com/machine-drivers/docker-machine-driver-vmware v0.1.1
github.com/mattn/go-colorable v0.1.1 // indirect
github.com/mattn/go-isatty v0.0.5
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8
github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936
github.com/moby/hyperkit v0.0.0-20171020124204-a12cd7250bcd
github.com/olekukonko/tablewriter v0.0.0-20160923125401-bdcc175572fd
......@@ -47,6 +48,7 @@ require (
github.com/pmezard/go-difflib v1.0.0
github.com/samalba/dockerclient v0.0.0-20160414174713-91d7393ff859 // indirect
github.com/shirou/gopsutil v2.18.12+incompatible
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
github.com/sirupsen/logrus v1.4.1 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.3
......@@ -58,7 +60,7 @@ require (
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
golang.org/x/sync v0.0.0-20190423024810-112230192c58
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb
golang.org/x/text v0.3.2
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
......
......@@ -57,6 +57,7 @@ github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEe
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c/go.mod h1:Xe6ZsFhtM8HrDku0pxJ3/Lr51rwykrzgFwpmTzleatY=
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
github.com/cheggaaa/pb v1.0.27 h1:wIkZHkNfC7R6GI5w7l/PdAdzXzlrbcI3p8OAlnkTsnc=
github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=
github.com/client9/misspell v0.0.0-20170928000206-9ce5d979ffda/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
......@@ -105,8 +106,8 @@ github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh
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/libnetwork v0.0.0-20180830151422-a9cd636e3789/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8=
github.com/docker/machine v0.16.1-0.20190718054102-a555e4f7a8f5 h1:5OiV/JwT55JRKNJsM9HZrTlJH/TRp97Ee89ahtB78+w=
github.com/docker/machine v0.16.1-0.20190718054102-a555e4f7a8f5/go.mod h1:I8mPNDeK1uH+JTcUU7X0ZW8KiYz0jyAgNaeSJ1rCfDI=
github.com/docker/machine v0.7.1-0.20190718054102-a555e4f7a8f5 h1:/2G2PrqxKga8hAVGPri/5NEv24rvDwXoH5pjPXUBCpA=
github.com/docker/machine v0.7.1-0.20190718054102-a555e4f7a8f5/go.mod h1:I8mPNDeK1uH+JTcUU7X0ZW8KiYz0jyAgNaeSJ1rCfDI=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
......@@ -194,6 +195,7 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
......@@ -295,11 +297,11 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-shellwords v0.0.0-20180605041737-f8471b0a71de/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
......@@ -398,6 +400,8 @@ github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e/go.mod h
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM=
github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0=
......@@ -538,8 +542,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
......
......@@ -27,7 +27,7 @@ set -e
OS_ARCH="linux-amd64"
VM_DRIVER="kvm2"
JOB_NAME="Linux-KVM"
JOB_NAME="KVM_Linux"
PARALLEL_COUNT=4
# Download files and set permissions
......
......@@ -15,7 +15,7 @@
# limitations under the License.
# This script runs the integration tests on a Linux machine for the Virtualbox Driver
# This script runs the integration tests on a Linux machine for the none Driver
# The script expects the following env variables:
# MINIKUBE_LOCATION: GIT_COMMIT from upstream build.
......@@ -28,7 +28,7 @@ set -e
OS_ARCH="linux-amd64"
VM_DRIVER="none"
JOB_NAME="Linux-None"
JOB_NAME="none_Linux"
EXTRA_ARGS="--bootstrapper=kubeadm"
PARALLEL_COUNT=1
......
......@@ -15,7 +15,7 @@
# limitations under the License.
# This script runs the integration tests on a Linux machine for the Virtualbox Driver
# This script runs the integration tests on a Linux machine for the VirtualBox Driver
# The script expects the following env variables:
# MINIKUBE_LOCATION: GIT_COMMIT from upstream build.
......@@ -27,7 +27,7 @@ set -e
OS_ARCH="linux-amd64"
VM_DRIVER="virtualbox"
JOB_NAME="Linux-VirtualBox"
JOB_NAME="VirtualBox_Linux"
PARALLEL_COUNT=4
# Download files and set permissions
......
......@@ -24,19 +24,29 @@
# ghprbActualCommit: The commit hash, injected from the ghpbr plugin.
# access_token: The Github API access token. Injected by the Jenkins credential provider.
set -e
set +x
set -eux -o pipefail
if [ "${ghprbPullId}" == "master" ]; then
echo "not setting github status for continuous builds"
exit 0
fi
for job in "OSX-Virtualbox" "OSX-Hyperkit" "Linux-Virtualbox" "Linux-KVM" "Linux-None"; do
target_url="https://storage.googleapis.com/minikube-builds/logs/${ghprbPullId}/${job}.txt"
jobs=(
'HyperKit_macOS'
'Hyper-V_Windows'
'VirtualBox_Linux'
'VirtualBox_macOS'
'VirtualBox_Windows'
# 'KVM-GPU_Linux' - Disabled
'KVM_Linux'
'none_Linux'
)
for j in ${jobs[@]}; do
target_url="https://storage.googleapis.com/minikube-builds/logs/${ghprbPullId}/${j}.txt"
curl "https://api.github.com/repos/kubernetes/minikube/statuses/${ghprbActualCommit}?access_token=$access_token" \
-H "Content-Type: application/json" \
-X POST \
-d "{\"state\": \"pending\", \"description\": \"Jenkins\", \"target_url\": \"${target_url}\", \"context\": \"${job}\"}"
-d "{\"state\": \"pending\", \"description\": \"Jenkins\", \"target_url\": \"${target_url}\", \"context\": \"${j}\"}"
done
#!/bin/bash
# Copyright 2017 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="kvm"
JOB_NAME="Minishift-Linux-KVM"
BINARY=$(pwd)/out/minishift
EXTRA_FLAGS="--show-libmachine-logs"
# Download files and set permissions
mkdir -p out/
curl -L http://artifacts.ci.centos.org/minishift/minishift/master/latest/linux-amd64/minishift -o out/minishift
gsutil -m cp gs://minikube-builds/${MINIKUBE_LOCATION}/docker-machine-driver-* out/ || true
gsutil -m cp gs://minikube-builds/${MINIKUBE_LOCATION}/minikube-testing.iso out/ || true
# Set the executable bit on the minishift and driver binary
chmod +x out/minishift
chmod +x out/docker-machine-driver-* || true
# Get version information
./out/minishift version
# Remove pre-exist kube config files
rm -fr $HOME/.kube || true
ISO=https://storage.googleapis.com/minikube/iso/minikube-v0.24.0.iso
if [ -f $(pwd)/out/minikube-testing.iso ]; then
ISO=file://$(pwd)/out/minikube-testing.iso
fi
export MINIKUBE_WANTREPORTERRORPROMPT=False
./out/minishift delete --force || true
# Add the out/ directory to the PATH, for using new drivers.
export PATH="$(pwd)/out/":$PATH
# Linux cleanup
virsh -c qemu:///system list --all \
| sed -n '3,$ p' \
| cut -d' ' -f 7 \
| xargs -I {} sh -c "virsh -c qemu:///system destroy {}; virsh -c qemu:///system undefine {}" \
|| true
sudo virsh net-define /usr/share/libvirt/networks/default.xml || true
sudo virsh net-start default || true
sudo virsh net-list
# see what driver we are using
which docker-machine-driver-${VM_DRIVER} || true
result=$?
echo $result
function print_success_message() {
echo ""
echo " ------------ [ $1 - Passed ]"
echo ""
}
function exit_with_message() {
if [[ "$1" != 0 ]]; then
echo "$2"
result=1
fi
}
function assert_equal() {
if [ "$1" != "$2" ]; then
echo "Expected '$1' equal to '$2'"
result=1
fi
}
# http://www.linuxjournal.com/content/validating-ip-address-bash-script
function assert_valid_ip() {
local ip=$1
local valid=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
valid=$?
fi
if [[ "$valid" != 0 ]]; then
echo "IP '$1' is invalid"
result=1
fi
}
function verify_start_instance() {
$BINARY start --iso-url $ISO $EXTRA_FLAGS
exit_with_message "$?" "Error starting Minishift VM"
output=`$BINARY status | sed -n 1p`
assert_equal "$output" "Minishift: Running"
print_success_message "Starting VM"
}
function verify_stop_instance() {
$BINARY stop
exit_with_message "$?" "Error starting Minishift VM"
output=`$BINARY status | sed -n 1p`
assert_equal "$output" "Minishift: Stopped"
print_success_message "Stopping VM"
}
function verify_swap_space() {
output=`$BINARY ssh -- free | tail -n 1 | awk '{print $2}'`
if [ "$output" == "0" ]; then
echo "Expected '$output' not equal to 0"
result=1
fi
print_success_message "Swap space check"
}
function verify_ssh_connection() {
output=`$BINARY ssh -- echo hello`
assert_equal $output "hello"
print_success_message "SSH Connection"
}
function verify_vm_ip() {
output=`$BINARY ip`
assert_valid_ip $output
print_success_message "Getting VM IP"
}
function verify_cifs_installation() {
expected="mount.cifs version: 6.6"
output=`$BINARY ssh -- sudo /sbin/mount.cifs -V`
assert_equal "$output" "$expected"
print_success_message "CIFS installation"
}
function verify_nfs_installation() {
expected="mount.nfs: (linux nfs-utils 1.3.3)"
output=`$BINARY ssh -- sudo /sbin/mount.nfs -V /need/for/version`
assert_equal "$output" "$expected"
print_success_message "NFS installation"
}
function verify_bind_mount() {
output=`$BINARY ssh -- 'findmnt | grep "\[/var/lib/" | wc -l'`
assert_equal $output "11"
print_success_message "Bind mount check"
}
function verify_delete() {
$BINARY delete --force
exit_with_message "$?" "Error deleting Minishift VM"
output=`$BINARY status`
if [ "$1" != "$2" ]; then
echo "Expected '$1' equal to '$2'"
result=1
fi
print_success_message "Deleting VM"
}
function verify_sshfs_installation() {
expected="SSHFS version 2.5"
output=`$BINARY ssh -- sudo sshfs -V`
assert_equal "$output" "$expected"
print_success_message "SSHFS installation"
}
# Tests
set +e
verify_start_instance
verify_vm_ip
verify_cifs_installation
verify_nfs_installation
verify_sshfs_installation
verify_bind_mount
verify_swap_space
verify_delete
set -e
if [[ $result -eq 0 ]]; then
status="success"
else
status="failure"
fi
set +x
target_url="https://storage.googleapis.com/minikube-builds/logs/${MINIKUBE_LOCATION}/${JOB_NAME}.txt"
curl "https://api.github.com/repos/kubernetes/minikube/statuses/${COMMIT}?access_token=$access_token" \
-H "Content-Type: application/json" \
-X POST \
-d "{\"state\": \"$status\", \"description\": \"Jenkins\", \"target_url\": \"$target_url\", \"context\": \"${JOB_NAME}\"}"
set -x
exit $result
......@@ -28,7 +28,7 @@ set -e
OS_ARCH="darwin-amd64"
VM_DRIVER="hyperkit"
JOB_NAME="OSX-Hyperkit"
JOB_NAME="HyperKit_macOS"
EXTRA_ARGS="--bootstrapper=kubeadm"
EXTRA_START_ARGS=""
PARALLEL_COUNT=3
......
......@@ -15,7 +15,7 @@
# limitations under the License.
# This script runs the integration tests on an OSX machine for the Virtualbox Driver
# This script runs the integration tests on an macOS machine for the VirtualBox Driver
# The script expects the following env variables:
# MINIKUBE_LOCATION: GIT_COMMIT from upstream build.
......@@ -27,7 +27,7 @@
set -e
OS_ARCH="darwin-amd64"
VM_DRIVER="virtualbox"
JOB_NAME="OSX-Virtualbox"
JOB_NAME="VirtualBox_macOS"
EXTRA_ARGS="--bootstrapper=kubeadm"
PARALLEL_COUNT=3
......
......@@ -25,8 +25,8 @@ $env:result=$lastexitcode
If($env:result -eq 0){$env:status="success"}
Else {$env:status="failure"}
$env:target_url="https://storage.googleapis.com/minikube-builds/logs/$env:MINIKUBE_LOCATION/Windows-hyperv.txt"
$json = "{`"state`": `"$env:status`", `"description`": `"Jenkins`", `"target_url`": `"$env:target_url`", `"context`": `"Windows-hyperv`"}"
$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
Exit $env:result
......@@ -25,8 +25,8 @@ $env:result=$lastexitcode
If($env:result -eq 0){$env:status="success"}
Else {$env:status="failure"}
$env:target_url="https://storage.googleapis.com/minikube-builds/logs/$env:MINIKUBE_LOCATION/Windows-virtualbox.txt"
$json = "{`"state`": `"$env:status`", `"description`": `"Jenkins`", `"target_url`": `"$env:target_url`", `"context`": `"Windows-virtualbox`"}"
$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
Exit $env:result
# Copyright 2016 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.
mkdir -p out
gsutil.cmd -m cp gs://minikube-builds/$env:MINIKUBE_LOCATION/minikube-windows-amd64.exe out/
gsutil.cmd -m cp gs://minikube-builds/$env:MINIKUBE_LOCATION/e2e-windows-amd64.exe out/
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/testdata .
./out/minikube-windows-amd64.exe delete
out/e2e-windows-amd64.exe --% -minikube-start-args="--vm-driver=virtualbox --container-runtime=cri-o" -minikube-args="--v=10 --logtostderr --bootstrapper=kubeadm" -test.v -test.timeout=30m -binary=out/minikube-windows-amd64.exe
$env:result=$lastexitcode
# If the last exit code was 0->success, x>0->error
If($env:result -eq 0){$env:status="success"}
Else {$env:status="failure"}
$env:target_url="https://storage.googleapis.com/minikube-builds/logs/$env:MINIKUBE_LOCATION/Windows-Kubeadm-CRI-O.txt"
$json = "{`"state`": `"$env:status`", `"description`": `"Jenkins`", `"target_url`": `"$env:target_url`", `"context`": `"Windows-Kubeadm-CRI-O`"}"
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
Exit $env:result
......@@ -74,6 +74,20 @@ func get(name string, config MinikubeConfig) (string, error) {
return "", ErrKeyNotFound
}
// WriteConfig writes a minikube config to the JSON file
func WriteConfig(configFile string, m MinikubeConfig) error {
f, err := os.Create(configFile)
if err != nil {
return fmt.Errorf("create %s: %s", configFile, err)
}
defer f.Close()
err = encode(f, m)
if err != nil {
return fmt.Errorf("encode %s: %s", configFile, err)
}
return nil
}
// ReadConfig reads in the JSON minikube config
func ReadConfig() (MinikubeConfig, error) {
return readConfig(constants.ConfigFile)
......@@ -103,6 +117,17 @@ func decode(r io.Reader) (MinikubeConfig, error) {
return data, err
}
func encode(w io.Writer, m MinikubeConfig) error {
b, err := json.MarshalIndent(m, "", " ")
if err != nil {
return err
}
_, err = w.Write(b)
return err
}
// GetMachineName gets the machine name for the VM
func GetMachineName() string {
// REFACTOR NECESSARY: This function should not rely on globals.
......
......@@ -18,6 +18,8 @@ package config
import (
"bytes"
"io/ioutil"
"os"
"reflect"
"testing"
......@@ -46,7 +48,7 @@ var configTestCases = []configTestCase{
"log_dir": "/etc/hosts",
"show-libmachine-logs": true,
"v": 5,
"vm-driver": "kvm"
"vm-driver": "kvm2"
}`,
config: map[string]interface{}{
"vm-driver": constants.DriverKvm2,
......@@ -141,3 +143,47 @@ func Test_readConfig(t *testing.T) {
t.Errorf("Did not read config correctly,\n\n wanted %+v, \n\n got %+v", expectedConfig, mkConfig)
}
}
func TestWriteConfig(t *testing.T) {
configFile, err := ioutil.TempFile("/tmp", "configTest")
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
cfg := map[string]interface{}{
"vm-driver": constants.DriverKvm2,
"cpus": 4,
"disk-size": "20g",
"show-libmachine-logs": true,
"log_dir": "/etc/hosts",
}
err = WriteConfig(configFile.Name(), cfg)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
defer os.Remove(configFile.Name())
mkConfig, err := readConfig(configFile.Name())
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
if reflect.DeepEqual(cfg, mkConfig) || err != nil {
t.Errorf("Did not read config correctly,\n\n wanted %+v, \n\n got %+v", cfg, mkConfig)
}
}
func Test_encode(t *testing.T) {
var b bytes.Buffer
for _, tt := range configTestCases {
err := encode(&b, tt.config)
if err != nil {
t.Errorf("Error encoding: %v", err)
}
if b.String() != tt.data {
t.Errorf("Did not write config correctly, \n\n expected:\n %+v \n\n actual:\n %+v", tt.data, b.String())
}
b.Reset()
}
}
......@@ -176,10 +176,10 @@ 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.1"
var DefaultKubernetesVersion = "v1.15.2"
// NewestKubernetesVersion is the newest Kubernetes version to test against
var NewestKubernetesVersion = "v1.15.1"
var NewestKubernetesVersion = "v1.15.2"
// OldestKubernetesVersion is the oldest Kubernetes version to test against
var OldestKubernetesVersion = "v1.10.13"
......
......@@ -165,6 +165,7 @@ func logCommands(r cruntime.Manager, bs bootstrapper.Bootstrapper, length int, f
}
cmds[r.Name()] = r.SystemLogCmd(length)
// Works across container runtimes with good formatting
cmds["container status"] = "sudo crictl ps -a"
// Fallback to 'docker ps' if it fails (none driver)
cmds["container status"] = "sudo crictl ps -a || sudo docker ps -a"
return cmds
}
......@@ -87,7 +87,7 @@ var styles = map[StyleEnum]style{
Caching: {Prefix: "🤹 "},
StartingVM: {Prefix: "🔥 "},
StartingNone: {Prefix: "🤹 "},
Provisioner: {Prefix: "ℹ️ "},
Provisioner: {Prefix: "ℹ️ "},
Resetting: {Prefix: "🔄 "},
DeletingHost: {Prefix: "🔥 "},
Copying: {Prefix: "✨ "},
......
......@@ -17,13 +17,12 @@ limitations under the License.
package util
import (
"crypto"
"net/url"
"os"
"path/filepath"
"github.com/golang/glog"
download "github.com/jimmidyson/go-download"
"github.com/hashicorp/go-getter"
"github.com/pkg/errors"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/out"
......@@ -55,33 +54,35 @@ func (f DefaultDownloader) GetISOFileURI(isoURL string) string {
}
// CacheMinikubeISOFromURL downloads the ISO, if it doesn't exist in cache
func (f DefaultDownloader) CacheMinikubeISOFromURL(isoURL string) error {
if !f.ShouldCacheMinikubeISO(isoURL) {
glog.Infof("Not caching ISO, using %s", isoURL)
func (f DefaultDownloader) CacheMinikubeISOFromURL(url string) error {
if !f.ShouldCacheMinikubeISO(url) {
glog.Infof("Not caching ISO, using %s", url)
return nil
}
options := download.FileOptions{
Mkdirs: download.MkdirAll,
Options: download.Options{
ProgressBars: &download.ProgressBarOptions{
MaxWidth: 80,
},
},
urlWithChecksum := url
if url == constants.DefaultISOURL {
urlWithChecksum = url + "?checksum=file:" + constants.DefaultISOSHAURL
}
// Validate the ISO if it was the default URL, before writing it to disk.
if isoURL == constants.DefaultISOURL {
options.Checksum = constants.DefaultISOSHAURL
options.ChecksumHash = crypto.SHA256
}
dst := f.GetISOCacheFilepath(url)
// Predictable temp destination so that resume can function
tmpDst := dst + ".download"
out.T(out.ISODownload, "Downloading Minikube ISO ...")
if err := download.ToFile(isoURL, f.GetISOCacheFilepath(isoURL), options); err != nil {
return errors.Wrap(err, isoURL)
opts := []getter.ClientOption{getter.WithProgress(defaultProgressBar)}
client := &getter.Client{
Src: urlWithChecksum,
Dst: tmpDst,
Mode: getter.ClientModeFile,
Options: opts,
}
return nil
glog.Infof("full url: %s", urlWithChecksum)
out.T(out.ISODownload, "Downloading VM boot image ...")
if err := client.Get(); err != nil {
return errors.Wrap(err, url)
}
return os.Rename(tmpDst, dst)
}
// ShouldCacheMinikubeISO returns if we need to download the ISO
......
......@@ -175,7 +175,7 @@ func ReadConfigOrNew(filename string) (*api.Config, error) {
}
// WriteConfig encodes the configuration and writes it to the given file.
// If the file exists, it's contents will be overwritten.
// If the file exists, its contents will be overwritten.
func WriteConfig(config *api.Config, filename string) error {
if config == nil {
glog.Errorf("could not write to '%s': config can't be nil", filename)
......
......@@ -394,6 +394,107 @@ func TestDeleteKubeConfigContext(t *testing.T) {
}
}
func TestSetCurrentContext(t *testing.T) {
contextName := "minikube"
kubeConfigFile, err := ioutil.TempFile("/tmp", "kubeconfig")
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
defer os.Remove(kubeConfigFile.Name())
cfg, err := ReadConfigOrNew(kubeConfigFile.Name())
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
if cfg.CurrentContext != "" {
t.Errorf("Expected empty context but got %v", cfg.CurrentContext)
}
err = SetCurrentContext(kubeConfigFile.Name(), contextName)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
defer func() {
err := UnsetCurrentContext(kubeConfigFile.Name(), contextName)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
}()
cfg, err = ReadConfigOrNew(kubeConfigFile.Name())
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
if cfg.CurrentContext != contextName {
t.Errorf("Expected context name %s but got %s", contextName, cfg.CurrentContext)
}
}
func TestUnsetCurrentContext(t *testing.T) {
kubeConfigFile := "./testdata/kubeconfig/config1"
contextName := "minikube"
cfg, err := ReadConfigOrNew(kubeConfigFile)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
if cfg.CurrentContext != contextName {
t.Errorf("Expected context name %s but got %s", contextName, cfg.CurrentContext)
}
err = UnsetCurrentContext(kubeConfigFile, contextName)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
defer func() {
err := SetCurrentContext(kubeConfigFile, contextName)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
}()
cfg, err = ReadConfigOrNew(kubeConfigFile)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
if cfg.CurrentContext != "" {
t.Errorf("Expected empty context but got %v", cfg.CurrentContext)
}
}
func TestUnsetCurrentContextOnlyChangesIfProfileIsTheCurrentContext(t *testing.T) {
contextName := "minikube"
kubeConfigFile := "./testdata/kubeconfig/config2"
cfg, err := ReadConfigOrNew(kubeConfigFile)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
if cfg.CurrentContext != contextName {
t.Errorf("Expected context name %s but got %s", contextName, cfg.CurrentContext)
}
err = UnsetCurrentContext(kubeConfigFile, "differentContextName")
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
cfg, err = ReadConfigOrNew(kubeConfigFile)
if err != nil {
t.Fatalf("Error not expected but got %v", err)
}
if cfg.CurrentContext != contextName {
t.Errorf("Expected context name %s but got %s", contextName, cfg.CurrentContext)
}
}
// tempFile creates a temporary with the provided bytes as its contents.
// The caller is responsible for deleting file after use.
func tempFile(t *testing.T, data []byte) string {
......
/*
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 file implements a go-getter wrapper for cheggaaa progress bar
// based on:
// https://github.com/hashicorp/go-getter/blob/master/cmd/go-getter/progress_tracking.go
package util
import (
"fmt"
"io"
"path/filepath"
"sync"
"github.com/cheggaaa/pb"
"github.com/golang/glog"
"github.com/hashicorp/go-getter"
)
var defaultProgressBar getter.ProgressTracker = &progressBar{}
type progressBar struct {
lock sync.Mutex
pool *pb.Pool
pbs int
}
// TrackProgress instantiates a new progress bar that will
// display the progress of stream until closed.
// total can be 0.
func (cpb *progressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser {
cpb.lock.Lock()
defer cpb.lock.Unlock()
if cpb.pool == nil {
cpb.pool = pb.NewPool()
if err := cpb.pool.Start(); err != nil {
glog.Errorf("pool start: %v", err)
}
}
p := pb.New64(totalSize)
p.Set64(currentSize)
p.SetUnits(pb.U_BYTES)
p.Prefix(fmt.Sprintf(" %s:", filepath.Base(src)))
// Just a hair less than 80 (standard terminal width) for aesthetics & pasting into docs
p.SetWidth(78)
cpb.pool.Add(p)
reader := p.NewProxyReader(stream)
cpb.pbs++
return &readCloser{
Reader: reader,
close: func() error {
cpb.lock.Lock()
defer cpb.lock.Unlock()
p.Finish()
cpb.pbs--
if cpb.pbs <= 0 {
if err := cpb.pool.Stop(); err != nil {
glog.Errorf("pool stop: %v", err)
}
cpb.pool = nil
}
return nil
},
}
}
type readCloser struct {
io.Reader
close func() error
}
func (c *readCloser) Close() error { return c.close() }
apiVersion: v1
clusters: []
contexts: []
current-context: minikube
kind: Config
preferences: {}
users: []
apiVersion: v1
clusters: []
contexts: []
current-context: "minikube"
kind: Config
preferences: {}
users: []
......@@ -62,7 +62,7 @@ weight = 1
[params]
copyright = "The Kubernetes Authors -- "
# The latest release of minikube
latest_release = "1.2.0"
latest_release = "1.3.0"
privacy_policy = ""
......
......@@ -16,13 +16,13 @@ Download and install minikube to /usr/local/bin:
&& sudo install minikube-linux-amd64 /usr/local/bin/minikube
```
{{% /tab %}}
{{% tab "Debian/Ubuntu (apt)" %}}
{{% tab "Debian/Ubuntu (deb)" %}}
Download and install minikube:
```shell
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_{{< latest >}}.deb \
&& dpkg -i minikube_{{< latest >}}.deb
&& sudo dpkg -i minikube_{{< latest >}}.deb
```
{{% /tab %}}
......@@ -32,8 +32,8 @@ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_{{< la
Download and install minikube:
```shell
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_{{< latest >}}.rpm \
&& rpm -ivh minikube_{{< latest >}}.rpm
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-{{< latest >}}.rpm \
&& sudo rpm -ivh minikube-{{< latest >}}.rpm
```
{{% /tab %}}
......
<!-- start: minikube override body-end partial -->
<script language="javascript">initTabs();</script>
<!-- end: minikube override body-end partial -->
<!-- tabs implementation, borrowed from skaffold -->
<!-- start: minikube override head-end partial -->
<link href="/css/tabs.css" rel="stylesheet">
<script src="/js/tabs.js"></script>
<!-- end: minikube override head-end partial -->
// +build integration
// +build linux
/*
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 integration
import (
"os"
"os/user"
"path/filepath"
"strconv"
"strings"
"syscall"
"testing"
)
func TestNone(t *testing.T) {
if !isTestNoneDriver(t) {
t.Skip("Only test none driver.")
}
if shouldRunInParallel(t) {
t.Parallel()
}
err := os.Setenv("CHANGE_MINIKUBE_NONE_USER", "true")
if err != nil {
t.Fatalf("Failed to setup TestNone: set env: %v", err)
}
t.Run("output", testNoneStartOutput)
t.Run("minikube permissions", testNoneMinikubeFolderPermissions)
t.Run("kubeconfig permissions", testNoneKubeConfigPermissions)
}
func testNoneMinikubeFolderPermissions(t *testing.T) {
username := os.Getenv("SUDO_USER")
if username == "" {
t.Fatal("Expected $SUDO_USER env to not be empty")
}
u, err := user.Lookup(username)
if err != nil {
t.Fatalf("Getting user failed: %v", err)
}
uid, err := strconv.Atoi(u.Uid)
if err != nil {
t.Errorf("Failed to convert uid to int: %v", err)
}
info, err := os.Stat(filepath.Join(u.HomeDir, ".minikube"))
if err != nil {
t.Errorf("Failed to get .minikube dir info, %v", err)
}
fileUID := info.Sys().(*syscall.Stat_t).Uid
if fileUID != uint32(uid) {
t.Errorf("Expected .minikube folder user: %d, got: %d", uint32(uid), fileUID)
}
}
func testNoneKubeConfigPermissions(t *testing.T) {
username := os.Getenv("SUDO_USER")
if username == "" {
t.Fatal("Expected $SUDO_USER env to not be empty")
}
u, err := user.Lookup(username)
if err != nil {
t.Fatalf("Getting user failed: %v", err)
}
uid, err := strconv.Atoi(u.Uid)
if err != nil {
t.Errorf("Failed to convert uid to int: %v", err)
}
info, err := os.Stat(filepath.Join(u.HomeDir, ".kube/config"))
if err != nil {
t.Errorf("Failed to get .minikube dir info, %v", err)
}
fileUID := info.Sys().(*syscall.Stat_t).Uid
if fileUID != uint32(uid) {
t.Errorf("Expected .minikube folder user: %d, got: %d", uint32(uid), fileUID)
}
}
func testNoneStartOutput(t *testing.T) {
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
mk.RunCommand("delete", false)
stdout, stderr, err := mk.Start()
if err != nil {
t.Fatalf("failed to start minikube (for profile %s) failed : %v\nstdout: %s\nstderr: %s", p, err, stdout, stderr)
}
msg := "Configuring local host environment"
if !strings.Contains(stdout, msg) {
t.Errorf("Expected: stdout to contain %q, got: %s", msg, stdout)
}
msg = "may reduce system security and reliability."
if !strings.Contains(stderr, msg) {
t.Errorf("Expected: stderr to contain %q, got: %s", msg, stderr)
}
}
......@@ -44,7 +44,7 @@ func TestStartStop(t *testing.T) {
name string
args []string
}{
{"oldest", []string{ // nocache_oldest
{"oldest", []string{
"--cache-images=false",
fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion),
// default is the network created by libvirt, if we change the name minikube won't boot
......@@ -52,7 +52,7 @@ func TestStartStop(t *testing.T) {
"--kvm-network=default",
"--kvm-qemu-uri=qemu:///system",
}},
{"cni", []string{ // feature_gates_newest_cni
{"cni", []string{
"--feature-gates",
"ServerSideApply=true",
"--network-plugin=cni",
......@@ -60,15 +60,15 @@ func TestStartStop(t *testing.T) {
"--extra-config=kubeadm.pod-network-cidr=192.168.111.111/16",
fmt.Sprintf("--kubernetes-version=%s", constants.NewestKubernetesVersion),
}},
{"containerd", []string{ // containerd_and_non_default_apiserver_port
{"containerd", []string{
"--container-runtime=containerd",
"--docker-opt containerd=/var/run/containerd/containerd.sock",
"--apiserver-port=8444",
}},
{"crio", []string{ // crio_ignore_preflights
{"crio", []string{
"--container-runtime=crio",
"--extra-config",
"kubeadm.ignore-preflight-errors=SystemVerification",
"--disable-driver-mounts",
"--extra-config=kubeadm.ignore-preflight-errors=SystemVerification",
}},
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册