Merge branch 'master' into ilyaz/multiarch_kicbase

pull/9969/head
Ilya Zuyev 2021-01-08 12:18:22 -08:00
commit 9c4a76581c
18 changed files with 103 additions and 23 deletions

View File

@ -7,7 +7,7 @@ env:
GOPROXY: https://proxy.golang.org
jobs:
build_test_iso:
runs-on: [self-hosted, debian9, gcp]
runs-on: [self-hosted, debian9, baremetal, equinix]
steps:
- name: Clean up workspace
shell: bash

View File

@ -7,7 +7,7 @@ env:
GOPROXY: https://proxy.golang.org
jobs:
build_test_kic_image:
runs-on: [self-hosted, debian9, gcp]
runs-on: [self-hosted, debian9, baremetal, equinix]
steps:
- name: Clean up
shell: bash

View File

@ -668,6 +668,20 @@ func validateSpecifiedDriver(existing *config.ClusterConfig) {
return
}
out.WarningT("Deleting existing cluster {{.name}} with different driver {{.driver_name}} due to --delete-on-failure flag set by the user. ", out.V{"name": existing.Name, "driver_name": old})
if viper.GetBool(deleteOnFailure) {
// Start failed, delete the cluster
profile, err := config.LoadProfile(existing.Name)
if err != nil {
out.ErrT(style.Meh, `"{{.name}}" profile does not exist, trying anyways.`, out.V{"name": existing.Name})
}
err = deleteProfile(profile)
if err != nil {
out.WarningT("Failed to delete cluster {{.name}}.", out.V{"name": existing.Name})
}
}
exit.Advice(
reason.GuestDrvMismatch,
`The existing "{{.name}}" cluster was created using the "{{.old}}" driver, which is incompatible with requested "{{.new}}" driver.`,

View File

@ -152,7 +152,7 @@ func initMinikubeFlags() {
startCmd.Flags().IntP(nodes, "n", 1, "The number of nodes to spin up. Defaults to 1.")
startCmd.Flags().Bool(preload, true, "If set, download tarball of preloaded images if available to improve start time. Defaults to true.")
startCmd.Flags().Bool(deleteOnFailure, false, "If set, delete the current cluster if start fails and try again. Defaults to false.")
startCmd.Flags().Bool(forceSystemd, false, "If set, force the container runtime to use sytemd as cgroup manager. Currently available for docker and crio. Defaults to false.")
startCmd.Flags().Bool(forceSystemd, false, "If set, force the container runtime to use sytemd as cgroup manager. Defaults to false.")
startCmd.Flags().StringP(network, "", "", "network to run minikube with. Only available with the docker/podman drivers. If left empty, minikube will create a new network.")
startCmd.Flags().StringVarP(&outputFormat, "output", "o", "text", "Format to print stdout in. Options include: [text,json]")
startCmd.Flags().StringP(trace, "", "", "Send trace events. Options include: [gcp]")

View File

@ -20,7 +20,7 @@ spec:
containers:
- name: metrics-server
image: {{default "k8s.gcr.io" .ImageRepository}}/metrics-server-{{.Arch}}:v0.2.1
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command:
- /metrics-server
- --source=kubernetes.summary_api:https://kubernetes.default?kubeletHttps=true&kubeletPort=10250&insecure=true

4
go.mod
View File

@ -38,7 +38,7 @@ require (
github.com/google/slowjam v0.0.0-20200530021616-df27e642fe7b
github.com/google/uuid v1.1.1
github.com/googleapis/gnostic v0.3.0 // indirect
github.com/hashicorp/go-getter v1.4.2
github.com/hashicorp/go-getter v1.5.1
github.com/hashicorp/go-retryablehttp v0.6.6
github.com/hooklift/assert v0.0.0-20170704181755-9d1defd6d214 // indirect
github.com/hooklift/iso9660 v0.0.0-20170318115843-1cf07e5970d8
@ -109,7 +109,7 @@ replace (
github.com/docker/docker => github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7
github.com/docker/machine => github.com/machine-drivers/machine v0.7.1-0.20200810185219-7d42fed1b770
github.com/google/go-containerregistry => github.com/afbjorklund/go-containerregistry v0.1.2-0.20210101161202-de47504a564f
github.com/hashicorp/go-getter => github.com/afbjorklund/go-getter v1.4.1-0.20201020145846-c0da14b4bffe
github.com/hashicorp/go-getter => github.com/afbjorklund/go-getter v1.4.3-0.20201119203610-3f740b1eaf7d
github.com/samalba/dockerclient => github.com/sayboras/dockerclient v1.0.0
k8s.io/api => k8s.io/api v0.17.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3

6
go.sum
View File

@ -110,8 +110,8 @@ github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21 h1:Pgxfz/g+Xy
github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21/go.mod h1:Y8CJ3IwPIAkMhv/rRUWIlczaeqd9ty9yrl+nc2AbaL4=
github.com/afbjorklund/go-containerregistry v0.1.2-0.20210101161202-de47504a564f h1:wu0jbxgv7MVpK/NydAoD7nAYFyDigjpKO2uighXRx1E=
github.com/afbjorklund/go-containerregistry v0.1.2-0.20210101161202-de47504a564f/go.mod h1:BJ7VxR1hAhdiZBGGnvGETHEmFs1hzXc4VM1xjOPO9wA=
github.com/afbjorklund/go-getter v1.4.1-0.20201020145846-c0da14b4bffe h1:TdcuDqk4ArmYI8cbeeL/RM5BPciDOaWpGZoPoT3OziQ=
github.com/afbjorklund/go-getter v1.4.1-0.20201020145846-c0da14b4bffe/go.mod h1:3Ao9Hol5VJsmwJV5BF1GUrONbaOUmA+m1Nj2+0LuMAY=
github.com/afbjorklund/go-getter v1.4.3-0.20201119203610-3f740b1eaf7d h1:OrAMhXPmPx2ZO7PcwAYSfxZiirjhaBB3HnANHUvhuLo=
github.com/afbjorklund/go-getter v1.4.3-0.20201119203610-3f740b1eaf7d/go.mod h1:a7z7NPPfNQpJWcn4rSWFtdrSldqLdLPEF3d8nFMsSLM=
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
@ -988,6 +988,8 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok=
github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ultraware/funlen v0.0.1/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA=
github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=

View File

@ -17,8 +17,12 @@ limitations under the License.
package config
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/spf13/viper"
)
// TestListProfiles uses a different MINIKUBE_HOME with rest of tests since it relies on file list index
@ -135,7 +139,7 @@ func TestProfileNameInReservedKeywords(t *testing.T) {
}
func TestProfileExists(t *testing.T) {
miniDir, err := filepath.Abs("./testdata/.minikube2")
miniDir, err := filepath.Abs("./testdata/.minikube")
if err != nil {
t.Errorf("error getting dir path for ./testdata/.minikube : %v", err)
}
@ -162,7 +166,7 @@ func TestProfileExists(t *testing.T) {
}
func TestCreateEmptyProfile(t *testing.T) {
miniDir, err := filepath.Abs("./testdata/.minikube2")
miniDir, err := filepath.Abs("./testdata/.minikube")
if err != nil {
t.Errorf("error getting dir path for ./testdata/.minikube : %v", err)
}
@ -193,7 +197,7 @@ func TestCreateEmptyProfile(t *testing.T) {
}
func TestCreateProfile(t *testing.T) {
miniDir, err := filepath.Abs("./testdata/.minikube2")
miniDir, err := filepath.Abs("./testdata/.minikube")
if err != nil {
t.Errorf("error getting dir path for ./testdata/.minikube : %v", err)
}
@ -229,7 +233,7 @@ func TestCreateProfile(t *testing.T) {
}
func TestDeleteProfile(t *testing.T) {
miniDir, err := filepath.Abs("./testdata/.minikube2")
miniDir, err := filepath.Abs("./testdata/.minikube")
if err != nil {
t.Errorf("error getting dir path for ./testdata/.minikube : %v", err)
}
@ -256,7 +260,7 @@ func TestDeleteProfile(t *testing.T) {
}
func TestGetPrimaryControlPlane(t *testing.T) {
miniDir, err := filepath.Abs("./testdata/.minikube2")
miniDir, err := filepath.Abs("./testdata/.minikube")
if err != nil {
t.Errorf("error getting dir path for ./testdata/.minikube : %v", err)
}
@ -273,11 +277,35 @@ func TestGetPrimaryControlPlane(t *testing.T) {
}
for _, tc := range tests {
// To save converted config file from old style config at ./testdata/.minikube,
//rather than at env(MINIKUBE_HOME) which depends on test environment
originalMinikubeHomeEnv := os.Getenv("MINIKUBE_HOME")
err = os.Setenv("MINIKUBE_HOME", miniDir)
if err != nil {
t.Fatalf("Failed to set ENV \"MINIKUBE_HOME\" for %s", miniDir)
}
cc, err := DefaultLoader.LoadConfigFromFile(tc.profile, miniDir)
if err != nil {
t.Fatalf("Failed to load config for %s", tc.description)
}
// temporarily copy the original profile config
originalFilePath := profileFilePath(tc.profile, miniDir)
tempFilePath := filepath.Join(miniDir, "profiles", tc.profile, "config_temp.json")
d, err := ioutil.ReadFile(originalFilePath)
if err != nil {
t.Fatalf("Failed to read config file : %s", originalFilePath)
}
err = ioutil.WriteFile(tempFilePath, d, 0644)
if err != nil {
t.Fatalf("Failed to write temporal config file : %s", tempFilePath)
}
// get primary control plane
viper.Set(ProfileName, tc.profile)
n, err := PrimaryControlPlane(cc)
if err != nil {
t.Fatalf("Unexpexted error getting primary control plane: %v", err)
@ -295,6 +323,19 @@ func TestGetPrimaryControlPlane(t *testing.T) {
t.Errorf("Unexpected name. expected: %d, got: %d", tc.expectedPort, n.Port)
}
}
defer func() {
// reset profile config
err = os.Rename(tempFilePath, originalFilePath)
if err != nil {
t.Fatalf("Failed to move temporal config file (%s) to original file path (%s)",
tempFilePath, originalFilePath)
}
// reset env(MINIKUBE_HOME)
err = os.Setenv("MINIKUBE_HOME", originalMinikubeHomeEnv)
if err != nil {
t.Fatalf("Failed to reset ENV \"MINIKUBE_HOME\" to original value (%s)", originalMinikubeHomeEnv)
}
}()
}
}

View File

@ -76,7 +76,7 @@ oom_score = 0
enable_selinux = false
sandbox_image = "{{ .PodInfraContainerImage }}"
stats_collect_period = 10
systemd_cgroup = false
systemd_cgroup = {{ .SystemdCgroup }}
enable_tls_streaming = false
max_container_log_line_size = 16384
[plugins.cri.containerd]
@ -172,14 +172,20 @@ func (r *Containerd) Available() error {
}
// generateContainerdConfig sets up /etc/containerd/config.toml
func generateContainerdConfig(cr CommandRunner, imageRepository string, kv semver.Version) error {
func generateContainerdConfig(cr CommandRunner, imageRepository string, kv semver.Version, forceSystemd bool) error {
cPath := containerdConfigFile
t, err := template.New("containerd.config.toml").Parse(containerdConfigTemplate)
if err != nil {
return err
}
pauseImage := images.Pause(kv, imageRepository)
opts := struct{ PodInfraContainerImage string }{PodInfraContainerImage: pauseImage}
opts := struct {
PodInfraContainerImage string
SystemdCgroup bool
}{
PodInfraContainerImage: pauseImage,
SystemdCgroup: forceSystemd,
}
var b bytes.Buffer
if err := t.Execute(&b, opts); err != nil {
return err
@ -192,7 +198,7 @@ func generateContainerdConfig(cr CommandRunner, imageRepository string, kv semve
}
// Enable idempotently enables containerd on a host
func (r *Containerd) Enable(disOthers, _ bool) error {
func (r *Containerd) Enable(disOthers, forceSystemd bool) error {
if disOthers {
if err := disableOthers(r, r.Runner); err != nil {
klog.Warningf("disableOthers: %v", err)
@ -201,7 +207,7 @@ func (r *Containerd) Enable(disOthers, _ bool) error {
if err := populateCRIConfig(r.Runner, r.SocketPath()); err != nil {
return err
}
if err := generateContainerdConfig(r.Runner, r.ImageRepository, r.KubernetesVersion); err != nil {
if err := generateContainerdConfig(r.Runner, r.ImageRepository, r.KubernetesVersion, forceSystemd); err != nil {
return err
}
if err := enableIPForwarding(r.Runner); err != nil {

View File

@ -25,11 +25,13 @@ import (
"runtime"
"strconv"
"strings"
"time"
"cloud.google.com/go/storage"
"github.com/pkg/errors"
"google.golang.org/api/option"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/util/retry"
)
// Binary holds a minikube binary
@ -109,9 +111,11 @@ func newBinaryFromPR(pr string) (*Binary, error) {
path: localMinikubePath(i),
pr: i,
}
if err := b.download(); err != nil {
if err := retry.Expo(b.download, 1*time.Minute, 10*time.Minute); err != nil {
return nil, errors.Wrapf(err, "downloading binary")
}
return b, nil
}

View File

@ -50,7 +50,7 @@ minikube start [flags]
Valid kubeadm parameters: ignore-preflight-errors, dry-run, kubeconfig, kubeconfig-dir, node-name, cri-socket, experimental-upload-certs, certificate-key, rootfs, skip-phases, pod-network-cidr
--feature-gates string A set of key=value pairs that describe feature gates for alpha/experimental features.
--force Force minikube to perform possibly dangerous operations
--force-systemd If set, force the container runtime to use sytemd as cgroup manager. Currently available for docker and crio. Defaults to false.
--force-systemd If set, force the container runtime to use sytemd as cgroup manager. Defaults to false.
--host-dns-resolver Enable host resolver for NAT DNS requests (virtualbox driver only) (default true)
--host-only-cidr string The CIDR to be used for the minikube VM (virtualbox driver only) (default "192.168.99.1/24")
--host-only-nic-type string NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only) (default "virtio")

View File

@ -0,0 +1,13 @@
## Requirements
*VMware Workstation
## Driver Installation
First install the [VMware Workstation](https://www.vmware.com/in/products/workstation-pro/workstation-pro-evaluation.html)
After installation, start a cluster using the vmware driver:
```shell
minikube start --driver vmware
```

View File

@ -11,13 +11,13 @@ The vmware driver supports virtualization across all VMware based hypervisors.
{{% tabs %}}
{{% mactab %}}
{{% readfile file="/docs/drivers/includes/vmware_macos_usage.inc" %}}
{{% readfile file="/docs/drivers/includes/vmware_macos_usage.inc" %}} vmware_windows_usage.inc
{{% /mactab %}}
{{% linuxtab %}}
No documentation is available yet.
{{% /linuxtab %}}
{{% windowstab %}}
No documentation is available yet.
{{% readfile file="/docs/drivers/includes/vmware_windows_usage.inc" %}}
{{% /windowstab %}}
{{% /tabs %}}