Skip to content

Commit fae81e9

Browse files
masonCheinTian
authored andcommitted
refactor: refactor external resource connection info to <resource>.external
1 parent 97f6ad8 commit fae81e9

File tree

11 files changed

+699
-1023
lines changed

11 files changed

+699
-1023
lines changed

charts/csghub/templates/configmap-server.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ data:
9494

9595
# Space Application
9696
STARHUB_SERVER_PUBLIC_DOMAIN: {{ include "csghub.external.endpoint" . | quote }}
97-
STARHUB_SERVER_MODEL_DOCKER_REG_BASE: {{ .Values.server.modelRegistry | default (or .Values.global.image.registry "docker.io") | quote }}
97+
STARHUB_SERVER_MODEL_DOCKER_REG_BASE: {{ .Values.server.model.registry | default (or .Values.global.image.registry "docker.io") | quote }}
9898

9999
# Deprecated ==> re-enabled
100100
{{- if .Values.global.usePublicDomain }}

charts/csghub/templates/helpers/_database.tpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ generate database config
3030
{{- $_ := set $config "sslMode" "disable" -}}
3131
{{- else -}}
3232
{{- /* use external postgresql */ -}}
33-
{{- $_ := set $config "host" $global.Values.global.postgresql.host -}}
34-
{{- $_ := set $config "port" $global.Values.global.postgresql.port -}}
35-
{{- $_ := set $config "user" $global.Values.global.postgresql.user -}}
36-
{{- $_ := set $config "password" $global.Values.global.postgresql.password -}}
37-
{{- $_ := set $config "timezone" ($global.Values.global.postgresql.timezone | default "UTC") -}}
38-
{{- $_ := set $config "sslMode" ($global.Values.global.postgresql.sslMode | default "require") -}}
33+
{{- $_ := set $config "host" $global.Values.global.postgresql.external.host -}}
34+
{{- $_ := set $config "port" $global.Values.global.postgresql.external.port -}}
35+
{{- $_ := set $config "user" $global.Values.global.postgresql.external.user -}}
36+
{{- $_ := set $config "password" $global.Values.global.postgresql.external.password -}}
37+
{{- $_ := set $config "timezone" ($global.Values.global.postgresql.external.timezone | default "UTC") -}}
38+
{{- $_ := set $config "sslMode" ($global.Values.global.postgresql.external.sslMode | default "require") -}}
3939
{{- end -}}
4040

4141
{{/* service-level config override */}}

charts/csghub/templates/helpers/_gitaly.tpl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ generate gitaly config
2121
{{- $_ := set $config "scheme" "tcp" -}}
2222
{{- else -}}
2323
{{/* use external gitaly */}}
24-
{{- $_ := set $config "host" $global.Values.global.gitaly.host -}}
25-
{{- $_ := set $config "port" $global.Values.global.gitaly.port -}}
26-
{{- $_ := set $config "storage" ($global.Values.global.gitaly.storage | default "default") -}}
27-
{{- $_ := set $config "token" $global.Values.global.gitaly.token -}}
28-
{{- $_ := set $config "isCluster" ($global.Values.global.gitaly.isCluster | default false) -}}
29-
{{- $_ := set $config "scheme" ($global.Values.global.gitaly.scheme | default "tcp") -}}
24+
{{- $_ := set $config "host" $global.Values.global.gitaly.external.host -}}
25+
{{- $_ := set $config "port" $global.Values.global.gitaly.external.port -}}
26+
{{- $_ := set $config "storage" ($global.Values.global.gitaly.external.storage | default "default") -}}
27+
{{- $_ := set $config "token" $global.Values.global.gitaly.external.token -}}
28+
{{- $_ := set $config "isCluster" ($global.Values.global.gitaly.external.isCluster | default false) -}}
29+
{{- $_ := set $config "scheme" ($global.Values.global.gitaly.external.scheme | default "tcp") -}}
3030
{{- end -}}
3131

3232
{{/* ensure port is string */}}
@@ -42,9 +42,5 @@ generate gitaly grpc endpoint
4242
{{- $service := .service -}}
4343
{{- $global := .global -}}
4444
{{- $config := include "csghub.gitaly.config" . | fromYaml -}}
45-
{{- if $config.tls -}}
46-
{{- printf "tls://%s:%s" $config.host $config.port -}}
47-
{{- else -}}
48-
{{- printf "tcp://%s:%s" $config.host $config.port -}}
49-
{{- end -}}
45+
{{- printf "%s://%s:%s" $config.scheme $config.host $config.port -}}
5046
{{- end }}

charts/csghub/templates/helpers/_objectStore.tpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ generate object store config
4646
{{- $_ := set $config "directUpload" false -}}
4747
{{- else -}}
4848
{{/* use external object store */}}
49-
{{- $_ := set $config "endpoint" $global.Values.global.objectStore.endpoint -}}
50-
{{- $_ := set $config "externalEndpoint" $global.Values.global.objectStore.endpoint -}}
51-
{{- $_ := set $config "region" $global.Values.global.objectStore.region -}}
52-
{{- $_ := set $config "accessKey" $global.Values.global.objectStore.accessKey -}}
53-
{{- $_ := set $config "secretKey" $global.Values.global.objectStore.secretKey -}}
54-
{{- $_ := set $config "encrypt" $global.Values.global.objectStore.encrypt -}}
55-
{{- $_ := set $config "secure" $global.Values.global.objectStore.secure -}}
56-
{{- $_ := set $config "pathStyle" $global.Values.global.objectStore.pathStyle -}}
57-
{{- $_ := set $config "directUpload" $global.Values.global.objectStore.directUpload -}}
49+
{{- $_ := set $config "endpoint" $global.Values.global.objectStore.external.endpoint -}}
50+
{{- $_ := set $config "externalEndpoint" $global.Values.global.objectStore.external.endpoint -}}
51+
{{- $_ := set $config "region" $global.Values.global.objectStore.external.region -}}
52+
{{- $_ := set $config "accessKey" $global.Values.global.objectStore.external.accessKey -}}
53+
{{- $_ := set $config "secretKey" $global.Values.global.objectStore.external.secretKey -}}
54+
{{- $_ := set $config "encrypt" $global.Values.global.objectStore.external.encrypt -}}
55+
{{- $_ := set $config "secure" $global.Values.global.objectStore.external.secure -}}
56+
{{- $_ := set $config "pathStyle" $global.Values.global.objectStore.external.pathStyle -}}
57+
{{- $_ := set $config "directUpload" $global.Values.global.objectStore.external.directUpload -}}
5858
{{- end -}}
5959

