Skip to content

Commit 7790a05

Browse files
committed
Moved to traefik for default ingress.
1 parent d0bbe96 commit 7790a05

File tree

14 files changed

+136
-74
lines changed

14 files changed

+136
-74
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Added support for annotations on the PgSTAC bootstrap job via `pgstacBootstrap.jobAnnotations` in values.yaml [#381](https://github.com/developmentseed/eoapi-k8s/pull/381)
1313

14+
### Changed
15+
16+
- Moved to traefik for the default ingress solution [#384](https://github.com/developmentseed/eoapi-k8s/pull/384)
17+
1418
### Fixed
1519

1620
- Fixed Helm template to check queryables `file` field with schema validation [#380](https://github.com/developmentseed/eoapi-k8s/pull/380)

charts/eoapi/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ apiServices:
9898
# Configure ingress
9999
ingress:
100100
enabled: true
101-
className: "nginx" # or "traefik"
101+
className: "traefik" # Or "nginx" for legacy setups
102102
host: "your-domain.com" # Optional
103103

104104
# Database options
@@ -130,7 +130,7 @@ pgstacBootstrap:
130130
| `postgresql.type` | Database deployment type | `postgrescluster` |
131131
| `postgrescluster.enabled` | Enable PostgreSQL cluster. Must be set to `false` when using external databases | `true` |
132132
| `ingress.enabled` | Enable ingress | `true` |
133-
| `ingress.className` | Ingress controller class | `nginx` |
133+
| `ingress.className` | Ingress controller class | `traefik` |
134134
| `browser.enabled` | Enable STAC Browser interface | `true` |
135135
| `pgstacBootstrap.enabled` | Enable database initialization | `true` |
136136
| `notifications.sources.pgstac` | Enable PostgreSQL notification triggers for STAC item changes | `false` |

charts/eoapi/profiles/core.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ observability:
167167
######################
168168
ingress:
169169
enabled: true
170-
className: "nginx"
170+
className: "traefik"
171171
pathType: "Prefix"
172172
host: ""
173173
tls:

charts/eoapi/profiles/experimental.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ autoscaling:
358358
######################
359359
ingress:
360360
enabled: true
361-
className: "nginx"
361+
className: "traefik"
362362
pathType: "Prefix"
363363
host: "localhost"
364364
tls:

charts/eoapi/profiles/production.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ knative:
343343
######################
344344
ingress:
345345
enabled: true
346-
className: "nginx"
346+
className: "traefik"
347347
pathType: "Prefix"
348348
host: "eoapi.example.com" # CHANGE THIS to your domain
349349
tls:

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ metadata:
1919
{{- if eq .Values.ingress.className "nginx" }}
2020
nginx.ingress.kubernetes.io/rewrite-target: /browser/$2
2121
nginx.ingress.kubernetes.io/use-regex: "true"
22-
{{- end }}
23-
# Temporary annotations for Traefik until uvicorn support real prefix in ASGI: https://github.com/encode/uvicorn/discussions/2490
24-
{{- if eq .Values.ingress.className "traefik" }}
22+
{{- else if eq .Values.ingress.className "traefik" }}
2523
traefik.ingress.kubernetes.io/router.entrypoints: web
2624
traefik.ingress.kubernetes.io/router.middlewares: {{ $.Release.Namespace }}-{{ $.Release.Name }}-strip-prefix-middleware@kubernetescrd
2725
{{- end }}

charts/eoapi/templates/networking/ingress.yaml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ metadata:
1515
{{- if eq .Values.ingress.className "nginx" }}
1616
nginx.ingress.kubernetes.io/rewrite-target: /$2
1717
nginx.ingress.kubernetes.io/use-regex: "true"
18+
{{- else if eq .Values.ingress.className "traefik" }}
19+
traefik.ingress.kubernetes.io/router.entrypoints: web
20+
traefik.ingress.kubernetes.io/router.middlewares: {{ $.Release.Namespace }}-{{ $.Release.Name }}-strip-prefix-middleware@kubernetescrd
1821
{{- end }}
1922
{{- if .Values.ingress.annotations }}
2023
{{ toYaml .Values.ingress.annotations | indent 4 }}
2124
{{- end }}
22-
# Temporary annotations for Traefik until uvicorn support real prefix in ASGI: https://github.com/encode/uvicorn/discussions/2490
23-
{{- if eq .Values.ingress.className "traefik" }}
24-
traefik.ingress.kubernetes.io/router.entrypoints: web
25-
traefik.ingress.kubernetes.io/router.middlewares: {{ $.Release.Namespace }}-{{ $.Release.Name }}-strip-prefix-middleware@kubernetescrd
26-
{{- end }}
2725
spec:
2826
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
2927
ingressClassName: {{ .Values.ingress.className }}
@@ -45,8 +43,8 @@ spec:
4543
{{- end }}
4644

4745
{{- if and $.Values.stac.enabled (or (not (hasKey $.Values.stac "ingress")) $.Values.stac.ingress.enabled) }}
48-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
49-
path: {{ $.Values.stac.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
46+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
47+
path: {{ $.Values.stac.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
5048
backend:
5149
service:
5250
{{- if index $.Values "stac-auth-proxy" "enabled" }}
@@ -59,8 +57,8 @@ spec:
5957
{{- end }}
6058

6159
{{- if and $.Values.vector.enabled (or (not (hasKey $.Values.vector "ingress")) $.Values.vector.ingress.enabled) }}
62-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
63-
path: {{ $.Values.vector.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
60+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
61+
path: {{ $.Values.vector.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
6462
backend:
6563
service:
6664
name: {{ $.Release.Name }}-vector
@@ -69,8 +67,8 @@ spec:
6967
{{- end }}
7068

7169
{{- if and $.Values.multidim.enabled (or (not (hasKey $.Values.multidim "ingress")) $.Values.multidim.ingress.enabled) }}
72-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
73-
path: {{ $.Values.multidim.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
70+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
71+
path: {{ $.Values.multidim.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
7472
backend:
7573
service:
7674
name: {{ $.Release.Name }}-multidim
@@ -79,8 +77,8 @@ spec:
7977
{{- end }}
8078

8179
{{- if and $.Values.mockOidcServer.enabled $.Values.mockOidcServer.ingress.enabled }}
82-
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
83-
path: {{ $.Values.mockOidcServer.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
80+
- pathType: {{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
81+
path: {{ $.Values.mockOidcServer.ingress.path }}{{ if or (eq $.Values.ingress.className "nginx") (eq $.Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
8482
backend:
8583
service:
8684
name: {{ $.Release.Name }}-mock-oidc-server
@@ -115,8 +113,8 @@ spec:
115113
{{- end }}
116114

117115
{{- if and .Values.stac.enabled (or (not (hasKey .Values.stac "ingress")) .Values.stac.ingress.enabled) }}
118-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
119-
path: {{ .Values.stac.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
116+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
117+
path: {{ .Values.stac.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
120118
backend:
121119
service:
122120
{{- if index .Values "stac-auth-proxy" "enabled" }}
@@ -129,8 +127,8 @@ spec:
129127
{{- end }}
130128

131129
{{- if and .Values.vector.enabled (or (not (hasKey .Values.vector "ingress")) .Values.vector.ingress.enabled) }}
132-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
133-
path: {{ .Values.vector.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
130+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
131+
path: {{ .Values.vector.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
134132
backend:
135133
service:
136134
name: {{ .Release.Name }}-vector
@@ -139,8 +137,8 @@ spec:
139137
{{- end }}
140138

141139
{{- if and .Values.multidim.enabled (or (not (hasKey .Values.multidim "ingress")) .Values.multidim.ingress.enabled) }}
142-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
143-
path: {{ .Values.multidim.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
140+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
141+
path: {{ .Values.multidim.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
144142
backend:
145143
service:
146144
name: {{ .Release.Name }}-multidim
@@ -149,8 +147,8 @@ spec:
149147
{{- end }}
150148

151149
{{- if and .Values.mockOidcServer.enabled .Values.mockOidcServer.ingress.enabled }}
152-
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
153-
path: {{ .Values.mockOidcServer.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
150+
- pathType: {{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}ImplementationSpecific{{ else }}Prefix{{ end }}
151+
path: {{ .Values.mockOidcServer.ingress.path }}{{ if or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik") }}(/|$)(.*){{ end }}
154152
backend:
155153
service:
156154
name: {{ .Release.Name }}-mock-oidc-server

charts/eoapi/tests/ingress_tests.yaml

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

36-
- it: "stac ingress with traefik controller"
36+
- it: "stac ingress with traefik controller (using nginx provider)"
3737
set:
3838
ingress.className: "traefik"
39-
ingress.pathType: "Prefix"
4039
ingress.host: "eoapi.local"
4140
raster.enabled: false
4241
stac.enabled: true
@@ -48,15 +47,15 @@ tests:
4847
of: Ingress
4948
- equal:
5049
path: spec.rules[0].http.paths[0].path
51-
value: "/stac"
50+
value: "/stac(/|$)(.*)"
5251
- equal:
5352
path: spec.rules[0].http.paths[0].pathType
54-
value: "Prefix"
53+
value: "ImplementationSpecific"
5554
- equal:
5655
path: metadata.annotations
5756
value:
58-
traefik.ingress.kubernetes.io/router.entrypoints: web
59-
traefik.ingress.kubernetes.io/router.middlewares: NAMESPACE-RELEASE-NAME-strip-prefix-middleware@kubernetescrd
57+
nginx.ingress.kubernetes.io/rewrite-target: /$2
58+
nginx.ingress.kubernetes.io/use-regex: "true"
6059
- equal:
6160
path: spec.ingressClassName
6261
value: "traefik"

charts/eoapi/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ service:
3232

3333
ingress:
3434
# Unified ingress configuration for both nginx and traefik
35+
# Traefik 3.5+ supports nginx annotations via the nginx provider
3536
enabled: true
3637
# ingressClassName: "nginx" or "traefik"
37-
className: "nginx"
38+
className: "traefik"
3839
rootPath: "" # Root path for doc server
3940
# Single host domain configuration (default)
4041
host: ""

docs/argocd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ spec:
136136
# Ingress setup
137137
ingress:
138138
enabled: true
139-
className: "nginx"
139+
className: "traefik"
140140
host: "eoapi.example.com"
141141
142142
destination:

0 commit comments

Comments
 (0)