Skip to content

Commit 7d53929

Browse files
committed
feat(storage): add azure support
1 parent 69cad5c commit 7d53929

File tree

4 files changed

+52
-6
lines changed

4 files changed

+52
-6
lines changed

docs/high-availability.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The registry supports various storage solutions, some of which enable high avail
1616
| MinIO | Yes | `minio.enabled=true` |
1717
| S3-compatible | Yes | `registry.persistence.s3=...` |
1818
| GCS | Yes | `registry.persistence.gcs=...` |
19+
| Azure | Yes | `registry.persistence.azure=...` |
1920

2021
HA-compatible backends uses a deployment whereas other backends relies on a statefulset.
2122

@@ -95,6 +96,28 @@ kubectl create secret generic secret-name \
9596
--from-literal=credentials.json=${GCS_KEY}
9697
```
9798

99+
### Azure
100+
101+
Microsoft Azure can also be used as a storage backend for the registry. Here is an example of values to use Azure:
102+
103+
```yaml
104+
registry:
105+
persistence:
106+
azureExistingSecret: secret-name
107+
azure:
108+
container: registry
109+
```
110+
111+
Please refer to the [Docker registry documentation](https://distribution.github.io/distribution/about/configuration/) for more details.
112+
113+
Note that you will need to create a Secret holding the associated service account secret:
114+
115+
```
116+
kubectl create secret generic secret-name \
117+
--from-literal=accountname=${ACCOUNTNAME} \
118+
--from-literal=accountkey=${ACCOUNTKEY}
119+
```
120+
98121
## MinIO
99122

100123
The kuik Helm chart has an optional dependency on the [bitnami MinIO chart](https://artifacthub.io/packages/helm/bitnami/minio). The subchart can be enabled by setting `minio.enabled` to `true`, and it can be configured by passing values under the `minio.*` path; for instance, with the following values YAML:
@@ -126,4 +149,3 @@ kubectl create secret generic minio-root-auth \
126149
It is NOT necessary to set `registry.persistence.enabled` to `true` to enable persistence through MinIO.
127150

128151
It is NOT necessary to configure the S3 endpoint when using this solution as it will be configured automatically by the chart.
129-

helm/kube-image-keeper/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,5 @@ Create the name of the service account to use
110110
{{- end }}
111111

112112
{{- define "kube-image-keeper.registry-stateless-mode" -}}
113-
{{- ternary "true" "false" (or .Values.minio.enabled (not (empty .Values.registry.persistence.s3)) (not (empty .Values.registry.persistence.gcs))) }}
113+
{{- ternary "true" "false" (or .Values.minio.enabled (not (empty .Values.registry.persistence.s3)) (not (empty .Values.registry.persistence.gcs)) (not (empty .Values.registry.persistence.azure))) }}
114114
{{- end }}

helm/kube-image-keeper/templates/registry-deployment.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@ spec:
4848
key: secret
4949
- name: REGISTRY_STORAGE_DELETE_ENABLED
5050
value: "true"
51-
{{- if (not (empty .Values.registry.persistence.s3))}}
51+
{{- if (not (empty .Values.registry.persistence.s3)) }}
5252
- name: REGISTRY_STORAGE
5353
value: s3
5454
{{- end}}
55-
{{- if (not (empty .Values.registry.persistence.gcs))}}
55+
{{- if (not (empty .Values.registry.persistence.gcs)) }}
5656
- name: REGISTRY_STORAGE
5757
value: gcs
5858
- name: REGISTRY_STORAGE_GCS_KEYFILE
5959
value: "/etc/registry/keys/credentials.json"
6060
{{- end}}
61+
{{- if (not (empty .Values.registry.persistence.azure)) }}
62+
- name: REGISTRY_STORAGE
63+
value: azure
64+
{{- end}}
6165
{{- if .Values.registry.serviceMonitor.create }}
6266
- name: REGISTRY_HTTP_DEBUG_ADDR
6367
value: 0.0.0.0:5001
@@ -78,10 +82,14 @@ spec:
7882
- name: {{ printf "%s_%s" "REGISTRY_STORAGE_S3" ($k | upper) }}
7983
value: {{ $v | quote }}
8084
{{- end }}
81-
{{- range $k, $v := omit .Values.registry.persistence.gcs }}
85+
{{- range $k, $v := .Values.registry.persistence.gcs }}
8286
- name: {{ printf "%s_%s" "REGISTRY_STORAGE_GCS" ($k | upper) }}
8387
value: {{ $v | quote }}
8488
{{- end }}
89+
{{- range $k, $v := omit .Values.registry.persistence.azure "accountname" "accountkey" }}
90+
- name: {{ printf "%s_%s" "REGISTRY_STORAGE_AZURE" ($k | upper) }}
91+
value: {{ $v | quote }}
92+
{{- end }}
8593
{{- if .Values.registry.persistence.disableS3Redirections }}
8694
- name: REGISTRY_STORAGE_REDIRECT_DISABLE
8795
value: "true"
@@ -100,6 +108,19 @@ spec:
100108
name: {{ $s3KeysSecretName }}
101109
key: secretKey
102110
{{- end }}
111+
{{- if (not (empty .Values.registry.persistence.azureExistingSecret)) }}
112+
{{ $azureKeysSecretName := .Values.registry.persistence.azureExistingSecret | default "kube-image-keeper-s3-registry-keys" }}
113+
- name: REGISTRY_STORAGE_AZURE_ACCOUNTNAME
114+
valueFrom:
115+
secretKeyRef:
116+
name: {{ $azureKeysSecretName }}
117+
key: accountname
118+
- name: REGISTRY_STORAGE_AZURE_ACCOUNTKEY
119+
valueFrom:
120+
secretKeyRef:
121+
name: {{ $azureKeysSecretName }}
122+
key: accountkey
123+
{{- end }}
103124
{{- range .Values.registry.env }}
104125
- name: {{ .name }}
105126
value: {{ .value | quote }}

helm/kube-image-keeper/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ registry:
220220
storageClass: null
221221
# -- Registry persistent volume size
222222
size: 20Gi
223-
# -- External S3 configuration (needed only if you don't enable minio) (see https://github.com/docker/docs/blob/main/registry/storage-drivers/s3.md)
223+
# -- External S3 configuration (needed only if you don't enable minio) (see https://github.com/distribution/distribution/blob/main/docs/content/storage-drivers/s3.md)
224224
s3: {}
225225
s3ExistingSecret: ""
226226
# -- Disable blobs redirection to S3 bucket (useful if your S3 instance is not accessible from kubelet)
@@ -229,6 +229,9 @@ registry:
229229
gcs: {}
230230
# use service account secret in JSON format
231231
gcsExistingSecret: ""
232+
# -- Azure configuration (see https://github.com/distribution/distribution/blob/main/docs/content/storage-drivers/azure.md)
233+
azure: {}
234+
azureExistingSecret: ""
232235
garbageCollection:
233236
# -- Garbage collector cron schedule. Use standard crontab format.
234237
schedule: "0 0 * * 0"

0 commit comments

Comments
 (0)