From e6721038043384be300dbcfc807de7506c68b7f8 Mon Sep 17 00:00:00 2001 From: Sriram Panyam Date: Mon, 16 Dec 2024 15:45:00 -0800 Subject: [PATCH 1/5] Option to load addon configs from file --- cmd/minikube/cmd/config/configure.go | 107 +++++++++++++++++++++------ 1 file changed, 83 insertions(+), 24 deletions(-) diff --git a/cmd/minikube/cmd/config/configure.go b/cmd/minikube/cmd/config/configure.go index 435dabdb904a..58c342b4eac7 100644 --- a/cmd/minikube/cmd/config/configure.go +++ b/cmd/minikube/cmd/config/configure.go @@ -17,6 +17,7 @@ limitations under the License. package config import ( + "log" "net" "os" "regexp" @@ -38,6 +39,7 @@ import ( "k8s.io/minikube/pkg/minikube/sysinit" ) +var AddonConfigFile = "" var posResponses = []string{"yes", "y"} var negResponses = []string{"no", "n"} @@ -73,25 +75,56 @@ var addonsConfigureCmd = &cobra.Command{ acrClientID := "changeme" acrPassword := "changeme" - enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses) - if enableAWSECR { - awsAccessID = AskForStaticValue("-- Enter AWS Access Key ID: ") - awsAccessKey = AskForStaticValue("-- Enter AWS Secret Access Key: ") - awsSessionToken = AskForStaticValueOptional("-- (Optional) Enter AWS Session Token: ") - awsRegion = AskForStaticValue("-- Enter AWS Region: ") - awsAccount = AskForStaticValue("-- Enter 12 digit AWS Account ID (Comma separated list): ") - awsRole = AskForStaticValueOptional("-- (Optional) Enter ARN of AWS role to assume: ") + regCredsConfig := make(map[string]any) + + if regCredsConfig == nil || regCredsConfig["enableAWSEcr"] == "prompt" { + enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses) + if enableAWSECR { + awsAccessID = AskForStaticValue("-- Enter AWS Access Key ID: ") + awsAccessKey = AskForStaticValue("-- Enter AWS Secret Access Key: ") + awsSessionToken = AskForStaticValueOptional("-- (Optional) Enter AWS Session Token: ") + awsRegion = AskForStaticValue("-- Enter AWS Region: ") + awsAccount = AskForStaticValue("-- Enter 12 digit AWS Account ID (Comma separated list): ") + awsRole = AskForStaticValueOptional("-- (Optional) Enter ARN of AWS role to assume: ") + } + } else if regCredsConfig["enableAWSEcr"] == "enable" { + log.Println("Loading AWS ECR configs from: ", AddonConfigFile) + // Then read the configs + awsAccessID = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessID") + awsAccessKey = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessKey") + awsSessionToken = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsSessionToken") + awsRegion = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsRegion") + awsAccount = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccount") + awsRole = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsRole") + } else if regCredsConfig["enableAWSEcr"] == "disable" { + log.Println("Ignoring AWS ECR configs") + } else { + log.Printf("Disabling AWS ECR. Invalid value for enableAWSEcr (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableAWSEcr"]) } - enableGCR := AskForYesNoConfirmation("\nDo you want to enable Google Container Registry?", posResponses, negResponses) - if enableGCR { - gcrPath := AskForStaticValue("-- Enter path to credentials (e.g. /home/user/.config/gcloud/application_default_credentials.json):") - gcrchangeURL := AskForYesNoConfirmation("-- Do you want to change the GCR URL (Default https://gcr.io)?", posResponses, negResponses) + gcrPath := "" + if regCredsConfig == nil || regCredsConfig["enableGCR"] == "prompt" { + enableGCR := AskForYesNoConfirmation("\nDo you want to enable Google Container Registry?", posResponses, negResponses) + if enableGCR { + gcrPath = AskForStaticValue("-- Enter path to credentials (e.g. /home/user/.config/gcloud/application_default_credentials.json):") + gcrchangeURL := AskForYesNoConfirmation("-- Do you want to change the GCR URL (Default https://gcr.io)?", posResponses, negResponses) - if gcrchangeURL { - gcrURL = AskForStaticValue("-- Enter GCR URL (e.g. https://asia.gcr.io):") + if gcrchangeURL { + gcrURL = AskForStaticValue("-- Enter GCR URL (e.g. https://asia.gcr.io):") + } } + } else if regCredsConfig["enableGCR"] == "enable" { + log.Println("Loading GCR configs from: ", AddonConfigFile) + // Then read the configs + gcrPath = GetNextedJsonString(regCredsConfig, "gcrConfigs", "gcrPath") + gcrURL = GetNextedJsonString(regCredsConfig, "gcrConfigs", "gcrURL") + } else if regCredsConfig["enableGCR"] == "disable" { + log.Println("Ignoring GCR configs") + } else { + log.Printf("Disabling GCR. Invalid value for enableGCR (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableGCR"]) + } + if gcrPath != "" { // Read file from disk dat, err := os.ReadFile(gcrPath) @@ -102,18 +135,39 @@ var addonsConfigureCmd = &cobra.Command{ } } - enableDR := AskForYesNoConfirmation("\nDo you want to enable Docker Registry?", posResponses, negResponses) - if enableDR { - dockerServer = AskForStaticValue("-- Enter docker registry server url: ") - dockerUser = AskForStaticValue("-- Enter docker registry username: ") - dockerPass = AskForPasswordValue("-- Enter docker registry password: ") + if regCredsConfig == nil || regCredsConfig["enableDockerRegistry"] == "prompt" { + enableDR := AskForYesNoConfirmation("\nDo you want to enable Docker Registry?", posResponses, negResponses) + if enableDR { + dockerServer = AskForStaticValue("-- Enter docker registry server url: ") + dockerUser = AskForStaticValue("-- Enter docker registry username: ") + dockerPass = AskForPasswordValue("-- Enter docker registry password: ") + } + } else if regCredsConfig["enableDockerRegistry"] == "enable" { + dockerServer = GetNextedJsonString(regCredsConfig, "dockerConfigs", "dockerServer") + dockerUser = GetNextedJsonString(regCredsConfig, "dockerConfigs", "dockerUser") + dockerPass = GetNextedJsonString(regCredsConfig, "dockerConfigs", "dockerPass") + } else if regCredsConfig["enableDockerRegistry"] == "disable" { + log.Println("Ignoring Docker Registry configs") + } else { + log.Printf("Disabling Docker Registry. Invalid value for enableDockerRegistry (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableDockerRegistry"]) } - enableACR := AskForYesNoConfirmation("\nDo you want to enable Azure Container Registry?", posResponses, negResponses) - if enableACR { - acrURL = AskForStaticValue("-- Enter Azure Container Registry (ACR) URL: ") - acrClientID = AskForStaticValue("-- Enter client ID (service principal ID) to access ACR: ") - acrPassword = AskForPasswordValue("-- Enter service principal password to access Azure Container Registry: ") + if regCredsConfig == nil || regCredsConfig["enableACR"] == "prompt" { + enableACR := AskForYesNoConfirmation("\nDo you want to enable Azure Container Registry?", posResponses, negResponses) + if enableACR { + acrURL = AskForStaticValue("-- Enter Azure Container Registry (ACR) URL: ") + acrClientID = AskForStaticValue("-- Enter client ID (service principal ID) to access ACR: ") + acrPassword = AskForPasswordValue("-- Enter service principal password to access Azure Container Registry: ") + } + } else if regCredsConfig == nil || regCredsConfig["enableACR"] == "enable" { + log.Println("Loading ACR configs from: ", AddonConfigFile) + acrURL = GetNextedJsonString(regCredsConfig, "acrConfigs", "acrURL") + acrClientID = GetNextedJsonString(regCredsConfig, "acrConfigs", "acrClientID") + acrPassword = GetNextedJsonString(regCredsConfig, "acrConfigs", "acrPassword") + } else if regCredsConfig["enableDockerRegistry"] == "disable" { + log.Println("Ignoring ACR configs") + } else { + log.Printf("Disabling ACR. Invalid value for enableACR (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableACR"]) } namespace := "kube-system" @@ -339,5 +393,10 @@ func unpauseWholeCluster(co mustload.ClusterController) { } func init() { + addonsConfigureCmd.Flags().StringVarP(&AddonConfigFile, "config-file", "c", "", "An optional configuration file to read addon specific configs from instead of being prompted each time.") AddonsCmd.AddCommand(addonsConfigureCmd) } + +func GetNextedJsonString(configMap map[string]any, keypath ...string) (out string) { + return +} From da060c14ace7f68b801b601c0c5c0918e506bad2 Mon Sep 17 00:00:00 2001 From: Sriram Panyam Date: Mon, 16 Dec 2024 17:28:26 -0800 Subject: [PATCH 2/5] properly using minikube.out pkg for printing messages --- cmd/minikube/cmd/config/configure.go | 104 ++++++++++++++++++--------- 1 file changed, 72 insertions(+), 32 deletions(-) diff --git a/cmd/minikube/cmd/config/configure.go b/cmd/minikube/cmd/config/configure.go index 58c342b4eac7..1f60bb6791bb 100644 --- a/cmd/minikube/cmd/config/configure.go +++ b/cmd/minikube/cmd/config/configure.go @@ -17,9 +17,13 @@ limitations under the License. package config import ( + "encoding/json" + "errors" + "fmt" "log" "net" "os" + "reflect" "regexp" "time" @@ -77,7 +81,19 @@ var addonsConfigureCmd = &cobra.Command{ regCredsConfig := make(map[string]any) - if regCredsConfig == nil || regCredsConfig["enableAWSEcr"] == "prompt" { + out.Ln("Reading %s configs from %s", addon, AddonConfigFile) + if confData, err := os.ReadFile(AddonConfigFile); err != nil && errors.Is(err, os.ErrNotExist) { + exit.Message(reason.Usage, "config file does not exist") + } else if err != nil { + exit.Message(reason.Kind{ExitCode: reason.ExProgramConfig, Advice: "provide a valid config file"}, + fmt.Sprintf("error opening config file: %v", err)) + } else if err = json.Unmarshal(confData, ®CredsConfig); err != nil { + exit.Message(reason.Kind{ExitCode: reason.ExProgramConfig, Advice: "provide a valid config file"}, + fmt.Sprintf("error opening config file: %v", err)) + } + + awsEcrAction := getNestedJsonString(regCredsConfig, "enableAWSEcr") + if regCredsConfig == nil || awsEcrAction == "prompt" { enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses) if enableAWSECR { awsAccessID = AskForStaticValue("-- Enter AWS Access Key ID: ") @@ -87,23 +103,24 @@ var addonsConfigureCmd = &cobra.Command{ awsAccount = AskForStaticValue("-- Enter 12 digit AWS Account ID (Comma separated list): ") awsRole = AskForStaticValueOptional("-- (Optional) Enter ARN of AWS role to assume: ") } - } else if regCredsConfig["enableAWSEcr"] == "enable" { + } else if awsEcrAction == "enable" { log.Println("Loading AWS ECR configs from: ", AddonConfigFile) // Then read the configs - awsAccessID = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessID") - awsAccessKey = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessKey") - awsSessionToken = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsSessionToken") - awsRegion = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsRegion") - awsAccount = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccount") - awsRole = GetNextedJsonString(regCredsConfig, "awsEcrConfigs", "awsRole") - } else if regCredsConfig["enableAWSEcr"] == "disable" { + awsAccessID = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessID") + awsAccessKey = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessKey") + awsSessionToken = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsSessionToken") + awsRegion = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsRegion") + awsAccount = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccount") + awsRole = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsRole") + } else if awsEcrAction == "disable" { log.Println("Ignoring AWS ECR configs") } else { - log.Printf("Disabling AWS ECR. Invalid value for enableAWSEcr (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableAWSEcr"]) + out.Ln("Disabling AWS ECR. Invalid value for enableAWSEcr (%s). Must be one of 'disable', 'enable' or 'prompt'", awsEcrAction) } gcrPath := "" - if regCredsConfig == nil || regCredsConfig["enableGCR"] == "prompt" { + gcrAction := getNestedJsonString(regCredsConfig, "enableGCR") + if regCredsConfig == nil || gcrAction == "prompt" { enableGCR := AskForYesNoConfirmation("\nDo you want to enable Google Container Registry?", posResponses, negResponses) if enableGCR { gcrPath = AskForStaticValue("-- Enter path to credentials (e.g. /home/user/.config/gcloud/application_default_credentials.json):") @@ -113,15 +130,15 @@ var addonsConfigureCmd = &cobra.Command{ gcrURL = AskForStaticValue("-- Enter GCR URL (e.g. https://asia.gcr.io):") } } - } else if regCredsConfig["enableGCR"] == "enable" { + } else if gcrAction == "enable" { log.Println("Loading GCR configs from: ", AddonConfigFile) // Then read the configs - gcrPath = GetNextedJsonString(regCredsConfig, "gcrConfigs", "gcrPath") - gcrURL = GetNextedJsonString(regCredsConfig, "gcrConfigs", "gcrURL") - } else if regCredsConfig["enableGCR"] == "disable" { + gcrPath = getNestedJsonString(regCredsConfig, "gcrConfigs", "gcrPath") + gcrURL = getNestedJsonString(regCredsConfig, "gcrConfigs", "gcrURL") + } else if gcrAction == "disable" { log.Println("Ignoring GCR configs") } else { - log.Printf("Disabling GCR. Invalid value for enableGCR (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableGCR"]) + out.Ln("Disabling GCR. Invalid value for enableGCR (%s). Must be one of 'disable', 'enable' or 'prompt'", gcrAction) } if gcrPath != "" { @@ -135,39 +152,41 @@ var addonsConfigureCmd = &cobra.Command{ } } - if regCredsConfig == nil || regCredsConfig["enableDockerRegistry"] == "prompt" { + dockerRegistryAction := getNestedJsonString(regCredsConfig, "enableDockerRegistry") + if regCredsConfig == nil || dockerRegistryAction == "prompt" { enableDR := AskForYesNoConfirmation("\nDo you want to enable Docker Registry?", posResponses, negResponses) if enableDR { dockerServer = AskForStaticValue("-- Enter docker registry server url: ") dockerUser = AskForStaticValue("-- Enter docker registry username: ") dockerPass = AskForPasswordValue("-- Enter docker registry password: ") } - } else if regCredsConfig["enableDockerRegistry"] == "enable" { - dockerServer = GetNextedJsonString(regCredsConfig, "dockerConfigs", "dockerServer") - dockerUser = GetNextedJsonString(regCredsConfig, "dockerConfigs", "dockerUser") - dockerPass = GetNextedJsonString(regCredsConfig, "dockerConfigs", "dockerPass") - } else if regCredsConfig["enableDockerRegistry"] == "disable" { + } else if dockerRegistryAction == "enable" { + dockerServer = getNestedJsonString(regCredsConfig, "dockerConfigs", "dockerServer") + dockerUser = getNestedJsonString(regCredsConfig, "dockerConfigs", "dockerUser") + dockerPass = getNestedJsonString(regCredsConfig, "dockerConfigs", "dockerPass") + } else if dockerRegistryAction == "disable" { log.Println("Ignoring Docker Registry configs") } else { - log.Printf("Disabling Docker Registry. Invalid value for enableDockerRegistry (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableDockerRegistry"]) + out.Ln("Disabling Docker Registry. Invalid value for enableDockerRegistry (%s). Must be one of 'disable', 'enable' or 'prompt'", dockerRegistryAction) } - if regCredsConfig == nil || regCredsConfig["enableACR"] == "prompt" { + acrAction := getNestedJsonString(regCredsConfig, "enableACR") + if regCredsConfig == nil || acrAction == "prompt" { enableACR := AskForYesNoConfirmation("\nDo you want to enable Azure Container Registry?", posResponses, negResponses) if enableACR { acrURL = AskForStaticValue("-- Enter Azure Container Registry (ACR) URL: ") acrClientID = AskForStaticValue("-- Enter client ID (service principal ID) to access ACR: ") acrPassword = AskForPasswordValue("-- Enter service principal password to access Azure Container Registry: ") } - } else if regCredsConfig == nil || regCredsConfig["enableACR"] == "enable" { + } else if regCredsConfig == nil || acrAction == "enable" { log.Println("Loading ACR configs from: ", AddonConfigFile) - acrURL = GetNextedJsonString(regCredsConfig, "acrConfigs", "acrURL") - acrClientID = GetNextedJsonString(regCredsConfig, "acrConfigs", "acrClientID") - acrPassword = GetNextedJsonString(regCredsConfig, "acrConfigs", "acrPassword") - } else if regCredsConfig["enableDockerRegistry"] == "disable" { + acrURL = getNestedJsonString(regCredsConfig, "acrConfigs", "acrURL") + acrClientID = getNestedJsonString(regCredsConfig, "acrConfigs", "acrClientID") + acrPassword = getNestedJsonString(regCredsConfig, "acrConfigs", "acrPassword") + } else if acrAction == "disable" { log.Println("Ignoring ACR configs") } else { - log.Printf("Disabling ACR. Invalid value for enableACR (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableACR"]) + out.Stringf("Disabling ACR. Invalid value for enableACR (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableACR"]) } namespace := "kube-system" @@ -397,6 +416,27 @@ func init() { AddonsCmd.AddCommand(addonsConfigureCmd) } -func GetNextedJsonString(configMap map[string]any, keypath ...string) (out string) { - return +func getNestedJsonString(configMap map[string]any, keypath ...string) string { + for idx, key := range keypath { + next, ok := configMap[key] + if !ok || next == nil { + break + } + if idx == len(keypath)-1 { + if strval, ok := next.(string); ok { + return strval + } else { + log.Println("Expected string at last key, found: ", reflect.TypeOf(next), next) + break + } + } else { + if mapval, ok := next.(map[string]any); ok && mapval != nil { + configMap = mapval + } else { + out.Stringf("expected map[string]any at %d, found: %v", idx, mapval) + break + } + } + } + return "" } From f275e5b24dc20fbec934f4164fed05d08deb2d20 Mon Sep 17 00:00:00 2001 From: Sriram Panyam Date: Mon, 16 Dec 2024 20:38:10 -0800 Subject: [PATCH 3/5] Emitting useful logs and only reading AddonConfigFile if provided --- cmd/minikube/cmd/config/configure.go | 95 ++++++++++++++-------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/cmd/minikube/cmd/config/configure.go b/cmd/minikube/cmd/config/configure.go index 1f60bb6791bb..12815d5bb1ae 100644 --- a/cmd/minikube/cmd/config/configure.go +++ b/cmd/minikube/cmd/config/configure.go @@ -20,7 +20,6 @@ import ( "encoding/json" "errors" "fmt" - "log" "net" "os" "reflect" @@ -57,8 +56,23 @@ var addonsConfigureCmd = &cobra.Command{ } profile := ClusterFlagValue() - addon := args[0] + + configFileData := make(map[string]any) + + if AddonConfigFile != "" { + out.Ln("Reading %s configs from %s", addon, AddonConfigFile) + if confData, err := os.ReadFile(AddonConfigFile); err != nil && errors.Is(err, os.ErrNotExist) { + exit.Message(reason.Usage, "config file does not exist") + } else if err != nil { + exit.Message(reason.Kind{ExitCode: reason.ExProgramConfig, Advice: "provide a valid config file"}, + fmt.Sprintf("error opening config file: %v", err)) + } else if err = json.Unmarshal(confData, &configFileData); err != nil { + exit.Message(reason.Kind{ExitCode: reason.ExProgramConfig, Advice: "provide a valid config file"}, + fmt.Sprintf("error opening config file: %v", err)) + } + } + // allows for additional prompting of information when enabling addons switch addon { case "registry-creds": @@ -79,21 +93,8 @@ var addonsConfigureCmd = &cobra.Command{ acrClientID := "changeme" acrPassword := "changeme" - regCredsConfig := make(map[string]any) - - out.Ln("Reading %s configs from %s", addon, AddonConfigFile) - if confData, err := os.ReadFile(AddonConfigFile); err != nil && errors.Is(err, os.ErrNotExist) { - exit.Message(reason.Usage, "config file does not exist") - } else if err != nil { - exit.Message(reason.Kind{ExitCode: reason.ExProgramConfig, Advice: "provide a valid config file"}, - fmt.Sprintf("error opening config file: %v", err)) - } else if err = json.Unmarshal(confData, ®CredsConfig); err != nil { - exit.Message(reason.Kind{ExitCode: reason.ExProgramConfig, Advice: "provide a valid config file"}, - fmt.Sprintf("error opening config file: %v", err)) - } - - awsEcrAction := getNestedJsonString(regCredsConfig, "enableAWSEcr") - if regCredsConfig == nil || awsEcrAction == "prompt" { + awsEcrAction := getNestedJsonString(configFileData, "enableAWSEcr") + if awsEcrAction == "prompt" || awsEcrAction == "" { enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses) if enableAWSECR { awsAccessID = AskForStaticValue("-- Enter AWS Access Key ID: ") @@ -104,23 +105,23 @@ var addonsConfigureCmd = &cobra.Command{ awsRole = AskForStaticValueOptional("-- (Optional) Enter ARN of AWS role to assume: ") } } else if awsEcrAction == "enable" { - log.Println("Loading AWS ECR configs from: ", AddonConfigFile) + out.Ln("Loading AWS ECR configs from: ", AddonConfigFile) // Then read the configs - awsAccessID = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessID") - awsAccessKey = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccessKey") - awsSessionToken = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsSessionToken") - awsRegion = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsRegion") - awsAccount = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsAccount") - awsRole = getNestedJsonString(regCredsConfig, "awsEcrConfigs", "awsRole") + awsAccessID = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessID") + awsAccessKey = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessKey") + awsSessionToken = getNestedJsonString(configFileData, "awsEcrConfigs", "awsSessionToken") + awsRegion = getNestedJsonString(configFileData, "awsEcrConfigs", "awsRegion") + awsAccount = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccount") + awsRole = getNestedJsonString(configFileData, "awsEcrConfigs", "awsRole") } else if awsEcrAction == "disable" { - log.Println("Ignoring AWS ECR configs") + out.Ln("Ignoring AWS ECR configs") } else { out.Ln("Disabling AWS ECR. Invalid value for enableAWSEcr (%s). Must be one of 'disable', 'enable' or 'prompt'", awsEcrAction) } gcrPath := "" - gcrAction := getNestedJsonString(regCredsConfig, "enableGCR") - if regCredsConfig == nil || gcrAction == "prompt" { + gcrAction := getNestedJsonString(configFileData, "enableGCR") + if gcrAction == "prompt" || gcrAction == "" { enableGCR := AskForYesNoConfirmation("\nDo you want to enable Google Container Registry?", posResponses, negResponses) if enableGCR { gcrPath = AskForStaticValue("-- Enter path to credentials (e.g. /home/user/.config/gcloud/application_default_credentials.json):") @@ -131,12 +132,12 @@ var addonsConfigureCmd = &cobra.Command{ } } } else if gcrAction == "enable" { - log.Println("Loading GCR configs from: ", AddonConfigFile) + out.Ln("Loading GCR configs from: ", AddonConfigFile) // Then read the configs - gcrPath = getNestedJsonString(regCredsConfig, "gcrConfigs", "gcrPath") - gcrURL = getNestedJsonString(regCredsConfig, "gcrConfigs", "gcrURL") + gcrPath = getNestedJsonString(configFileData, "gcrConfigs", "gcrPath") + gcrURL = getNestedJsonString(configFileData, "gcrConfigs", "gcrURL") } else if gcrAction == "disable" { - log.Println("Ignoring GCR configs") + out.Ln("Ignoring GCR configs") } else { out.Ln("Disabling GCR. Invalid value for enableGCR (%s). Must be one of 'disable', 'enable' or 'prompt'", gcrAction) } @@ -152,8 +153,8 @@ var addonsConfigureCmd = &cobra.Command{ } } - dockerRegistryAction := getNestedJsonString(regCredsConfig, "enableDockerRegistry") - if regCredsConfig == nil || dockerRegistryAction == "prompt" { + dockerRegistryAction := getNestedJsonString(configFileData, "enableDockerRegistry") + if dockerRegistryAction == "prompt" || dockerRegistryAction == "" { enableDR := AskForYesNoConfirmation("\nDo you want to enable Docker Registry?", posResponses, negResponses) if enableDR { dockerServer = AskForStaticValue("-- Enter docker registry server url: ") @@ -161,32 +162,32 @@ var addonsConfigureCmd = &cobra.Command{ dockerPass = AskForPasswordValue("-- Enter docker registry password: ") } } else if dockerRegistryAction == "enable" { - dockerServer = getNestedJsonString(regCredsConfig, "dockerConfigs", "dockerServer") - dockerUser = getNestedJsonString(regCredsConfig, "dockerConfigs", "dockerUser") - dockerPass = getNestedJsonString(regCredsConfig, "dockerConfigs", "dockerPass") + dockerServer = getNestedJsonString(configFileData, "dockerConfigs", "dockerServer") + dockerUser = getNestedJsonString(configFileData, "dockerConfigs", "dockerUser") + dockerPass = getNestedJsonString(configFileData, "dockerConfigs", "dockerPass") } else if dockerRegistryAction == "disable" { - log.Println("Ignoring Docker Registry configs") + out.Ln("Ignoring Docker Registry configs") } else { out.Ln("Disabling Docker Registry. Invalid value for enableDockerRegistry (%s). Must be one of 'disable', 'enable' or 'prompt'", dockerRegistryAction) } - acrAction := getNestedJsonString(regCredsConfig, "enableACR") - if regCredsConfig == nil || acrAction == "prompt" { + acrAction := getNestedJsonString(configFileData, "enableACR") + if acrAction == "prompt" || acrAction == "" { enableACR := AskForYesNoConfirmation("\nDo you want to enable Azure Container Registry?", posResponses, negResponses) if enableACR { acrURL = AskForStaticValue("-- Enter Azure Container Registry (ACR) URL: ") acrClientID = AskForStaticValue("-- Enter client ID (service principal ID) to access ACR: ") acrPassword = AskForPasswordValue("-- Enter service principal password to access Azure Container Registry: ") } - } else if regCredsConfig == nil || acrAction == "enable" { - log.Println("Loading ACR configs from: ", AddonConfigFile) - acrURL = getNestedJsonString(regCredsConfig, "acrConfigs", "acrURL") - acrClientID = getNestedJsonString(regCredsConfig, "acrConfigs", "acrClientID") - acrPassword = getNestedJsonString(regCredsConfig, "acrConfigs", "acrPassword") + } else if configFileData == nil || acrAction == "enable" { + out.Ln("Loading ACR configs from: ", AddonConfigFile) + acrURL = getNestedJsonString(configFileData, "acrConfigs", "acrURL") + acrClientID = getNestedJsonString(configFileData, "acrConfigs", "acrClientID") + acrPassword = getNestedJsonString(configFileData, "acrConfigs", "acrPassword") } else if acrAction == "disable" { - log.Println("Ignoring ACR configs") + out.Ln("Ignoring ACR configs") } else { - out.Stringf("Disabling ACR. Invalid value for enableACR (%s). Must be one of 'disable', 'enable' or 'prompt'", regCredsConfig["enableACR"]) + out.Stringf("Disabling ACR. Invalid value for enableACR (%s). Must be one of 'disable', 'enable' or 'prompt'", configFileData["enableACR"]) } namespace := "kube-system" @@ -426,7 +427,7 @@ func getNestedJsonString(configMap map[string]any, keypath ...string) string { if strval, ok := next.(string); ok { return strval } else { - log.Println("Expected string at last key, found: ", reflect.TypeOf(next), next) + out.Ln("Expected string at last key, found: ", reflect.TypeOf(next), next) break } } else { From 8ea83bc3922c59ffece97ce88774032001706fdf Mon Sep 17 00:00:00 2001 From: Sriram Panyam Date: Mon, 16 Dec 2024 23:48:33 -0800 Subject: [PATCH 4/5] fixing format string --- cmd/minikube/cmd/config/configure.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/config/configure.go b/cmd/minikube/cmd/config/configure.go index 12815d5bb1ae..b0485436afc1 100644 --- a/cmd/minikube/cmd/config/configure.go +++ b/cmd/minikube/cmd/config/configure.go @@ -105,7 +105,7 @@ var addonsConfigureCmd = &cobra.Command{ awsRole = AskForStaticValueOptional("-- (Optional) Enter ARN of AWS role to assume: ") } } else if awsEcrAction == "enable" { - out.Ln("Loading AWS ECR configs from: ", AddonConfigFile) + out.Ln("Loading AWS ECR configs from: %s", AddonConfigFile) // Then read the configs awsAccessID = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessID") awsAccessKey = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessKey") From 58d369f4a6842a115446e721b37c911ced247b83 Mon Sep 17 00:00:00 2001 From: Sriram Panyam Date: Tue, 17 Dec 2024 11:26:02 -0800 Subject: [PATCH 5/5] Moving addon specific config input and parsing to its own function --- cmd/minikube/cmd/config/configure.go | 389 ++++++++++++++------------- 1 file changed, 196 insertions(+), 193 deletions(-) diff --git a/cmd/minikube/cmd/config/configure.go b/cmd/minikube/cmd/config/configure.go index b0485436afc1..3ddd63023984 100644 --- a/cmd/minikube/cmd/config/configure.go +++ b/cmd/minikube/cmd/config/configure.go @@ -76,199 +76,7 @@ var addonsConfigureCmd = &cobra.Command{ // allows for additional prompting of information when enabling addons switch addon { case "registry-creds": - - // Default values - awsAccessID := "changeme" - awsAccessKey := "changeme" - awsSessionToken := "" - awsRegion := "changeme" - awsAccount := "changeme" - awsRole := "changeme" - gcrApplicationDefaultCredentials := "changeme" - dockerServer := "changeme" - dockerUser := "changeme" - dockerPass := "changeme" - gcrURL := "https://gcr.io" - acrURL := "changeme" - acrClientID := "changeme" - acrPassword := "changeme" - - awsEcrAction := getNestedJsonString(configFileData, "enableAWSEcr") - if awsEcrAction == "prompt" || awsEcrAction == "" { - enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses) - if enableAWSECR { - awsAccessID = AskForStaticValue("-- Enter AWS Access Key ID: ") - awsAccessKey = AskForStaticValue("-- Enter AWS Secret Access Key: ") - awsSessionToken = AskForStaticValueOptional("-- (Optional) Enter AWS Session Token: ") - awsRegion = AskForStaticValue("-- Enter AWS Region: ") - awsAccount = AskForStaticValue("-- Enter 12 digit AWS Account ID (Comma separated list): ") - awsRole = AskForStaticValueOptional("-- (Optional) Enter ARN of AWS role to assume: ") - } - } else if awsEcrAction == "enable" { - out.Ln("Loading AWS ECR configs from: %s", AddonConfigFile) - // Then read the configs - awsAccessID = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessID") - awsAccessKey = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessKey") - awsSessionToken = getNestedJsonString(configFileData, "awsEcrConfigs", "awsSessionToken") - awsRegion = getNestedJsonString(configFileData, "awsEcrConfigs", "awsRegion") - awsAccount = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccount") - awsRole = getNestedJsonString(configFileData, "awsEcrConfigs", "awsRole") - } else if awsEcrAction == "disable" { - out.Ln("Ignoring AWS ECR configs") - } else { - out.Ln("Disabling AWS ECR. Invalid value for enableAWSEcr (%s). Must be one of 'disable', 'enable' or 'prompt'", awsEcrAction) - } - - gcrPath := "" - gcrAction := getNestedJsonString(configFileData, "enableGCR") - if gcrAction == "prompt" || gcrAction == "" { - enableGCR := AskForYesNoConfirmation("\nDo you want to enable Google Container Registry?", posResponses, negResponses) - if enableGCR { - gcrPath = AskForStaticValue("-- Enter path to credentials (e.g. /home/user/.config/gcloud/application_default_credentials.json):") - gcrchangeURL := AskForYesNoConfirmation("-- Do you want to change the GCR URL (Default https://gcr.io)?", posResponses, negResponses) - - if gcrchangeURL { - gcrURL = AskForStaticValue("-- Enter GCR URL (e.g. https://asia.gcr.io):") - } - } - } else if gcrAction == "enable" { - out.Ln("Loading GCR configs from: ", AddonConfigFile) - // Then read the configs - gcrPath = getNestedJsonString(configFileData, "gcrConfigs", "gcrPath") - gcrURL = getNestedJsonString(configFileData, "gcrConfigs", "gcrURL") - } else if gcrAction == "disable" { - out.Ln("Ignoring GCR configs") - } else { - out.Ln("Disabling GCR. Invalid value for enableGCR (%s). Must be one of 'disable', 'enable' or 'prompt'", gcrAction) - } - - if gcrPath != "" { - // Read file from disk - dat, err := os.ReadFile(gcrPath) - - if err != nil { - out.FailureT("Error reading {{.path}}: {{.error}}", out.V{"path": gcrPath, "error": err}) - } else { - gcrApplicationDefaultCredentials = string(dat) - } - } - - dockerRegistryAction := getNestedJsonString(configFileData, "enableDockerRegistry") - if dockerRegistryAction == "prompt" || dockerRegistryAction == "" { - enableDR := AskForYesNoConfirmation("\nDo you want to enable Docker Registry?", posResponses, negResponses) - if enableDR { - dockerServer = AskForStaticValue("-- Enter docker registry server url: ") - dockerUser = AskForStaticValue("-- Enter docker registry username: ") - dockerPass = AskForPasswordValue("-- Enter docker registry password: ") - } - } else if dockerRegistryAction == "enable" { - dockerServer = getNestedJsonString(configFileData, "dockerConfigs", "dockerServer") - dockerUser = getNestedJsonString(configFileData, "dockerConfigs", "dockerUser") - dockerPass = getNestedJsonString(configFileData, "dockerConfigs", "dockerPass") - } else if dockerRegistryAction == "disable" { - out.Ln("Ignoring Docker Registry configs") - } else { - out.Ln("Disabling Docker Registry. Invalid value for enableDockerRegistry (%s). Must be one of 'disable', 'enable' or 'prompt'", dockerRegistryAction) - } - - acrAction := getNestedJsonString(configFileData, "enableACR") - if acrAction == "prompt" || acrAction == "" { - enableACR := AskForYesNoConfirmation("\nDo you want to enable Azure Container Registry?", posResponses, negResponses) - if enableACR { - acrURL = AskForStaticValue("-- Enter Azure Container Registry (ACR) URL: ") - acrClientID = AskForStaticValue("-- Enter client ID (service principal ID) to access ACR: ") - acrPassword = AskForPasswordValue("-- Enter service principal password to access Azure Container Registry: ") - } - } else if configFileData == nil || acrAction == "enable" { - out.Ln("Loading ACR configs from: ", AddonConfigFile) - acrURL = getNestedJsonString(configFileData, "acrConfigs", "acrURL") - acrClientID = getNestedJsonString(configFileData, "acrConfigs", "acrClientID") - acrPassword = getNestedJsonString(configFileData, "acrConfigs", "acrPassword") - } else if acrAction == "disable" { - out.Ln("Ignoring ACR configs") - } else { - out.Stringf("Disabling ACR. Invalid value for enableACR (%s). Must be one of 'disable', 'enable' or 'prompt'", configFileData["enableACR"]) - } - - namespace := "kube-system" - - // Create ECR Secret - err := service.CreateSecret( - profile, - namespace, - "registry-creds-ecr", - map[string]string{ - "AWS_ACCESS_KEY_ID": awsAccessID, - "AWS_SECRET_ACCESS_KEY": awsAccessKey, - "AWS_SESSION_TOKEN": awsSessionToken, - "aws-account": awsAccount, - "aws-region": awsRegion, - "aws-assume-role": awsRole, - }, - map[string]string{ - "app": "registry-creds", - "cloud": "ecr", - "kubernetes.io/minikube-addons": "registry-creds", - }) - if err != nil { - out.FailureT("ERROR creating `registry-creds-ecr` secret: {{.error}}", out.V{"error": err}) - } - - // Create GCR Secret - err = service.CreateSecret( - profile, - namespace, - "registry-creds-gcr", - map[string]string{ - "application_default_credentials.json": gcrApplicationDefaultCredentials, - "gcrurl": gcrURL, - }, - map[string]string{ - "app": "registry-creds", - "cloud": "gcr", - "kubernetes.io/minikube-addons": "registry-creds", - }) - - if err != nil { - out.FailureT("ERROR creating `registry-creds-gcr` secret: {{.error}}", out.V{"error": err}) - } - - // Create Docker Secret - err = service.CreateSecret( - profile, - namespace, - "registry-creds-dpr", - map[string]string{ - "DOCKER_PRIVATE_REGISTRY_SERVER": dockerServer, - "DOCKER_PRIVATE_REGISTRY_USER": dockerUser, - "DOCKER_PRIVATE_REGISTRY_PASSWORD": dockerPass, - }, - map[string]string{ - "app": "registry-creds", - "cloud": "dpr", - "kubernetes.io/minikube-addons": "registry-creds", - }) - - if err != nil { - out.WarningT("ERROR creating `registry-creds-dpr` secret") - } - - // Create Azure Container Registry Secret - err = service.CreateSecret( - profile, - namespace, - "registry-creds-acr", - map[string]string{ - "ACR_URL": acrURL, - "ACR_CLIENT_ID": acrClientID, - "ACR_PASSWORD": acrPassword, - }, - map[string]string{ - "app": "registry-creds", - "cloud": "acr", - "kubernetes.io/minikube-addons": "registry-creds", - }) - + err := processRegistryCredsConfig(profile, configFileData) if err != nil { out.WarningT("ERROR creating `registry-creds-acr` secret") } @@ -441,3 +249,198 @@ func getNestedJsonString(configMap map[string]any, keypath ...string) string { } return "" } + +func processRegistryCredsConfig(profile string, configFileData map[string]any) (err error) { + // Default values + awsAccessID := "changeme" + awsAccessKey := "changeme" + awsSessionToken := "" + awsRegion := "changeme" + awsAccount := "changeme" + awsRole := "changeme" + gcrApplicationDefaultCredentials := "changeme" + dockerServer := "changeme" + dockerUser := "changeme" + dockerPass := "changeme" + gcrURL := "https://gcr.io" + acrURL := "changeme" + acrClientID := "changeme" + acrPassword := "changeme" + + awsEcrAction := getNestedJsonString(configFileData, "enableAWSEcr") + if awsEcrAction == "prompt" || awsEcrAction == "" { + enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses) + if enableAWSECR { + awsAccessID = AskForStaticValue("-- Enter AWS Access Key ID: ") + awsAccessKey = AskForStaticValue("-- Enter AWS Secret Access Key: ") + awsSessionToken = AskForStaticValueOptional("-- (Optional) Enter AWS Session Token: ") + awsRegion = AskForStaticValue("-- Enter AWS Region: ") + awsAccount = AskForStaticValue("-- Enter 12 digit AWS Account ID (Comma separated list): ") + awsRole = AskForStaticValueOptional("-- (Optional) Enter ARN of AWS role to assume: ") + } + } else if awsEcrAction == "enable" { + out.Ln("Loading AWS ECR configs from: %s", AddonConfigFile) + // Then read the configs + awsAccessID = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessID") + awsAccessKey = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccessKey") + awsSessionToken = getNestedJsonString(configFileData, "awsEcrConfigs", "awsSessionToken") + awsRegion = getNestedJsonString(configFileData, "awsEcrConfigs", "awsRegion") + awsAccount = getNestedJsonString(configFileData, "awsEcrConfigs", "awsAccount") + awsRole = getNestedJsonString(configFileData, "awsEcrConfigs", "awsRole") + } else if awsEcrAction == "disable" { + out.Ln("Ignoring AWS ECR configs") + } else { + out.Ln("Disabling AWS ECR. Invalid value for enableAWSEcr (%s). Must be one of 'disable', 'enable' or 'prompt'", awsEcrAction) + } + + gcrPath := "" + gcrAction := getNestedJsonString(configFileData, "enableGCR") + if gcrAction == "prompt" || gcrAction == "" { + enableGCR := AskForYesNoConfirmation("\nDo you want to enable Google Container Registry?", posResponses, negResponses) + if enableGCR { + gcrPath = AskForStaticValue("-- Enter path to credentials (e.g. /home/user/.config/gcloud/application_default_credentials.json):") + gcrchangeURL := AskForYesNoConfirmation("-- Do you want to change the GCR URL (Default https://gcr.io)?", posResponses, negResponses) + + if gcrchangeURL { + gcrURL = AskForStaticValue("-- Enter GCR URL (e.g. https://asia.gcr.io):") + } + } + } else if gcrAction == "enable" { + out.Ln("Loading GCR configs from: ", AddonConfigFile) + // Then read the configs + gcrPath = getNestedJsonString(configFileData, "gcrConfigs", "gcrPath") + gcrURL = getNestedJsonString(configFileData, "gcrConfigs", "gcrURL") + } else if gcrAction == "disable" { + out.Ln("Ignoring GCR configs") + } else { + out.Ln("Disabling GCR. Invalid value for enableGCR (%s). Must be one of 'disable', 'enable' or 'prompt'", gcrAction) + } + + if gcrPath != "" { + // Read file from disk + dat, err := os.ReadFile(gcrPath) + + if err != nil { + out.FailureT("Error reading {{.path}}: {{.error}}", out.V{"path": gcrPath, "error": err}) + } else { + gcrApplicationDefaultCredentials = string(dat) + } + } + + dockerRegistryAction := getNestedJsonString(configFileData, "enableDockerRegistry") + if dockerRegistryAction == "prompt" || dockerRegistryAction == "" { + enableDR := AskForYesNoConfirmation("\nDo you want to enable Docker Registry?", posResponses, negResponses) + if enableDR { + dockerServer = AskForStaticValue("-- Enter docker registry server url: ") + dockerUser = AskForStaticValue("-- Enter docker registry username: ") + dockerPass = AskForPasswordValue("-- Enter docker registry password: ") + } + } else if dockerRegistryAction == "enable" { + dockerServer = getNestedJsonString(configFileData, "dockerConfigs", "dockerServer") + dockerUser = getNestedJsonString(configFileData, "dockerConfigs", "dockerUser") + dockerPass = getNestedJsonString(configFileData, "dockerConfigs", "dockerPass") + } else if dockerRegistryAction == "disable" { + out.Ln("Ignoring Docker Registry configs") + } else { + out.Ln("Disabling Docker Registry. Invalid value for enableDockerRegistry (%s). Must be one of 'disable', 'enable' or 'prompt'", dockerRegistryAction) + } + + acrAction := getNestedJsonString(configFileData, "enableACR") + if acrAction == "prompt" || acrAction == "" { + enableACR := AskForYesNoConfirmation("\nDo you want to enable Azure Container Registry?", posResponses, negResponses) + if enableACR { + acrURL = AskForStaticValue("-- Enter Azure Container Registry (ACR) URL: ") + acrClientID = AskForStaticValue("-- Enter client ID (service principal ID) to access ACR: ") + acrPassword = AskForPasswordValue("-- Enter service principal password to access Azure Container Registry: ") + } + } else if configFileData == nil || acrAction == "enable" { + out.Ln("Loading ACR configs from: ", AddonConfigFile) + acrURL = getNestedJsonString(configFileData, "acrConfigs", "acrURL") + acrClientID = getNestedJsonString(configFileData, "acrConfigs", "acrClientID") + acrPassword = getNestedJsonString(configFileData, "acrConfigs", "acrPassword") + } else if acrAction == "disable" { + out.Ln("Ignoring ACR configs") + } else { + out.Stringf("Disabling ACR. Invalid value for enableACR (%s). Must be one of 'disable', 'enable' or 'prompt'", configFileData["enableACR"]) + } + + namespace := "kube-system" + + // Create ECR Secret + err = service.CreateSecret( + profile, + namespace, + "registry-creds-ecr", + map[string]string{ + "AWS_ACCESS_KEY_ID": awsAccessID, + "AWS_SECRET_ACCESS_KEY": awsAccessKey, + "AWS_SESSION_TOKEN": awsSessionToken, + "aws-account": awsAccount, + "aws-region": awsRegion, + "aws-assume-role": awsRole, + }, + map[string]string{ + "app": "registry-creds", + "cloud": "ecr", + "kubernetes.io/minikube-addons": "registry-creds", + }) + if err != nil { + out.FailureT("ERROR creating `registry-creds-ecr` secret: {{.error}}", out.V{"error": err}) + } + + // Create GCR Secret + err = service.CreateSecret( + profile, + namespace, + "registry-creds-gcr", + map[string]string{ + "application_default_credentials.json": gcrApplicationDefaultCredentials, + "gcrurl": gcrURL, + }, + map[string]string{ + "app": "registry-creds", + "cloud": "gcr", + "kubernetes.io/minikube-addons": "registry-creds", + }) + + if err != nil { + out.FailureT("ERROR creating `registry-creds-gcr` secret: {{.error}}", out.V{"error": err}) + } + + // Create Docker Secret + err = service.CreateSecret( + profile, + namespace, + "registry-creds-dpr", + map[string]string{ + "DOCKER_PRIVATE_REGISTRY_SERVER": dockerServer, + "DOCKER_PRIVATE_REGISTRY_USER": dockerUser, + "DOCKER_PRIVATE_REGISTRY_PASSWORD": dockerPass, + }, + map[string]string{ + "app": "registry-creds", + "cloud": "dpr", + "kubernetes.io/minikube-addons": "registry-creds", + }) + + if err != nil { + out.WarningT("ERROR creating `registry-creds-dpr` secret") + } + + // Create Azure Container Registry Secret + err = service.CreateSecret( + profile, + namespace, + "registry-creds-acr", + map[string]string{ + "ACR_URL": acrURL, + "ACR_CLIENT_ID": acrClientID, + "ACR_PASSWORD": acrPassword, + }, + map[string]string{ + "app": "registry-creds", + "cloud": "acr", + "kubernetes.io/minikube-addons": "registry-creds", + }) + return +}