File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ RUN groupadd drycc --gid ${DRYCC_GID} \
4343 && chown -R ${DRYCC_GID}:${DRYCC_UID} ${DRYCC_HOME_DIR}
4444
4545COPY --chown=${DRYCC_GID}:${DRYCC_UID} rootfs/config-example.yml /opt/drycc/registry/etc/config.yml
46+ ENV DRYCC_REGISTRY_CONFIG /opt/drycc/registry/etc/config.yml
4647
4748USER ${DRYCC_UID}
4849VOLUME ["${DRYCC_HOME_DIR}" ]
Original file line number Diff line number Diff line change 1- {{- define " registry.envs" -}}
1+ {{- define " registry.envs" }}
2+ env:
23- name: REGISTRY_STORAGE_DELETE_ENABLED
34 value: " true"
45- name: REGISTRY_LOG_LEVEL
Original file line number Diff line number Diff line change 1+ {{- if eq .Values.global.registryLocation "on-cluster" }}
2+ apiVersion : batch/v1
3+ kind : CronJob
4+ metadata :
5+ name : drycc-registry-cronjob-daily
6+ labels :
7+ heritage : drycc
8+ annotations :
9+ component.drycc.cc/version : {{ .Values.imageTag }}
10+ spec :
11+ schedule : " 0 0 * * *"
12+ concurrencyPolicy : {{ .Values.concurrencyPolicy }}
13+ successfulJobsHistoryLimit : 1
14+ failedJobsHistoryLimit : 1
15+ jobTemplate :
16+ spec :
17+ template :
18+ spec :
19+ restartPolicy : OnFailure
20+ serviceAccount : drycc-controller
21+ initContainers :
22+ - name : drycc-registry-init
23+ image : {{.Values.imageRegistry}}/{{.Values.imageOrg}}/python-dev:latest
24+ imagePullPolicy : {{.Values.imagePullPolicy}}
25+ args :
26+ - netcat
27+ - -v
28+ - -u
29+ - $(DRYCC_MINIO_ENDPOINT)
30+ {{- include "builder.envs" . | indent 12 }}
31+ containers :
32+ - image : {{.Values.imageRegistry}}/{{.Values.imageOrg}}/registry:{{.Values.imageTag}}
33+ imagePullPolicy : {{.Values.imagePullPolicy}}
34+ name : drycc-registry-garbage-collect
35+ args :
36+ - /bin/bash
37+ - -c
38+ - /opt/registry/bin/registry
39+ - garbage-collect
40+ - $(DRYCC_REGISTRY_CONFIG)
41+ - --dry-run
42+ - --delete-untagged
43+ {{- include "builder.envs" . | indent 12 }}
44+ {{- end }}
Original file line number Diff line number Diff line change @@ -33,22 +33,22 @@ spec:
3333 - -v
3434 - -u
3535 - $(DRYCC_MINIO_ENDPOINT)
36- {{- include "builder .envs" . | indent 8 }}
36+ {{- include "registry .envs" . | indent 8 }}
3737 containers :
3838 - name : drycc-registry
3939 image : {{.Values.imageRegistry}}/{{.Values.imageOrg}}/registry:{{.Values.imageTag}}
4040 imagePullPolicy : {{.Values.imagePullPolicy}}
41- {{- include "builder .limits" . | indent 8 }}
42- {{- include "builder .envs" . | indent 8 }}
41+ {{- include "registry .limits" . | indent 8 }}
42+ {{- include "registry .envs" . | indent 8 }}
4343 livenessProbe :
4444 httpGet :
45- path : /v2/
45+ path : /
4646 port : 5000
4747 initialDelaySeconds : 1
4848 timeoutSeconds : 1
4949 readinessProbe :
5050 httpGet :
51- path : /v2/
51+ path : /
5252 port : 5000
5353 initialDelaySeconds : 1
5454 timeoutSeconds : 1
Original file line number Diff line number Diff line change 1-
21apiVersion : v1
32kind : Secret
43metadata :
@@ -9,8 +8,8 @@ metadata:
98 drycc.cc/registry-location : " {{ .Values.global.registryLocation }}"
109type : Opaque
1110data :
12- {{- if ne .Values.global.registryLocation "on-cluster" }}
13- host : {{ print "drycc-registry" .Release.Namespace ".svc." .Values.global.clusterDomain | b64enc }}
11+ {{- if eq .Values.global.registryLocation "on-cluster" }}
12+ host : {{ printf "drycc-registry.%s.svc.%s:80 " .Release.Namespace .Values.global.clusterDomain | b64enc }}
1413 secret : {{ randAlphaNum 32 | b64enc }}
1514 {{- else }}
1615 host : {{ .Values.host | b64enc }}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ imageTag: "canary"
44imageRegistry : " registry.drycc.cc"
55# limitsCpu: "100m"
66# limitsMemory: "50Mi"
7+ concurrencyPolicy : " Replace"
78
89# Service
910service :
Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ import (
1111
1212const (
1313 registryBinary = "/opt/drycc/registry/bin/registry"
14- registryConfig = "/opt/drycc/registry/etc/config.yml"
1514 registryHtpasswd = "/opt/drycc/registry/etc/htpasswd"
15+ registryConfigEnvVar = "DRYCC_REGISTRY_CONFIG"
1616 registryRedirectEnvVar = "DRYCC_REGISTRY_REDIRECT"
1717 minioLookupEnvVar = "DRYCC_MINIO_LOOKUP"
1818 minioBucketEnvVar = "DRYCC_MINIO_BUCKET"
1919 minioEndpointEnvVar = "DRYCC_MINIO_ENDPOINT"
2020 minioAccesskeyEnvVar = "DRYCC_MINIO_ACCESSKEY"
2121 minioSecretkeyEnvVar = "DRYCC_MINIO_SECRETKEY"
22- command = "serve"
22+ defaultCommand = "serve"
2323)
2424
2525func main () {
@@ -61,8 +61,12 @@ func main() {
6161 if err := cmd .Run (); err != nil {
6262 log .Fatal ("Error creating the registry bucket: " , err )
6363 }
64+ if len (os .Args ) > 1 {
65+ cmd = exec .Command (registryBinary , os .Args [1 :]... )
66+ } else {
67+ cmd = exec .Command (registryBinary , defaultCommand , os .Getenv (registryConfigEnvVar ))
68+ }
6469
65- cmd = exec .Command (registryBinary , command , registryConfig )
6670 cmd .Stdout = os .Stdout
6771 cmd .Stderr = os .Stderr
6872 if err := cmd .Run (); err != nil {
You can’t perform that action at this time.
0 commit comments