Skip to content

Commit

Permalink
Merge pull request #12897 from sharifelgamal/overwrite-ingress-crt
Browse files Browse the repository at this point in the history
Allow custom cert for ingress to be overwritten
  • Loading branch information
sharifelgamal authored Nov 10, 2021
2 parents 12b9d92 + df14157 commit 7d28cfa
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmd/minikube/cmd/config/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down Expand Up @@ -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})
}
Expand Down

0 comments on commit 7d28cfa

Please sign in to comment.