Allow custom cert for ingress to be overwritten

pull/12897/head
Sharif Elgamal 2021-11-08 17:16:00 -08:00
parent 2ec8875aed
commit 93e267c5ae
1 changed files with 11 additions and 4 deletions

View File

@ -32,6 +32,9 @@ import (
"k8s.io/minikube/pkg/minikube/style"
)
var posResponses = []string{"yes", "y"}
var negResponses = []string{"no", "n"}
var addonsConfigureCmd = &cobra.Command{
Use: "configure ADDON_NAME",
Short: "Configures the addon w/ADDON_NAME within minikube (example: minikube addons configure registry-creds). For a list of available addons use: minikube addons list",
@ -45,8 +48,6 @@ var addonsConfigureCmd = &cobra.Command{
// allows for additional prompting of information when enabling addons
switch addon {
case "registry-creds":
posResponses := []string{"yes", "y"}
negResponses := []string{"no", "n"}
// Default values
awsAccessID := "changeme"
@ -220,10 +221,16 @@ var addonsConfigureCmd = &cobra.Command{
return format.MatchString(s)
}
if cfg.KubernetesConfig.CustomIngressCert == "" {
cfg.KubernetesConfig.CustomIngressCert = AskForStaticValidatedValue("-- Enter custom cert(format is \"namespace/secret\"): ", validator)
customCert := AskForStaticValidatedValue("-- Enter custom cert(format is \"namespace/secret\"): ", validator)
if cfg.KubernetesConfig.CustomIngressCert != "" {
overwrite := AskForYesNoConfirmation("A custom cert for ingress has already been set. Do you want overwrite it?", posResponses, negResponses)
if !overwrite {
break
}
}
cfg.KubernetesConfig.CustomIngressCert = customCert
if err := config.SaveProfile(profile, cfg); err != nil {
out.ErrT(style.Fatal, "Failed to save config {{.profile}}", out.V{"profile": profile})
}