Skip to content

Commit bdc2ffa

Browse files
Add configurable ingress paths for raster, stac, vector, and multidim services
1 parent 362626d commit bdc2ffa

File tree

4 files changed

+74
-5
lines changed

4 files changed

+74
-5
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"makefile.configureOnOpen": false
3+
}

helm-chart/eoapi/templates/services/ingress.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spec:
3636
paths:
3737
{{- if and .Values.raster.enabled (or (not (hasKey .Values.raster "ingress")) .Values.raster.ingress.enabled) }}
3838
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
39-
path: /raster{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
39+
path: {{ .Values.raster.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
4040
backend:
4141
service:
4242
name: raster-{{ $.Release.Name }}
@@ -46,7 +46,7 @@ spec:
4646

4747
{{- if and .Values.stac.enabled (or (not (hasKey .Values.stac "ingress")) .Values.stac.ingress.enabled) }}
4848
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
49-
path: /stac{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
49+
path: {{ .Values.stac.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
5050
backend:
5151
service:
5252
name: stac-{{ $.Release.Name }}
@@ -56,7 +56,7 @@ spec:
5656

5757
{{- if and .Values.vector.enabled (or (not (hasKey .Values.vector "ingress")) .Values.vector.ingress.enabled) }}
5858
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
59-
path: /vector{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
59+
path: {{ .Values.vector.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
6060
backend:
6161
service:
6262
name: vector-{{ $.Release.Name }}
@@ -66,7 +66,7 @@ spec:
6666

6767
{{- if and .Values.multidim.enabled (or (not (hasKey .Values.multidim "ingress")) .Values.multidim.ingress.enabled) }}
6868
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
69-
path: /multidim{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
69+
path: {{ .Values.multidim.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
7070
backend:
7171
service:
7272
name: multidim-{{ $.Release.Name }}

helm-chart/eoapi/tests/ingress_tests.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,65 @@ tests:
9191
- equal:
9292
path: spec.rules[0].http.paths[1].backend.service.name
9393
value: doc-server-RELEASE-NAME
94+
95+
- it: "custom paths for multiple services with nginx controller"
96+
set:
97+
ingress.className: "nginx"
98+
raster.enabled: true
99+
raster.ingress.path: "/titiler"
100+
stac.enabled: true
101+
stac.ingress.path: "/api"
102+
vector.enabled: true
103+
vector.ingress.path: "/features"
104+
multidim.enabled: false
105+
browser.enabled: false
106+
asserts:
107+
- isKind:
108+
of: Ingress
109+
- equal:
110+
path: spec.rules[0].http.paths[0].path
111+
value: "/titiler(/|$)(.*)"
112+
- equal:
113+
path: spec.rules[0].http.paths[1].path
114+
value: "/api(/|$)(.*)"
115+
- equal:
116+
path: spec.rules[0].http.paths[2].path
117+
value: "/features(/|$)(.*)"
118+
- equal:
119+
path: spec.rules[0].http.paths[0].pathType
120+
value: "ImplementationSpecific"
121+
- equal:
122+
path: spec.rules[0].http.paths[1].pathType
123+
value: "ImplementationSpecific"
124+
- equal:
125+
path: spec.rules[0].http.paths[2].pathType
126+
value: "ImplementationSpecific"
127+
- equal:
128+
path: metadata.annotations
129+
value:
130+
nginx.ingress.kubernetes.io/use-regex: "true"
131+
nginx.ingress.kubernetes.io/rewrite-target: /$2
132+
133+
- it: "custom paths with traefik controller"
134+
set:
135+
ingress.className: "traefik"
136+
raster.enabled: false
137+
stac.enabled: true
138+
stac.ingress.path: "/api"
139+
vector.enabled: false
140+
multidim.enabled: false
141+
browser.enabled: false
142+
asserts:
143+
- isKind:
144+
of: Ingress
145+
- equal:
146+
path: spec.rules[0].http.paths[0].path
147+
value: "/api"
148+
- equal:
149+
path: spec.rules[0].http.paths[0].pathType
150+
value: "Prefix"
151+
- equal:
152+
path: metadata.annotations
153+
value:
154+
traefik.ingress.kubernetes.io/router.entrypoints: web
155+
traefik.ingress.kubernetes.io/router.middlewares: NAMESPACE-strip-prefix-middleware-RELEASE-NAME@kubernetescrd

helm-chart/eoapi/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ raster:
190190
enabled: true
191191
ingress:
192192
enabled: true # Control ingress specifically for raster service
193+
path: "/raster" # Configurable path prefix for the raster service
193194
autoscaling:
194195
# NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart
195196
# see ../../../docs/autoscaling.md for more information
@@ -261,6 +262,7 @@ multidim:
261262
enabled: false # disabled by default
262263
ingress:
263264
enabled: true # Control ingress specifically for multidim service
265+
path: "/multidim" # Configurable path prefix for the multidim service
264266
autoscaling:
265267
# NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart
266268
# see ../../../docs/autoscaling.md for more information
@@ -332,6 +334,7 @@ stac:
332334
enabled: true
333335
ingress:
334336
enabled: true # Control ingress specifically for stac service
337+
path: "/stac" # Configurable path prefix for the stac service
335338
autoscaling:
336339
# NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart
337340
# see ../../../docs/autoscaling.md for more information
@@ -391,6 +394,7 @@ vector:
391394
enabled: true
392395
ingress:
393396
enabled: true # Control ingress specifically for vector service
397+
path: "/vector" # Configurable path prefix for the vector service
394398
autoscaling:
395399
# NOTE: to have autoscaling working you'll need to install the `eoapi-support` chart
396400
# see ../../../docs/autoscaling.md for more information
@@ -473,4 +477,4 @@ docServer:
473477
# prefer to set it in the command line
474478
# helm upgrade --set previousVersion=$PREVIOUS_VERSION
475479
# or in the CI/CD pipeline
476-
previousVersion: ""
480+
previousVersion: ""

0 commit comments

Comments
 (0)