fix(platform): leave tenant-root's ingress empty when the root has none

cozystack-basics wrote _namespace.ingress: tenant-root whatever the root
Tenant's spec.ingress said, so applications in tenant-root were told an
ingress-nginx runs there when nothing deploys it. SeaweedFS then waited
forever on ingress-nginx-system, and the platform backup bucket with it.
Every other tenant already derives the key and leaves it empty without
ingress.

cozystack-basics cannot read the root Tenant, so the platform carries
its ingress state the way it carries monitoring: ingress.rootEnabled
reaches the Secret as _cluster.ingress-enabled and gates the key. The
default keeps the value existing clusters render, and a Secret written
before the key existed keeps it too.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
This commit is contained in:
Alexey Artamonov committed 2026-11-11 18:04:35 +03:00
1 parent c117420f5e
commit 5b6708c7f9
5 files changed
+116 -8

No files matched your search

@@ -261,6 +261,10 @@ stringData:
null/omitted in custom values. Missing key -> the true default,
matching the chart values.yaml. */}}
monitoring-enabled: {{ dig "rootEnabled" true (.Values.monitoring | default dict) | quote }}
{{- /* Whether the root tenant runs its own ingress-nginx
(Tenant/root spec.ingress). `dig`, as for monitoring-enabled
above, so an explicit false survives. */}}
ingress-enabled: {{ dig "rootEnabled" true (.Values.ingress | default dict) | quote }}
{{- /* The rate each shared-central tracing tenant's collector holds it
to. Only written when set: every release in every tenant reads
this Secret, and a key appearing would upgrade all of them. */}}
@@ -0,0 +1,35 @@
suite: apps.yaml ingress.rootEnabled → _cluster wiring
templates:
- templates/apps.yaml
release:
name: cozy-platform
namespace: cozy-system
# ingress.rootEnabled records whether the root tenant runs its own
# ingress-nginx (Tenant/root spec.ingress). It reaches cozystack-basics through
# _cluster.ingress-enabled in the cozystack-values Secret, where it decides
# whether tenant-root's _namespace.ingress names tenant-root or stays empty.
tests:
- it: writes ingress-enabled true by default
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s*ingress-enabled:\s*"true"'
- it: writes ingress-enabled false when ingress.rootEnabled is disabled
set:
ingress.rootEnabled: false
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s*ingress-enabled:\s*"false"'
- it: falls back to true (no panic) when ingress is null
set:
ingress: null
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s*ingress-enabled:\s*"true"'
+13
View File
@@ -669,6 +669,19 @@ gateway:
- cozy-monitoring
- cozy-linstor-gui
- default
# Platform ingress configuration.
ingress:
# Whether the root tenant (tenant-root) runs its own ingress-nginx, i.e.
# Tenant/root spec.ingress=true. It decides whether tenant-root's
# _namespace.ingress names tenant-root or stays empty, which is what
# applications there (SeaweedFS waiting on ingress-nginx-system, the
# ingressClassName of their Ingresses) and every tenant inheriting from the
# root read. Nothing in the charts sets Tenant/root spec.ingress, so keep
# this in sync with it by hand; changing it re-renders cozystack-basics and
# the releases reading the cozystack-values Secret. The default is true only
# to keep the value existing clusters already render.
rootEnabled: true
# Platform monitoring configuration.
monitoring:
# Whether the root tenant (tenant-root) hosts the platform
@@ -15,7 +15,13 @@ stringData:
_namespace:
host: {{ index .Values._cluster "root-host" | quote }}
etcd: tenant-root
{{- /* Without ingress on the root Tenant there is no
ingress-nginx-system in tenant-root, so the key stays empty, as
it does for a sub-tenant with no ingress anywhere above it. A
missing key keeps tenant-root for Secrets written before it. */ -}}
{{- if eq (toString (index .Values._cluster "ingress-enabled" | default "true")) "true" }}
ingress: tenant-root
{{- end }}
{{- /* `gateway` is conditional, the other four `_namespace` keys are
unconditional. The `apps/tenant` chart gates tenant-root via
`ne (include "tenant.name" .) "tenant-root"`, so the namespace.yaml
@@ -19,14 +19,16 @@ set:
# never reaches tenant-root — this Secret is the only place that
# value gets set for the root tenant.
#
# Four of the five `_namespace.*` keys (`etcd`, `ingress`,
# `monitoring`, `seaweedfs`) are always rendered, because their
# dependent platform apps are always installable in tenant-root.
# `gateway` is conditional on `_cluster.gateway-enabled`: when the
# platform-level flag is false (the default), Gateway is not
# installed, and writing `gateway: tenant-root` would point apps at a
# Gateway that doesn't exist. The fixtures below pin both halves of
# that contract.
# Three of the five `_namespace.*` keys (`etcd`, `monitoring`,
# `seaweedfs`) are always rendered, because their dependent platform
# apps are always installable in tenant-root. `gateway` is conditional
# on `_cluster.gateway-enabled`: when the platform-level flag is false
# (the default), Gateway is not installed, and writing
# `gateway: tenant-root` would point apps at a Gateway that doesn't
# exist. `ingress` is conditional on `_cluster.ingress-enabled` for the
# same reason: with ingress off on the root Tenant there is no
# ingress-nginx-system in tenant-root, and seaweedfs would wait on it
# forever. The fixtures below pin both halves of each contract.
tests:
- it: omits _namespace.gateway when _cluster.gateway-enabled is missing (default)
asserts:
@@ -52,6 +54,54 @@ tests:
path: stringData["values.yaml"]
pattern: '(?m)^\s+gateway: tenant-root$'
- it: emits _namespace.ingress=tenant-root when _cluster.ingress-enabled is missing (Secrets written before the key existed)
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+ingress: tenant-root$'
- it: emits _namespace.ingress=tenant-root when _cluster.ingress-enabled is "true"
set:
_cluster:
ingress-enabled: "true"
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+ingress: tenant-root$'
- it: emits _namespace.ingress=tenant-root when _cluster.ingress-enabled is a bool true
set:
_cluster:
ingress-enabled: true
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+ingress: tenant-root$'
- it: omits _namespace.ingress when _cluster.ingress-enabled is "false"
set:
_cluster:
ingress-enabled: "false"
asserts:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+ingress:'
- it: keeps _namespace.{etcd,monitoring,seaweedfs} when ingress is off
set:
_cluster:
ingress-enabled: "false"
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+etcd: tenant-root$'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+monitoring: tenant-root$'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs: tenant-root$'
- it: keeps _namespace.{etcd,ingress,monitoring,seaweedfs} unconditional when Gateway is off — regression guard for a refactor that accidentally gates them on the same flag
asserts:
- matchRegex: