Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.7.6] - UNRELEASED

### Added

- Added support for multiple hosts in ingress configuration via `ingress.hosts` array [#248](https://github.com/developmentseed/eoapi-k8s/pull/248)

## [0.7.5] - 2025-07-11

### Changed
Expand Down
27 changes: 25 additions & 2 deletions charts/eoapi/templates/services/ingress-browser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# We need a separate ingress because browser has the prefix /browser hardcoded in the code
{{- if and .Values.browser.enabled .Values.ingress.enabled }}
{{- if and .Values.browser.enabled .Values.ingress.enabled (or (not (hasKey .Values.browser "ingress")) .Values.browser.ingress.enabled) }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
Expand Down Expand Up @@ -30,6 +30,22 @@ spec:
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
rules:
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
{{- if and $.Values.browser.enabled (or (not (hasKey $.Values.browser "ingress")) $.Values.browser.ingress.enabled) }}
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: "/browser{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}"
backend:
service:
name: browser-{{ $.Release.Name }}
port:
number: 8080
{{- end }}
{{- end }}
{{- else }}
- {{- if .Values.ingress.host }}
host: {{ .Values.ingress.host }}
{{- end }}
Expand All @@ -44,10 +60,17 @@ spec:
port:
number: 8080
{{- end }}
{{- if and .Values.ingress.host .Values.ingress.tls.enabled }}
{{- end }}
{{- if and .Values.ingress.tls.enabled (or .Values.ingress.hosts .Values.ingress.host) }}
tls:
- hosts:
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- {{ . }}
{{- end }}
{{- else if .Values.ingress.host }}
- {{ .Values.ingress.host }}
{{- end }}
secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
{{- end }}
73 changes: 68 additions & 5 deletions charts/eoapi/templates/services/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,62 @@ spec:
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
rules:
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
{{- if and $.Values.raster.enabled (or (not (hasKey $.Values.raster "ingress")) $.Values.raster.ingress.enabled) }}
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: {{ $.Values.raster.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
backend:
service:
name: raster-{{ $.Release.Name }}
port:
number: {{ $.Values.service.port }}
{{- end }}

{{- if and $.Values.stac.enabled (or (not (hasKey $.Values.stac "ingress")) $.Values.stac.ingress.enabled) }}
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: {{ $.Values.stac.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
backend:
service:
name: stac-{{ $.Release.Name }}
port:
number: {{ $.Values.service.port }}
{{- end }}

{{- if and $.Values.vector.enabled (or (not (hasKey $.Values.vector "ingress")) $.Values.vector.ingress.enabled) }}
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: {{ $.Values.vector.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
backend:
service:
name: vector-{{ $.Release.Name }}
port:
number: {{ $.Values.service.port }}
{{- end }}

{{- if and $.Values.multidim.enabled (or (not (hasKey $.Values.multidim "ingress")) $.Values.multidim.ingress.enabled) }}
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: {{ $.Values.multidim.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
backend:
service:
name: multidim-{{ $.Release.Name }}
port:
number: {{ $.Values.service.port }}
{{- end }}

{{- if $.Values.docServer.enabled }}
- pathType: Prefix
path: "/{{ $.Values.ingress.rootPath | default "" }}"
backend:
service:
name: doc-server-{{ $.Release.Name }}
port:
number: 80
{{- end }}
{{- end }}
{{- else }}
- {{- if .Values.ingress.host }}
host: {{ .Values.ingress.host }}
{{- end }}
Expand All @@ -43,7 +99,7 @@ spec:
port:
number: {{ .Values.service.port }}
{{- end }}

{{- if and .Values.stac.enabled (or (not (hasKey .Values.stac "ingress")) .Values.stac.ingress.enabled) }}
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: {{ .Values.stac.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
Expand All @@ -53,7 +109,7 @@ spec:
port:
number: {{ .Values.service.port }}
{{- end }}

{{- if and .Values.vector.enabled (or (not (hasKey .Values.vector "ingress")) .Values.vector.ingress.enabled) }}
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: {{ .Values.vector.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
Expand All @@ -63,7 +119,7 @@ spec:
port:
number: {{ .Values.service.port }}
{{- end }}

{{- if and .Values.multidim.enabled (or (not (hasKey .Values.multidim "ingress")) .Values.multidim.ingress.enabled) }}
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
path: {{ .Values.multidim.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
Expand All @@ -73,7 +129,7 @@ spec:
port:
number: {{ .Values.service.port }}
{{- end }}

{{- if .Values.docServer.enabled }}
- pathType: Prefix
path: "/{{ $.Values.ingress.rootPath | default "" }}"
Expand All @@ -83,10 +139,17 @@ spec:
port:
number: 80
{{- end }}
{{- if and .Values.ingress.host .Values.ingress.tls.enabled }}
{{- end }}
{{- if and .Values.ingress.tls.enabled (or .Values.ingress.hosts .Values.ingress.host) }}
tls:
- hosts:
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- {{ . }}
{{- end }}
{{- else if .Values.ingress.host }}
- {{ .Values.ingress.host }}
{{- end }}
secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
{{- end }}
139 changes: 138 additions & 1 deletion charts/eoapi/tests/ingress_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tests:
- equal:
path: spec.rules[0].host
value: "eoapi.local"

- it: "multidim ingress in production (non-testing) with traefik controller"
set:
ingress.className: "traefik"
Expand Down Expand Up @@ -153,3 +153,140 @@ tests:
value:
traefik.ingress.kubernetes.io/router.entrypoints: web
traefik.ingress.kubernetes.io/router.middlewares: NAMESPACE-strip-prefix-middleware-RELEASE-NAME@kubernetescrd

- it: "multiple hosts with nginx controller"
set:
ingress.className: "nginx"
ingress.hosts:
- "2.eoapi.dev"
- "1.eoapi.dev"
raster.enabled: true
stac.enabled: true
vector.enabled: false
multidim.enabled: false
browser.enabled: false
asserts:
- isKind:
of: Ingress
- equal:
path: spec.rules[0].host
value: "2.eoapi.dev"
- equal:
path: spec.rules[1].host
value: "1.eoapi.dev"
- equal:
path: spec.rules[0].http.paths[0].path
value: "/raster(/|$)(.*)"
- equal:
path: spec.rules[0].http.paths[1].path
value: "/stac(/|$)(.*)"
- equal:
path: spec.rules[1].http.paths[0].path
value: "/raster(/|$)(.*)"
- equal:
path: spec.rules[1].http.paths[1].path
value: "/stac(/|$)(.*)"

- it: "multiple hosts with traefik controller"
set:
ingress.className: "traefik"
ingress.hosts:
- "2.eoapi.dev"
- "1.eoapi.dev"
raster.enabled: false
stac.enabled: true
vector.enabled: false
multidim.enabled: false
browser.enabled: false
asserts:
- isKind:
of: Ingress
- equal:
path: spec.rules[0].host
value: "2.eoapi.dev"
- equal:
path: spec.rules[1].host
value: "1.eoapi.dev"
- equal:
path: spec.rules[0].http.paths[0].path
value: "/stac"
- equal:
path: spec.rules[0].http.paths[0].pathType
value: "Prefix"
- equal:
path: spec.rules[1].http.paths[0].path
value: "/stac"
- equal:
path: spec.rules[1].http.paths[0].pathType
value: "Prefix"

- it: "multiple hosts with TLS enabled"
set:
ingress.className: "nginx"
ingress.hosts:
- "2.eoapi.dev"
- "1.eoapi.dev"
ingress.tls.enabled: true
ingress.tls.secretName: "eoapi-tls"
raster.enabled: false
stac.enabled: true
vector.enabled: false
multidim.enabled: false
browser.enabled: false
asserts:
- isKind:
of: Ingress
- equal:
path: spec.tls[0].hosts[0]
value: "2.eoapi.dev"
- equal:
path: spec.tls[0].hosts[1]
value: "1.eoapi.dev"
- equal:
path: spec.tls[0].secretName
value: "eoapi-tls"

- it: "single host (default)"
set:
ingress.className: "nginx"
ingress.host: "1.eoapi.dev"
ingress.tls.enabled: true
ingress.tls.secretName: "eoapi-tls"
raster.enabled: false
stac.enabled: true
vector.enabled: false
multidim.enabled: false
browser.enabled: false
asserts:
- isKind:
of: Ingress
- equal:
path: spec.rules[0].host
value: "1.eoapi.dev"
- equal:
path: spec.tls[0].hosts[0]
value: "1.eoapi.dev"
- equal:
path: spec.tls[0].secretName
value: "eoapi-tls"

- it: "hosts array takes precedence over single host"
set:
ingress.className: "nginx"
ingress.host: "should-be-ignored.com"
ingress.hosts:
- "1.eoapi.dev"
raster.enabled: false
stac.enabled: true
vector.enabled: false
multidim.enabled: false
browser.enabled: false
asserts:
- isKind:
of: Ingress
- equal:
path: spec.rules[0].host
value: "1.eoapi.dev"
- notEqual:
path: spec.rules[0].host
value: "should-be-ignored.com"
7 changes: 7 additions & 0 deletions charts/eoapi/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
"type": "string",
"description": "Ingress host"
},
"hosts": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of multiple ingress host domains array - if specified, takes precedence over single host"
},
"annotations": {
"type": "object",
"description": "Additional annotations for ingress"
Expand Down
4 changes: 3 additions & 1 deletion charts/eoapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ ingress:
# ingressClassName: "nginx" or "traefik"
className: "nginx"
rootPath: "" # Root path for doc server
# Host configuration
# Single host domain configuration (default)
host: ""
# Multiple host domains array - if specified, takes precedence over single host
# hosts: []
# Custom annotations to add to the ingress
annotations: {}
# TLS configuration
Expand Down