6060
{{/* service level config override */}}

charts/csghub/templates/helpers/_redis.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ generate redis config
1313
{{- $_ := set $config "password" (or $global.Values.redis.password (randAlphaNum 15)) -}}
1414
{{- else -}}
1515
{{- /* user external redis */ -}}
16-
{{- $_ := set $config "host" $global.Values.global.redis.host -}}
17-
{{- $_ := set $config "port" $global.Values.global.redis.port -}}
18-
{{- $_ := set $config "password" $global.Values.global.redis.password -}}
16+
{{- $_ := set $config "host" $global.Values.global.redis.external.host -}}
17+
{{- $_ := set $config "port" $global.Values.global.redis.external.port -}}
18+
{{- $_ := set $config "password" $global.Values.global.redis.external.password -}}
1919
{{- end -}}
2020

2121
{{/* service-level config override */}}

charts/csghub/templates/helpers/_registry.tpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ generate registry config
2323
{{- $_ := set $config "username" $defaultUser -}}
2424
{{- $_ := set $config "password" $defaultPass -}}
2525
{{- $_ := set $config "htpasswd" $defaultHtpasswd -}}
26+
{{- $_ := set $config "insecure" "true" -}}
2627

2728
{{/* use secrets if exists */}}
2829
{{- $secret := (include "common.names.custom" (list $global "registry")) -}}
@@ -44,10 +45,11 @@ generate registry config
4445

4546
{{- else -}}
4647
{{/* use external registry */}}
47-
{{- $_ := set $config "registry" $global.Values.global.registry.registry -}}
48-
{{- $_ := set $config "repository" $global.Values.global.registry.repository -}}
49-
{{- $_ := set $config "username" $global.Values.global.registry.username -}}
50-
{{- $_ := set $config "password" $global.Values.global.registry.password -}}
48+
{{- $_ := set $config "registry" $global.Values.global.registry.external.registry -}}
49+
{{- $_ := set $config "repository" $global.Values.global.registry.external.repository -}}
50+
{{- $_ := set $config "username" $global.Values.global.registry.external.username -}}
51+
{{- $_ := set $config "password" $global.Values.global.registry.external.password -}}
52+
{{- $_ := set $config "insecure" $global.Values.global.registry.external.insecure -}}
5153
{{- end -}}
5254

5355
{{/* service level config override */}}

charts/csghub/tests/gitaly_test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ tests:
3030
- it: when using external gitaly, should render gitlab-shell config right
3131
set:
3232
global.gitaly.enabled: false
33-
global.gitaly.host: "gitaly.opencsg-poc.com"
34-
global.gitaly.port: 8875
35-
global.gitaly.token: "gitaly@2025!"
33+
global.gitaly.external.host: "gitaly.opencsg-poc.com"
34+
global.gitaly.external.port: 8875
35+
global.gitaly.external.token: "gitaly@2025!"
3636
release:
3737
name: csghub
3838
namespace: csghub

charts/csghub/tests/postgresql_test.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ tests:
154154
- configmap-server.yaml
155155
set:
156156
global.postgresql.enabled: false
157-
global.postgresql.host: "postgresql.opencsg-poc.com"
158-
global.postgresql.port: 6432
159-
global.postgresql.user: "csghub_server124"
160-
global.postgresql.password: "csghub_server@2025!"
161-
global.postgresql.database: "csghub"
162-
global.postgresql.timezone: "Asia/Shanghai"
157+
global.postgresql.external.host: "postgresql.opencsg-poc.com"
158+
global.postgresql.external.port: 6432
159+
global.postgresql.external.user: "csghub_server124"
160+
global.postgresql.external.password: "csghub_server@2025!"
161+
global.postgresql.external.database: "csghub"
162+
global.postgresql.external.timezone: "UTC"
163163
release:
164164
name: csghub
165165
namespace: csghub
@@ -182,4 +182,4 @@ tests:
182182
value: "csghub_server"
183183
- equal:
184184
path: data["STARHUB_DATABASE_TIMEZONE"]
185-
value: "Asia/Shanghai"
185+
value: "UTC"

charts/csghub/tests/s3_test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ tests:
3636
- charts/registry/templates/configmap.yaml
3737
set:
3838
global.objectStore.enabled: false
39-
global.objectStore.endpoint: "http://s3.opencsg-poc.com"
40-
global.objectStore.accessKey: "minio666"
41-
global.objectStore.secretKey: "minio123"
42-
global.objectStore.region: "cn-north-1"
39+
global.objectStore.external.endpoint: "http://s3.opencsg-poc.com"
40+
global.objectStore.external.accessKey: "minio666"
41+
global.objectStore.external.secretKey: "minio123"
42+
global.objectStore.external.region: "cn-north-1"
4343
global.ingress.domain: "opencsg-poc.com"
4444
release:
4545
name: csghub

0 commit comments

Comments
 (0)