Skip to content

Commit 2e60247

Browse files
committed
chore(registry): change minio to storage
1 parent 9bafd4d commit 2e60247

7 files changed

Lines changed: 45 additions & 44 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
rootfs/opt/
22
contrib/ci/tmp/
3+
.vscode/

charts/registry/templates/_helper.tpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,30 @@ env:
2424
secretKeyRef:
2525
name: registry-secret
2626
key: password
27-
- name: "DRYCC_MINIO_LOOKUP"
27+
- name: "DRYCC_STORAGE_LOOKUP"
2828
valueFrom:
2929
secretKeyRef:
30-
name: minio-creds
30+
name: storage-creds
3131
key: lookup
32-
- name: "DRYCC_MINIO_BUCKET"
32+
- name: "DRYCC_STORAGE_BUCKET"
3333
valueFrom:
3434
secretKeyRef:
35-
name: minio-creds
35+
name: storage-creds
3636
key: registry-bucket
37-
- name: "DRYCC_MINIO_ENDPOINT"
37+
- name: "DRYCC_STORAGE_ENDPOINT"
3838
valueFrom:
3939
secretKeyRef:
40-
name: minio-creds
40+
name: storage-creds
4141
key: endpoint
42-
- name: "DRYCC_MINIO_ACCESSKEY"
42+
- name: "DRYCC_STORAGE_ACCESSKEY"
4343
valueFrom:
4444
secretKeyRef:
45-
name: minio-creds
45+
name: storage-creds
4646
key: accesskey
47-
- name: "DRYCC_MINIO_SECRETKEY"
47+
- name: "DRYCC_STORAGE_SECRETKEY"
4848
valueFrom:
4949
secretKeyRef:
50-
name: minio-creds
50+
name: storage-creds
5151
key: secretkey
5252
{{- end }}
5353

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
- netcat
2727
- -v
2828
- -u
29-
- $(DRYCC_MINIO_ENDPOINT)
29+
- $(DRYCC_STORAGE_ENDPOINT)
3030
{{- include "builder.envs" . | indent 12 }}
3131
containers:
3232
- image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/registry:{{.Values.imageTag}}

charts/registry/templates/registry-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
- netcat
3636
- -v
3737
- -u
38-
- $(DRYCC_MINIO_ENDPOINT)
38+
- $(DRYCC_STORAGE_ENDPOINT)
3939
{{- include "registry.envs" . | indent 8 }}
4040
containers:
4141
- name: drycc-registry

contrib/ci/test.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@ set -eoxf pipefail
55
s3Accesskey=drycc
66
s3Secretkey=123456789
77

8-
MINIO_JOB=$(docker run -d --name minio \
9-
-e DRYCC_MINIO_ACCESSKEY=$s3Accesskey \
10-
-e DRYCC_MINIO_SECRETKEY=$s3Secretkey \
11-
"${DEV_REGISTRY}"/drycc/minio:canary server /data/minio/ --console-address :9001)
8+
STORAGE_JOB=$(docker run -d --name storage \
9+
-e DRYCC_STORAGE_ACCESSKEY=$s3Accesskey \
10+
-e DRYCC_STORAGE_SECRETKEY=$s3Secretkey \
11+
"${DEV_REGISTRY}"/drycc/storage:canary server /data/storage/ --console-address :9001)
1212

1313
sleep 5
14-
docker logs "${MINIO_JOB}"
14+
docker logs "${STORAGE_JOB}"
1515

16-
MINIO_IP=$(docker inspect --format "{{ .NetworkSettings.IPAddress }}" "${MINIO_JOB}")
16+
STORAGE_IP=$(docker inspect --format "{{ .NetworkSettings.IPAddress }}" "${STORAGE_JOB}")
1717

