fix(monitoring): leave Grafana's ingress out in a tenant without ingress

grafana-operator creates the Ingress from spec.ingress verbatim, so an
empty _namespace.ingress reached the API as ingressClassName "" and was
rejected. With no ingress-nginx in the tenant there is nothing for that
Ingress to attach to.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
This commit is contained in:
Alexey Artamonov committed 2026-11-11 18:20:38 +03:00
1 parent c61e6a842e
commit 275c840a8c
2 files changed
+41 -1

No files matched your search

@@ -280,7 +280,7 @@ spec:
path: auth.ini
{{- end }}
{{- end }}
{{- if ne $gatewayEnabled "true" }}
{{- if and (ne $gatewayEnabled "true") $ingress }}
ingress:
{{- /* Operator wildcard mode: nginx serves the default SSL cert, so skip per-host ACME. */}}
{{- if not $wildcardSecret }}
@@ -0,0 +1,40 @@
suite: grafana ingress needs an ingress class to name
templates:
- templates/grafana/grafana.yaml
release:
name: monitoring
namespace: tenant-root
# An empty _namespace.ingress means no ingress-nginx serves this tenant, and
# the API rejects the ingressClassName "" the operator would put on the
# Ingress it creates from spec.ingress.
tests:
- it: leaves spec.ingress out when the tenant has no ingress
set:
_cluster:
issuer-name: letsencrypt-prod
gateway-enabled: "false"
_namespace:
host: example.org
ingress: ""
asserts:
- equal:
path: kind
value: Grafana
- notExists:
path: spec.ingress
- it: keeps spec.ingress when the tenant has an ingress
set:
_cluster:
issuer-name: letsencrypt-prod
gateway-enabled: "false"
_namespace:
host: example.org
ingress: tenant-root
asserts:
- equal:
path: spec.ingress.spec.ingressClassName
value: tenant-root