Skip to content

Commit 63d60da

Browse files
committed
chore(charts): use condition
1 parent 7b889aa commit 63d60da

9 files changed

Lines changed: 44 additions & 42 deletions

charts/registry/templates/_helper.tpl

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ env:
44
value: "true"
55
- name: REGISTRY_LOG_LEVEL
66
value: info
7-
- name: "REGISTRY_HTTP_SECRET"
8-
valueFrom:
9-
secretKeyRef:
10-
name: registry-secret
11-
key: secret
127
- name: "DRYCC_REGISTRY_REDIRECT"
138
valueFrom:
149
secretKeyRef:
@@ -24,21 +19,39 @@ env:
2419
secretKeyRef:
2520
name: registry-secret
2621
key: password
22+
{{- if (.Values.storageEndpoint) }}
2723
- name: "DRYCC_STORAGE_LOOKUP"
2824
valueFrom:
2925
secretKeyRef:
30-
name: storage-creds
31-
key: lookup
26+
name: registry-secret
27+
key: storage-lookup
3228
- name: "DRYCC_STORAGE_BUCKET"
3329
valueFrom:
3430
secretKeyRef:
35-
name: storage-creds
36-
key: registry-bucket
31+
name: registry-secret
32+
key: storage-bucket
3733
- name: "DRYCC_STORAGE_ENDPOINT"
3834
valueFrom:
3935
secretKeyRef:
40-
name: storage-creds
41-
key: endpoint
36+
name: registry-secret
37+
key: storage-endpoint
38+
- name: "DRYCC_STORAGE_ACCESSKEY"
39+
valueFrom:
40+
secretKeyRef:
41+
name: registry-secret
42+
key: storage-accesskey
43+
- name: "DRYCC_STORAGE_SECRETKEY"
44+
valueFrom:
45+
secretKeyRef:
46+
name: registry-secret
47+
key: storage-secretkey
48+
{{- else if .Values.storage.enabled }}
49+
- name: "DRYCC_STORAGE_LOOKUP"
50+
value: "path"
51+
- name: "DRYCC_STORAGE_BUCKET"
52+
value: "registry"
53+
- name: "DRYCC_STORAGE_ENDPOINT"
54+
value: {{ printf "http://drycc-storage.%s.svc.%s:9000" .Release.Namespace .Values.global.clusterDomain }}
4255
- name: "DRYCC_STORAGE_ACCESSKEY"
4356
valueFrom:
4457
secretKeyRef:
@@ -50,6 +63,7 @@ env:
5063
name: storage-creds
5164
key: secretkey
5265
{{- end }}
66+
{{- end }}
5367

5468
{{/* Generate registry deployment limits */}}
5569
{{- define "registry.limits" -}}

charts/registry/templates/registry-cronjob-daily.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if eq .Values.global.registryLocation "on-cluster" }}
21
apiVersion: batch/v1
32
kind: CronJob
43
metadata:
@@ -45,4 +44,3 @@ spec:
4544
boot garbage-collect ${DRYCC_REGISTRY_CONFIG} --dry-run --delete-untagged
4645
{{- end }}
4746
{{- include "registry.envs" . | indent 12 }}
48-
{{- end }}

charts/registry/templates/registry-deployment.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if eq .Values.global.registryLocation "on-cluster" }}
21
apiVersion: apps/v1
32
kind: Deployment
43
metadata:
@@ -91,4 +90,3 @@ spec:
9190
volumes:
9291
- name: registry-storage
9392
emptyDir: {}
94-
{{- end }}

