From 5f6511c73c55bc6ac7b1db590409fe13e8de0fad Mon Sep 17 00:00:00 2001 From: Teddy Schmitz Date: Tue, 2 May 2017 12:14:17 +0800 Subject: [PATCH] Add gcrurl env var to addon deployment and configuration --- cmd/minikube/cmd/config/configure.go | 7 +++++++ deploy/addons/registry-creds/registry-creds-rc.yaml | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/cmd/minikube/cmd/config/configure.go b/cmd/minikube/cmd/config/configure.go index fb65f43fe7d9..e8251a7eabf5 100644 --- a/cmd/minikube/cmd/config/configure.go +++ b/cmd/minikube/cmd/config/configure.go @@ -52,6 +52,7 @@ var addonsConfigureCmd = &cobra.Command{ dockerServer := "changeme" dockerUser := "changeme" dockerPass := "changeme" + gcrURL := "https://gcr.io" enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses) if enableAWSECR { @@ -64,6 +65,11 @@ var addonsConfigureCmd = &cobra.Command{ 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):") + } // Read file from disk dat, err := ioutil.ReadFile(gcrPath) @@ -108,6 +114,7 @@ var addonsConfigureCmd = &cobra.Command{ "registry-creds-gcr", map[string]string{ "application_default_credentials.json": gcrApplicationDefaultCredentials, + "gcrurl": gcrURL, }, map[string]string{ "app": "registry-creds", diff --git a/deploy/addons/registry-creds/registry-creds-rc.yaml b/deploy/addons/registry-creds/registry-creds-rc.yaml index f6f07008fd08..b3e5f30a1e6d 100644 --- a/deploy/addons/registry-creds/registry-creds-rc.yaml +++ b/deploy/addons/registry-creds/registry-creds-rc.yaml @@ -60,6 +60,11 @@ spec: secretKeyRef: name: registry-creds-dpr key: DOCKER_PRIVATE_REGISTRY_USER + - name: gcrurl + valueFrom: + secretKeyRef: + name: registry-creds-gcr + key: gcrurl volumeMounts: - name: gcr-creds mountPath: "/root/.config/gcloud" @@ -68,3 +73,7 @@ spec: - name: gcr-creds secret: secretName: registry-creds-gcr + items: + - key: "application_default_credentials.json" + path: "application_default_credentials.json" +