Skip to content

Commit f5aa5eb

Browse files
committed
set default cors regex list
1 parent f1febe6 commit f5aa5eb

File tree

7 files changed

+14
-1
lines changed

7 files changed

+14
-1
lines changed

charts/platform-ingress/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ chart: {{ include "platform.chart" . }}
2525
heritage: {{ .Release.Service | quote }}
2626
release: {{ .Release.Name | quote }}
2727
{{- end -}}
28+
29+
{{- define "platform.clusterDnsName" -}}
30+
{{- required "clusterDnsName is required" .Values.clusterDnsName -}}
31+
{{- end -}}

charts/platform-ingress/templates/cors-middleware.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ spec:
4242
accessControlAllowOriginList:
4343
{{- toYaml . | nindent 6 }}
4444
{{- end }}
45-
{{- with .Values.cors.originListRegex }}
4645
accessControlAllowOriginListRegex:
46+
- https:\/\/[a-zA-Z0-9_-]+\.jobs\.{{ include "platform.clusterDnsName" . | regexQuoteMeta }}
47+
- https:\/\/[a-zA-Z0-9_-]+\.apps\.{{ include "platform.clusterDnsName" . | regexQuoteMeta }}
48+
{{- with .Values.cors.originListRegex }}
4749
{{- toYaml . | nindent 6 }}
4850
{{- end }}
4951
accessControlMaxAge: 100

charts/platform-ingress/tests/__snapshot__/cors-middleware_test.yaml.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ exposes configured CORS origins:
4646
accessControlAllowOriginList:
4747
- https://example.com
4848
accessControlAllowOriginListRegex:
49+
- https:\/\/[a-zA-Z0-9_-]+\.jobs\.test-cluster\.org\.apolo\.us
50+
- https:\/\/[a-zA-Z0-9_-]+\.apps\.test-cluster\.org\.apolo\.us
4951
- https://.*\\.example\\.com
5052
accessControlMaxAge: 100
5153
addVaryHeader: true

charts/platform-ingress/tests/cors-middleware_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ tests:
66
release:
77
name: ingress
88
set:
9+
clusterDnsName: test-cluster.org.apolo.us
910
cors:
1011
originList:
1112
- https://example.com

charts/platform-ingress/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# defaultClassName: traefik
22

3+
clusterDnsName: ""
34
ingressAuthHost: api.apolo.us
45
fallbackHost: default.jobs.apolo.us
56

charts/platform/templates/platform-ingress-application.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{{- define "platform.argocd.applications.platformIngress.values" -}}
2+
{{- $clusterDnsName := include "platform.clusterDnsName" . -}}
23
{{- $platformUrls := include "platform.urls" . | fromYaml -}}
34
{{- $ingressAuthUrl := urlParse (get $platformUrls "ingressAuthUrl") -}}
45
{{- $ingressAuthHost := $ingressAuthUrl.host -}}
56
{{- with .Values.defaultIngressClassName }}
67
defaultClassName: {{ . }}
78
{{- end }}
9+
clusterDnsName: {{ $clusterDnsName }}
810
ingressAuthHost: {{ $ingressAuthHost }}
911
{{- end }}
1012

charts/platform/tests/__snapshot__/platform-ingress-application_test.yaml.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ renders argocd application for platform-ingress chart:
1919
helm:
2020
releaseName: platform
2121
valuesObject:
22+
clusterDnsName: test-cluster.org.apolo.us
2223
defaultClassName: traefik
2324
ingressAuthHost: api.apolo.us
2425
repoURL: ghcr.io/neuro-inc/helm-charts/platform-compute

0 commit comments

Comments
 (0)