Skip to content

Commit 405090d

Browse files
committed
chore(storage): use path style replace lookup
1 parent 1684d29 commit 405090d

8 files changed

Lines changed: 29 additions & 28 deletions

File tree

charts/builder/templates/_helpers.tpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ env:
2323
- name: "DRYCC_CONTROLLER_URL"
2424
value: http://drycc-controller-api
2525
{{- if (.Values.storageEndpoint) }}
26-
- name: "DRYCC_STORAGE_LOOKUP"
27-
valueFrom:
28-
secretKeyRef:
29-
name: builder-secret
30-
key: storage-lookup
3126
- name: "DRYCC_STORAGE_BUCKET"
3227
valueFrom:
3328
secretKeyRef:
@@ -48,9 +43,12 @@ env:
4843
secretKeyRef:
4944
name: builder-secret
5045
key: storage-secretkey
46+
- name: "DRYCC_STORAGE_PATH_STYLE"
47+
valueFrom:
48+
secretKeyRef:
49+
name: builder-secret
50+
key: storage-path-style
5151
{{- else if .Values.storage.enabled }}
52-
- name: "DRYCC_STORAGE_LOOKUP"
53-
value: "path"
5452
- name: "DRYCC_STORAGE_BUCKET"
5553
value: "builder"
5654
- name: "DRYCC_STORAGE_ENDPOINT"
@@ -65,6 +63,8 @@ env:
6563
secretKeyRef:
6664
name: storage-creds
6765
key: secretkey
66+
- name: "DRYCC_STORAGE_PATH_STYLE"
67+
value: "on"
6868
{{- end }}
6969
- name: "DRYCC_REGISTRY_LOCATION"
7070
value: {{ ternary "on-cluster" "off-cluster" .Values.registry.enabled }}

charts/builder/templates/builder-secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ data:
1313
registry-organization: {{ .Values.registryOrganization | b64enc }}
1414
{{- end }}
1515
{{- if (.Values.storageEndpoint) }}
16-
storage-lookup: {{ .Values.storageLookup | b64enc }}
1716
storage-bucket: {{ .Values.storageBucket | b64enc }}
1817
storage-endpoint: {{ .Values.storageEndpoint | b64enc }}
1918
storage-accesskey: {{ .Values.storageAccesskey | b64enc }}
2019
storage-secretkey: {{ .Values.storageSecretkey | b64enc }}
20+
storage-path-style: {{ .Values.storagePathStyle | b64enc }}
2121
{{- end }}

charts/builder/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ podAntiAffinityPreset:
5757
ttlSecondsAfterFinished: 21600
5858

5959
# The following parameters will no longer use the built-in storage component.
60-
storageLookup: "auto"
6160
storageBucket: "registry"
6261
storageEndpoint: ""
6362
storageAccesskey: ""
6463
storageSecretkey: ""
64+
storagePathStyle: "auto"
6565

6666
# The following parameters will no longer use the built-in registry component.
6767
registryHost: ""

pkg/conf/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
)
1212

1313
const (
14-
storageLookupEnvVar = "DRYCC_STORAGE_LOOKUP"
1514
storageBucketEnvVar = "DRYCC_STORAGE_BUCKET"
1615
storageEndpointEnvVar = "DRYCC_STORAGE_ENDPOINT"
1716
storageAccesskeyEnvVar = "DRYCC_STORAGE_ACCESSKEY"
1817
storageSecretkeyEnvVar = "DRYCC_STORAGE_SECRETKEY"
18+
storagePathStyleEnvVar = "DRYCC_STORAGE_PATH_STYLE"
1919
)
2020