18-
JOB=$(docker run --add-host minio:"${MINIO_IP}" \
18+
JOB=$(docker run --add-host storage:"${STORAGE_IP}" \
1919
-d \
2020
-p 5000:5000 \
2121
-e REGISTRY_HTTP_SECRET=drycc \
2222
-e DRYCC_REGISTRY_REDIRECT=false \
2323
-e DRYCC_REGISTRY_USERNAME=admin \
2424
-e DRYCC_REGISTRY_PASSWORD=admin \
25-
-e DRYCC_MINIO_LOOKUP=path \
26-
-e DRYCC_MINIO_BUCKET=registry \
27-
-e DRYCC_MINIO_ENDPOINT=http://minio:9000 \
28-
-e DRYCC_MINIO_ACCESSKEY=$s3Accesskey \
29-
-e DRYCC_MINIO_SECRETKEY=$s3Secretkey \
25+
-e DRYCC_STORAGE_LOOKUP=path \
26+
-e DRYCC_STORAGE_BUCKET=registry \
27+
-e DRYCC_STORAGE_ENDPOINT=http://storage:9000 \
28+
-e DRYCC_STORAGE_ACCESSKEY=$s3Accesskey \
29+
-e DRYCC_STORAGE_SECRETKEY=$s3Secretkey \
3030
"$1")
3131

3232
# let the registry run for a few seconds
3333
sleep 5
3434
# check that the registry is still up
3535
docker logs "${JOB}"
3636
docker ps -q --no-trunc=true | grep "${JOB}"
37-
docker rm -f "${JOB}" "${MINIO_JOB}"
37+
docker rm -f "${JOB}" "${STORAGE_JOB}"

main.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ const (
1414
registryHtpasswd = "/opt/drycc/registry/etc/htpasswd"
1515
registryConfigEnvVar = "DRYCC_REGISTRY_CONFIG"
1616
registryRedirectEnvVar = "DRYCC_REGISTRY_REDIRECT"
17-
minioLookupEnvVar = "DRYCC_MINIO_LOOKUP"
18-
minioBucketEnvVar = "DRYCC_MINIO_BUCKET"
19-
minioEndpointEnvVar = "DRYCC_MINIO_ENDPOINT"
20-
minioAccesskeyEnvVar = "DRYCC_MINIO_ACCESSKEY"
21-
minioSecretkeyEnvVar = "DRYCC_MINIO_SECRETKEY"
17+
storageLookupEnvVar = "DRYCC_STORAGE_LOOKUP"
18+
storageBucketEnvVar = "DRYCC_STORAGE_BUCKET"
19+
storageEndpointEnvVar = "DRYCC_STORAGE_ENDPOINT"
20+
storageAccesskeyEnvVar = "DRYCC_STORAGE_ACCESSKEY"
21+
storageSecretkeyEnvVar = "DRYCC_STORAGE_SECRETKEY"
2222
defaultCommand = "serve"
2323
)
2424

2525
func main() {
2626
log.Println("INFO: Starting registry...")
2727
os.Setenv("REGISTRY_STORAGE", "s3")
28-
mEndpoint := os.Getenv(minioEndpointEnvVar)
28+
mEndpoint := os.Getenv(storageEndpointEnvVar)
2929
os.Setenv("REGISTRY_STORAGE_S3_REGIONENDPOINT", mEndpoint)
3030

3131
region := "us-east-1" //region is required in distribution
@@ -36,12 +36,12 @@ func main() {
3636
}
3737
os.Setenv("REGISTRY_STORAGE_S3_REGION", region)
3838

39-
os.Setenv("REGISTRY_STORAGE_S3_ACCESSKEY", os.Getenv(minioAccesskeyEnvVar))
40-
os.Setenv("REGISTRY_STORAGE_S3_SECRETKEY", os.Getenv(minioSecretkeyEnvVar))
41-
os.Setenv("REGISTRY_STORAGE_S3_BUCKET", os.Getenv(minioBucketEnvVar))
39+
os.Setenv("REGISTRY_STORAGE_S3_ACCESSKEY", os.Getenv(storageAccesskeyEnvVar))
40+
os.Setenv("REGISTRY_STORAGE_S3_SECRETKEY", os.Getenv(storageSecretkeyEnvVar))
41+
os.Setenv("REGISTRY_STORAGE_S3_BUCKET", os.Getenv(storageBucketEnvVar))
4242
os.Setenv("REGISTRY_STORAGE_S3_ROOTDIRECTORY", "/registry")
4343

44-
if os.Getenv(minioLookupEnvVar) == "path" {
44+
if os.Getenv(storageLookupEnvVar) == "path" {
4545
os.Setenv("REGISTRY_STORAGE_S3_FORCEPATHSTYLE", "true")
4646
}
4747

rootfs/bin/init_registry

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
set -e
44

5-
mc config host add minio \
6-
"${DRYCC_MINIO_ENDPOINT}" \
7-
"${DRYCC_MINIO_ACCESSKEY}" \
8-
"${DRYCC_MINIO_SECRETKEY}" \
9-
--lookup "${DRYCC_MINIO_LOOKUP}" \
5+
mc config host add storage \
6+
"${DRYCC_STORAGE_ENDPOINT}" \
7+
"${DRYCC_STORAGE_ACCESSKEY}" \
8+
"${DRYCC_STORAGE_SECRETKEY}" \
9+
--lookup "${DRYCC_STORAGE_LOOKUP}" \
1010
--api s3v4
1111

1212
has_bucket(){
13-
mc ls minio -json|jq -r '.key'|grep -w "${DRYCC_MINIO_BUCKET}"
13+
mc ls storage -json|jq -r '.key'|grep -w "${DRYCC_STORAGE_BUCKET}"
1414
}
1515

1616
if [ -z "$(has_bucket)" ] ;then
17-
mc mb minio/"${DRYCC_MINIO_BUCKET}"
17+
mc mb storage/"${DRYCC_STORAGE_BUCKET}"
1818
if [ -z "$(has_bucket)" ] ;then
19-
echo "create bucket ${DRYCC_MINIO_BUCKET} error"
19+
echo "create bucket ${DRYCC_STORAGE_BUCKET} error"
2020
exit 1
2121
fi
2222
fi
23-
echo "create bucket ${DRYCC_MINIO_BUCKET} success"
23+
echo "create bucket ${DRYCC_STORAGE_BUCKET} success"
2424

2525
htpasswd -Bbn "${DRYCC_REGISTRY_USERNAME}" "${DRYCC_REGISTRY_PASSWORD}" > "${REGISTRY_AUTH_HTPASSWD_PATH}"
2626
echo "create ${REGISTRY_AUTH_HTPASSWD_PATH} success"

0 commit comments

Comments
 (0)