Skip to content

Commit 2082f36

Browse files
author
Keerthan Mala
committed
add support for azure blob storage
1 parent c5736ad commit 2082f36

3 files changed

Lines changed: 37 additions & 7 deletions

File tree

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,21 @@ Before deploying your custom image you must update the container image specifica
4444
value: "true"
4545
```
4646
47-
By default registry uses the filesystem as the storage medium. To use a custom object store like s3 or gcs:
47+
By default registry uses the filesystem as the storage medium. To use a custom object store like s3, gcs or azure:
4848
- First provide the details required for authenticating to object store in base64 format by updating the secret file which can be found at `contrib/kubernetes/manifests/registry-{STORAGE_TYPE}-secret.yaml`.
49-
- Set the STORAGE_TYPE environment variable.
50-
```
51-
$ export STORAGE_TYPE = {s3/gcs}
52-
```
53-
- Update the secret to be used in the pod manifest. This file is found at `contrib/kubernetes/manifests/registry-rc.yaml`:
49+
- Update the storage type and secret to be used in the pod manifest. This file is found at `contrib/kubernetes/manifests/registry-rc.yaml`:
5450
```yaml
51+
- name: REGISTRY_STORAGE
52+
value: filesystem
53+
5554
- name: registry-creds
5655
secret:
5756
secretName: fs-keyfile
5857
```
59-
58+
- Set the STORAGE_TYPE environment variable.
59+
```
60+
$ export STORAGE_TYPE = {s3/gcs/azure}
61+
```
6062

6163
Once updated, deploy the registry to your kubernetes cluster with:
6264

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: azure-keyfile
5+
type: Opaque
6+
data:
7+
accountname : {base64-encoded account name}
8+
accountkey : {base64-encoded primary or secondary account key}
9+
container : {base64-encoded container name}

main.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ func main() {
4949
} else {
5050
os.Setenv("REGISTRY_STORAGE_S3_BUCKET", string(bucket))
5151
}
52+
} else if storageType == "azure" {
53+
if accountname, err := ioutil.ReadFile("/var/run/secrets/deis/registry/creds/accountname"); err != nil {
54+
log.Fatal(err)
55+
} else {
56+
os.Setenv("REGISTRY_STORAGE_AZURE_ACCOUNTNAME", string(accountname))
57+
}
58+
59+
if accountkey, err := ioutil.ReadFile("/var/run/secrets/deis/registry/creds/accountkey"); err != nil {
60+
log.Fatal(err)
61+
} else {
62+
os.Setenv("REGISTRY_STORAGE_AZURE_ACCOUNTKEY", string(accountkey))
63+
}
64+
65+
if container, err := ioutil.ReadFile("/var/run/secrets/deis/registry/creds/container"); err != nil {
66+
log.Fatal(err)
67+
} else {
68+
os.Setenv("REGISTRY_STORAGE_AZURE_CONTAINER", string(container))
69+
}
70+
5271
}
5372

5473
cmd := exec.Command(registryBinary, registryConfig)

0 commit comments

Comments
 (0)