Skip to content

Commit c05a765

Browse files
committed
bar
1 parent ea321ad commit c05a765

File tree

4 files changed

+64
-32
lines changed

4 files changed

+64
-32
lines changed

charts/eoapi/templates/networking/ingress-browser.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ metadata:
1313
labels:
1414
app: {{ .Release.Name }}-ingress-browser
1515
annotations:
16-
{{- if .Values.ingress.annotations }}
17-
{{ toYaml .Values.ingress.annotations | indent 4 }}
18-
{{- end }}
1916
{{- if eq .Values.ingress.className "nginx" }}
2017
nginx.ingress.kubernetes.io/rewrite-target: /browser/$2
2118
nginx.ingress.kubernetes.io/use-regex: "true"
2219
{{- else if eq .Values.ingress.className "traefik" }}
20+
# Traefik with NGINX provider supports nginx annotations
21+
nginx.ingress.kubernetes.io/rewrite-target: /browser/$2
22+
nginx.ingress.kubernetes.io/use-regex: "true"
2323
traefik.ingress.kubernetes.io/router.entrypoints: web
2424
{{- end }}
25+
{{- if .Values.ingress.annotations }}
26+
{{ toYaml .Values.ingress.annotations | indent 4 }}
27+
{{- end }}
2528
spec:
2629
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
2730
ingressClassName: {{ .Values.ingress.className }}
@@ -33,8 +36,8 @@ spec:
3336
http:
3437
paths:
3538
{{- if and $.Values.browser.enabled (or (not (hasKey $.Values.browser "ingress")) $.Values.browser.ingress.enabled) }}
36-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
37-
path: "/browser{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}"
39+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
40+
path: "/browser{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}"
3841
backend:
3942
service:
4043
name: {{ .Release.Name }}-browser
@@ -49,8 +52,8 @@ spec:
4952
http:
5053
paths:
5154
{{- if and .Values.browser.enabled (or (not (hasKey .Values.browser "ingress")) .Values.browser.ingress.enabled) }}
52-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
53-
path: "/browser{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}"
55+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
56+
path: "/browser{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}"
5457
backend:
5558
service:
5659
name: {{ .Release.Name }}-browser

