From 275c840a8c9576ebc45acd6d7e6bc295192afcc3 Mon Sep 17 00:00:00 2001 From: Alexey Artamonov Date: Wed, 11 Nov 2026 18:20:38 +0300 Subject: [PATCH] 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 --- .../monitoring/templates/grafana/grafana.yaml | 2 +- .../grafana_ingress_empty_class_test.yaml | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 packages/system/monitoring/tests/grafana_ingress_empty_class_test.yaml diff --git a/packages/system/monitoring/templates/grafana/grafana.yaml b/packages/system/monitoring/templates/grafana/grafana.yaml index 85517151a..2da6d2fc6 100644 --- a/packages/system/monitoring/templates/grafana/grafana.yaml +++ b/packages/system/monitoring/templates/grafana/grafana.yaml @@ -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 }} diff --git a/packages/system/monitoring/tests/grafana_ingress_empty_class_test.yaml b/packages/system/monitoring/tests/grafana_ingress_empty_class_test.yaml new file mode 100644 index 000000000..9e6b0350c --- /dev/null +++ b/packages/system/monitoring/tests/grafana_ingress_empty_class_test.yaml @@ -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