charts/registry/templates/registry-proxy-daemonset.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if eq .Values.global.registryLocation "on-cluster" }}
21
apiVersion: apps/v1
32
kind: DaemonSet
43
metadata:
@@ -36,10 +35,7 @@ spec:
3635
- $(DRYCC_REGISTRY_HOST)
3736
env:
3837
- name: "DRYCC_REGISTRY_HOST"
39-
valueFrom:
40-
secretKeyRef:
41-
name: registry-secret
42-
key: host
38+
value: {{ printf "drycc-registry.%s.svc.%s:5000" .Release.Namespace .Values.global.clusterDomain }}
4339
containers:
4440
- name: drycc-registry-proxy
4541
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/registry:{{.Values.imageTag}}
@@ -92,10 +88,7 @@ spec:
9288
{{- end }}
9389
env:
9490
- name: "DRYCC_REGISTRY_HOST"
95-
valueFrom:
96-
secretKeyRef:
97-
name: registry-secret
98-
key: host
91+
value: {{ printf "drycc-registry.%s.svc.%s:5000" .Release.Namespace .Values.global.clusterDomain }}
9992
- name: "DRYCC_REGISTRY_USERNAME"
10093
valueFrom:
10194
secretKeyRef:
@@ -109,4 +102,3 @@ spec:
109102
ports:
110103
- containerPort: 8080
111104
hostPort: {{.Values.proxyPort}}
112-
{{- end }}

charts/registry/templates/registry-secret.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ metadata:
44
name: registry-secret
55
labels:
66
heritage: drycc
7-
annotations:
8-
drycc.cc/registry-location: "{{ .Values.global.registryLocation }}"
97
type: Opaque
108
data:
11-
{{- if eq .Values.global.registryLocation "on-cluster" }}
12-
host: {{ printf "drycc-registry.%s.svc.%s:5000" .Release.Namespace .Values.global.clusterDomain | b64enc }}
13-
secret: {{ include "common.secrets.lookup" (dict "secret" "registry-secret" "key" "secret" "defaultValue" (randAlphaNum 32) "context" $) }}
14-
{{- else }}
15-
host: {{ .Values.host | b64enc }}
16-
organization: {{ .Values.organization | b64enc }}
17-
{{- end }}
189
username: {{ include "common.secrets.lookup" (dict "secret" "registry-secret" "key" "username" "defaultValue" (.Values.username | default (randAlphaNum 32)) "context" $) }}
1910
password: {{ include "common.secrets.lookup" (dict "secret" "registry-secret" "key" "password" "defaultValue" (.Values.password | default (randAlphaNum 32)) "context" $) }}
2011
redirect: {{ .Values.redirect | b64enc }}
12+
{{- if (.Values.storageEndpoint) }}
13+
storage-lookup: {{ .Values.storageLookup | b64enc }}
14+
storage-bucket: {{ .Values.storageBucket | b64enc }}
15+
storage-endpoint: {{ .Values.storageEndpoint | b64enc }}
16+
storage-accesskey: {{ .Values.storageAccesskey | b64enc }}
17+
storage-secretkey: {{ .Values.storageSecretkey | b64enc }}
18+
{{- end }}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
{{- if eq .Values.global.registryLocation "on-cluster" }}
21
apiVersion: v1
32
kind: ServiceAccount
43
metadata:
54
name: drycc-registry
65
labels:
76
heritage: drycc
8-
{{- end }}

charts/registry/templates/registry-service.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if eq .Values.global.registryLocation "on-cluster" }}
21
apiVersion: v1
32
kind: Service
43
metadata:
@@ -14,4 +13,3 @@ spec:
1413
selector:
1514
app: drycc-registry
1615
sessionAffinity: ClientIP
17-
{{- end }}

charts/registry/values.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ proxyPort: 5555
4545

4646
concurrencyPolicy: "Replace"
4747

48+
# The following parameters will no longer use the built-in storage component.
49+
storageLookup: "auto"
50+
storageBucket: "builder"
51+
storageEndpoint: ""
52+
storageAccesskey: ""
53+
storageSecretkey: ""
54+
55+
storage:
56+
enabled: true
57+
4858
# Service
4959
service:
5060
# Provide any additional service annotations
5161
annotations: {}
52-
53-
global:
54-
registryLocation: "on-cluster"

contrib/ci/test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ echo -e "\\033[32m---> S3 service ${STORAGE_IP}:9000 ready...\\033[0m"
1919
podman logs "${STORAGE_JOB}"
2020

2121
REGISTRY_JOB=$(podman run -d --rm \
22-
-e REGISTRY_HTTP_SECRET=drycc \
2322
-e DRYCC_REGISTRY_REDIRECT=false \
2423
-e DRYCC_REGISTRY_USERNAME=admin \
2524
-e DRYCC_REGISTRY_PASSWORD=admin \

0 commit comments

Comments
 (0)