From 934ac1f109326e7bf8b7228f087bb99e1691fe4e Mon Sep 17 00:00:00 2001 From: JacekDuszenko Date: Fri, 4 Jun 2021 00:05:37 +0100 Subject: [PATCH 1/2] add json deserialization to embed-certs from global config --- pkg/minikube/config/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/minikube/config/types.go b/pkg/minikube/config/types.go index aee9b1ac2840..274d5d3e8302 100644 --- a/pkg/minikube/config/types.go +++ b/pkg/minikube/config/types.go @@ -34,7 +34,7 @@ type Profile struct { type ClusterConfig struct { Name string KeepContext bool // used by start and profile command to or not to switch kubectl's current context - EmbedCerts bool // used by kubeconfig.Setup + EmbedCerts bool `json:"embed-certs"` // used by kubeconfig.Setup MinikubeISO string // ISO used for VM-drivers. KicBaseImage string // base-image used for docker/podman drivers. Memory int From b7a6dd0b5e141bcf33df6a0f0042746a837509a9 Mon Sep 17 00:00:00 2001 From: JacekDuszenko Date: Sat, 5 Jun 2021 23:52:40 +0100 Subject: [PATCH 2/2] implement embed certs global config as EmbedCerts --- cmd/minikube/cmd/config/config.go | 2 +- cmd/minikube/cmd/root.go | 1 + cmd/minikube/cmd/start.go | 1 - pkg/minikube/config/config.go | 2 ++ pkg/minikube/config/types.go | 2 +- site/content/en/docs/commands/config.md | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/minikube/cmd/config/config.go b/cmd/minikube/cmd/config/config.go index 8ef3630915f1..bc9c5d6d8456 100644 --- a/cmd/minikube/cmd/config/config.go +++ b/cmd/minikube/cmd/config/config.go @@ -172,7 +172,7 @@ var settings = []Setting{ setMap: SetMap, }, { - name: "embed-certs", + name: config.EmbedCerts, set: SetBool, }, { diff --git a/cmd/minikube/cmd/root.go b/cmd/minikube/cmd/root.go index cfcd7f02763e..b702496a6cce 100644 --- a/cmd/minikube/cmd/root.go +++ b/cmd/minikube/cmd/root.go @@ -301,6 +301,7 @@ func setupViper() { viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) viper.AutomaticEnv() + viper.RegisterAlias(config.EmbedCerts, embedCerts) viper.SetDefault(config.WantUpdateNotification, true) viper.SetDefault(config.ReminderWaitPeriodInHours, 24) viper.SetDefault(config.WantReportError, false) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 0d4f574e29a8..bd0c4f162d6e 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -169,7 +169,6 @@ func runStart(cmd *cobra.Command, args []string) { out.WarningT("Profile name '{{.name}}' is not valid", out.V{"name": ClusterFlagValue()}) exit.Message(reason.Usage, "Only alphanumeric and dashes '-' are permitted. Minimum 2 characters, starting with alphanumeric.") } - existing, err := config.Load(ClusterFlagValue()) if err != nil && !config.IsNotExist(err) { kind := reason.HostConfigLoad diff --git a/pkg/minikube/config/config.go b/pkg/minikube/config/config.go index f194099266a5..22e99f1e3b6b 100644 --- a/pkg/minikube/config/config.go +++ b/pkg/minikube/config/config.go @@ -58,6 +58,8 @@ const ( AddonRegistries = "addon-registries" // AddonListFlag represents the key for addons parameter AddonListFlag = "addons" + // EmbedCerts represents the config for embedding certificates in kubeconfig + EmbedCerts = "EmbedCerts" ) var ( diff --git a/pkg/minikube/config/types.go b/pkg/minikube/config/types.go index 274d5d3e8302..aee9b1ac2840 100644 --- a/pkg/minikube/config/types.go +++ b/pkg/minikube/config/types.go @@ -34,7 +34,7 @@ type Profile struct { type ClusterConfig struct { Name string KeepContext bool // used by start and profile command to or not to switch kubectl's current context - EmbedCerts bool `json:"embed-certs"` // used by kubeconfig.Setup + EmbedCerts bool // used by kubeconfig.Setup MinikubeISO string // ISO used for VM-drivers. KicBaseImage string // base-image used for docker/podman drivers. Memory int diff --git a/site/content/en/docs/commands/config.md b/site/content/en/docs/commands/config.md index 51ff431b204b..16f8f5a382db 100644 --- a/site/content/en/docs/commands/config.md +++ b/site/content/en/docs/commands/config.md @@ -41,7 +41,7 @@ Configurable fields: * hyperv-virtual-switch * disable-driver-mounts * cache - * embed-certs + * EmbedCerts * native-ssh ```shell