charts/eoapi/templates/networking/ingress.yaml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ metadata:
1616
nginx.ingress.kubernetes.io/rewrite-target: /$2
1717
nginx.ingress.kubernetes.io/use-regex: "true"
1818
{{- else if eq .Values.ingress.className "traefik" }}
19+
# Traefik with NGINX provider supports nginx annotations
20+
nginx.ingress.kubernetes.io/rewrite-target: /$2
21+
nginx.ingress.kubernetes.io/use-regex: "true"
1922
traefik.ingress.kubernetes.io/router.entrypoints: web
2023
{{- end }}
2124
{{- if .Values.ingress.annotations }}
@@ -32,8 +35,8 @@ spec:
3235
http:
3336
paths:
3437
{{- if and $.Values.raster.enabled (or (not (hasKey $.Values.raster "ingress")) $.Values.raster.ingress.enabled) }}
35-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
36-
path: {{ $.Values.raster.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
38+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
39+
path: {{ $.Values.raster.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
3740
backend:
3841
service:
3942
name: {{ $.Release.Name }}-raster
@@ -42,8 +45,8 @@ spec:
4245
{{- end }}
4346

4447
{{- if and $.Values.stac.enabled (or (not (hasKey $.Values.stac "ingress")) $.Values.stac.ingress.enabled) }}
45-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
46-
path: {{ $.Values.stac.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
48+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
49+
path: {{ $.Values.stac.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
4750
backend:
4851
service:
4952
{{- if index $.Values "stac-auth-proxy" "enabled" }}
@@ -56,8 +59,8 @@ spec:
5659
{{- end }}
5760

5861
{{- if and $.Values.vector.enabled (or (not (hasKey $.Values.vector "ingress")) $.Values.vector.ingress.enabled) }}
59-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
60-
path: {{ $.Values.vector.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
62+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
63+
path: {{ $.Values.vector.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
6164
backend:
6265
service:
6366
name: {{ $.Release.Name }}-vector
@@ -66,8 +69,8 @@ spec:
6669
{{- end }}
6770

6871
{{- if and $.Values.multidim.enabled (or (not (hasKey $.Values.multidim "ingress")) $.Values.multidim.ingress.enabled) }}
69-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
70-
path: {{ $.Values.multidim.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
72+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
73+
path: {{ $.Values.multidim.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
7174
backend:
7275
service:
7376
name: {{ $.Release.Name }}-multidim
@@ -76,8 +79,8 @@ spec:
7679
{{- end }}
7780

7881
{{- if and $.Values.mockOidcServer.enabled $.Values.mockOidcServer.ingress.enabled }}
79-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
80-
path: {{ $.Values.mockOidcServer.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
82+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
83+
path: {{ $.Values.mockOidcServer.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
8184
backend:
8285
service:
8386
name: {{ $.Release.Name }}-mock-oidc-server
@@ -102,8 +105,8 @@ spec:
102105
http:
103106
paths:
104107
{{- if and .Values.raster.enabled (or (not (hasKey .Values.raster "ingress")) .Values.raster.ingress.enabled) }}
105-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
106-
path: {{ .Values.raster.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
108+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
109+
path: {{ .Values.raster.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
107110
backend:
108111
service:
109112
name: {{ .Release.Name }}-raster
@@ -112,8 +115,8 @@ spec:
112115
{{- end }}
113116

114117
{{- if and .Values.stac.enabled (or (not (hasKey .Values.stac "ingress")) .Values.stac.ingress.enabled) }}
115-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
116-
path: {{ .Values.stac.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
118+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
119+
path: {{ .Values.stac.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
117120
backend:
118121
service:
119122
{{- if index .Values "stac-auth-proxy" "enabled" }}
@@ -126,8 +129,8 @@ spec:
126129
{{- end }}
127130

128131
{{- if and .Values.vector.enabled (or (not (hasKey .Values.vector "ingress")) .Values.vector.ingress.enabled) }}
129-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
130-
path: {{ .Values.vector.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
132+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
133+
path: {{ .Values.vector.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
131134
backend:
132135
service:
133136
name: {{ .Release.Name }}-vector
@@ -136,8 +139,8 @@ spec:
136139
{{- end }}
137140

138141
{{- if and .Values.multidim.enabled (or (not (hasKey .Values.multidim "ingress")) .Values.multidim.ingress.enabled) }}
139-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
140-
path: {{ .Values.multidim.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
142+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
143+
path: {{ .Values.multidim.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
141144
backend:
142145
service:
143146
name: {{ .Release.Name }}-multidim
@@ -146,8 +149,8 @@ spec:
146149
{{- end }}
147150

148151
{{- if and .Values.mockOidcServer.enabled .Values.mockOidcServer.ingress.enabled }}
149-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
150-
path: {{ .Values.mockOidcServer.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
152+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
153+
path: {{ .Values.mockOidcServer.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
151154
backend:
152155
service:
153156
name: {{ .Release.Name }}-mock-oidc-server
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- if and .Values.ingress.enabled (eq .Values.ingress.className "traefik") }}
2+
apiVersion: traefik.io/v1alpha1
3+
kind: Middleware
4+
metadata:
5+
name: {{ .Release.Name }}-strip-prefix-middleware
6+
namespace: {{ .Release.Namespace }}
7+
spec:
8+
stripPrefix:
9+
prefixes:
10+
{{- if .Values.raster.enabled }}
11+
- {{ .Values.raster.ingress.path }}
12+
{{- end }}
13+
{{- if .Values.stac.enabled }}
14+
- {{ .Values.stac.ingress.path }}
15+
{{- end }}
16+
{{- if .Values.vector.enabled }}
17+
- {{ .Values.vector.ingress.path }}
18+
{{- end }}
19+
{{- if .Values.multidim.enabled }}
20+
- {{ .Values.multidim.ingress.path }}
21+
{{- end }}
22+
{{- if and .Values.mockOidcServer.enabled .Values.mockOidcServer.ingress.enabled }}
23+
- {{ .Values.mockOidcServer.ingress.path }}
24+
{{- end }}
25+
{{- end }}

charts/eoapi/tests/ingress_tests.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ tests:
3333
path: spec.ingressClassName
3434
value: "nginx"
3535

36-
- it: "stac ingress with traefik controller (using nginx provider)"
36+
- it: "stac ingress with traefik controller"
3737
set:
3838
ingress.className: "traefik"
39+
ingress.pathType: "Prefix"
3940
ingress.host: "eoapi.local"
4041
raster.enabled: false
4142
stac.enabled: true
@@ -47,15 +48,15 @@ tests:
4748
of: Ingress
4849
- equal:
4950
path: spec.rules[0].http.paths[0].path
50-
value: "/stac(/|$)(.*)"
51+
value: "/stac"
5152
- equal:
5253
path: spec.rules[0].http.paths[0].pathType
53-
value: "ImplementationSpecific"
54+
value: "Prefix"
5455
- equal:
5556
path: metadata.annotations
5657
value:
57-
nginx.ingress.kubernetes.io/rewrite-target: /$2
58-
nginx.ingress.kubernetes.io/use-regex: "true"
58+
traefik.ingress.kubernetes.io/router.entrypoints: web
59+
traefik.ingress.kubernetes.io/router.middlewares: NAMESPACE-RELEASE-NAME-strip-prefix-middleware@kubernetescrd
5960
- equal:
6061
path: spec.ingressClassName
6162
value: "traefik"

0 commit comments

Comments
 (0)