2121
// ServiceKeyLocation holds the path of the service key secret.
@@ -51,7 +51,7 @@ func GetStorageParams(env sys.Env) (Parameters, error) {
5151
params["accesskey"] = env.Get(storageAccesskeyEnvVar)
5252
params["secretkey"] = env.Get(storageSecretkeyEnvVar)
5353
params["bucket"] = env.Get(storageBucketEnvVar)
54-
if env.Get(storageLookupEnvVar) == "path" {
54+
if env.Get(storagePathStyleEnvVar) == "on" {
5555
params["forcepathstyle"] = "true"
5656
}
5757

pkg/conf/config_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ func TestGetStorageParams(t *testing.T) {
1313

1414
env := sys.NewFakeEnv()
1515
env.Envs = map[string]string{
16-
"DRYCC_STORAGE_LOOKUP": "path",
17-
"DRYCC_STORAGE_BUCKET": "builder",
18-
"DRYCC_STORAGE_ENDPOINT": "http://localhost:8088",
19-
"DRYCC_STORAGE_ACCESSKEY": "admin",
20-
"DRYCC_STORAGE_SECRETKEY": "adminpass",
16+
"DRYCC_STORAGE_BUCKET": "builder",
17+
"DRYCC_STORAGE_ENDPOINT": "http://localhost:8088",
18+
"DRYCC_STORAGE_ACCESSKEY": "admin",
19+
"DRYCC_STORAGE_SECRETKEY": "adminpass",
20+
"DRYCC_STORAGE_PATH_STYLE": "on",
2121
}
2222
params, err := GetStorageParams(env)
2323
if err != nil {

pkg/gitreceive/imagebuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99

1010
var (
1111
requiredEnvNames = []string{
12-
"DRYCC_STORAGE_LOOKUP",
1312
"DRYCC_STORAGE_BUCKET",
1413
"DRYCC_STORAGE_ENDPOINT",
14+
"DRYCC_STORAGE_PATH_STYLE",
1515
"DRYCC_REGISTRY_HOST",
1616
}
1717
)

pkg/gitreceive/imagebuilder_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ func TestGetImagebuilderEnvOffclusterErr(t *testing.T) {
1515
}
1616
env := sys.NewFakeEnv()
1717
env.Envs = map[string]string{
18-
"DRYCC_STORAGE_LOOKUP": "path",
19-
"DRYCC_STORAGE_BUCKET": "builder",
20-
"DRYCC_STORAGE_ENDPOINT": "drycc-storage",
21-
"DRYCC_REGISTRY_LOCATION": "off-cluster",
18+
"DRYCC_STORAGE_BUCKET": "builder",
19+
"DRYCC_STORAGE_ENDPOINT": "drycc-storage",
20+
"DRYCC_STORAGE_PATH_STYLE": "auto",
21+
"DRYCC_REGISTRY_LOCATION": "off-cluster",
2222
}
2323
_, err := getImagebuilderEnv(&image, config, env)
2424
assert.Error(t, err, errors.New("the environment variable DRYCC_REGISTRY_HOST is required"))
@@ -30,17 +30,17 @@ func TestGetImagebuilderEnvOffclusterErr(t *testing.T) {
3030
func TestGetImagebuilderEnvOffclusterSuccess(t *testing.T) {
3131
env := sys.NewFakeEnv()
3232
env.Envs = map[string]string{
33-
"DRYCC_STORAGE_LOOKUP": "path",
3433
"DRYCC_STORAGE_BUCKET": "builder",
3534
"DRYCC_STORAGE_ENDPOINT": "drycc-storage",
35+
"DRYCC_STORAGE_PATH_STYLE": "auto",
3636
"DRYCC_REGISTRY_HOST": "quay.io",
3737
"DRYCC_REGISTRY_ORGANIZATION": "kmala",
3838
"DRYCC_REGISTRY_LOCATION": "off-cluster",
3939
}
4040
expectedData := map[string]string{
41-
"DRYCC_STORAGE_LOOKUP": "path",
4241
"DRYCC_STORAGE_BUCKET": "builder",
4342
"DRYCC_STORAGE_ENDPOINT": "drycc-storage",
43+
"DRYCC_STORAGE_PATH_STYLE": "auto",
4444
"DRYCC_REGISTRY_LOCATION": "off-cluster",
4545
"DRYCC_REGISTRY_HOST": "quay.io",
4646
"DRYCC_REGISTRY_ORGANIZATION": "kmala",
@@ -61,17 +61,18 @@ func TestGetImagebuilderEnvOffclusterSuccess(t *testing.T) {
6161
func TestGetImagebuilderEnvOnclusterSuccess(t *testing.T) {
6262
env := sys.NewFakeEnv()
6363
env.Envs = map[string]string{
64-
"DRYCC_STORAGE_LOOKUP": "path",
6564
"DRYCC_STORAGE_BUCKET": "builder",
6665
"DRYCC_STORAGE_ENDPOINT": "drycc-storage",
66+
"DRYCC_STORAGE_PATH_STYLE": "auto",
6767
"DRYCC_REGISTRY_HOST": "drycc-registry",
6868
"DRYCC_REGISTRY_PROXY_HOST": "127.0.0.1:8000",
6969
"DRYCC_REGISTRY_LOCATION": "on-cluster",
7070
}
7171
expectedData := map[string]string{
72-
"DRYCC_STORAGE_LOOKUP": "path",
72+
7373
"DRYCC_STORAGE_BUCKET": "builder",
7474
"DRYCC_STORAGE_ENDPOINT": "drycc-storage",
75+
"DRYCC_STORAGE_PATH_STYLE": "auto",
7576
"DRYCC_REGISTRY_HOST": "drycc-registry",
7677
"DRYCC_REGISTRY_LOCATION": "on-cluster",
7778
"DRYCC_REGISTRY_PROXY_HOST": "127.0.0.1:8000",

rootfs/bin/create_bucket

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

33
set -e
44

5-
mc config host add storage \
5+
mc alias set storage \
66
"${DRYCC_STORAGE_ENDPOINT}" \
77
"${DRYCC_STORAGE_ACCESSKEY}" \
88
"${DRYCC_STORAGE_SECRETKEY}" \
9-
--lookup "${DRYCC_STORAGE_LOOKUP}" \
10-
--api s3v4
9+
--path "${DRYCC_STORAGE_PATH_STYLE}"
10+
1111
mc ping storage -x
1212
mc mb --ignore-existing storage/"${DRYCC_STORAGE_BUCKET}"

0 commit comments

Comments
 (0)