fix merge conflict

pull/8831/head
Priya Wadhwa 2020-09-02 09:31:42 -04:00
commit ea5af644ec
227 changed files with 3649 additions and 2431 deletions

View File

@ -60,7 +60,7 @@ MINIKUBE_RELEASES_URL=https://github.com/kubernetes/minikube/releases/download
KERNEL_VERSION ?= 4.19.107
# latest from https://github.com/golangci/golangci-lint/releases
GOLINT_VERSION ?= v1.29.0
GOLINT_VERSION ?= v1.30.0
# Limit number of default jobs, to avoid the CI builds running out of memory
GOLINT_JOBS ?= 4
# see https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint

View File

@ -23,6 +23,7 @@ import (
"k8s.io/minikube/pkg/minikube/image"
"k8s.io/minikube/pkg/minikube/machine"
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/reason"
)
// cacheImageConfigKey is the config field name used to store which images we have previously cached
@ -43,11 +44,11 @@ var addCacheCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
// Cache and load images into docker daemon
if err := machine.CacheAndLoadImages(args); err != nil {
exit.WithError("Failed to cache and load images", err)
exit.Error(reason.InternalCacheLoad, "Failed to cache and load images", err)
}
// Add images to config file
if err := cmdConfig.AddToConfigMap(cacheImageConfigKey, args); err != nil {
exit.WithError("Failed to update config", err)
exit.Error(reason.InternalAddConfig, "Failed to update config", err)
}
},
}
@ -60,11 +61,11 @@ var deleteCacheCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
// Delete images from config file
if err := cmdConfig.DeleteFromConfigMap(cacheImageConfigKey, args); err != nil {
exit.WithError("Failed to delete images from config", err)
exit.Error(reason.InternalDelConfig, "Failed to delete images from config", err)
}
// Delete images from cache/images directory
if err := image.DeleteFromCacheDir(args); err != nil {
exit.WithError("Failed to delete images", err)
exit.Error(reason.HostDelCache, "Failed to delete images", err)
}
},
}
@ -77,7 +78,7 @@ var reloadCacheCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
err := node.CacheAndLoadImagesInConfig()
if err != nil {
exit.WithError("Failed to reload cached images", err)
exit.Error(reason.GuestCacheLoad, "Failed to reload cached images", err)
}
},
}

View File

@ -23,6 +23,7 @@ import (
"github.com/spf13/cobra"
cmdConfig "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/reason"
)
const defaultCacheListFormat = "{{.CacheImage}}\n"
@ -42,10 +43,10 @@ var listCacheCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
images, err := cmdConfig.ListConfigMap(cacheImageConfigKey)
if err != nil {
exit.WithError("Failed to get image map", err)
exit.Error(reason.InternalListConfig, "Failed to get image map", err)
}
if err := cacheList(images); err != nil {
exit.WithError("Failed to list cached images", err)
exit.Error(reason.InternalCacheList, "Failed to list cached images", err)
}
},
}

View File

@ -25,6 +25,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
)
const longDescription = `
@ -73,27 +74,26 @@ var completionCmd = &cobra.Command{
Long: longDescription,
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
exit.UsageT("Usage: minikube completion SHELL")
exit.Message(reason.Usage, "Usage: minikube completion SHELL")
}
if args[0] != "bash" && args[0] != "zsh" && args[0] != "fish" {
exit.UsageT("Sorry, completion support is not yet implemented for {{.name}}", out.V{"name": args[0]})
exit.Message(reason.Usage, "Sorry, completion support is not yet implemented for {{.name}}", out.V{"name": args[0]})
} else if args[0] == "bash" {
err := GenerateBashCompletion(os.Stdout, cmd.Parent())
if err != nil {
exit.WithError("bash completion failed", err)
exit.Error(reason.InternalCompletion, "bash completion failed", err)
}
} else if args[0] == "zsh" {
err := GenerateZshCompletion(os.Stdout, cmd.Parent())
if err != nil {
exit.WithError("zsh completion failed", err)
exit.Error(reason.InternalCompletion, "zsh completion failed", err)
}
} else {
err := GenerateFishCompletion(os.Stdout, cmd.Parent())
if err != nil {
exit.WithError("fish completion failed", err)
exit.Error(reason.InternalCompletion, "fish completion failed", err)
}
}
},
}

View File

@ -31,6 +31,8 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var addonListOutput string
@ -47,7 +49,7 @@ var addonsListCmd = &cobra.Command{
Long: "Lists all available minikube addons as well as their current statuses (enabled/disabled)",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 0 {
exit.UsageT("usage: minikube addons list")
exit.Message(reason.Usage, "usage: minikube addons list")
}
_, cc := mustload.Partial(ClusterFlagValue())
@ -57,7 +59,7 @@ var addonsListCmd = &cobra.Command{
case "json":
printAddonsJSON(cc)
default:
exit.WithCodeT(exit.BadUsage, fmt.Sprintf("invalid output format: %s. Valid values: 'list', 'json'", addonListOutput))
exit.Message(reason.Usage, fmt.Sprintf("invalid output format: %s. Valid values: 'list', 'json'", addonListOutput))
}
},
}
@ -115,7 +117,7 @@ var printAddonsList = func(cc *config.ClusterConfig) {
glog.Errorf("list profiles returned error: %v", err)
}
if len(v) > 1 {
out.T(out.Tip, "To see addons list for other profiles use: `minikube addons -p name list`")
out.T(style.Tip, "To see addons list for other profiles use: `minikube addons -p name list`")
}
}

View File

@ -25,7 +25,9 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/service"
"k8s.io/minikube/pkg/minikube/style"
)
var addonsConfigureCmd = &cobra.Command{
@ -34,7 +36,7 @@ var addonsConfigureCmd = &cobra.Command{
Long: "Configures the addon w/ADDON_NAME within minikube (example: minikube addons configure registry-creds). For a list of available addons use: minikube addons list ",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
exit.UsageT("usage: minikube addons configure ADDON_NAME")
exit.Message(reason.Usage, "usage: minikube addons configure ADDON_NAME")
}
addon := args[0]
@ -123,7 +125,6 @@ var addonsConfigureCmd = &cobra.Command{
"cloud": "ecr",
"kubernetes.io/minikube-addons": "registry-creds",
})
if err != nil {
out.FailureT("ERROR creating `registry-creds-ecr` secret: {{.error}}", out.V{"error": err})
}
@ -204,7 +205,7 @@ var addonsConfigureCmd = &cobra.Command{
}
if err := config.SaveProfile(profile, cfg); err != nil {
out.ErrT(out.FatalType, "Failed to save config {{.profile}}", out.V{"profile": profile})
out.ErrT(style.Fatal, "Failed to save config {{.profile}}", out.V{"profile": profile})
}
default:

View File

@ -21,6 +21,8 @@ import (
"k8s.io/minikube/pkg/addons"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var addonsDisableCmd = &cobra.Command{
@ -29,18 +31,18 @@ var addonsDisableCmd = &cobra.Command{
Long: "Disables the addon w/ADDON_NAME within minikube (example: minikube addons disable dashboard). For a list of available addons use: minikube addons list ",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
exit.UsageT("usage: minikube addons disable ADDON_NAME")
exit.Message(reason.Usage, "usage: minikube addons disable ADDON_NAME")
}
addon := args[0]
if addon == "heapster" {
exit.WithCodeT(exit.Unavailable, "The heapster addon is depreciated. please try to disable metrics-server instead")
exit.Message(reason.AddonUnsupported, "The heapster addon is depreciated. please try to disable metrics-server instead")
}
err := addons.SetAndSave(ClusterFlagValue(), addon, "false")
if err != nil {
exit.WithError("disable failed", err)
exit.Error(reason.InternalDisable, "disable failed", err)
}
out.T(out.AddonDisable, `"The '{{.minikube_addon}}' addon is disabled`, out.V{"minikube_addon": addon})
out.T(style.AddonDisable, `"The '{{.minikube_addon}}' addon is disabled`, out.V{"minikube_addon": addon})
},
}

View File

