mirror of
https://github.com/twuni/docker-registry.helm.git
synced 2026-02-19 14:49:51 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
411fd99f68 | ||
|
|
171632afef | ||
|
|
25bf25dda1 | ||
|
|
76ff283a25 | ||
|
|
fd7fdcaa44 | ||
|
|
3b4ff679f8 | ||
|
|
79c14893af | ||
|
|
257d223141 | ||
|
|
29a0863ee2 | ||
|
|
f158323875 | ||
|
|
39788072e6 | ||
|
|
0b6729f21d | ||
|
|
b5ad18ea83 | ||
|
|
297f860dd6 | ||
|
|
c91c8139c5 | ||
|
|
4b5531d4ef | ||
|
|
98bdab8c45 | ||
|
|
a95a3480c6 | ||
|
|
c855e53b9e | ||
|
|
944cf7eb62 | ||
|
|
2726d10083 |
@@ -1,7 +1,7 @@
|
||||
apiVersion: v1
|
||||
description: A Helm chart for Docker Registry
|
||||
name: docker-registry
|
||||
version: 2.0.1
|
||||
version: 2.2.0
|
||||
appVersion: 2.7.1
|
||||
home: https://hub.docker.com/_/registry/
|
||||
icon: https://helm.twun.io/docker-registry.png
|
||||
|
||||
12
README.md
12
README.md
@@ -61,6 +61,12 @@ their default values.
|
||||
| `podDisruptionBudget` | Pod disruption budget | `{}` |
|
||||
| `resources.limits.cpu` | Container requested CPU | `nil` |
|
||||
| `resources.limits.memory` | Container requested memory | `nil` |
|
||||
| `autoscaling.enabled` | Enable autoscaling using HorizontalPodAutoscaler | `false` |
|
||||
| `autoscaling.minReplicas` | Minimal number of replicas | `1` |
|
||||
| `autoscaling.maxReplicas` | Maximal number of replicas | `2` |
|
||||
| `autoscaling.targetCPUUtilizationPercentage` | Target average utilization of CPU on Pods | `60` |
|
||||
| `autoscaling.targetMemoryUtilizationPercentage` | (Kubernetes ≥1.23) Target average utilization of Memory on Pods | `60` |
|
||||
| `autoscaling.behavior` | (Kubernetes ≥1.23) Configurable scaling behavior | `{}` |
|
||||
| `priorityClassName ` | priorityClassName | `""` |
|
||||
| `storage` | Storage system to use | `filesystem` |
|
||||
| `tlsSecretName` | Name of secret for TLS certs | `nil` |
|
||||
@@ -70,7 +76,7 @@ their default values.
|
||||
| `secrets.s3.secretRef` | The ref for an external secret containing the accessKey and secretKey keys | `""` |
|
||||
| `secrets.swift.username` | Username for Swift configuration | `nil` |
|
||||
| `secrets.swift.password` | Password for Swift configuration | `nil` |
|
||||
| `haSharedSecret` | Shared secret for Registry | `nil` |
|
||||
| `secrets.haSharedSecret` | Shared secret for Registry | `nil` |
|
||||
| `configData` | Configuration hash for docker | `nil` |
|
||||
| `s3.region` | S3 region | `nil` |
|
||||
| `s3.regionEndpoint` | S3 region endpoint | `nil` |
|
||||
@@ -108,6 +114,10 @@ their default values.
|
||||
| `extraVolumeMounts` | Additional volumeMounts to the registry container | `[]` |
|
||||
| `extraVolumes` | Additional volumes to the pod | `[]` |
|
||||
| `extraEnvVars` | Additional environment variables to the pod | `[]` |
|
||||
| `initContainers` | Init containers to be created in the pod | `[]` |
|
||||
| `garbageCollect.enabled` | If true, will deploy garbage-collector cronjob | `false` |
|
||||
| `garbageCollect.deleteUntagged` | If true, garbage-collector will delete manifests that are not currently referenced via tag | `true` | |
|
||||
| `garbageCollect.schedule` | CronTab schedule, please use standard crontab format | `0 1 * * *` | |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to
|
||||
`helm install`.
|
||||
|
||||
222
templates/cronjob.yaml
Normal file
222
templates/cronjob.yaml
Normal file
@@ -0,0 +1,222 @@
|
||||
{{- if .Values.garbageCollect.enabled }}
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ template "docker-registry.fullname" . }}-garbage-collector
|
||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||
labels:
|
||||
app: {{ template "docker-registry.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
schedule: {{ .Values.garbageCollect.schedule | quote }}
|
||||
jobTemplate:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "docker-registry.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{ toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
||||
{{- if $.Values.podAnnotations }}
|
||||
{{ toYaml $.Values.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
{{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }}
|
||||
serviceAccountName: {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }}
|
||||
{{- end }}
|
||||
{{- if .Values.imagePullSecrets }}
|
||||
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: "{{ .Values.priorityClassName }}"
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /bin/registry
|
||||
- garbage-collect
|
||||
- --delete-untagged={{ .Values.garbageCollect.deleteUntagged }}
|
||||
- /etc/docker/registry/config.yml
|
||||
env:
|
||||
{{- if .Values.secrets.htpasswd }}
|
||||
- name: REGISTRY_AUTH
|
||||
value: "htpasswd"
|
||||
- name: REGISTRY_AUTH_HTPASSWD_REALM
|
||||
value: "Registry Realm"
|
||||
- name: REGISTRY_AUTH_HTPASSWD_PATH
|
||||
value: "/auth/htpasswd"
|
||||
{{- end }}
|
||||
- name: REGISTRY_HTTP_SECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "docker-registry.fullname" . }}-secret
|
||||
key: haSharedSecret
|
||||
{{- if .Values.tlsSecretName }}
|
||||
- name: REGISTRY_HTTP_TLS_CERTIFICATE
|
||||
value: /etc/ssl/docker/tls.crt
|
||||
- name: REGISTRY_HTTP_TLS_KEY
|
||||
value: /etc/ssl/docker/tls.key
|
||||
{{- end }}
|
||||
{{- if eq .Values.storage "filesystem" }}
|
||||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
value: "/var/lib/registry"
|
||||
{{- else if eq .Values.storage "azure" }}
|
||||
- name: REGISTRY_STORAGE_AZURE_ACCOUNTNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "docker-registry.fullname" . }}-secret
|
||||
key: azureAccountName
|
||||
- name: REGISTRY_STORAGE_AZURE_ACCOUNTKEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "docker-registry.fullname" . }}-secret
|
||||
key: azureAccountKey
|
||||
- name: REGISTRY_STORAGE_AZURE_CONTAINER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "docker-registry.fullname" . }}-secret
|
||||
key: azureContainer
|
||||
{{- else if eq .Values.storage "s3" }}
|
||||
{{- if or (and .Values.secrets.s3.secretKey .Values.secrets.s3.accessKey) .Values.secrets.s3.secretRef }}
|
||||
- name: REGISTRY_STORAGE_S3_ACCESSKEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ if .Values.secrets.s3.secretRef }}{{ .Values.secrets.s3.secretRef }}{{ else }}{{ template "docker-registry.fullname" . }}-secret{{ end }}
|
||||
key: s3AccessKey
|
||||
- name: REGISTRY_STORAGE_S3_SECRETKEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ if .Values.secrets.s3.secretRef }}{{ .Values.secrets.s3.secretRef }}{{ else }}{{ template "docker-registry.fullname" . }}-secret{{ end }}
|
||||
key: s3SecretKey
|
||||
{{- end }}
|
||||
- name: REGISTRY_STORAGE_S3_REGION
|
||||
value: {{ required ".Values.s3.region is required" .Values.s3.region }}
|
||||
{{- if .Values.s3.regionEndpoint }}
|
||||
- name: REGISTRY_STORAGE_S3_REGIONENDPOINT
|
||||
value: {{ .Values.s3.regionEndpoint }}
|
||||
{{- end }}
|
||||
- name: REGISTRY_STORAGE_S3_BUCKET
|
||||
value: {{ required ".Values.s3.bucket is required" .Values.s3.bucket }}
|
||||
{{- if .Values.s3.rootdirectory }}
|
||||
- name: REGISTRY_STORAGE_S3_ROOTDIRECTORY
|
||||
value: {{ .Values.s3.rootdirectory | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.s3.encrypt }}
|
||||
- name: REGISTRY_STORAGE_S3_ENCRYPT
|
||||
value: {{ .Values.s3.encrypt | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.s3.secure }}
|
||||
- name: REGISTRY_STORAGE_S3_SECURE
|
||||
value: {{ .Values.s3.secure | quote }}
|
||||
{{- end }}
|
||||
{{- else if eq .Values.storage "swift" }}
|
||||
- name: REGISTRY_STORAGE_SWIFT_AUTHURL
|
||||
value: {{ required ".Values.swift.authurl is required" .Values.swift.authurl }}
|
||||
- name: REGISTRY_STORAGE_SWIFT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "docker-registry.fullname" . }}-secret
|
||||
key: swiftUsername
|
||||
- name: REGISTRY_STORAGE_SWIFT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "docker-registry.fullname" . }}-secret
|
||||
key: swiftPassword
|
||||
- name: REGISTRY_STORAGE_SWIFT_CONTAINER
|
||||
value: {{ required ".Values.swift.container is required" .Values.swift.container }}
|
||||
{{- end }}
|
||||
{{- if .Values.proxy.enabled }}
|
||||
- name: REGISTRY_PROXY_REMOTEURL
|
||||
value: {{ required ".Values.proxy.remoteurl is required" .Values.proxy.remoteurl }}
|
||||
- name: REGISTRY_PROXY_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ if .Values.proxy.secretRef }}{{ .Values.proxy.secretRef }}{{ else }}{{ template "docker-registry.fullname" . }}-secret{{ end }}
|
||||
key: proxyUsername
|
||||
- name: REGISTRY_PROXY_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ if .Values.proxy.secretRef }}{{ .Values.proxy.secretRef }}{{ else }}{{ template "docker-registry.fullname" . }}-secret{{ end }}
|
||||
key: proxyPassword
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.deleteEnabled }}
|
||||
- name: REGISTRY_STORAGE_DELETE_ENABLED
|
||||
value: "true"
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnvVars }}
|
||||
{{- toYaml . | nindent 14 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.secrets.htpasswd }}
|
||||
- name: auth
|
||||
mountPath: /auth
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if eq .Values.storage "filesystem" }}
|
||||
- name: data
|
||||
mountPath: /var/lib/registry/
|
||||
{{- end }}
|
||||
- name: "{{ template "docker-registry.fullname" . }}-config"
|
||||
mountPath: "/etc/docker/registry"
|
||||
{{- if .Values.tlsSecretName }}
|
||||
- mountPath: /etc/ssl/docker
|
||||
name: tls-cert
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 16 }}
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity: {{ toYaml .Values.affinity | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations: {{ toYaml .Values.tolerations | nindent 12 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.secrets.htpasswd }}
|
||||
- name: auth
|
||||
secret:
|
||||
secretName: {{ template "docker-registry.fullname" . }}-secret
|
||||
items:
|
||||
- key: htpasswd
|
||||
path: htpasswd
|
||||
{{- end }}
|
||||
{{- if eq .Values.storage "filesystem" }}
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "docker-registry.fullname" . }}{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
- name: {{ template "docker-registry.fullname" . }}-config
|
||||
configMap:
|
||||
name: {{ template "docker-registry.fullname" . }}-config
|
||||
{{- if .Values.tlsSecretName }}
|
||||
- name: tls-cert
|
||||
secret:
|
||||
secretName: {{ .Values.tlsSecretName }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraVolumes }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -29,6 +29,7 @@ spec:
|
||||
{{- end }}
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
||||
{{- if $.Values.podAnnotations }}
|
||||
{{ toYaml $.Values.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
@@ -47,6 +48,10 @@ spec:
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
{{- with .Values.initContainers }}
|
||||
initContainers:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
|
||||
42
templates/hpa.yaml
Normal file
42
templates/hpa.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
{{- $apiVersions := .Capabilities.APIVersions -}}
|
||||
{{- if $apiVersions.Has "autoscaling/v2" }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ template "docker-registry.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "docker-registry.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ template "docker-registry.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- with .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.autoscaling.behavior }}
|
||||
behavior:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
22
templates/hpaV1.yaml
Normal file
22
templates/hpaV1.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
{{- $apiVersions := .Capabilities.APIVersions -}}
|
||||
{{- if not ($apiVersions.Has "autoscaling/v2") }}
|
||||
apiVersion: autoscaling/v1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ template "docker-registry.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "docker-registry.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ template "docker-registry.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
targetCPUUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
35
values.yaml
35
values.yaml
@@ -163,6 +163,30 @@ podDisruptionBudget: {}
|
||||
# maxUnavailable: 1
|
||||
# minAvailable: 2
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 2
|
||||
targetCPUUtilizationPercentage: 60
|
||||
targetMemoryUtilizationPercentage: 60 # available only on Kubernetes ≥1.23 [required "autoscaling/v2"]
|
||||
behavior: {} # available only on Kubernetes ≥1.23 [required "autoscaling/v2"]
|
||||
# scaleDown:
|
||||
# stabilizationWindowSeconds: 300
|
||||
# policies:
|
||||
# - type: Percent
|
||||
# value: 100
|
||||
# periodSeconds: 15
|
||||
# scaleUp:
|
||||
# stabilizationWindowSeconds: 0
|
||||
# policies:
|
||||
# - type: Percent
|
||||
# value: 100
|
||||
# periodSeconds: 15
|
||||
# - type: Pods
|
||||
# value: 4
|
||||
# periodSeconds: 15
|
||||
# selectPolicy: Max
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
affinity: {}
|
||||
@@ -189,3 +213,14 @@ extraEnvVars: []
|
||||
## Additional ENV variables to set
|
||||
# - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
# value: "/var/lib/example"
|
||||
|
||||
initContainers: []
|
||||
## Init containers to add to the Deployment
|
||||
# - name: init
|
||||
# image: busybox
|
||||
# command: []
|
||||
|
||||
garbageCollect:
|
||||
enabled: false
|
||||
deleteUntagged: true
|
||||
schedule: "0 1 * * *"
|
||||
|
||||
Reference in New Issue
Block a user