Skip to content

Commit

Permalink
Merge pull request #6483 from karolz-ms/dev/karolz/azure-cr
Browse files Browse the repository at this point in the history
Add Azure Container Registry support
  • Loading branch information
tstromberg authored Feb 5, 2020
2 parents c7eec26 + 4a4e7b7 commit 4dda226
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
30 changes: 30 additions & 0 deletions cmd/minikube/cmd/config/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ var addonsConfigureCmd = &cobra.Command{
dockerUser := "changeme"
dockerPass := "changeme"
gcrURL := "https://gcr.io"
acrURL := "changeme"
acrClientID := "changeme"
acrPassword := "changeme"

enableAWSECR := AskForYesNoConfirmation("\nDo you want to enable AWS Elastic Container Registry?", posResponses, negResponses)
if enableAWSECR {
Expand Down Expand Up @@ -90,6 +93,13 @@ var addonsConfigureCmd = &cobra.Command{
dockerPass = AskForPasswordValue("-- Enter docker registry password: ")
}

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: ")
}

// Create ECR Secret
err := service.CreateSecret(
"kube-system",
Expand Down Expand Up @@ -148,6 +158,26 @@ var addonsConfigureCmd = &cobra.Command{
if err != nil {
out.WarningT("ERROR creating `registry-creds-dpr` secret")
}

// Create Azure Container Registry Secret
err = service.CreateSecret(
"kube-system",
"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",
})

if err != nil {
out.WarningT("ERROR creating `registry-creds-acr` secret")
}

default:
out.FailureT("{{.name}} has no available configuration options", out.V{"name": addon})
return
Expand Down
17 changes: 16 additions & 1 deletion deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
addonmanager.kubernetes.io/mode: Reconcile
spec:
containers:
- image: upmcenterprises/registry-creds:1.9
- image: upmcenterprises/registry-creds:1.10
name: registry-creds
imagePullPolicy: Always
env:
Expand Down Expand Up @@ -77,6 +77,21 @@ spec:
secretKeyRef:
name: registry-creds-gcr
key: gcrurl
- name: ACR_PASSWORD
valueFrom:
secretKeyRef:
name: registry-creds-acr
key: ACR_PASSWORD
- name: ACR_URL
valueFrom:
secretKeyRef:
name: registry-creds-acr
key: ACR_URL
- name: ACR_CLIENT_ID
valueFrom:
secretKeyRef:
name: registry-creds-acr
key: ACR_CLIENT_ID
volumeMounts:
- name: gcr-creds
mountPath: "/root/.config/gcloud"
Expand Down
6 changes: 4 additions & 2 deletions site/content/en/docs/Tasks/Registry/private.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: "Private"
linkTitle: "Private"
weight: 6
date: 2019-08-01
date: 2020-01-14
description: >
How to use a private registry within minikube
---


**GCR/ECR/Docker**: minikube has an addon, `registry-creds` which maps credentials into minikube to support pulling from Google Container Registry (GCR), Amazon's EC2 Container Registry (ECR), and Private Docker registries. You will need to run `minikube addons configure registry-creds` and `minikube addons enable registry-creds` to get up and running. An example of this is below:
**GCR/ECR/ACR/Docker**: minikube has an addon, `registry-creds` which maps credentials into minikube to support pulling from Google Container Registry (GCR), Amazon's EC2 Container Registry (ECR), Azure Container Registry (ACR), and Private Docker registries. You will need to run `minikube addons configure registry-creds` and `minikube addons enable registry-creds` to get up and running. An example of this is below:

```shell
$ minikube addons configure registry-creds
Expand All @@ -18,6 +18,8 @@ Do you want to enable Google Container Registry? [y/n]: y
-- Enter path to credentials (e.g. /home/user/.config/gcloud/application_default_credentials.json):/home/user/.config/gcloud/application_default_credentials.json

Do you want to enable Docker Registry? [y/n]: n

Do you want to enable Azure Container Registry? [y/n]: n
registry-creds was successfully configured
$ minikube addons enable registry-creds
```
Expand Down

0 comments on commit 4dda226

Please sign in to comment.