@ -24,6 +24,8 @@ import (
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var addonsEnableCmd = &cobra.Command{
@ -32,24 +34,24 @@ var addonsEnableCmd = &cobra.Command{
Long: "Enables the addon w/ADDON_NAME within minikube (example: minikube addons enable dashboard). For a list of available addons use: minikube addons list ",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
exit.UsageT("usage: minikube addons enable ADDON_NAME")
exit.Message(reason.Usage, "usage: minikube addons enable ADDON_NAME")
}
addon := args[0]
// replace heapster as metrics-server because heapster is deprecated
if addon == "heapster" {
out.T(out.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated")
out.T(style.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated")
addon = "metrics-server"
}
err := addons.SetAndSave(ClusterFlagValue(), addon, "true")
if err != nil {
exit.WithError("enable failed", err)
exit.Error(reason.InternalEnable, "enable failed", err)
}
if addon == "dashboard" {
tipProfileArg := ""
if ClusterFlagValue() != constants.DefaultClusterName {
tipProfileArg = fmt.Sprintf(" -p %s", ClusterFlagValue())
}
out.T(out.Tip, `Some dashboard features require the metrics-server addon. To enable all features please run:
out.T(style.Tip, `Some dashboard features require the metrics-server addon. To enable all features please run:
minikube{{.profileArg}} addons enable metrics-server
@ -57,7 +59,7 @@ var addonsEnableCmd = &cobra.Command{
}
out.T(out.AddonEnable, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon})
out.T(style.AddonEnable, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon})
},
}

View File

@ -26,7 +26,9 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/service"
"k8s.io/minikube/pkg/minikube/style"
)
var (
@ -47,13 +49,13 @@ var addonsOpenCmd = &cobra.Command{
PreRun: func(cmd *cobra.Command, args []string) {
t, err := template.New("addonsURL").Parse(addonsURLFormat)
if err != nil {
exit.UsageT("The value passed to --format is invalid: {{.error}}", out.V{"error": err})
exit.Message(reason.Usage, "The value passed to --format is invalid: {{.error}}", out.V{"error": err})
}
addonsURLTemplate = t
},
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
exit.UsageT("usage: minikube addons open ADDON_NAME")
exit.Message(reason.Usage, "usage: minikube addons open ADDON_NAME")
}
addonName := args[0]
@ -62,14 +64,14 @@ var addonsOpenCmd = &cobra.Command{
addon, ok := assets.Addons[addonName] // validate addon input
if !ok {
exit.WithCodeT(exit.Data, `addon '{{.name}}' is not a valid addon packaged with minikube.
exit.Message(reason.Usage, `addon '{{.name}}' is not a valid addon packaged with minikube.
To see the list of available addons run:
minikube addons list`, out.V{"name": addonName})
}
enabled := addon.IsEnabled(co.Config)
if !enabled {
exit.WithCodeT(exit.Unavailable, `addon '{{.name}}' is currently not enabled.
exit.Message(reason.AddonNotEnabled, `addon '{{.name}}' is currently not enabled.
To enable this addon run:
minikube addons enable {{.name}}`, out.V{"name": addonName})
}
@ -79,10 +81,10 @@ minikube addons enable {{.name}}`, out.V{"name": addonName})
serviceList, err := service.GetServiceListByLabel(cname, namespace, key, addonName)
if err != nil {
exit.WithCodeT(exit.Unavailable, "Error getting service with namespace: {{.namespace}} and labels {{.labelName}}:{{.addonName}}: {{.error}}", out.V{"namespace": namespace, "labelName": key, "addonName": addonName, "error": err})
exit.Message(reason.SvcList, "Error getting service with namespace: {{.namespace}} and labels {{.labelName}}:{{.addonName}}: {{.error}}", out.V{"namespace": namespace, "labelName": key, "addonName": addonName, "error": err})
}
if len(serviceList.Items) == 0 {
exit.WithCodeT(exit.Config, `This addon does not have an endpoint defined for the 'addons open' command.
exit.Message(reason.SvcNotFound, `This addon does not have an endpoint defined for the 'addons open' command.
You can add one by annotating a service with the label {{.labelName}}:{{.addonName}}`, out.V{"labelName": key, "addonName": addonName})
}
for i := range serviceList.Items {
@ -90,14 +92,14 @@ You can add one by annotating a service with the label {{.labelName}}:{{.addonNa
var urlString []string
if urlString, err = service.WaitForService(co.API, co.Config.Name, namespace, svc, addonsURLTemplate, addonsURLMode, https, wait, interval); err != nil {
exit.WithCodeT(exit.Unavailable, "Wait failed: {{.error}}", out.V{"error": err})
exit.Message(reason.SvcTimeout, "Wait failed: {{.error}}", out.V{"error": err})
}
if len(urlString) != 0 {
out.T(out.Celebrate, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
out.T(style.Celebrate, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
for _, url := range urlString {
if err := browser.OpenURL(url); err != nil {
exit.WithError(fmt.Sprintf("browser failed to open url %s", url), err)
exit.Error(reason.HostBrowser, fmt.Sprintf("browser failed to open url %s", url), err)
}
}
}

View File

@ -25,6 +25,8 @@ import (
"k8s.io/minikube/pkg/minikube/kubeconfig"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
// ProfileCmd represents the profile command
@ -35,26 +37,26 @@ var ProfileCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
profile := ClusterFlagValue()
out.T(out.Empty, profile)
out.T(style.Empty, profile)
os.Exit(0)
}
if len(args) > 1 {
exit.UsageT("usage: minikube profile [MINIKUBE_PROFILE_NAME]")
exit.Message(reason.Usage, "usage: minikube profile [MINIKUBE_PROFILE_NAME]")
}
profile := args[0]
// Check whether the profile name is container friendly
if !config.ProfileNameValid(profile) {
out.WarningT("Profile name '{{.profilename}}' is not valid", out.V{"profilename": profile})
exit.UsageT("Only alphanumeric and dashes '-' are permitted. Minimum 1 character, starting with alphanumeric.")
exit.Message(reason.Usage, "Only alphanumeric and dashes '-' are permitted. Minimum 1 character, starting with alphanumeric.")
}
/**
we need to add code over here to check whether the profile
name is in the list of reserved keywords
*/
if config.ProfileNameInReservedKeywords(profile) {
exit.WithCodeT(exit.Config, `Profile name "{{.profilename}}" is reserved keyword. To delete this profile, run: "{{.cmd}}"`, out.V{"profilename": profile, "cmd": mustload.ExampleCmd(profile, "delete")})
exit.Message(reason.InternalReservedProfile, `Profile name "{{.profilename}}" is reserved keyword. To delete this profile, run: "{{.cmd}}"`, out.V{"profilename": profile, "cmd": mustload.ExampleCmd(profile, "delete")})
}
if profile == "default" {
@ -68,18 +70,18 @@ var ProfileCmd = &cobra.Command{
}
if !config.ProfileExists(profile) {
out.ErrT(out.Tip, `if you want to create a profile you can by this command: minikube start -p {{.profile_name}}`, out.V{"profile_name": profile})
out.ErrT(style.Tip, `if you want to create a profile you can by this command: minikube start -p {{.profile_name}}`, out.V{"profile_name": profile})
os.Exit(0)
}
err := Set(config.ProfileName, profile)
if err != nil {
exit.WithError("Setting profile failed", err)
exit.Error(reason.InternalConfigSet, "Setting profile failed", err)
}
cc, err := config.Load(profile)
// might err when loading older version of cfg file that doesn't have KeepContext field
if err != nil && !config.IsNotExist(err) {
out.ErrT(out.Sad, `Error loading profile config: {{.error}}`, out.V{"error": err})
out.ErrT(style.Sad, `Error loading profile config: {{.error}}`, out.V{"error": err})
}
if err == nil {
if cc.KeepContext {
@ -88,7 +90,7 @@ var ProfileCmd = &cobra.Command{
} else {
err := kubeconfig.SetCurrentContext(profile, kubeconfig.PathFromEnv())
if err != nil {
out.ErrT(out.Sad, `Error while setting kubectl current context : {{.error}}`, out.V{"error": err})
out.ErrT(style.Sad, `Error while setting kubectl current context : {{.error}}`, out.V{"error": err})
}
}
out.SuccessT("minikube profile was successfully set to {{.profile_name}}", out.V{"profile_name": profile})

View File

@ -28,36 +28,33 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/machine"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
"github.com/golang/glog"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
)
var (
output string
)
var output string
var profileListCmd = &cobra.Command{
Use: "list",
Short: "Lists all minikube profiles.",
Long: "Lists all valid minikube profiles and detects all possible invalid profiles.",
Run: func(cmd *cobra.Command, args []string) {
switch strings.ToLower(output) {
case "json":
printProfilesJSON()
case "table":
printProfilesTable()
default:
exit.WithCodeT(exit.BadUsage, fmt.Sprintf("invalid output format: %s. Valid values: 'table', 'json'", output))
exit.Message(reason.Usage, fmt.Sprintf("invalid output format: %s. Valid values: 'table', 'json'", output))
}
},
}
var printProfilesTable = func() {
var validData [][]string
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Profile", "VM Driver", "Runtime", "IP", "Port", "Version", "Status"})
@ -67,7 +64,7 @@ var printProfilesTable = func() {
validProfiles, invalidProfiles, err := config.ListProfiles()
if len(validProfiles) == 0 || err != nil {
exit.UsageT("No minikube profile was found. You can create one using `minikube start`.")
exit.Message(reason.Usage, "No minikube profile was found. You can create one using `minikube start`.")
}
api, err := machine.NewAPIClient()
if err != nil {
@ -78,7 +75,7 @@ var printProfilesTable = func() {
for _, p := range validProfiles {
cp, err := config.PrimaryControlPlane(p.Config)
if err != nil {
exit.WithError("error getting primary control plane", err)
exit.Error(reason.GuestCpConfig, "error getting primary control plane", err)
}
p.Status, err = machine.Status(api, driver.MachineName(*p.Config, cp))
if err != nil {
@ -93,9 +90,9 @@ var printProfilesTable = func() {
if invalidProfiles != nil {
out.WarningT("Found {{.number}} invalid profile(s) ! ", out.V{"number": len(invalidProfiles)})
for _, p := range invalidProfiles {
out.ErrT(out.Empty, "\t "+p.Name)
out.ErrT(style.Empty, "\t "+p.Name)
}
out.ErrT(out.Tip, "You can delete them using the following command(s): ")
out.ErrT(style.Tip, "You can delete them using the following command(s): ")
for _, p := range invalidProfiles {
out.Err(fmt.Sprintf("\t $ minikube delete -p %s \n", p.Name))
}
@ -105,7 +102,6 @@ var printProfilesTable = func() {
if err != nil {
glog.Warningf("error loading profiles: %v", err)
}
}
var printProfilesJSON = func() {
@ -119,7 +115,7 @@ var printProfilesJSON = func() {
for _, v := range validProfiles {
cp, err := config.PrimaryControlPlane(v.Config)
if err != nil {
exit.WithError("error getting primary control plane", err)
exit.Error(reason.GuestCpConfig, "error getting primary control plane", err)
}
status, err := machine.Status(api, driver.MachineName(*v.Config, cp))
if err != nil {
@ -143,7 +139,7 @@ var printProfilesJSON = func() {
invalid = []*config.Profile{}
}
var body = map[string]interface{}{}
body := map[string]interface{}{}
if err == nil || config.IsNotExist(err) {
body["valid"] = valid
@ -154,7 +150,7 @@ var printProfilesJSON = func() {
body["error"] = err
jsonString, _ := json.Marshal(body)
out.String(string(jsonString))
os.Exit(exit.Failure)
os.Exit(reason.ExGuestError)
}
}

View File

@ -23,6 +23,7 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
)
var configSetCmd = &cobra.Command{
@ -32,14 +33,14 @@ var configSetCmd = &cobra.Command{
These values can be overwritten by flags or environment variables at runtime.`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) < 2 {
exit.UsageT("not enough arguments ({{.ArgCount}}).\nusage: minikube config set PROPERTY_NAME PROPERTY_VALUE", out.V{"ArgCount": len(args)})
exit.Message(reason.Usage, "not enough arguments ({{.ArgCount}}).\nusage: minikube config set PROPERTY_NAME PROPERTY_VALUE", out.V{"ArgCount": len(args)})
}
if len(args) > 2 {
exit.UsageT("toom any arguments ({{.ArgCount}}).\nusage: minikube config set PROPERTY_NAME PROPERTY_VALUE", out.V{"ArgCount": len(args)})
exit.Message(reason.Usage, "toom any arguments ({{.ArgCount}}).\nusage: minikube config set PROPERTY_NAME PROPERTY_VALUE", out.V{"ArgCount": len(args)})
}
err := Set(args[0], args[1])
if err != nil {
exit.WithError("Set failed", err)
exit.Error(reason.InternalConfigSet, "Set failed", err)
}
},
}

View File

@ -21,6 +21,7 @@ import (
config "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/reason"
)
var configUnsetCmd = &cobra.Command{
@ -29,11 +30,11 @@ var configUnsetCmd = &cobra.Command{
Long: "unsets PROPERTY_NAME from the minikube config file. Can be overwritten by flags or environmental variables",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
exit.UsageT("usage: minikube config unset PROPERTY_NAME")
exit.Message(reason.Usage, "usage: minikube config unset PROPERTY_NAME")
}
err := Unset(args[0])
if err != nil {
exit.WithError("unset failed", err)
exit.Error(reason.InternalConfigUnset, "unset failed", err)
}
},
}

View File

@ -24,6 +24,7 @@ import (
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/reason"
)
const defaultConfigViewFormat = "- {{.ConfigKey}}: {{.ConfigValue}}\n"
@ -43,7 +44,7 @@ var configViewCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
err := View()
if err != nil {
exit.WithError("config view failed", err)
exit.Error(reason.InternalConfigView, "config view failed", err)
}
},
}
@ -64,12 +65,12 @@ func View() error {
for k, v := range cfg {
tmpl, err := template.New("view").Parse(viewFormat)
if err != nil {
exit.WithError("Error creating view template", err)
exit.Error(reason.InternalViewTmpl, "Error creating view template", err)
}
viewTmplt := ViewTemplate{k, v}
err = tmpl.Execute(os.Stdout, viewTmplt)
if err != nil {
exit.WithError("Error executing view template", err)
exit.Error(reason.InternalViewExec, "Error executing view template", err)
}
}
return nil

View File

@ -31,12 +31,14 @@ import (
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/addons"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/pkg/minikube/browser"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/proxy"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/service"
"k8s.io/minikube/pkg/util/retry"
)
@ -72,47 +74,47 @@ var dashboardCmd = &cobra.Command{
if !enabled {
// Send status messages to stderr for folks re-using this output.
out.ErrT(out.Enabling, "Enabling dashboard ...")
out.ErrT(style.Enabling, "Enabling dashboard ...")
// Enable the dashboard add-on
err = addons.SetAndSave(cname, "dashboard", "true")
if err != nil {
exit.WithError("Unable to enable dashboard", err)
exit.Error(reason.InternalAddonEnable, "Unable to enable dashboard", err)
}
}
ns := "kubernetes-dashboard"
svc := "kubernetes-dashboard"
out.ErrT(out.Verifying, "Verifying dashboard health ...")
out.ErrT(style.Verifying, "Verifying dashboard health ...")
checkSVC := func() error { return service.CheckService(cname, ns, svc) }
// for slow machines or parallels in CI to avoid #7503
if err = retry.Expo(checkSVC, 100*time.Microsecond, time.Minute*10); err != nil {
exit.WithCodeT(exit.Unavailable, "dashboard service is not running: {{.error}}", out.V{"error": err})
exit.Message(reason.SvcCheckTimeout, "dashboard service is not running: {{.error}}", out.V{"error": err})
}
out.ErrT(out.Launch, "Launching proxy ...")
out.ErrT(style.Launch, "Launching proxy ...")
p, hostPort, err := kubectlProxy(kubectlVersion, cname)
if err != nil {
exit.WithError("kubectl proxy", err)
exit.Error(reason.HostKubectlProxy, "kubectl proxy", err)
}
url := dashboardURL(hostPort, ns, svc)
out.ErrT(out.Verifying, "Verifying proxy health ...")
out.ErrT(style.Verifying, "Verifying proxy health ...")
chkURL := func() error { return checkURL(url) }
if err = retry.Expo(chkURL, 100*time.Microsecond, 10*time.Minute); err != nil {
exit.WithCodeT(exit.Unavailable, "{{.url}} is not accessible: {{.error}}", out.V{"url": url, "error": err})
exit.Message(reason.SvcURLTimeout, "{{.url}} is not accessible: {{.error}}", out.V{"url": url, "error": err})
}
//check if current user is root
// check if current user is root
user, err := user.Current()
if err != nil {
exit.WithError("Unable to get current user", err)
exit.Error(reason.HostCurrentUser, "Unable to get current user", err)
}
if dashboardURLMode || user.Uid == "0" {
out.Ln(url)
} else {
out.T(out.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})
out.T(style.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})
exit.Message(reason.HostBrowser, "failed to open browser: {{.error}}", out.V{"error": err})
}
}

View File

@ -45,10 +45,14 @@ import (
"k8s.io/minikube/pkg/minikube/machine"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var deleteAll bool
var purge bool
var (
deleteAll bool
purge bool
)
// deleteCmd represents the delete command
var deleteCmd = &cobra.Command{
@ -85,7 +89,7 @@ func init() {
deleteCmd.Flags().BoolVar(&purge, "purge", false, "Set this flag to delete the '.minikube' folder from your user directory.")
if err := viper.BindPFlags(deleteCmd.Flags()); err != nil {
exit.WithError("unable to bind flags", err)
exit.Error(reason.InternalBindFlags, "unable to bind flags", err)
}
RootCmd.AddCommand(deleteCmd)
}
@ -124,9 +128,9 @@ func deleteContainersAndVolumes(ociBin string) {
// runDelete handles the executes the flow of "minikube delete"
func runDelete(cmd *cobra.Command, args []string) {
if len(args) > 0 {
exit.UsageT("Usage: minikube delete")
exit.Message(reason.Usage, "Usage: minikube delete")
}
//register.SetEventLogPath(localpath.EventLog(ClusterFlagValue()))
// register.SetEventLogPath(localpath.EventLog(ClusterFlagValue()))
register.Reg.SetStep(register.Deleting)
validProfiles, invalidProfiles, err := config.ListProfiles()
@ -137,11 +141,11 @@ func runDelete(cmd *cobra.Command, args []string) {
// in the case user has more than 1 profile and runs --purge
// to prevent abandoned VMs/containers, force user to run with delete --all
if purge && len(profilesToDelete) > 1 && !deleteAll {
out.ErrT(out.Notice, "Multiple minikube profiles were found - ")
out.ErrT(style.Notice, "Multiple minikube profiles were found - ")
for _, p := range profilesToDelete {
out.T(out.Notice, " - {{.profile}}", out.V{"profile": p.Name})
out.T(style.Notice, " - {{.profile}}", out.V{"profile": p.Name})
}
exit.UsageT("Usage: minikube delete --all --purge")
exit.Message(reason.Usage, "Usage: minikube delete --all --purge")
}
if deleteAll {
@ -154,11 +158,11 @@ func runDelete(cmd *cobra.Command, args []string) {
if len(errs) > 0 {
HandleDeletionErrors(errs)
} else {
out.T(out.DeletingHost, "Successfully deleted all profiles")
out.T(style.DeletingHost, "Successfully deleted all profiles")
}
} else {
if len(args) > 0 {
exit.UsageT("usage: minikube delete")
exit.Message(reason.Usage, "usage: minikube delete")
}
cname := ClusterFlagValue()
@ -166,7 +170,7 @@ func runDelete(cmd *cobra.Command, args []string) {
orphan := false
if err != nil {
out.ErrT(out.Meh, `"{{.name}}" profile does not exist, trying anyways.`, out.V{"name": cname})
out.ErrT(style.Meh, `"{{.name}}" profile does not exist, trying anyways.`, out.V{"name": cname})
orphan = true
}
@ -193,9 +197,9 @@ func runDelete(cmd *cobra.Command, args []string) {
func purgeMinikubeDirectory() {
glog.Infof("Purging the '.minikube' directory located at %s", localpath.MiniPath())
if err := os.RemoveAll(localpath.MiniPath()); err != nil {
exit.WithError("unable to delete minikube config folder", err)
exit.Error(reason.HostPurge, "unable to delete minikube config folder", err)
}
out.T(out.Deleted, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", out.V{"minikubeDirectory": localpath.MiniPath()})
out.T(style.Deleted, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", out.V{"minikubeDirectory": localpath.MiniPath()})
}
// DeleteProfiles deletes one or more profiles
@ -204,7 +208,6 @@ func DeleteProfiles(profiles []*config.Profile) []error {
var errs []error
for _, profile := range profiles {
err := deleteProfile(profile)
if err != nil {
mm, loadErr := machine.LoadMachine(profile.Name)
@ -244,7 +247,7 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
cs, err := oci.ListContainersByLabel(bin, delLabel)
if err == nil && len(cs) > 0 {
for _, c := range cs {
out.T(out.DeletingHost, `Deleting container "{{.name}}" ...`, out.V{"name": cname})
out.T(style.DeletingHost, `Deleting container "{{.name}}" ...`, out.V{"name": cname})
err := oci.DeleteContainer(bin, c)
if err != nil { // it will error if there is no container to delete
glog.Errorf("error deleting container %q. You may want to delete it manually :\n%v", cname, err)
@ -279,7 +282,7 @@ func deleteProfile(profile *config.Profile) error {
// if driver is oci driver, delete containers and volumes
if driver.IsKIC(profile.Config.Driver) {
out.T(out.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver})
out.T(style.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver})
for _, n := range profile.Config.Nodes {
machineName := driver.MachineName(*profile.Config, n)
deletePossibleKicLeftOver(machineName, profile.Config.Driver)
@ -330,7 +333,7 @@ func deleteProfile(profile *config.Profile) error {
if err := deleteContext(profile.Name); err != nil {
return err
}
out.T(out.Deleted, `Removed all traces of the "{{.name}}" cluster.`, out.V{"name": profile.Name})
out.T(style.Deleted, `Removed all traces of the "{{.name}}" cluster.`, out.V{"name": profile.Name})
return nil
}
@ -346,7 +349,7 @@ func deleteHosts(api libmachine.API, cc *config.ClusterConfig) {
glog.Infof("Host %s does not exist. Proceeding ahead with cleanup.", machineName)
default:
out.FailureT("Failed to delete cluster: {{.error}}", out.V{"error": err})
out.T(out.Notice, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName})
out.T(style.Notice, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName})
}
}
}
@ -377,7 +380,7 @@ func deleteContext(machineName string) error {
}
func deleteInvalidProfile(profile *config.Profile) []error {
out.T(out.DeletingHost, "Trying to delete invalid profile {{.profile}}", out.V{"profile": profile.Name})
out.T(style.DeletingHost, "Trying to delete invalid profile {{.profile}}", out.V{"profile": profile.Name})
var errs []error
pathToProfile := config.ProfileFolderPath(profile.Name, localpath.MiniPath())
@ -403,7 +406,7 @@ func profileDeletionErr(cname string, additionalInfo string) error {
}
func uninstallKubernetes(api libmachine.API, cc config.ClusterConfig, n config.Node, bsName string) error {
out.T(out.Resetting, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName})
out.T(style.Resetting, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName})
host, err := machine.LoadHost(api, driver.MachineName(cc, n))
if err != nil {
return DeletionError{Err: fmt.Errorf("unable to load host: %v", err), Errtype: MissingCluster}
@ -453,19 +456,19 @@ func handleSingleDeletionError(err error) {
case Fatal:
out.FatalT(deletionError.Error())
case MissingProfile:
out.ErrT(out.Sad, deletionError.Error())
out.ErrT(style.Sad, deletionError.Error())
case MissingCluster:
out.ErrT(out.Meh, deletionError.Error())
out.ErrT(style.Meh, deletionError.Error())
default:
out.FatalT(deletionError.Error())
}
} else {
exit.WithError("Could not process error from failed deletion", err)
exit.Error(reason.GuestDeletion, "Could not process error from failed deletion", err)
}
}
func handleMultipleDeletionErrors(errors []error) {
out.ErrT(out.Sad, "Multiple errors deleting profiles")
out.ErrT(style.Sad, "Multiple errors deleting profiles")
for _, err := range errors {
deletionError, ok := err.(DeletionError)
@ -473,7 +476,7 @@ func handleMultipleDeletionErrors(errors []error) {
if ok {
glog.Errorln(deletionError.Error())
} else {
exit.WithError("Could not process errors from failed deletion", err)
exit.Error(reason.GuestDeletion, "Could not process errors from failed deletion", err)
}
}
}
@ -481,10 +484,10 @@ func handleMultipleDeletionErrors(errors []error) {
func deleteProfileDirectory(profile string) {
machineDir := filepath.Join(localpath.MiniPath(), "machines", profile)
if _, err := os.Stat(machineDir); err == nil {
out.T(out.DeletingHost, `Removing {{.directory}} ...`, out.V{"directory": machineDir})
out.T(style.DeletingHost, `Removing {{.directory}} ...`, out.V{"directory": machineDir})
err := os.RemoveAll(machineDir)
if err != nil {
exit.WithError("Unable to remove machine directory", err)
exit.Error(reason.GuestProfileDeletion, "Unable to remove machine directory", err)
}
}
}

View File

@ -38,6 +38,7 @@ import (
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/shell"
"k8s.io/minikube/pkg/minikube/sysinit"
)
@ -73,7 +74,7 @@ type EnvNoProxyGetter struct{}
func dockerShellCfgSet(ec DockerEnvConfig, envMap map[string]string) *DockerShellConfig {
profile := ec.profile
const usgPlz = "To point your shell to minikube's docker-daemon, run:"
var usgCmd = fmt.Sprintf("minikube -p %s docker-env", profile)
usgCmd := fmt.Sprintf("minikube -p %s docker-env", profile)
s := &DockerShellConfig{
Config: *shell.CfgSet(ec.EnvConfig, usgPlz, usgCmd),
}
@ -123,7 +124,7 @@ func isDockerActive(r command.Runner) bool {
func mustRestartDocker(name string, runner command.Runner) {
if err := sysinit.New(runner).Restart("docker"); err != nil {
exit.WithCodeT(exit.Unavailable, `The Docker service within '{{.name}}' is not active`, out.V{"name": name})
exit.Message(reason.RuntimeRestart, `The Docker service within '{{.name}}' is not active`, out.V{"name": name})
}
}
@ -139,7 +140,7 @@ var dockerEnvCmd = &cobra.Command{
if dockerUnset {
if err := dockerUnsetScript(DockerEnvConfig{EnvConfig: sh}, os.Stdout); err != nil {
exit.WithError("Error generating unset output", err)
exit.Error(reason.InternalEnvScript, "Error generating unset output", err)
}
return
}
@ -149,15 +150,15 @@ var dockerEnvCmd = &cobra.Command{
driverName := co.CP.Host.DriverName
if driverName == driver.None {
exit.UsageT(`'none' driver does not support 'minikube docker-env' command`)
exit.Message(reason.EnvDriverConflict, `'none' driver does not support 'minikube docker-env' command`)
}
if len(co.Config.Nodes) > 1 {
exit.WithCodeT(exit.BadUsage, `The docker-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/`)
exit.Message(reason.EnvMultiConflict, `The docker-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/`)
}
if co.Config.KubernetesConfig.ContainerRuntime != "docker" {
exit.WithCodeT(exit.BadUsage, `The docker-env command is only compatible with the "docker" runtime, but this cluster was configured to use the "{{.runtime}}" runtime.`,
exit.Message(reason.Usage, `The docker-env command is only compatible with the "docker" runtime, but this cluster was configured to use the "{{.runtime}}" runtime.`,
out.V{"runtime": co.Config.KubernetesConfig.ContainerRuntime})
}
@ -171,7 +172,7 @@ var dockerEnvCmd = &cobra.Command{
if driver.NeedsPortForward(driverName) {
port, err = oci.ForwardedPort(driverName, cname, port)
if err != nil {
exit.WithCodeT(exit.Failure, "Error getting port binding for '{{.driver_name}} driver: {{.error}}", out.V{"driver_name": driverName, "error": err})
exit.Message(reason.DrvPortForward, "Error getting port binding for '{{.driver_name}} driver: {{.error}}", out.V{"driver_name": driverName, "error": err})
}
}
@ -188,7 +189,7 @@ var dockerEnvCmd = &cobra.Command{
if ec.Shell == "" {
ec.Shell, err = shell.Detect()
if err != nil {
exit.WithError("Error detecting shell", err)
exit.Error(reason.InternalShellDetect, "Error detecting shell", err)
}
}
@ -208,7 +209,7 @@ var dockerEnvCmd = &cobra.Command{
}
if err := dockerSetScript(ec, os.Stdout); err != nil {
exit.WithError("Error generating set output", err)
exit.Error(reason.InternalDockerScript, "Error generating set output", err)
}
},
}

View File

@ -23,6 +23,8 @@ import (
"k8s.io/minikube/pkg/generate"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var path string
@ -35,18 +37,17 @@ var generateDocs = &cobra.Command{
Example: "minikube generate-docs --path <FOLDER_PATH>",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
// if directory does not exist
docsPath, err := os.Stat(path)
if err != nil || !docsPath.IsDir() {
exit.UsageT("Unable to generate the documentation. Please ensure that the path specified is a directory, exists & you have permission to write to it.")
exit.Message(reason.Usage, "Unable to generate the documentation. Please ensure that the path specified is a directory, exists & you have permission to write to it.")
}
// generate docs
if err := generate.Docs(RootCmd, path); err != nil {
exit.WithError("Unable to generate docs", err)
exit.Error(reason.InternalGenerateDocs, "Unable to generate docs", err)
}
out.T(out.Documentation, "Docs have been saved at - {{.path}}", out.V{"path": path})
out.T(style.Documentation, "Docs have been saved at - {{.path}}", out.V{"path": path})
},
}

View File

@ -28,6 +28,7 @@ import (
"k8s.io/minikube/pkg/minikube/logs"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
)
const (
@ -55,17 +56,17 @@ var logsCmd = &cobra.Command{
bs, err := cluster.Bootstrapper(co.API, viper.GetString(cmdcfg.Bootstrapper), *co.Config, co.CP.Runner)
if err != nil {
exit.WithError("Error getting cluster bootstrapper", err)
exit.Error(reason.InternalBootstrapper, "Error getting cluster bootstrapper", err)
}
cr, err := cruntime.New(cruntime.Config{Type: co.Config.KubernetesConfig.ContainerRuntime, Runner: co.CP.Runner})
if err != nil {
exit.WithError("Unable to get runtime", err)
exit.Error(reason.InternalNewRuntime, "Unable to get runtime", err)
}
if followLogs {
err := logs.Follow(cr, bs, *co.Config, co.CP.Runner)
if err != nil {
exit.WithError("Follow", err)
exit.Error(reason.InternalLogFollow, "Follow", err)
}
return
}
@ -77,9 +78,9 @@ var logsCmd = &cobra.Command{
err = logs.Output(cr, bs, *co.Config, co.CP.Runner, numberOfLines)
if err != nil {
out.Ln("")
// Avoid exit.WithError, since it outputs the issue URL
// Avoid exit.Error, since it outputs the issue URL
out.WarningT("{{.error}}", out.V{"error": err})
os.Exit(exit.Unavailable)
os.Exit(reason.ExSvcError)
}
},
}

View File

@ -35,6 +35,8 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/third_party/go9p/ufs"
)
@ -46,15 +48,17 @@ const (
)
// placeholders for flag values
var mountIP string
var mountVersion string
var mountType string
var isKill bool
var uid string
var gid string
var mSize int
var options []string
var mode uint
var (
mountIP string
mountVersion string
mountType string
isKill bool
uid string
gid string
mSize int
options []string
mode uint
)
// supportedFilesystems is a map of filesystem types to not warn against.
var supportedFilesystems = map[string]bool{nineP: true}
@ -67,31 +71,31 @@ var mountCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
if isKill {
if err := killMountProcess(); err != nil {
exit.WithError("Error killing mount process", err)
exit.Error(reason.HostKillMountProc, "Error killing mount process", err)
}
os.Exit(0)
}
if len(args) != 1 {
exit.UsageT(`Please specify the directory to be mounted:
exit.Message(reason.Usage, `Please specify the directory to be mounted:
minikube mount <source directory>:<target directory> (example: "/host-home:/vm-home")`)
}
mountString := args[0]
idx := strings.LastIndex(mountString, ":")
if idx == -1 { // no ":" was present
exit.UsageT(`mount argument "{{.value}}" must be in form: <source directory>:<target directory>`, out.V{"value": mountString})
exit.Message(reason.Usage, `mount argument "{{.value}}" must be in form: <source directory>:<target directory>`, out.V{"value": mountString})
}
hostPath := mountString[:idx]
vmPath := mountString[idx+1:]
if _, err := os.Stat(hostPath); err != nil {
if os.IsNotExist(err) {
exit.WithCodeT(exit.NoInput, "Cannot find directory {{.path}} for mount", out.V{"path": hostPath})
exit.Message(reason.HostPathMissing, "Cannot find directory {{.path}} for mount", out.V{"path": hostPath})
} else {
exit.WithError("stat failed", err)
exit.Error(reason.HostPathStat, "stat failed", err)
}
}
if len(vmPath) == 0 || !strings.HasPrefix(vmPath, "/") {
exit.UsageT("Target directory {{.path}} must be an absolute path", out.V{"path": vmPath})
exit.Message(reason.Usage, "Target directory {{.path}} must be an absolute path", out.V{"path": vmPath})
}
var debugVal int
if glog.V(1) {
@ -100,7 +104,7 @@ var mountCmd = &cobra.Command{
co := mustload.Running(ClusterFlagValue())
if co.CP.Host.Driver.DriverName() == driver.None {
exit.UsageT(`'none' driver does not support 'minikube mount' command`)
exit.Message(reason.Usage, `'none' driver does not support 'minikube mount' command`)
}
var ip net.IP
@ -108,17 +112,17 @@ var mountCmd = &cobra.Command{
if mountIP == "" {
ip, err = cluster.HostIP(co.CP.Host)
if err != nil {
exit.WithError("Error getting the host IP address to use from within the VM", err)
exit.Error(reason.IfHostIP, "Error getting the host IP address to use from within the VM", err)
}
} else {
ip = net.ParseIP(mountIP)
if ip == nil {
exit.WithCodeT(exit.Data, "error parsing the input ip address for mount")
exit.Message(reason.IfMountIP, "error parsing the input ip address for mount")
}
}
port, err := getPort()
if err != nil {
exit.WithError("Error finding port for mount", err)
exit.Error(reason.IfMountPort, "Error finding port for mount", err)
}
cfg := &cluster.MountConfig{
@ -150,7 +154,7 @@ var mountCmd = &cobra.Command{
if driver.IsKIC(co.CP.Host.Driver.DriverName()) && runtime.GOOS != "linux" {
bindIP = "127.0.0.1"
}
out.T(out.Mounting, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.T(style.Mounting, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.Infof("Mount type: {{.name}}", out.V{"type": cfg.Type})
out.Infof("User ID: {{.userID}}", out.V{"userID": cfg.UID})
out.Infof("Group ID: {{.groupID}}", out.V{"groupID": cfg.GID})
@ -164,9 +168,9 @@ var mountCmd = &cobra.Command{
if cfg.Type == nineP {
wg.Add(1)
go func() {
out.T(out.Fileserver, "Userspace file server: ")
out.T(style.Fileserver, "Userspace file server: ")
ufs.StartServer(net.JoinHostPort(bindIP, strconv.Itoa(port)), debugVal, hostPath)
out.T(out.Stopped, "Userspace file server is shutdown")
out.T(style.Stopped, "Userspace file server is shutdown")
wg.Done()
}()
}
@ -176,22 +180,22 @@ var mountCmd = &cobra.Command{
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
for sig := range c {
out.T(out.Unmount, "Unmounting {{.path}} ...", out.V{"path": vmPath})
out.T(style.Unmount, "Unmounting {{.path}} ...", out.V{"path": vmPath})
err := cluster.Unmount(co.CP.Runner, vmPath)
if err != nil {
out.FailureT("Failed unmount: {{.error}}", out.V{"error": err})
}
exit.WithCodeT(exit.Interrupted, "Received {{.name}} signal", out.V{"name": sig})
exit.Message(reason.Interrupted, "Received {{.name}} signal", out.V{"name": sig})
}
}()
err = cluster.Mount(co.CP.Runner, ip.String(), vmPath, cfg)
if err != nil {
exit.WithError("mount failed", err)
exit.Error(reason.GuestMount, "mount failed", err)
}
out.T(out.SuccessType, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.T(style.Success, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.Ln("")
out.T(out.Notice, "NOTE: This process must stay alive for the mount to be accessible ...")
out.T(style.Notice, "NOTE: This process must stay alive for the mount to be accessible ...")
wg.Wait()
},
}
@ -203,7 +207,7 @@ func init() {
mountCmd.Flags().BoolVar(&isKill, "kill", false, "Kill the mount process spawned by minikube start")
mountCmd.Flags().StringVar(&uid, "uid", "docker", "Default user id used for the mount")
mountCmd.Flags().StringVar(&gid, "gid", "docker", "Default group id used for the mount")
mountCmd.Flags().UintVar(&mode, "mode", 0755, "File permissions used for the mount")
mountCmd.Flags().UintVar(&mode, "mode", 0o755, "File permissions used for the mount")
mountCmd.Flags().StringSliceVar(&options, "options", []string{}, "Additional mount options, such as cache=fscache")
mountCmd.Flags().IntVar(&mSize, "msize", defaultMsize, "The number of bytes to use for 9p packet payload")
}

View File

@ -19,6 +19,7 @@ package cmd
import (
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/reason"
)
// nodeCmd represents the set of node subcommands
@ -27,6 +28,6 @@ var nodeCmd = &cobra.Command{
Short: "Add, remove, or list additional nodes",
Long: "Operations on nodes",
Run: func(cmd *cobra.Command, args []string) {
exit.UsageT("Usage: minikube node [add|start|stop|delete|list]")
exit.Message(reason.Usage, "Usage: minikube node [add|start|stop|delete|list]")
},
}

View File

@ -25,12 +25,15 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var (
cp bool
worker bool
)
var nodeAddCmd = &cobra.Command{
Use: "add",
Short: "Adds a node to the given cluster.",
@ -45,7 +48,7 @@ var nodeAddCmd = &cobra.Command{
name := node.Name(len(cc.Nodes) + 1)
out.T(out.Happy, "Adding node {{.name}} to cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name})
out.T(style.Happy, "Adding node {{.name}} to cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name})
// TODO: Deal with parameters better. Ideally we should be able to acceot any node-specific minikube start params here.
n := config.Node{
@ -66,15 +69,15 @@ var nodeAddCmd = &cobra.Command{
if err := node.Add(cc, n, false); err != nil {
_, err := maybeDeleteAndRetry(cmd, *cc, n, nil, err)
if err != nil {
exit.WithError("failed to add node", err)
exit.Error(reason.GuestNodeAdd, "failed to add node", err)
}
}
if err := config.SaveProfile(cc.Name, cc); err != nil {
exit.WithError("failed to save config", err)
exit.Error(reason.HostSaveProfile, "failed to save config", err)
}
out.T(out.Ready, "Successfully added {{.name}} to {{.cluster}}!", out.V{"name": name, "cluster": cc.Name})
out.T(style.Ready, "Successfully added {{.name}} to {{.cluster}}!", out.V{"name": name, "cluster": cc.Name})
},
}

View File

@ -23,6 +23,8 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var nodeDeleteCmd = &cobra.Command{
@ -30,18 +32,17 @@ var nodeDeleteCmd = &cobra.Command{
Short: "Deletes a node from a cluster.",
Long: "Deletes a node from a cluster.",
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
exit.UsageT("Usage: minikube node delete [name]")
exit.Message(reason.Usage, "Usage: minikube node delete [name]")
}
name := args[0]
co := mustload.Healthy(ClusterFlagValue())
out.T(out.DeletingHost, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name})
out.T(style.DeletingHost, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name})
n, err := node.Delete(*co.Config, name)
if err != nil {
exit.WithError("deleting node", err)
exit.Error(reason.GuestNodeDelete, "deleting node", err)
}
if driver.IsKIC(co.Config.Driver) {
@ -49,7 +50,7 @@ var nodeDeleteCmd = &cobra.Command{
deletePossibleKicLeftOver(machineName, co.Config.Driver)
}
out.T(out.Deleted, "Node {{.name}} was successfully deleted.", out.V{"name": name})
out.T(style.Deleted, "Node {{.name}} was successfully deleted.", out.V{"name": name})
},
}

View File

@ -25,6 +25,7 @@ import (
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/reason"
)
var nodeListCmd = &cobra.Command{
@ -33,7 +34,7 @@ var nodeListCmd = &cobra.Command{
Long: "List existing minikube nodes.",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 0 {
exit.UsageT("Usage: minikube node list")
exit.Message(reason.Usage, "Usage: minikube node list")
}
cname := ClusterFlagValue()

View File

@ -27,6 +27,8 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var nodeStartCmd = &cobra.Command{
@ -35,7 +37,7 @@ var nodeStartCmd = &cobra.Command{
Long: "Starts an existing stopped node in a cluster.",
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
exit.UsageT("Usage: minikube node start [name]")
exit.Message(reason.Usage, "Usage: minikube node start [name]")
}
api, cc := mustload.Partial(ClusterFlagValue())
@ -43,18 +45,18 @@ var nodeStartCmd = &cobra.Command{
n, _, err := node.Retrieve(*cc, name)
if err != nil {
exit.WithError("retrieving node", err)
exit.Error(reason.GuestNodeRetrieve, "retrieving node", err)
}
machineName := driver.MachineName(*cc, *n)
if machine.IsRunning(api, machineName) {
out.T(out.Check, "{{.name}} is already running", out.V{"name": name})
out.T(style.Check, "{{.name}} is already running", out.V{"name": name})
os.Exit(0)
}
r, p, m, h, err := node.Provision(cc, n, false, viper.GetBool(deleteOnFailure))
if err != nil {
exit.WithError("provisioning host for node", err)
exit.Error(reason.GuestNodeProvision, "provisioning host for node", err)
}
s := node.Starter{
@ -71,11 +73,11 @@ var nodeStartCmd = &cobra.Command{
if err != nil {
_, err := maybeDeleteAndRetry(cmd, *cc, *n, nil, err)
if err != nil {
node.MaybeExitWithAdvice(err)
exit.WithError("failed to start node", err)
node.ExitIfFatal(err)
exit.Error(reason.GuestNodeStart, "failed to start node", err)
}
}
out.T(out.Happy, "Successfully started node {{.name}}!", out.V{"name": machineName})
out.T(style.Happy, "Successfully started node {{.name}}!", out.V{"name": machineName})
},
}

View File

@ -24,6 +24,8 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var nodeStopCmd = &cobra.Command{
@ -32,7 +34,7 @@ var nodeStopCmd = &cobra.Command{
Long: "Stops a node in a cluster.",
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
exit.UsageT("Usage: minikube node stop [name]")
exit.Message(reason.Usage, "Usage: minikube node stop [name]")
}
name := args[0]
@ -40,7 +42,7 @@ var nodeStopCmd = &cobra.Command{
n, _, err := node.Retrieve(*cc, name)
if err != nil {
exit.WithError("retrieving node", err)
exit.Error(reason.GuestNodeRetrieve, "retrieving node", err)
}
machineName := driver.MachineName(*cc, *n)
@ -49,7 +51,7 @@ var nodeStopCmd = &cobra.Command{
if err != nil {
out.FatalT("Failed to stop node {{.name}}", out.V{"name": name})
}
out.T(out.Stopped, "Successfully stopped node {{.name}}", out.V{"name": machineName})
out.T(style.Stopped, "Successfully stopped node {{.name}}", out.V{"name": machineName})
},
}

View File

@ -33,6 +33,8 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
var (
@ -54,9 +56,9 @@ func runPause(cmd *cobra.Command, args []string) {
glog.Infof("namespaces: %v keys: %v", namespaces, viper.AllSettings())
if allNamespaces {
namespaces = nil //all
namespaces = nil // all
} else if len(namespaces) == 0 {
exit.WithCodeT(exit.BadUsage, "Use -A to specify all namespaces")
exit.Message(reason.Usage, "Use -A to specify all namespaces")
}
ids := []string{}
@ -68,35 +70,35 @@ func runPause(cmd *cobra.Command, args []string) {
name = co.Config.Name
}
out.T(out.Pause, "Pausing node {{.name}} ... ", out.V{"name": name})
out.T(style.Pause, "Pausing node {{.name}} ... ", out.V{"name": name})
host, err := machine.LoadHost(co.API, driver.MachineName(*co.Config, n))
if err != nil {
exit.WithError("Error getting host", err)
exit.Error(reason.GuestLoadHost, "Error getting host", err)
}
r, err := machine.CommandRunner(host)
if err != nil {
exit.WithError("Failed to get command runner", err)
exit.Error(reason.InternalCommandRunner, "Failed to get command runner", err)
}
cr, err := cruntime.New(cruntime.Config{Type: co.Config.KubernetesConfig.ContainerRuntime, Runner: r})
if err != nil {
exit.WithError("Failed runtime", err)
exit.Error(reason.InternalNewRuntime, "Failed runtime", err)
}
uids, err := cluster.Pause(cr, r, namespaces)
if err != nil {
exit.WithError("Pause", err)
exit.Error(reason.GuestPause, "Pause", err)
}
ids = append(ids, uids...)
}
register.Reg.SetStep(register.Done)
if namespaces == nil {
out.T(out.Unpause, "Paused {{.count}} containers", out.V{"count": len(ids)})
out.T(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(ids)})
} else {
out.T(out.Unpause, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")})
out.T(style.Unpause, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")})
}
}

View File

@ -35,6 +35,7 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/shell"
)
@ -47,15 +48,13 @@ type PodmanShellConfig struct {
MinikubePodmanProfile string
}
var (
podmanUnset bool
)
var podmanUnset bool
// podmanShellCfgSet generates context variables for "podman-env"
func podmanShellCfgSet(ec PodmanEnvConfig, envMap map[string]string) *PodmanShellConfig {
profile := ec.profile
const usgPlz = "To point your shell to minikube's podman service, run:"
var usgCmd = fmt.Sprintf("minikube -p %s podman-env", profile)
usgCmd := fmt.Sprintf("minikube -p %s podman-env", profile)
s := &PodmanShellConfig{
Config: *shell.CfgSet(ec.EnvConfig, usgPlz, usgCmd),
}
@ -114,7 +113,7 @@ var podmanEnvCmd = &cobra.Command{
if podmanUnset {
if err := podmanUnsetScript(PodmanEnvConfig{EnvConfig: sh}, os.Stdout); err != nil {
exit.WithError("Error generating unset output", err)
exit.Error(reason.InternalEnvScript, "Error generating unset output", err)
}
return
}
@ -124,20 +123,20 @@ var podmanEnvCmd = &cobra.Command{
driverName := co.CP.Host.DriverName
if driverName == driver.None {
exit.UsageT(`'none' driver does not support 'minikube podman-env' command`)
exit.Message(reason.Usage, `'none' driver does not support 'minikube podman-env' command`)
}
if len(co.Config.Nodes) > 1 {
exit.WithCodeT(exit.BadUsage, `The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/`)
exit.Message(reason.Usage, `The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/`)
}
if ok := isPodmanAvailable(co.CP.Runner); !ok {
exit.WithCodeT(exit.Unavailable, `The podman service within '{{.cluster}}' is not active`, out.V{"cluster": cname})
exit.Message(reason.EnvPodmanUnavailable, `The podman service within '{{.cluster}}' is not active`, out.V{"cluster": cname})
}
client, err := createExternalSSHClient(co.CP.Host.Driver)
if err != nil {
exit.WithError("Error getting ssh client", err)
exit.Error(reason.IfSSHClient, "Error getting ssh client", err)
}
ec := PodmanEnvConfig{
@ -150,12 +149,12 @@ var podmanEnvCmd = &cobra.Command{
if ec.Shell == "" {
ec.Shell, err = shell.Detect()
if err != nil {
exit.WithError("Error detecting shell", err)
exit.Error(reason.InternalShellDetect, "Error detecting shell", err)
}
}
if err := podmanSetScript(ec, os.Stdout); err != nil {
exit.WithError("Error generating set output", err)
exit.Error(reason.InternalEnvScript, "Error generating set output", err)
}
},
}

View File

@ -20,6 +20,7 @@ import (
goflag "flag"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
@ -34,6 +35,7 @@ import (
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/translate"
)
@ -56,15 +58,15 @@ var RootCmd = &cobra.Command{
Long: `minikube provisions and manages local Kubernetes clusters optimized for development workflows.`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
for _, path := range dirs {
if err := os.MkdirAll(path, 0777); err != nil {
exit.WithError("Error creating minikube directory", err)
if err := os.MkdirAll(path, 0o777); err != nil {
exit.Error(reason.HostHomeMkdir, "Error creating minikube directory", err)
}
}
logDir := pflag.Lookup("log_dir")
if !logDir.Changed {
if err := logDir.Value.Set(localpath.MakeMiniPath("logs")); err != nil {
exit.WithError("logdir set failed", err)
exit.Error(reason.InternalFlagSet, "logdir set failed", err)
}
}
},
@ -73,6 +75,11 @@ var RootCmd = &cobra.Command{
// Execute adds all child commands to the root command sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
_, callingCmd := filepath.Split(os.Args[0])
if callingCmd == "kubectl" {
os.Args = append([]string{RootCmd.Use, callingCmd}, os.Args[1:]...)
}
for _, c := range RootCmd.Commands() {
c.Short = translate.T(c.Short)
c.Long = translate.T(c.Long)
@ -105,7 +112,7 @@ func Execute() {
if err := RootCmd.Execute(); err != nil {
// Cobra already outputs the error, typically because the user provided an unknown command.
os.Exit(exit.BadUsage)
os.Exit(reason.ExProgramUsage)
}
}
@ -143,7 +150,7 @@ func usageTemplate() string {
// by setting them directly, using values from viper when not passed in as args
func setFlagsUsingViper() {
for _, config := range []string{"alsologtostderr", "log_dir", "v"} {
var a = pflag.Lookup(config)
a := pflag.Lookup(config)
viper.SetDefault(a.Name, a.DefValue)
// If the flag is set, override viper value
if a.Changed {
@ -152,7 +159,7 @@ func setFlagsUsingViper() {
// Viper will give precedence first to calls to the Set command,
// then to values from the config.yml
if err := a.Value.Set(viper.GetString(a.Name)); err != nil {
exit.WithError(fmt.Sprintf("failed to set value for %q", a.Name), err)
exit.Error(reason.InternalFlagSet, fmt.Sprintf("failed to set value for %q", a.Name), err)
}
a.Changed = true
}
@ -229,10 +236,9 @@ func init() {
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
if err := viper.BindPFlags(RootCmd.PersistentFlags()); err != nil {
exit.WithError("Unable to bind flags", err)
exit.Error(reason.InternalBindFlags, "Unable to bind flags", err)
}
cobra.OnInitialize(initConfig)
}
// initConfig reads in config file and ENV variables if set.

View File

@ -40,7 +40,9 @@ import (
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/service"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/pkg/minikube/tunnel/kic"
)
@ -64,7 +66,7 @@ var serviceCmd = &cobra.Command{
PersistentPreRun: func(cmd *cobra.Command, args []string) {
t, err := template.New("serviceURL").Parse(serviceURLFormat)
if err != nil {
exit.WithError("The value passed to --format is invalid", err)
exit.Error(reason.InternalFormatUsage, "The value passed to --format is invalid", err)
}
serviceURLTemplate = t
@ -72,7 +74,7 @@ var serviceCmd = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 || len(args) > 1 {
exit.UsageT("You must specify a service name")
exit.Message(reason.Usage, "You must specify a service name")
}
svc := args[0]
@ -84,10 +86,10 @@ var serviceCmd = &cobra.Command{
if err != nil {
var s *service.SVCNotFoundError
if errors.As(err, &s) {
exit.WithCodeT(exit.Data, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
exit.Message(reason.SvcNotFound, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
You may select another namespace by using 'minikube service {{.service}} -n <namespace>'. Or list out all the services using 'minikube service list'`, out.V{"service": svc, "namespace": namespace})
}
exit.WithError("Error opening service", err)
exit.Error(reason.SvcTimeout, "Error opening service", err)
}
if driver.NeedsPortForward(co.Config.Driver) {
@ -107,7 +109,6 @@ func init() {
serviceCmd.Flags().IntVar(&interval, "interval", service.DefaultInterval, "The initial time interval for each check that wait performs in seconds")
serviceCmd.PersistentFlags().StringVar(&serviceURLFormat, "format", defaultServiceFormatTemplate, "Format to output service URL in. This format will be applied to each url individually and they will be printed one at a time.")
}
func startKicServiceTunnel(svc, configName string) {
@ -116,12 +117,12 @@ func startKicServiceTunnel(svc, configName string) {
clientset, err := kapi.Client(configName)
if err != nil {
exit.WithError("error creating clientset", err)
exit.Error(reason.InternalKubernetesClient, "error creating clientset", err)
}
port, err := oci.ForwardedPort(oci.Docker, configName, 22)
if err != nil {
exit.WithError("error getting ssh port", err)
exit.Error(reason.DrvPortForward, "error getting ssh port", err)
}
sshPort := strconv.Itoa(port)
sshKey := filepath.Join(localpath.MiniPath(), "machines", configName, "id_rsa")
@ -129,7 +130,7 @@ func startKicServiceTunnel(svc, configName string) {
serviceTunnel := kic.NewServiceTunnel(sshPort, sshKey, clientset.CoreV1())
urls, err := serviceTunnel.Start(svc, namespace)
if err != nil {
exit.WithError("error starting tunnel", err)
exit.Error(reason.SvcTunnelStart, "error starting tunnel", err)
}
// wait for tunnel to come up
@ -145,7 +146,7 @@ func startKicServiceTunnel(svc, configName string) {
err = serviceTunnel.Stop()
if err != nil {
exit.WithError("error stopping tunnel", err)
exit.Error(reason.SvcTunnelStop, "error stopping tunnel", err)
}
}
@ -163,9 +164,9 @@ func openURLs(svc string, urls []string) {
continue
}
out.T(out.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
out.T(style.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
if err := browser.OpenURL(u); err != nil {
exit.WithError(fmt.Sprintf("open url failed: %s", u), err)
exit.Error(reason.HostBrowser, fmt.Sprintf("open url failed: %s", u), err)
}
}
}

View File

@ -24,10 +24,11 @@ import (
"github.com/spf13/cobra"
core "k8s.io/api/core/v1"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/service"
"k8s.io/minikube/pkg/minikube/style"
)
var serviceListNamespace string
@ -43,8 +44,8 @@ var serviceListCmd = &cobra.Command{
serviceURLs, err := service.GetServiceURLs(co.API, co.Config.Name, serviceListNamespace, serviceURLTemplate)
if err != nil {
out.FatalT("Failed to get service URL: {{.error}}", out.V{"error": err})
out.ErrT(out.Notice, "Check that minikube is running and that you have specified the correct namespace (-n flag) if required.")
os.Exit(exit.Unavailable)
out.ErrT(style.Notice, "Check that minikube is running and that you have specified the correct namespace (-n flag) if required.")
os.Exit(reason.ExSvcUnavailable)
}
var data [][]string

View File

@ -28,11 +28,10 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
)
var (
nativeSSHClient bool
)
var nativeSSHClient bool
// sshCmd represents the docker-ssh command
var sshCmd = &cobra.Command{
@ -43,7 +42,7 @@ var sshCmd = &cobra.Command{
cname := ClusterFlagValue()
co := mustload.Running(cname)
if co.CP.Host.DriverName == driver.None {
exit.UsageT("'none' driver does not support 'minikube ssh' command")
exit.Message(reason.Usage, "'none' driver does not support 'minikube ssh' command")
}
var err error
@ -53,7 +52,7 @@ var sshCmd = &cobra.Command{
} else {
n, _, err = node.Retrieve(*co.Config, nodeName)
if err != nil {
exit.WithCodeT(exit.Unavailable, "Node {{.nodeName}} does not exist.", out.V{"nodeName": nodeName})
exit.Message(reason.GuestNodeRetrieve, "Node {{.nodeName}} does not exist.", out.V{"nodeName": nodeName})
}
}
@ -62,7 +61,7 @@ var sshCmd = &cobra.Command{
// This is typically due to a non-zero exit code, so no need for flourish.
out.ErrLn("ssh: %v", err)
// It'd be nice if we could pass up the correct error code here :(
os.Exit(exit.Failure)
os.Exit(1)
}
},
}

View File

@ -57,6 +57,8 @@ import (
"k8s.io/minikube/pkg/minikube/notify"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/pkg/minikube/registry"
"k8s.io/minikube/pkg/minikube/translate"
@ -77,7 +79,7 @@ func init() {
initDriverFlags()
initNetworkingFlags()
if err := viper.BindPFlags(startCmd.Flags()); err != nil {
exit.WithError("unable to bind flags", err)
exit.Error(reason.InternalBindFlags, "unable to bind flags", err)
}
}
@ -152,11 +154,11 @@ func runStart(cmd *cobra.Command, args []string) {
if !config.ProfileNameValid(ClusterFlagValue()) {
out.WarningT("Profile name '{{.name}}' is not valid", out.V{"name": ClusterFlagValue()})
exit.UsageT("Only alphanumeric and dashes '-' are permitted. Minimum 1 character, starting with alphanumeric.")
exit.Message(reason.Usage, "Only alphanumeric and dashes '-' are permitted. Minimum 1 character, starting with alphanumeric.")
}
existing, err := config.Load(ClusterFlagValue())
if err != nil && !config.IsNotExist(err) {
exit.WithCodeT(exit.Data, "Unable to load config: {{.error}}", out.V{"error": err})
exit.Message(reason.HostConfigLoad, "Unable to load config: {{.error}}", out.V{"error": err})
}
if existing != nil {
@ -168,11 +170,11 @@ func runStart(cmd *cobra.Command, args []string) {
ds, alts, specified := selectDriver(existing)
starter, err := provisionWithDriver(cmd, ds, existing)
if err != nil {
node.MaybeExitWithAdvice(err)
node.ExitIfFatal(err)
machine.MaybeDisplayAdvice(err, ds.Name)
if specified {
// If the user specified a driver, don't fallback to anything else
exit.WithError("error provisioning host", err)
exit.Error(reason.GuestProvision, "error provisioning host", err)
} else {
success := false
// Walk down the rest of the options
@ -199,7 +201,7 @@ func runStart(cmd *cobra.Command, args []string) {
}
}
if !success {
exit.WithError("error provisioning host", err)
exit.Error(reason.GuestProvision, "error provisioning host", err)
}
}
}
@ -211,20 +213,19 @@ func runStart(cmd *cobra.Command, args []string) {
stopProfile(existing.Name)
starter, err = provisionWithDriver(cmd, ds, existing)
if err != nil {
exit.WithError("error provisioning host", err)
exit.Error(reason.GuestProvision, "error provisioning host", err)
}
}
kubeconfig, err := startWithDriver(cmd, starter, existing)
if err != nil {
node.MaybeExitWithAdvice(err)
exit.WithError("failed to start node", err)
node.ExitIfFatal(err)
exit.Error(reason.GuestStart, "failed to start node", err)
}
if err := showKubectlInfo(kubeconfig, starter.Node.KubernetesVersion, starter.Cfg.Name); err != nil {
glog.Errorf("kubectl info: %v", err)
}
}
func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *config.ClusterConfig) (node.Starter, error) {
@ -253,7 +254,7 @@ func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *
// This is about as far as we can go without overwriting config files
if viper.GetBool(dryRun) {
out.T(out.DryRun, `dry-run validation complete!`)
out.T(style.DryRun, `dry-run validation complete!`)
os.Exit(0)
}
@ -273,17 +274,17 @@ func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *
}
}
mRunner, preExists, mAPI, host, err := node.Provision(&cc, &n, true, viper.GetBool(deleteOnFailure))
if err != nil {
return node.Starter{}, err
}
if viper.GetBool(nativeSSH) {
ssh.SetDefaultClient(ssh.Native)
} else {
ssh.SetDefaultClient(ssh.External)
}
mRunner, preExists, mAPI, host, err := node.Provision(&cc, &n, true, viper.GetBool(deleteOnFailure))
if err != nil {
return node.Starter{}, err
}
return node.Starter{
Runner: mRunner,
PreExists: preExists,
@ -314,7 +315,7 @@ func startWithDriver(cmd *cobra.Command, starter node.Starter, existing *config.
}
if numNodes > 1 {
if driver.BareMetal(starter.Cfg.Driver) {
exit.WithCodeT(exit.Config, "The none driver is not compatible with multi-node clusters.")
exit.Message(reason.DrvUnsupportedMulti, "The none driver is not compatible with multi-node clusters.")
} else {
// Only warn users on first start.
if existing == nil {
@ -353,7 +354,7 @@ func startWithDriver(cmd *cobra.Command, starter node.Starter, existing *config.
func warnAboutMultiNode() {
out.WarningT("Multi-node clusters are currently experimental and might exhibit unintended behavior.")
out.T(out.Documentation, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.")
out.T(style.Documentation, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.")
}
func updateDriver(driverName string) {
@ -372,7 +373,7 @@ func displayVersion(version string) {
}
register.Reg.SetStep(register.InitialSetup)
out.T(out.Happy, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version, "platform": platform()})
out.T(style.Happy, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version, "platform": platform()})
}
// displayEnviron makes the user aware of environment variables that will affect how minikube operates
@ -390,16 +391,16 @@ func displayEnviron(env []string) {
func showKubectlInfo(kcs *kubeconfig.Settings, k8sVersion string, machineName string) error {
register.Reg.SetStep(register.Done)
if kcs.KeepContext {
out.T(out.Kubectl, "To connect to this cluster, use: kubectl --context={{.name}}", out.V{"name": kcs.ClusterName})
out.T(style.Kubectl, "To connect to this cluster, use: kubectl --context={{.name}}", out.V{"name": kcs.ClusterName})
} else {
out.T(out.Ready, `Done! kubectl is now configured to use "{{.name}}"`, out.V{"name": machineName})
out.T(style.Ready, `Done! kubectl is now configured to use "{{.name}}"`, out.V{"name": machineName})
}
path, err := exec.LookPath("kubectl")
if err != nil {
out.ErrT(out.Kubectl, "Kubectl not found in your path")
out.ErrT(out.Workaround, "You can use kubectl inside minikube. For more information, visit https://minikube.sigs.k8s.io/docs/handbook/kubectl/")
out.ErrT(out.Tip, "For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/")
out.ErrT(style.Kubectl, "Kubectl not found in your path")
out.ErrT(style.Workaround, "You can use kubectl inside minikube. For more information, visit https://minikube.sigs.k8s.io/docs/handbook/kubectl/")
out.ErrT(style.Tip, "For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/")
return nil
}
@ -421,7 +422,7 @@ func showKubectlInfo(kcs *kubeconfig.Settings, k8sVersion string, machineName st
out.Ln("")
out.WarningT("{{.path}} is version {{.client_version}}, which may be incompatible with Kubernetes {{.cluster_version}}.",
out.V{"path": path, "client_version": client, "cluster_version": cluster})
out.ErrT(out.Tip, "You can also use 'minikube kubectl -- get pods' to invoke a matching version",
out.ErrT(style.Tip, "You can also use 'minikube kubectl -- get pods' to invoke a matching version",
out.V{"path": path, "client_version": client})
}
return nil
@ -433,7 +434,7 @@ func maybeDeleteAndRetry(cmd *cobra.Command, existing config.ClusterConfig, n co
// Start failed, delete the cluster and try again
profile, err := config.LoadProfile(existing.Name)
if err != nil {
out.ErrT(out.Meh, `"{{.name}}" profile does not exist, trying anyways.`, out.V{"name": existing.Name})
out.ErrT(style.Meh, `"{{.name}}" profile does not exist, trying anyways.`, out.V{"name": existing.Name})
}
err = deleteProfile(profile)
@ -472,7 +473,7 @@ func maybeDeleteAndRetry(cmd *cobra.Command, existing config.ClusterConfig, n co
return kubeconfig, nil
}
// Don't delete the cluster unless they ask
return nil, errors.Wrap(originalErr, "startup failed")
return nil, originalErr
}
func kubectlVersion(path string) (string, error) {
@ -508,7 +509,7 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
if existing != nil {
old := hostDriver(existing)
ds := driver.Status(old)
out.T(out.Sparkle, `Using the {{.driver}} driver based on existing profile`, out.V{"driver": ds.String()})
out.T(style.Sparkle, `Using the {{.driver}} driver based on existing profile`, out.V{"driver": ds.String()})
return ds, nil, true
}
@ -526,9 +527,9 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
}
ds := driver.Status(d)
if ds.Name == "" {
exit.WithCodeT(exit.Unavailable, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": d, "os": runtime.GOOS})
exit.Message(reason.DrvUnsupportedOS, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": d, "os": runtime.GOOS})
}
out.T(out.Sparkle, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()})
out.T(style.Sparkle, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()})
return ds, nil, true
}
@ -536,21 +537,20 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
if d := viper.GetString("vm-driver"); d != "" {
ds := driver.Status(viper.GetString("vm-driver"))
if ds.Name == "" {
exit.WithCodeT(exit.Unavailable, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": d, "os": runtime.GOOS})
exit.Message(reason.DrvUnsupportedOS, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": d, "os": runtime.GOOS})
}
out.T(out.Sparkle, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()})
out.T(style.Sparkle, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()})
return ds, nil, true
}
choices := driver.Choices(viper.GetBool("vm"))
pick, alts, rejects := driver.Suggest(choices)
if pick.Name == "" {
out.T(out.ThumbsDown, "Unable to pick a default driver. Here is what was considered, in preference order:")
out.T(style.ThumbsDown, "Unable to pick a default driver. Here is what was considered, in preference order:")
for _, r := range rejects {
out.Infof("{{ .name }}: {{ .rejection }}", out.V{"name": r.Name, "rejection": r.Rejection})
}
out.T(out.Workaround, "Try specifying a --driver, or see https://minikube.sigs.k8s.io/docs/start/")
os.Exit(exit.Unavailable)
exit.Message(reason.DrvNotDetected, "No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/")
}
if len(alts) > 1 {
@ -558,9 +558,9 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
for _, a := range alts {
altNames = append(altNames, a.String())
}
out.T(out.Sparkle, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")})
out.T(style.Sparkle, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")})
} else {
out.T(out.Sparkle, `Automatically selected the {{.driver}} driver`, out.V{"driver": pick.String()})
out.T(style.Sparkle, `Automatically selected the {{.driver}} driver`, out.V{"driver": pick.String()})
}
return pick, alts, false
}
@ -618,19 +618,18 @@ func validateSpecifiedDriver(existing *config.ClusterConfig) {
return
}
out.ErrT(out.Conflict, `The existing "{{.name}}" VM was created using the "{{.old}}" driver, and is incompatible with the "{{.new}}" driver.`,
out.V{"name": existing.Name, "new": requested, "old": old})
out.ErrT(out.Workaround, `To proceed, either:
1) Delete the existing "{{.name}}" cluster using: '{{.delcommand}}'
* or *
2) Start the existing "{{.name}}" cluster using: '{{.command}} --driver={{.old}}'
`, out.V{"command": mustload.ExampleCmd(existing.Name, "start"), "delcommand": mustload.ExampleCmd(existing.Name, "delete"), "old": old, "name": existing.Name})
exit.WithCodeT(exit.Config, "Exiting.")
exit.Advice(
reason.GuestDrvMismatch,
`The existing "{{.name}}" cluster was created using the "{{.old}}" driver, which is incompatible with requested "{{.new}}" driver.`,
"Delete the existing '{{.name}}' cluster using: '{{.delcommand}}', or start the existing '{{.name}}' cluster using: '{{.command}} --driver={{.old}}'",
out.V{
"name": existing.Name,
"new": requested,
"old": old,
"command": mustload.ExampleCmd(existing.Name, "start"),
"delcommand": mustload.ExampleCmd(existing.Name, "delete"),
},
)
}
// validateDriver validates that the selected driver appears sane, exits if not
@ -638,7 +637,7 @@ func validateDriver(ds registry.DriverState, existing *config.ClusterConfig) {
name := ds.Name
glog.Infof("validating driver %q against %+v", name, existing)
if !driver.Supported(name) {
exit.WithCodeT(exit.Unavailable, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": name, "os": runtime.GOOS})
exit.Message(reason.DrvUnsupportedOS, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": name, "os": runtime.GOOS})
}
// if we are only downloading artifacts for a driver, we can stop validation here
@ -649,33 +648,43 @@ func validateDriver(ds registry.DriverState, existing *config.ClusterConfig) {
st := ds.State
glog.Infof("status for %s: %+v", name, st)
if st.NeedsImprovement { // warn but don't exit
out.ErrLn("")
out.WarningT("'{{.driver}}' driver reported a issue that could affect the performance.", out.V{"driver": name})
out.ErrT(out.Tip, "Suggestion: {{.fix}}", out.V{"fix": translate.T(st.Fix)})
out.ErrLn("")
if st.NeedsImprovement {
out.WarnReason(reason.Kind{
ID: fmt.Sprintf("PROVIDER_%s_IMPROVEMENT", strings.ToUpper(name)),
Advice: translate.T(st.Fix),
Style: style.Improvement,
}, `The '{{.driver}}' driver reported a performance issue`, out.V{"driver": name})
}
if st.Error != nil {
out.ErrLn("")
out.WarningT("'{{.driver}}' driver reported an issue: {{.error}}", out.V{"driver": name, "error": st.Error})
out.ErrT(out.Tip, "Suggestion: {{.fix}}", out.V{"fix": translate.T(st.Fix)})
if st.Doc != "" {
out.ErrT(out.Documentation, "Documentation: {{.url}}", out.V{"url": st.Doc})
}
out.ErrLn("")
if !st.Installed {
if existing != nil {
if old := hostDriver(existing); name == old {
exit.WithCodeT(exit.Unavailable, "{{.driver}} does not appear to be installed, but is specified by an existing profile. Please run 'minikube delete' or install {{.driver}}", out.V{"driver": name})
}
}
exit.WithCodeT(exit.Unavailable, "{{.driver}} does not appear to be installed", out.V{"driver": name})
}
exitIfNotForced(exit.Unavailable, "Failed to validate '{{.driver}}' driver", out.V{"driver": name})
if st.Error == nil {
return
}
if !st.Installed {
exit.Message(reason.Kind{
ID: fmt.Sprintf("PROVIDER_%s_NOT_FOUND", strings.ToUpper(name)),
Advice: translate.T(st.Fix),
ExitCode: reason.ExProviderNotFound,
URL: st.Doc,
Style: style.Shrug,
}, `The '{{.driver}}' provider was not found: {{.error}}`, out.V{"driver": name, "error": st.Error})
}
id := fmt.Sprintf("PROVIDER_%s_ERROR", strings.ToUpper(name))
code := reason.ExProviderUnavailable
if !st.Running {
id = fmt.Sprintf("PROVIDER_%s_NOT_RUNNING", strings.ToUpper(name))
code = reason.ExProviderNotRunning
}
exitIfNotForced(reason.Kind{
ID: id,
Advice: translate.T(st.Fix),
ExitCode: code,
URL: st.Doc,
Style: style.Fatal,
}, st.Error.Error())
}
func selectImageRepository(mirrorCountry string, v semver.Version) (bool, string, error) {
@ -740,31 +749,30 @@ func validateUser(drvName string) {
useForce := viper.GetBool(force)
if driver.NeedsRoot(drvName) && u.Uid != "0" && !useForce {
exit.WithCodeT(exit.Permissions, `The "{{.driver_name}}" driver requires root privileges. Please run minikube using 'sudo -E minikube start --driver={{.driver_name}}'.`, out.V{"driver_name": drvName})
exit.Message(reason.DrvNeedsRoot, `The "{{.driver_name}}" driver requires root privileges. Please run minikube using 'sudo -E minikube start --driver={{.driver_name}}'.`, out.V{"driver_name": drvName})
}
// If root is required, or we are not root, exit early
if driver.NeedsRoot(drvName) || u.Uid != "0" {
return
}
out.ErrT(out.Stopped, `The "{{.driver_name}}" driver should not be used with root privileges.`, out.V{"driver_name": drvName})
out.ErrT(out.Tip, "If you are running minikube within a VM, consider using --driver=none:")
out.ErrT(out.Documentation, " https://minikube.sigs.k8s.io/docs/reference/drivers/none/")
out.ErrT(style.Stopped, `The "{{.driver_name}}" driver should not be used with root privileges.`, out.V{"driver_name": drvName})
out.ErrT(style.Tip, "If you are running minikube within a VM, consider using --driver=none:")
out.ErrT(style.Documentation, " https://minikube.sigs.k8s.io/docs/reference/drivers/none/")
if !useForce {
os.Exit(exit.Permissions)
}
cname := ClusterFlagValue()
_, err = config.Load(cname)
if err == nil || !config.IsNotExist(err) {
out.ErrT(out.Tip, "Tip: To remove this root owned cluster, run: sudo {{.cmd}}", out.V{"cmd": mustload.ExampleCmd(cname, "delete")})
out.ErrT(style.Tip, "Tip: To remove this root owned cluster, run: sudo {{.cmd}}", out.V{"cmd": mustload.ExampleCmd(cname, "delete")})
}
if !useForce {
exit.WithCodeT(exit.Permissions, "Exiting")
exit.Message(reason.DrvAsRoot, `The "{{.driver_name}}" driver should not be used with root privileges.`, out.V{"driver_name": drvName})
}
}
// memoryLimits returns the amount of memory allocated to the system and hypervisor , the return value is in MB
// memoryLimits returns the amount of memory allocated to the system and hypervisor, the return value is in MiB
func memoryLimits(drvName string) (int, int, error) {
info, cpuErr, memErr, diskErr := machine.CachedHostInfo()
if cpuErr != nil {
@ -792,7 +800,7 @@ func memoryLimits(drvName string) (int, int, error) {
return sysLimit, containerLimit, nil
}
// suggestMemoryAllocation calculates the default memory footprint in MB
// suggestMemoryAllocation calculates the default memory footprint in MiB
func suggestMemoryAllocation(sysLimit int, containerLimit int, nodes int) int {
if mem := viper.GetInt(memory); mem != 0 {
return mem
@ -830,76 +838,60 @@ func suggestMemoryAllocation(sysLimit int, containerLimit int, nodes int) int {
return suggested
}
// validateMemoryHardLimit checks if the user system has enough memory at all !
func validateMemoryHardLimit(drvName string) {
s, c, err := memoryLimits(drvName)
if err != nil {
glog.Warningf("Unable to query memory limits: %v", err)
out.WarningT("Failed to verify system memory limits.")
return
}
if s < 2200 {
out.WarningT("Your system has only {{.memory_amount}}MB memory. This might not work minimum required is 2000MB.", out.V{"memory_amount": s})
return
}
if driver.IsDockerDesktop(drvName) {
// in Docker Desktop if you allocate 2 GB the docker info shows: Total Memory: 1.945GiB which becomes 1991 when we calculate the MBs
// thats why it is not same number as other drivers which is 2 GB
if c < 1991 {
out.WarningT(`Increase Docker for Desktop memory to at least 2.5GB or more:
Docker for Desktop > Settings > Resources > Memory
`)
}
}
}
// validateMemorySize validates the memory size matches the minimum recommended
func validateMemorySize(req int, drvName string) {
// validateRequestedMemorySize validates the memory size matches the minimum recommended
func validateRequestedMemorySize(req int, drvName string) {
// TODO: Fix MB vs MiB confusion
sysLimit, containerLimit, err := memoryLimits(drvName)
if err != nil {
glog.Warningf("Unable to query memory limits: %v", err)
}
// maximm percent of their ram they could allocate to minikube to prevent #8708
maxAdvised := 0.79 * float64(sysLimit)
// a more sane alternative to their high memory 80%
minAdvised := 0.50 * float64(sysLimit)
// Detect if their system doesn't have enough memory to work with.
if driver.IsKIC(drvName) && containerLimit < minUsableMem {
if driver.IsDockerDesktop(drvName) {
if runtime.GOOS == "darwin" {
exitIfNotForced(reason.RsrcInsufficientDarwinDockerMemory, "Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes", out.V{"size": containerLimit, "req": minUsableMem, "recommend": "2.25 GB"})
} else {
exitIfNotForced(reason.RsrcInsufficientWindowsDockerMemory, "Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes", out.V{"size": containerLimit, "req": minUsableMem, "recommend": "2.25 GB"})
}
}
exitIfNotForced(reason.RsrcInsufficientContainerMemory, "{{.driver}} only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes", out.V{"size": containerLimit, "driver": drvName, "req": minUsableMem})
}
if sysLimit < minUsableMem {
exitIfNotForced(reason.RsrcInsufficientSysMemory, "System only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes", out.V{"size": containerLimit, "driver": drvName, "req": minUsableMem})
}
if req < minUsableMem {
exitIfNotForced(exit.Config, "Requested memory allocation {{.requested}}MB is less than the usable minimum of {{.minimum_memory}}MB", out.V{"requested": req, "minimum_memory": minUsableMem})
exitIfNotForced(reason.RsrcInsufficientReqMemory, "Requested memory allocation {{.requested}}MiB is less than the usable minimum of {{.minimum_memory}}MB", out.V{"requested": req, "minimum_memory": minUsableMem})
}
if req < minRecommendedMem {
out.WarningT("Requested memory allocation ({{.requested}}MB) is less than the recommended minimum {{.recommended}}MB. Kubernetes may crash unexpectedly.",
out.V{"requested": req, "recommended": minRecommendedMem})
out.WarnReason(reason.RsrcInsufficientReqMemory, "Requested memory allocation ({{.requested}}MB) is less than the recommended minimum {{.recommend}}MB. Deployments may fail.", out.V{"requested": req, "recommend": minRecommendedMem})
}
if driver.IsDockerDesktop(drvName) && containerLimit < 2997 && sysLimit > 8000 { // for users with more than 8 GB advice 3 GB
out.WarningT(`Your system has {{.system_limit}}MB memory but Docker has only {{.container_limit}}MB. For a better performance increase to at least 3GB.
Docker for Desktop > Settings > Resources > Memory
`, out.V{"container_limit": containerLimit, "system_limit": sysLimit})
r := reason.RsrcInsufficientDarwinDockerMemory
if runtime.GOOS == "Windows" {
r = reason.RsrcInsufficientWindowsDockerMemory
}
r.Style = style.Improvement
out.WarnReason(r, "Docker Desktop has access to only {{.size}}MiB of the {{.sys}}MiB in available system memory. Consider increasing this for improved performance.", out.V{"size": containerLimit, "sys": sysLimit, "recommend": "3 GB"})
}
advised := suggestMemoryAllocation(sysLimit, containerLimit, viper.GetInt(nodes))
if req > sysLimit {
message := `Requested memory allocation {{.requested}}MB is more than your system limit {{.system_limit}}MB. Try specifying a lower memory:
minikube start --memory={{.min_advised}}mb
`
exitIfNotForced(exit.Config, message, out.V{"requested": req, "system_limit": sysLimit, "max_advised": int32(maxAdvised), "min_advised": minAdvised})
exitIfNotForced(reason.Kind{ID: "RSRC_OVER_ALLOC_MEM", Advice: "Start minikube with less memory allocated: 'minikube start --memory={{.advised}}mb'"},
`Requested memory allocation {{.requested}}MB is more than your system limit {{.system_limit}}MB.`,
out.V{"requested": req, "system_limit": sysLimit, "advised": advised})
}
if float64(req) > maxAdvised {
out.WarningT(`You are allocating {{.requested}}MB to memory and your system only has {{.system_limit}}MB. You might face issues. try specifying a lower memory:
minikube start --memory={{.min_advised}}mb
`, out.V{"requested": req, "system_limit": sysLimit, "min_advised": minAdvised})
// Recommend 1GB to handle OS/VM overhead
maxAdvised := sysLimit - 1024
if req > maxAdvised {
out.WarnReason(reason.Kind{ID: "RSRC_OVER_ALLOC_MEM", Advice: "Start minikube with less memory allocated: 'minikube start --memory={{.advised}}mb'"},
`The requested memory allocation of {{.requested}}MiB does not leave room for system overhead (total system memory: {{.system_limit}}MiB). You may face stability issues.`,
out.V{"requested": req, "system_limit": sysLimit, "advised": advised})
}
}
// validateCPUCount validates the cpu count matches the minimum recommended
@ -916,45 +908,49 @@ func validateCPUCount(drvName string) {
} else {
cpuCount = viper.GetInt(cpus)
}
if cpuCount < minimumCPUS {
exitIfNotForced(exit.BadUsage, "Requested cpu count {{.requested_cpus}} is less than the minimum allowed of {{.minimum_cpus}}", out.V{"requested_cpus": cpuCount, "minimum_cpus": minimumCPUS})
exitIfNotForced(reason.RsrcInsufficientCores, "Requested cpu count {{.requested_cpus}} is less than the minimum allowed of {{.minimum_cpus}}", out.V{"requested_cpus": cpuCount, "minimum_cpus": minimumCPUS})
}
if driver.IsKIC((drvName)) {
si, err := oci.CachedDaemonInfo(drvName)
if err != nil {
out.T(out.Confused, "Failed to verify '{{.driver_name}} info' will try again ...", out.V{"driver_name": drvName})
si, err = oci.DaemonInfo(drvName)
if err != nil {
exit.UsageT("Ensure your {{.driver_name}} is running and is healthy.", out.V{"driver_name": driver.FullName(drvName)})
}
if !driver.IsKIC((drvName)) {
return
}
si, err := oci.CachedDaemonInfo(drvName)
if err != nil {
out.T(style.Confused, "Failed to verify '{{.driver_name}} info' will try again ...", out.V{"driver_name": drvName})
si, err = oci.DaemonInfo(drvName)
if err != nil {
exit.Message(reason.Usage, "Ensure your {{.driver_name}} is running and is healthy.", out.V{"driver_name": driver.FullName(drvName)})
}
if si.CPUs < 2 {
if drvName == oci.Docker {
out.T(out.Conflict, `Your Docker Desktop has less than 2 CPUs. Increase CPUs for Docker Desktop.
Docker icon > Settings > Resources > CPUs
`)
}
out.T(out.Documentation, "https://docs.docker.com/config/containers/resource_constraints/")
exitIfNotForced(exit.BadUsage, "Ensure your {{.driver_name}} system has enough CPUs. The minimum allowed is 2 CPUs.", out.V{"driver_name": driver.FullName(viper.GetString("driver"))})
}
}
// looks good
if si.CPUs >= 2 {
return
}
if drvName == oci.Docker && runtime.GOOS == "darwin" {
exitIfNotForced(reason.RsrcInsufficientDarwinDockerCores, "Docker Desktop has less than 2 CPUs configured, but Kubernetes requires at least 2 to be available")
} else if drvName == oci.Docker && runtime.GOOS == "windows" {
exitIfNotForced(reason.RsrcInsufficientWindowsDockerCores, "Docker Desktop has less than 2 CPUs configured, but Kubernetes requires at least 2 to be available")
} else {
exitIfNotForced(reason.RsrcInsufficientCores, "{{.driver_name}} has less than 2 CPUs available, but Kubernetes requires at least 2 to be available", out.V{"driver_name": driver.FullName(viper.GetString("driver"))})
}
}
// validateFlags validates the supplied flags against known bad combinations
func validateFlags(cmd *cobra.Command, drvName string) {
if cmd.Flags().Changed(humanReadableDiskSize) {
diskSizeMB, err := util.CalculateSizeInMB(viper.GetString(humanReadableDiskSize))
if err != nil {
exitIfNotForced(exit.Config, "Validation unable to parse disk size '{{.diskSize}}': {{.error}}", out.V{"diskSize": viper.GetString(humanReadableDiskSize), "error": err})
exitIfNotForced(reason.Usage, "Validation unable to parse disk size '{{.diskSize}}': {{.error}}", out.V{"diskSize": viper.GetString(humanReadableDiskSize), "error": err})
}
if diskSizeMB < minimumDiskSize {
exitIfNotForced(exit.Config, "Requested disk size {{.requested_size}} is less than minimum of {{.minimum_size}}", out.V{"requested_size": diskSizeMB, "minimum_size": minimumDiskSize})
exitIfNotForced(reason.RsrcInsufficientStorage, "Requested disk size {{.requested_size}} is less than minimum of {{.minimum_size}}", out.V{"requested_size": diskSizeMB, "minimum_size": minimumDiskSize})
}
}
@ -963,8 +959,8 @@ func validateFlags(cmd *cobra.Command, drvName string) {
out.WarningT("The '{{.name}}' driver does not respect the --cpus flag", out.V{"name": drvName})
}
}
validateCPUCount(drvName)
validateMemoryHardLimit(drvName)
if cmd.Flags().Changed(memory) {
if !driver.HasResourceLimits(drvName) {
@ -972,9 +968,9 @@ func validateFlags(cmd *cobra.Command, drvName string) {
}
req, err := util.CalculateSizeInMB(viper.GetString(memory))
if err != nil {
exitIfNotForced(exit.Config, "Unable to parse memory '{{.memory}}': {{.error}}", out.V{"memory": viper.GetString(memory), "error": err})
exitIfNotForced(reason.Usage, "Unable to parse memory '{{.memory}}': {{.error}}", out.V{"memory": viper.GetString(memory), "error": err})
}
validateMemorySize(req, drvName)
validateRequestedMemorySize(req, drvName)
}
if cmd.Flags().Changed(containerRuntime) {
@ -997,13 +993,13 @@ func validateFlags(cmd *cobra.Command, drvName string) {
}
if !validRuntime {
exit.UsageT(`Invalid Container Runtime: "{{.runtime}}". Valid runtimes are: {{.validOptions}}`, out.V{"runtime": runtime, "validOptions": strings.Join(cruntime.ValidRuntimes(), ", ")})
exit.Message(reason.Usage, `Invalid Container Runtime: "{{.runtime}}". Valid runtimes are: {{.validOptions}}`, out.V{"runtime": runtime, "validOptions": strings.Join(cruntime.ValidRuntimes(), ", ")})
}
}
if driver.BareMetal(drvName) {
if ClusterFlagValue() != constants.DefaultClusterName {
exit.WithCodeT(exit.Config, "The '{{.name}} driver does not support multiple profiles: https://minikube.sigs.k8s.io/docs/reference/drivers/none/", out.V{"name": drvName})
exit.Message(reason.DrvUnsupportedProfile, "The '{{.name}} driver does not support multiple profiles: https://minikube.sigs.k8s.io/docs/reference/drivers/none/", out.V{"name": drvName})
}
runtime := viper.GetString(containerRuntime)
@ -1015,20 +1011,19 @@ func validateFlags(cmd *cobra.Command, drvName string) {
version, _ := util.ParseKubernetesVersion(getKubernetesVersion(nil))
if version.GTE(semver.MustParse("1.18.0-beta.1")) {
if _, err := exec.LookPath("conntrack"); err != nil {
exit.WithCodeT(exit.Config, "Sorry, Kubernetes {{.k8sVersion}} requires conntrack to be installed in root's path", out.V{"k8sVersion": version.String()})
exit.Message(reason.GuestMissingConntrack, "Sorry, Kubernetes {{.k8sVersion}} requires conntrack to be installed in root's path", out.V{"k8sVersion": version.String()})
}
}
}
// validate kubeadm extra args
if invalidOpts := bsutil.FindInvalidExtraConfigFlags(config.ExtraOptions); len(invalidOpts) > 0 {
out.ErrT(
out.Warning,
out.WarningT(
"These --extra-config parameters are invalid: {{.invalid_extra_opts}}",
out.V{"invalid_extra_opts": invalidOpts},
)
exit.WithCodeT(
exit.Config,
exit.Message(
reason.Usage,
"Valid components are: {{.valid_extra_opts}}",
out.V{"valid_extra_opts": bsutil.KubeadmExtraConfigOpts},
)
@ -1038,12 +1033,12 @@ func validateFlags(cmd *cobra.Command, drvName string) {
for param := range config.ExtraOptions.AsMap().Get(bsutil.Kubeadm) {
if !config.ContainsParam(bsutil.KubeadmExtraArgsAllowed[bsutil.KubeadmCmdParam], param) &&
!config.ContainsParam(bsutil.KubeadmExtraArgsAllowed[bsutil.KubeadmConfigParam], param) {
exit.UsageT("Sorry, the kubeadm.{{.parameter_name}} parameter is currently not supported by --extra-config", out.V{"parameter_name": param})
exit.Message(reason.Usage, "Sorry, the kubeadm.{{.parameter_name}} parameter is currently not supported by --extra-config", out.V{"parameter_name": param})
}
}
if s := viper.GetString(startOutput); s != "text" && s != "json" {
exit.UsageT("Sorry, please set the --output flag to one of the following valid options: [text,json]")
exit.Message(reason.Usage, "Sorry, please set the --output flag to one of the following valid options: [text,json]")
}
validateRegistryMirror()
@ -1052,7 +1047,6 @@ func validateFlags(cmd *cobra.Command, drvName string) {
// This function validates if the --registry-mirror
// args match the format of http://localhost
func validateRegistryMirror() {
if len(registryMirror) > 0 {
for _, loc := range registryMirror {
URL, err := url.Parse(loc)
@ -1060,7 +1054,7 @@ func validateRegistryMirror() {
glog.Errorln("Error Parsing URL: ", err)
}
if (URL.Scheme != "http" && URL.Scheme != "https") || URL.Path != "" {
exit.UsageT("Sorry, the url provided with the --registry-mirror flag is invalid: {{.url}}", out.V{"url": loc})
exit.Message(reason.Usage, "Sorry, the url provided with the --registry-mirror flag is invalid: {{.url}}", out.V{"url": loc})
}
}
@ -1141,11 +1135,11 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
oldestVersion, err := semver.Make(strings.TrimPrefix(constants.OldestKubernetesVersion, version.VersionPrefix))
if err != nil {
exit.WithCodeT(exit.Data, "Unable to parse oldest Kubernetes version from constants: {{.error}}", out.V{"error": err})
exit.Message(reason.InternalSemverParse, "Unable to parse oldest Kubernetes version from constants: {{.error}}", out.V{"error": err})
}
defaultVersion, err := semver.Make(strings.TrimPrefix(constants.DefaultKubernetesVersion, version.VersionPrefix))
if err != nil {
exit.WithCodeT(exit.Data, "Unable to parse default Kubernetes version from constants: {{.error}}", out.V{"error": err})
exit.Message(reason.InternalSemverParse, "Unable to parse default Kubernetes version from constants: {{.error}}", out.V{"error": err})
}
if nvs.LT(oldestVersion) {
@ -1153,7 +1147,7 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
if !viper.GetBool(force) {
out.WarningT("You can force an unsupported Kubernetes version via the --force flag")
}
exitIfNotForced(exit.Data, "Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs})
exitIfNotForced(reason.KubernetesTooOld, "Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs})
}
if old == nil || old.KubernetesConfig.KubernetesVersion == "" {
@ -1172,26 +1166,12 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
}
suggestedName := old.Name + "2"
out.T(out.Conflict, "You have selected Kubernetes {{.new}}, but the existing cluster is running Kubernetes {{.old}}", out.V{"new": nvs, "old": ovs, "profile": profileArg})
exit.WithCodeT(exit.Config, `Non-destructive downgrades are not supported, but you can proceed with one of the following options:
1) Recreate the cluster with Kubernetes {{.new}}, by running:
minikube delete{{.profile}}
minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.new}}
2) Create a second cluster with Kubernetes {{.new}}, by running:
minikube start -p {{.suggestedName}} --kubernetes-version={{.prefix}}{{.new}}
3) Use the existing cluster at version Kubernetes {{.old}}, by running:
minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.old}}
`, out.V{"prefix": version.VersionPrefix, "new": nvs, "old": ovs, "profile": profileArg, "suggestedName": suggestedName})
exit.Message(reason.KubernetesDowngrade, "Unable to safely downgrade existing Kubernetes v{{.old}} cluster to v{{.new}}",
out.V{"prefix": version.VersionPrefix, "new": nvs, "old": ovs, "profile": profileArg, "suggestedName": suggestedName})
}
if defaultVersion.GT(nvs) {
out.T(out.New, "Kubernetes {{.new}} is now available. If you would like to upgrade, specify: --kubernetes-version={{.prefix}}{{.new}}", out.V{"prefix": version.VersionPrefix, "new": defaultVersion})
out.T(style.New, "Kubernetes {{.new}} is now available. If you would like to upgrade, specify: --kubernetes-version={{.prefix}}{{.new}}", out.V{"prefix": version.VersionPrefix, "new": defaultVersion})
}
}
@ -1211,7 +1191,7 @@ func getKubernetesVersion(old *config.ClusterConfig) string {
nvs, err := semver.Make(strings.TrimPrefix(paramVersion, version.VersionPrefix))
if err != nil {
exit.WithCodeT(exit.Data, `Unable to parse "{{.kubernetes_version}}": {{.error}}`, out.V{"kubernetes_version": paramVersion, "error": err})
exit.Message(reason.Usage, `Unable to parse "{{.kubernetes_version}}": {{.error}}`, out.V{"kubernetes_version": paramVersion, "error": err})
}
return version.VersionPrefix + nvs.String()
@ -1224,7 +1204,7 @@ func validateDockerStorageDriver(drvName string) {
return
}
if _, err := exec.LookPath(drvName); err != nil {
exit.WithCodeT(exit.BadUsage, "Please make sure {{.DriverName}} is available on your PATH", out.V{"DriverName": drvName})
exit.Error(reason.DrvNotFound, fmt.Sprintf("%s not found on PATH", drvName), err)
}
si, err := oci.DaemonInfo(drvName)
if err != nil {
@ -1239,9 +1219,9 @@ func validateDockerStorageDriver(drvName string) {
viper.Set(preload, false)
}
func exitIfNotForced(code int, message string, v out.V) {
func exitIfNotForced(r reason.Kind, message string, v ...out.V) {
if !viper.GetBool(force) {
exit.WithCodeT(code, message, v)
exit.Message(r, message, v...)
}
out.WarningT(message, v)
out.Error(r, message, v...)
}

View File

@ -38,6 +38,8 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/proxy"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
pkgutil "k8s.io/minikube/pkg/util"
"k8s.io/minikube/pkg/version"
)
@ -92,8 +94,8 @@ const (
interactive = "interactive"
waitTimeout = "wait-timeout"
nativeSSH = "native-ssh"
minUsableMem = 1024 // Kubernetes will not start with less than 1GB
minRecommendedMem = 2000 // Warn at no lower than existing configurations
minUsableMem = 1024 // In MiB: Kubernetes will not start with less than 1GiB
minRecommendedMem = 2000 // In MiB: Warn at no lower than existing configurations
minimumCPUS = 2
minimumDiskSize = 2000
autoUpdate = "auto-update-drivers"
@ -144,7 +146,7 @@ func initMinikubeFlags() {
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().String(startOutput, "text", "Format to print stdout in. Options include: [text,json]")
startCmd.Flags().StringP(startOutput, "o", "text", "Format to print stdout in. Options include: [text,json]")
}
// initKubernetesFlags inits the commandline flags for Kubernetes related options
@ -230,19 +232,19 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
var err error
mem, err = pkgutil.CalculateSizeInMB(viper.GetString(memory))
if err != nil {
exit.WithCodeT(exit.Config, "Generate unable to parse memory '{{.memory}}': {{.error}}", out.V{"memory": viper.GetString(memory), "error": err})
exit.Message(reason.Usage, "Generate unable to parse memory '{{.memory}}': {{.error}}", out.V{"memory": viper.GetString(memory), "error": err})
}
if driver.IsKIC(drvName) && mem > containerLimit {
exit.UsageT("{{.driver_name}} has only {{.container_limit}}MB memory but you specified {{.specified_memory}}MB", out.V{"container_limit": containerLimit, "specified_memory": mem, "driver_name": driver.FullName(drvName)})
exit.Message(reason.Usage, "{{.driver_name}} has only {{.container_limit}}MB memory but you specified {{.specified_memory}}MB", out.V{"container_limit": containerLimit, "specified_memory": mem, "driver_name": driver.FullName(drvName)})
}
} else {
validateMemorySize(mem, drvName)
validateRequestedMemorySize(mem, drvName)
glog.Infof("Using suggested %dMB memory alloc based on sys=%dMB, container=%dMB", mem, sysLimit, containerLimit)
}
diskSize, err := pkgutil.CalculateSizeInMB(viper.GetString(humanReadableDiskSize))
if err != nil {
exit.WithCodeT(exit.Config, "Generate unable to parse disk size '{{.diskSize}}': {{.error}}", out.V{"diskSize": viper.GetString(humanReadableDiskSize), "error": err})
exit.Message(reason.Usage, "Generate unable to parse disk size '{{.diskSize}}': {{.error}}", out.V{"diskSize": viper.GetString(humanReadableDiskSize), "error": err})
}
repository := viper.GetString(imageRepository)
@ -250,12 +252,12 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
if strings.ToLower(repository) == "auto" || (mirrorCountry != "" && repository == "") {
found, autoSelectedRepository, err := selectImageRepository(mirrorCountry, semver.MustParse(strings.TrimPrefix(k8sVersion, version.VersionPrefix)))
if err != nil {
exit.WithError("Failed to check main repository and mirrors for images", err)
exit.Error(reason.InetRepo, "Failed to check main repository and mirrors for images", err)
}
if !found {
if autoSelectedRepository == "" {
exit.WithCodeT(exit.Failure, "None of the known repositories is accessible. Consider specifying an alternative image repository with --image-repository flag")
exit.Message(reason.InetReposUnavailable, "None of the known repositories are accessible. Consider specifying an alternative image repository with --image-repository flag")
} else {
out.WarningT("None of the known repositories in your location are accessible. Using {{.image_repository_name}} as fallback.", out.V{"image_repository_name": autoSelectedRepository})
}
@ -265,7 +267,7 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
}
if cmd.Flags().Changed(imageRepository) || cmd.Flags().Changed(imageMirrorCountry) {
out.T(out.SuccessType, "Using image repository {{.name}}", out.V{"name": repository})
out.T(style.Success, "Using image repository {{.name}}", out.V{"name": repository})
}
// Backwards compatibility with --enable-default-cni
@ -329,7 +331,9 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
},
}
cc.VerifyComponents = interpretWaitFlag(*cmd)
if viper.GetBool(createMount) && driver.IsKIC(drvName) {
cc.ContainerVolumeMounts = []string{viper.GetString(mountString)}
}
cnm, err := cni.New(cc)
if err != nil {
return cc, config.Node{}, errors.Wrap(err, "cni")
@ -428,7 +432,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
}
// validate the memory size in case user changed their system memory limits (example change docker desktop or upgraded memory.)
validateMemorySize(cc.Memory, cc.Driver)
validateRequestedMemorySize(cc.Memory, cc.Driver)
if cc.CPUs == 0 {
glog.Info("Existing config file was missing cpu. (could be an old minikube config), will use the default value")

View File

@ -45,12 +45,15 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/node"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/version"
)
var statusFormat string
var output string
var layout string
var (
statusFormat string
output string
layout string
)
const (
// Additional legacy states:
@ -182,9 +185,8 @@ var statusCmd = &cobra.Command{
Exit status contains the status of minikube's VM, cluster and Kubernetes encoded on it's bits in this order from right to left.
Eg: 7 meaning: 1 (for minikube NOK) + 2 (for cluster NOK) + 4 (for Kubernetes NOK)`,
Run: func(cmd *cobra.Command, args []string) {
if output != "text" && statusFormat != defaultStatusFormat {
exit.UsageT("Cannot use both --output and --format options")
exit.Message(reason.Usage, "Cannot use both --output and --format options")
}
cname := ClusterFlagValue()
@ -195,7 +197,7 @@ var statusCmd = &cobra.Command{
if nodeName != "" || statusFormat != defaultStatusFormat && len(cc.Nodes) > 1 {
n, _, err := node.Retrieve(*cc, nodeName)
if err != nil {
exit.WithError("retrieving node", err)
exit.Error(reason.GuestNodeRetrieve, "retrieving node", err)
}
st, err := nodeStatus(api, *cc, *n)
@ -224,22 +226,22 @@ var statusCmd = &cobra.Command{
case "text":
for _, st := range statuses {
if err := statusText(st, os.Stdout); err != nil {
exit.WithError("status text failure", err)
exit.Error(reason.InternalStatusText, "status text failure", err)
}
}
case "json":
// Layout is currently only supported for JSON mode
if layout == "cluster" {
if err := clusterStatusJSON(statuses, os.Stdout); err != nil {
exit.WithError("status json failure", err)
exit.Error(reason.InternalStatusJSON, "status json failure", err)
}
} else {
if err := statusJSON(statuses, os.Stdout); err != nil {
exit.WithError("status json failure", err)
exit.Error(reason.InternalStatusJSON, "status json failure", err)
}
}
default:
exit.WithCodeT(exit.BadUsage, fmt.Sprintf("invalid output format: %s. Valid values: 'text', 'json'", output))
exit.Message(reason.Usage, fmt.Sprintf("invalid output format: %s. Valid values: 'text', 'json'", output))
}
os.Exit(exitCode(statuses))

View File

@ -34,11 +34,15 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/pkg/util/retry"
)
var stopAll bool
var keepActive bool
var (
stopAll bool
keepActive bool
)
// stopCmd represents the stop command
var stopCmd = &cobra.Command{
@ -50,12 +54,11 @@ itself, leaving all files intact. The cluster can be started again with the "sta
}
func init() {
stopCmd.Flags().BoolVar(&stopAll, "all", false, "Set flag to stop all profiles (clusters)")
stopCmd.Flags().BoolVar(&keepActive, "keep-context-active", false, "keep the kube-context active after cluster is stopped. Defaults to false.")
if err := viper.GetViper().BindPFlags(stopCmd.Flags()); err != nil {
exit.WithError("unable to bind flags", err)
exit.Error(reason.InternalFlagsBind, "unable to bind flags", err)
}
RootCmd.AddCommand(stopCmd)
@ -88,7 +91,7 @@ func runStop(cmd *cobra.Command, args []string) {
register.Reg.SetStep(register.Done)
if stoppedNodes > 0 {
out.T(out.Stopped, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes})
out.T(style.Stopped, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes})
}
}
@ -115,7 +118,7 @@ func stopProfile(profile string) int {
if !keepActive {
if err := kubeconfig.UnsetCurrentContext(profile, kubeconfig.PathFromEnv()); err != nil {
exit.WithError("update config", err)
exit.Error(reason.HostKubeconfigUnset, "update config", err)
}
}
@ -134,7 +137,7 @@ func stop(api libmachine.API, machineName string) bool {
switch err := errors.Cause(err).(type) {
case mcnerror.ErrHostDoesNotExist:
out.T(out.Meh, `"{{.machineName}}" does not exist, nothing to stop`, out.V{"machineName": machineName})
out.T(style.Meh, `"{{.machineName}}" does not exist, nothing to stop`, out.V{"machineName": machineName})
nonexistent = true
return nil
default:
@ -143,7 +146,7 @@ func stop(api libmachine.API, machineName string) bool {
}
if err := retry.Expo(tryStop, 1*time.Second, 120*time.Second, 5); err != nil {
exit.WithError("Unable to stop VM", err)
exit.Error(reason.GuestStopTimeout, "Unable to stop VM", err)
}
return nonexistent

View File

@ -33,6 +33,7 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/tunnel"
"k8s.io/minikube/pkg/minikube/tunnel/kic"
)
@ -65,7 +66,7 @@ var tunnelCmd = &cobra.Command{
// doesn't hang on the API server call during startup and shutdown time or if there is a temporary error.
clientset, err := kapi.Client(cname)
if err != nil {
exit.WithError("error creating clientset", err)
exit.Error(reason.InternalKubernetesClient, "error creating clientset", err)
}
ctrlC := make(chan os.Signal, 1)
@ -80,7 +81,7 @@ var tunnelCmd = &cobra.Command{
port, err := oci.ForwardedPort(oci.Docker, cname, 22)
if err != nil {
exit.WithError("error getting ssh port", err)
exit.Error(reason.DrvPortForward, "error getting ssh port", err)
}
sshPort := strconv.Itoa(port)
sshKey := filepath.Join(localpath.MiniPath(), "machines", cname, "id_rsa")
@ -88,7 +89,7 @@ var tunnelCmd = &cobra.Command{
kicSSHTunnel := kic.NewSSHTunnel(ctx, sshPort, sshKey, clientset.CoreV1())
err = kicSSHTunnel.Start()
if err != nil {
exit.WithError("error starting tunnel", err)
exit.Error(reason.SvcTunnelStart, "error starting tunnel", err)
}
return
@ -96,7 +97,7 @@ var tunnelCmd = &cobra.Command{
done, err := manager.StartTunnel(ctx, cname, co.API, config.DefaultLoader, clientset.CoreV1())
if err != nil {
exit.WithError("error starting tunnel", err)
exit.Error(reason.SvcTunnelStart, "error starting tunnel", err)
}
<-done
},

View File

@ -33,6 +33,8 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
// unpauseCmd represents the docker-pause command
@ -48,10 +50,10 @@ var unpauseCmd = &cobra.Command{
glog.Infof("namespaces: %v keys: %v", namespaces, viper.AllSettings())
if allNamespaces {
namespaces = nil //all
namespaces = nil // all
} else {
if len(namespaces) == 0 {
exit.WithCodeT(exit.BadUsage, "Use -A to specify all namespaces")
exit.Message(reason.Usage, "Use -A to specify all namespaces")
}
}
@ -66,27 +68,27 @@ var unpauseCmd = &cobra.Command{
name = co.Config.Name
}
out.T(out.Pause, "Unpausing node {{.name}} ... ", out.V{"name": name})
out.T(style.Pause, "Unpausing node {{.name}} ... ", out.V{"name": name})
machineName := driver.MachineName(*co.Config, n)
host, err := machine.LoadHost(co.API, machineName)
if err != nil {
exit.WithError("Error getting host", err)
exit.Error(reason.GuestLoadHost, "Error getting host", err)
}
r, err := machine.CommandRunner(host)
if err != nil {
exit.WithError("Failed to get command runner", err)
exit.Error(reason.InternalCommandRunner, "Failed to get command runner", err)
}
cr, err := cruntime.New(cruntime.Config{Type: co.Config.KubernetesConfig.ContainerRuntime, Runner: r})
if err != nil {
exit.WithError("Failed runtime", err)
exit.Error(reason.InternalNewRuntime, "Failed runtime", err)
}
uids, err := cluster.Unpause(cr, r, namespaces)
if err != nil {
exit.WithError("Pause", err)
exit.Error(reason.GuestUnpause, "Pause", err)
}
ids = append(ids, uids...)
}
@ -94,9 +96,9 @@ var unpauseCmd = &cobra.Command{
register.Reg.SetStep(register.Done)
if namespaces == nil {
out.T(out.Pause, "Unpaused {{.count}} containers", out.V{"count": len(ids)})
out.T(style.Pause, "Unpaused {{.count}} containers", out.V{"count": len(ids)})
} else {
out.T(out.Pause, "Unpaused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")})
out.T(style.Pause, "Unpaused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")})
}
},
}

View File

@ -21,6 +21,7 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/notify"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/version"
)
@ -32,11 +33,11 @@ var updateCheckCmd = &cobra.Command{
url := notify.GithubMinikubeReleasesURL
r, err := notify.GetAllVersionsFromURL(url)
if err != nil {
exit.WithError("Unable to fetch latest version info", err)
exit.Error(reason.InetVersionUnavailable, "Unable to fetch latest version info", err)
}
if len(r) < 1 {
exit.WithCodeT(exit.Data, "Update server returned an empty list")
exit.Message(reason.InetVersionEmpty, "Update server returned an empty list")
}
out.Ln("CurrentVersion: %s", version.GetVersion())

View File

@ -22,6 +22,8 @@ import (
"k8s.io/minikube/pkg/minikube/kubeconfig"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
// updateContextCmd represents the update-context command
@ -36,13 +38,12 @@ var updateContextCmd = &cobra.Command{
updated, err := kubeconfig.UpdateEndpoint(cname, co.CP.Hostname, co.CP.Port, kubeconfig.PathFromEnv())
if err != nil {
exit.WithError("update config", err)
exit.Error(reason.HostKubeconfigUpdate, "update config", err)
}
if updated {
out.T(out.Celebrate, `"{{.context}}" context has been updated to point to {{.hostname}}:{{.port}}`, out.V{"context": cname, "hostname": co.CP.Hostname, "port": co.CP.Port})
out.T(style.Celebrate, `"{{.context}}" context has been updated to point to {{.hostname}}:{{.port}}`, out.V{"context": cname, "hostname": co.CP.Hostname, "port": co.CP.Port})
} else {
out.T(out.Meh, `No changes required for the "{{.context}}" context`, out.V{"context": cname})
out.T(style.Meh, `No changes required for the "{{.context}}" context`, out.V{"context": cname})
}
},
}

View File

@ -23,6 +23,7 @@ import (
"gopkg.in/yaml.v2"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/version"
)
@ -51,17 +52,17 @@ var versionCmd = &cobra.Command{
case "json":
json, err := json.Marshal(data)
if err != nil {
exit.WithError("version json failure", err)
exit.Error(reason.InternalJSONMarshal, "version json failure", err)
}
out.Ln(string(json))
case "yaml":
yaml, err := yaml.Marshal(data)
if err != nil {
exit.WithError("version yaml failure", err)
exit.Error(reason.InternalYamlMarshal, "version yaml failure", err)
}
out.Ln(string(yaml))
default:
exit.WithCodeT(exit.BadUsage, "error: --output must be 'yaml' or 'json'")
exit.Message(reason.InternalOutputUsage, "error: --output must be 'yaml' or 'json'")
}
},
}

View File

@ -90,7 +90,7 @@ spec:
containers:
- name: kubernetes-dashboard
# WARNING: This must match pkg/minikube/bootstrapper/images/images.go
image: kubernetesui/dashboard:v2.0.1
image: kubernetesui/dashboard:v2.0.3
ports:
- containerPort: 9090
protocol: TCP

View File

@ -48,7 +48,7 @@ spec:
serviceAccountName: ingress-nginx
containers:
- name: controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.33.0
image: us.gcr.io/k8s-artifacts-prod/ingress-nginx/controller:v0.34.1@sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20
imagePullPolicy: IfNotPresent
lifecycle:
preStop:

View File

@ -4,7 +4,9 @@ sha256 b873e3590e56ead740ed905108221f98da6100da3c5b7acf2355ea1cf628d931 0.20.0.t
sha256 b1c9884855d58be94a97b2e348bcdc7db995800f0405b0f4e9a7176ee2f094a7 0.21.0.tar.gz
sha256 11890b1401c197c28ee0a70a364004f58f5ec5526365e9a283699a75e5662773 0.22.0.tar.gz
sha256 ed991ffbece8f543f5dc6aa5a660ab1ed4bae771b6aa4930663a3902cc160ea3 0.23.0.tar.gz
sha256 5703d724e0b2ce3b98208549ca9d1abdc9a0298a9abfd748b34863c0c4015dcf 0.24.0.tar.gz
# sysdig
sha256 6e477ac5fe9d3110b870bd4495f01541373a008c375a1934a2d1c46798b6bad6 146a431edf95829ac11bfd9c85ba3ef08789bffe.tar.gz
sha256 1c69363e4c36cdaeed413c2ef557af53bfc4bf1109fbcb6d6e18dc40fe6ddec8 be1ea2d9482d0e6e2cb14a0fd7e08cbecf517f94.tar.gz
sha256 766e8952a36a4198fd976b9d848523e6abe4336612188e4fc911e217d8e8a00d 96bd9bc560f67742738eb7255aeb4d03046b8045.tar.gz
sha256 6c3f5f2d699c9540e281f50cbc5cb6b580f0fc689798bc65d4a77f57f932a71c 85c88952b018fdbce2464222c3303229f5bfcfad.tar.gz

View File

@ -4,7 +4,7 @@
#
########################################################################
FALCO_MODULE_VERSION = 0.23.0
FALCO_MODULE_VERSION = 0.24.0
FALCO_MODULE_SITE = https://github.com/falcosecurity/falco/archive
FALCO_MODULE_SOURCE = $(FALCO_MODULE_VERSION).tar.gz
FALCO_MODULE_DEPENDENCIES += ncurses libyaml
@ -12,7 +12,7 @@ FALCO_MODULE_LICENSE = Apache-2.0
FALCO_MODULE_LICENSE_FILES = COPYING
# see cmake/modules/sysdig-repo/CMakeLists.txt
FALCO_MODULE_SYSDIG_VERSION = 96bd9bc560f67742738eb7255aeb4d03046b8045
FALCO_MODULE_SYSDIG_VERSION = 85c88952b018fdbce2464222c3303229f5bfcfad
FALCO_MODULE_EXTRA_DOWNLOADS = https://github.com/draios/sysdig/archive/${FALCO_MODULE_SYSDIG_VERSION}.tar.gz
define FALCO_MODULE_SYSDIG_SRC

View File

@ -56,6 +56,9 @@ RUN echo 'root:root' |chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
# minikube relies on /etc/hosts for control-plane discovery. This prevents nefarious DNS servers from breaking it.
RUN sed -ri 's/dns files/files dns/g' /etc/nsswitch.conf
EXPOSE 22
# create docker user for minikube ssh. to match VM using "docker" as username
RUN adduser --ingroup docker --disabled-password --gecos '' docker

View File

@ -82,7 +82,7 @@ fix_cgroup_mounts() {
# NOTE: This extracts fields 4 and on
# See https://man7.org/linux/man-pages/man5/proc.5.html for field names
cgroup_mounts=$(egrep -o '(/docker|libpod_parent).*/sys/fs/cgroup.*' /proc/self/mountinfo || true)
cgroup_mounts=$(egrep -o '(/docker|libpod_parent|/kubepods).*/sys/fs/cgroup.*' /proc/self/mountinfo || true)
if [[ -n "${cgroup_mounts}" ]]; then
local mount_root

View File

@ -46,7 +46,7 @@ func getSHAFromURL(url string) (string, error) {
return hex.EncodeToString(b[:]), nil
}
func TestReleasesJson(t *testing.T) {
func TestReleasesJSON(t *testing.T) {
releases, err := notify.GetAllVersionsFromURL(notify.GithubMinikubeReleasesURL)
if err != nil {
t.Fatalf("Error getting releases.json: %v", err)

View File

@ -41,7 +41,9 @@ import (
"k8s.io/minikube/pkg/minikube/machine"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/out/register"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/storageclass"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/pkg/util/retry"
)
@ -144,7 +146,7 @@ func enableOrDisableAddon(cc *config.ClusterConfig, name string, val string) err
// to match both ingress and ingress-dns addons
if strings.HasPrefix(name, "ingress") && enable {
if driver.IsKIC(cc.Driver) && runtime.GOOS != "linux" {
exit.UsageT(`Due to networking limitations of driver {{.driver_name}} on {{.os_name}}, {{.addon_name}} addon is not supported.
exit.Message(reason.Usage, `Due to networking limitations of driver {{.driver_name}} on {{.os_name}}, {{.addon_name}} addon is not supported.
Alternatively to use this addon you can use a vm-based driver:
'minikube start --vm=true'
@ -152,7 +154,7 @@ Alternatively to use this addon you can use a vm-based driver:
To track the update on this work in progress feature please check:
https://github.com/kubernetes/minikube/issues/7332`, out.V{"driver_name": cc.Driver, "os_name": runtime.GOOS, "addon_name": name})
} else if driver.BareMetal(cc.Driver) {
exit.UsageT(`Due to networking limitations of driver {{.driver_name}}, {{.addon_name}} addon is not supported. Try using a different driver.`,
exit.Message(reason.Usage, `Due to networking limitations of driver {{.driver_name}}, {{.addon_name}} addon is not supported. Try using a different driver.`,
out.V{"driver_name": cc.Driver, "addon_name": name})
}
}
@ -177,7 +179,7 @@ https://github.com/kubernetes/minikube/issues/7332`, out.V{"driver_name": cc.Dri
cp, err := config.PrimaryControlPlane(cc)
if err != nil {
exit.WithError("Error getting primary control plane", err)
exit.Error(reason.GuestCpConfig, "Error getting primary control plane", err)
}
mName := driver.MachineName(*cc, cp)
@ -193,8 +195,8 @@ https://github.com/kubernetes/minikube/issues/7332`, out.V{"driver_name": cc.Dri
if err != nil {
return errors.Wrap(err, "registry port")
}
out.T(out.Tip, `Registry addon on with {{.driver}} uses {{.port}} please use that instead of default 5000`, out.V{"driver": cc.Driver, "port": port})
out.T(out.Documentation, `For more information see: https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}`, out.V{"driver": cc.Driver})
out.T(style.Tip, `Registry addon on with {{.driver}} uses {{.port}} please use that instead of default 5000`, out.V{"driver": cc.Driver, "port": port})
out.T(style.Documentation, `For more information see: https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}`, out.V{"driver": cc.Driver})
}
}
@ -334,7 +336,7 @@ func verifyAddonStatusInternal(cc *config.ClusterConfig, name string, val string
label, ok := addonPodLabels[name]
if ok && enable {
out.T(out.HealthCheck, "Verifying {{.addon_name}} addon...", out.V{"addon_name": name})
out.T(style.HealthCheck, "Verifying {{.addon_name}} addon...", out.V{"addon_name": name})
client, err := kapi.Client(viper.GetString(config.ProfileName))
if err != nil {
return errors.Wrapf(err, "get kube-client to validate %s addon: %v", name, err)
@ -351,7 +353,6 @@ func verifyAddonStatusInternal(cc *config.ClusterConfig, name string, val string
// Start enables the default addons for a profile, plus any additional
func Start(wg *sync.WaitGroup, cc *config.ClusterConfig, toEnable map[string]bool, additional []string) {
wg.Add(1)
defer wg.Done()
start := time.Now()
@ -395,7 +396,7 @@ func Start(wg *sync.WaitGroup, cc *config.ClusterConfig, toEnable map[string]boo
defer func() { // making it show after verifications( not perfect till #7613 is closed)
register.Reg.SetStep(register.EnablingAddons)
out.T(out.AddonEnable, "Enabled addons: {{.addons}}", out.V{"addons": strings.Join(toEnableList, ", ")})
out.T(style.AddonEnable, "Enabled addons: {{.addons}}", out.V{"addons": strings.Join(toEnableList, ", ")})
}()
for _, a := range toEnableList {
awg.Add(1)

View File

@ -26,6 +26,7 @@ import (
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/tests"
)
func createTestProfile(t *testing.T) string {
@ -35,6 +36,13 @@ func createTestProfile(t *testing.T) string {
t.Fatalf("tempdir: %v", err)
}
t.Cleanup(func() {
err := os.RemoveAll(td)
t.Logf("remove path %q", td)
if err != nil {
t.Errorf("failed to clean up temp folder %q", td)
}
})
err = os.Setenv(localpath.MinikubeHome, td)
if err != nil {
t.Errorf("error setting up test environment. could not set %s", localpath.MinikubeHome)
@ -122,6 +130,10 @@ func TestSetAndSave(t *testing.T) {
}
func TestStart(t *testing.T) {
// this test will write a config.json into MinikubeHome, create a temp dir for it
tempDir := tests.MakeTempDir()
defer tests.RemoveTempDir(tempDir)
cc := &config.ClusterConfig{
Name: "start",
CPUs: 2,
@ -130,7 +142,8 @@ func TestStart(t *testing.T) {
}
var wg sync.WaitGroup
Start(&wg, cc, map[string]bool{}, []string{"dashboard"})
wg.Add(1)
go Start(&wg, cc, map[string]bool{}, []string{"dashboard"})
wg.Wait()
if !assets.Addons["dashboard"].IsEnabled(cc) {

View File

@ -29,6 +29,8 @@ import (
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
)
const (
@ -46,7 +48,6 @@ func EnableOrDisable(cfg *config.ClusterConfig, name string, val string) error {
return enableAddon(cfg)
}
return disableAddon(cfg)
}
func enableAddon(cfg *config.ClusterConfig) error {
@ -58,7 +59,7 @@ func enableAddon(cfg *config.ClusterConfig) error {
ctx := context.Background()
creds, err := google.FindDefaultCredentials(ctx)
if err != nil {
exit.WithCodeT(exit.Failure, "Could not find any GCP credentials. Either run `gcloud auth login` or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your credentials file.")
exit.Message(reason.InternalCredsNotFound, "Could not find any GCP credentials. Either run `gcloud auth login` or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your credentials file.")
}
f := assets.NewMemoryAssetTarget(creds.JSON, credentialsPath, "0444")
@ -83,7 +84,7 @@ func enableAddon(cfg *config.ClusterConfig) error {
}
out.WarningT("Could not determine a Google Cloud project, which might be ok.")
out.T(out.Tip, `To set your Google Cloud project, run:
out.T(style.Tip, `To set your Google Cloud project, run:
gcloud config set project <project name>
@ -122,8 +123,8 @@ func DisplayAddonMessage(cfg *config.ClusterConfig, name string, val string) err
return errors.Wrapf(err, "parsing bool: %s", name)
}
if enable {
out.T(out.Notice, "Your GCP credentials will now be mounted into every pod created in the {{.name}} cluster.", out.V{"name": cfg.Name})
out.T(out.Notice, "If you don't want your credentials mounted into a specific pod, add a label with the `gcp-auth-skip-secret` key to your pod configuration.")
out.T(style.Notice, "Your GCP credentials will now be mounted into every pod created in the {{.name}} cluster.", out.V{"name": cfg.Name})
out.T(style.Notice, "If you don't want your credentials mounted into a specific pod, add a label with the `gcp-auth-skip-secret` key to your pod configuration.")
}
return nil
}

View File

@ -68,6 +68,7 @@ func NewDriver(c Config) *Driver {
// Create a host using the driver's config
func (d *Driver) Create() error {
params := oci.CreateParams{
Mounts: d.NodeConfig.Mounts,
Name: d.NodeConfig.MachineName,
Image: d.NodeConfig.ImageDigest,
ClusterLabel: oci.ProfileLabelKey + "=" + d.MachineName,

View File

@ -28,6 +28,7 @@ import (
"github.com/golang/glog"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/style"
)
// RunResult holds the results of a Runner
@ -100,7 +101,7 @@ func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
if warn { // convert exec.Command to with context
cmdWithCtx := exec.CommandContext(ctx, cmd.Args[0], cmd.Args[1:]...)
cmdWithCtx.Stdout = cmd.Stdout //copying the original command
cmdWithCtx.Stdout = cmd.Stdout // copying the original command
cmdWithCtx.Stderr = cmd.Stderr
cmd = cmdWithCtx
}
@ -134,7 +135,7 @@ func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
out.WarningT(`Executing "{{.command}}" took an unusually long time: {{.duration}}`, out.V{"command": rr.Command(), "duration": elapsed})
// Don't show any restarting hint, when running podman locally (on linux, with sudo). Only when having a service.
if cmd.Args[0] != "sudo" {
out.ErrT(out.Tip, `Restarting the {{.name}} service may improve performance.`, out.V{"name": cmd.Args[0]})
out.ErrT(style.Tip, `Restarting the {{.name}} service may improve performance.`, out.V{"name": cmd.Args[0]})
}
}

View File

@ -58,9 +58,20 @@ func digDNS(ociBin, containerName, dns string) (net.IP, error) {
return ip, nil
}
// profileInContainers checks whether the profile is within the containers list
func profileInContainers(profile string, containers []string) bool {
for _, container := range containers {
if container == profile {
return true
}
}
return false
}
// dockerGatewayIP gets the default gateway ip for the docker bridge on the user's host machine
// gets the ip from user's host docker
func dockerGatewayIP(profile string) (net.IP, error) {
var bridgeID string
// check if using custom network first
if networkExists(profile) {
ip := net.ParseIP(DefaultGateway)
@ -70,8 +81,25 @@ func dockerGatewayIP(profile string) (net.IP, error) {
if err != nil {
return nil, errors.Wrapf(err, "get network bridge")
}
networksOutput := strings.TrimSpace(rr.Stdout.String())
networksSlice := strings.Fields(networksOutput)
// Look for the minikube container within each docker network
for _, net := range networksSlice {
// get all containers in the network
rs, err := runCmd(exec.Command(Docker, "network", "inspect", net, "-f", "{{range $k, $v := .Containers}}{{$v.Name}} {{end}}"))
if err != nil {
return nil, errors.Wrapf(err, "get containers in network")
}
containersSlice := strings.Fields(rs.Stdout.String())
if profileInContainers(profile, containersSlice) {
bridgeID = net
break
}
}
bridgeID := strings.TrimSpace(rr.Stdout.String())
if bridgeID == "" {
return nil, errors.Errorf("unable to determine bridge network id from %q", networksOutput)
}
rr, err = runCmd(exec.Command(Docker, "network", "inspect",
"--format", "{{(index .IPAM.Config 0).Gateway}}", bridgeID))
if err != nil {

View File

@ -16,6 +16,13 @@ limitations under the License.
package oci
import (
"errors"
"fmt"
"path/filepath"
"strings"
)
const (
// DefaultBindIPV4 is The default IP the container will listen on.
DefaultBindIPV4 = "127.0.0.1"
@ -102,6 +109,46 @@ type Mount struct {
Propagation MountPropagation `protobuf:"varint,5,opt,name=propagation,proto3,enum=runtime.v1alpha2.MountPropagation" json:"propagation,omitempty"`
}
// ParseMountString parses a mount string of format:
// '[host-path:]container-path[:<options>]' The comma-delimited 'options' are
// [rw|ro], [Z], [srhared|rslave|rprivate].
func ParseMountString(spec string) (m Mount, err error) {
switch fields := strings.Split(spec, ":"); len(fields) {
case 0:
err = errors.New("invalid empty spec")
case 1:
m.ContainerPath = fields[0]
case 3:
for _, opt := range strings.Split(fields[2], ",") {
switch opt {
case "Z":
m.SelinuxRelabel = true
case "ro":
m.Readonly = true
case "rw":
m.Readonly = false
case "rslave":
m.Propagation = MountPropagationHostToContainer
case "rshared":
m.Propagation = MountPropagationBidirectional
case "private":
m.Propagation = MountPropagationNone
default:
err = fmt.Errorf("unknown mount option: '%s'", opt)
}
}
fallthrough
case 2:
m.HostPath, m.ContainerPath = fields[0], fields[1]
if !filepath.IsAbs(m.ContainerPath) {
err = fmt.Errorf("'%s' container path must be absolute", m.ContainerPath)
}
default:
err = errors.New("spec must be in form: <host path>:<container path>[:<options>]")
}
return m, err
}
// PortMapping specifies a host port mapped into a container port.
// In yaml this looks like:
// containerPort: 80

View File

@ -24,9 +24,9 @@ import (
const (
// Version is the current version of kic
Version = "v0.0.12-snapshot"
Version = "v0.0.12-snapshot3"
// SHA of the kic base image
baseImageSHA = "7be40a42fdfec56fbf7bc9de07ea2ed4a931cbb70dccb8612b2ba13763bf4568"
baseImageSHA = "1d687ba53e19dbe5fafe4cc18aa07f269ecc4b7b622f2251b5bf569ddb474e9b"
)
var (

View File

@ -124,7 +124,7 @@ func writeSubcommands(command *cobra.Command, w io.Writer) error {
func generateTitle(command *cobra.Command, w io.Writer) error {
date := time.Now().Format("2006-01-02")
title := out.ApplyTemplateFormatting(9999, false, title, out.V{"Command": command.Name(), "Description": command.Short, "Date": date})
title := out.Fmt(title, out.V{"Command": command.Name(), "Description": command.Short, "Date": date})
_, err := w.Write([]byte(title))
return err
}
@ -134,5 +134,5 @@ func saveDocForCommand(command *cobra.Command, contents []byte, path string) err
if err := os.Remove(fp); err != nil {
glog.Warningf("error removing %s", fp)
}
return ioutil.WriteFile(fp, contents, 0644)
return ioutil.WriteFile(fp, contents, 0o644)
}

View File

@ -65,12 +65,6 @@ etcd:
dataDir: {{.EtcdDataDir}}
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://{{.AdvertiseAddress}}:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: {{.KubernetesVersion}}
networking:
dnsDomain: {{if .DNSDomain}}{{.DNSDomain}}{{else}}cluster.local{{end}}

View File

@ -68,12 +68,6 @@ etcd:
{{- range $i, $val := printMapInOrder .EtcdExtraArgs ": " }}
{{$val}}
{{- end}}
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: {{.KubernetesVersion}}
networking:
dnsDomain: {{if .DNSDomain}}{{.DNSDomain}}{{else}}cluster.local{{end}}

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:12345
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -29,9 +29,11 @@ controllerManager:
extraArgs:
feature-gates: "a=b"
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
feature-gates: "a=b"
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -43,12 +45,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: 1.1.1.1

View File

@ -24,6 +24,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -34,12 +40,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -27,8 +27,10 @@ apiServer:
controllerManager:
extraArgs:
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -40,12 +42,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.14.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:12345
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -29,9 +29,11 @@ controllerManager:
extraArgs:
feature-gates: "a=b"
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
feature-gates: "a=b"
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -43,12 +45,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: 1.1.1.1

View File

@ -24,6 +24,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -34,12 +40,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -27,8 +27,10 @@ apiServer:
controllerManager:
extraArgs:
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -40,12 +42,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.15.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:12345
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -29,9 +29,11 @@ controllerManager:
extraArgs:
feature-gates: "a=b"
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
feature-gates: "a=b"
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -43,12 +45,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: 1.1.1.1

View File

@ -24,6 +24,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -34,12 +40,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -27,8 +27,10 @@ apiServer:
controllerManager:
extraArgs:
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -40,12 +42,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
listen-metrics-urls: http://127.0.0.1:2381,http://1.1.1.1:2381
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.16.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:12345
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -29,9 +29,11 @@ controllerManager:
extraArgs:
feature-gates: "a=b"
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
feature-gates: "a=b"
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -43,12 +45,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: 1.1.1.1

View File

@ -24,6 +24,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -34,12 +40,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -27,8 +27,10 @@ apiServer:
controllerManager:
extraArgs:
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -40,12 +42,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.17.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:12345
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local

View File

@ -29,9 +29,11 @@ controllerManager:
extraArgs:
feature-gates: "a=b"
kube-api-burst: "32"
leader-elect: "false"
scheduler:
extraArgs:
feature-gates: "a=b"
leader-elect: "false"
scheduler-name: "mini-scheduler"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
@ -43,12 +45,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local

View File

@ -23,6 +23,12 @@ apiServer:
certSANs: ["127.0.0.1", "localhost", "1.1.1.1"]
extraArgs:
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
controllerManager:
extraArgs:
leader-elect: "false"
scheduler:
extraArgs:
leader-elect: "false"
certificatesDir: /var/lib/minikube/certs
clusterName: mk
controlPlaneEndpoint: control-plane.minikube.internal:8443
@ -33,12 +39,6 @@ etcd:
dataDir: /var/lib/minikube/etcd
extraArgs:
proxy-refresh-interval: "70000"
controllerManager:
extraArgs:
"leader-elect": "false"
scheduler:
extraArgs:
"leader-elect": "false"
kubernetesVersion: v1.18.0
networking:
dnsDomain: cluster.local

Some files were not shown because too many files have changed in this diff Show More