Files
cozystack/packages/system/cozystack-basics/tests/cozystack-values-secret_test.yaml
T
Aleksei Sviridkin 039924f59d feat(gateway): align _namespace.gateway propagation with tenant.gatewayEffective
Two related fixes for the gap where the tenant chart's gateway HelmRelease materialises but child apps (harbor, bucket) silently fall back to ingress-nginx:

- packages/apps/tenant/templates/namespace.yaml: switch the
  _namespace.gateway resolution from raw .Values.gateway to
  tenant.gatewayEffective. This is the same helper consulted by
  gateway.yaml (HelmRelease render), so per-tenant Gateway
  materialisation and child-app HTTPRoute / Ingress selection now
  stay in lockstep — including the auto-default for derived-apex
  tenants.
- packages/system/cozystack-basics/templates/cozystack-values-secret.yaml:
  add a conditional gateway field to the tenant-root cozystack-values
  Secret. cozystack-basics is the only writer of _namespace.* for
  tenant-root (apps/tenant chart skips tenant-root via the existing
  ne 'tenant-root' gate). Without this line, tenant-root apps read
  _namespace.gateway as empty and route to ingress even when the
  platform's gateway.enabled flag is on. Conditional on
  _cluster.gateway-enabled='true' so non-Gateway clusters keep the
  empty value.

Test fixture in cozystack-basics/tests/cozystack-values-secret_test.yaml
pins the conditional and the regression-guard that the other four
_namespace keys (etcd, ingress, monitoring, seaweedfs) stay
unconditional.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-05-25 17:07:02 +03:00

87 lines
3.1 KiB
YAML

suite: cozystack-values Secret for tenant-root
templates:
- templates/cozystack-values-secret.yaml
release:
name: cozystack-basics
namespace: cozy-system
set:
_cluster:
root-host: example.org
# The `cozystack-values` Secret in tenant-root is the bottom of the
# `_namespace.*` lookup chain for tenant-root's own apps (harbor,
# bucket — both read `_namespace.gateway` to switch between Ingress
# and HTTPRoute). The `apps/tenant` chart gates tenant-root via
# `ne (include "tenant.name" .) "tenant-root"`, so the propagation
# logic that flows `tenant.gatewayEffective` into `_namespace.gateway`
# 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.
tests:
- it: omits _namespace.gateway when _cluster.gateway-enabled is missing (default)
asserts:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+gateway:'
- it: omits _namespace.gateway when _cluster.gateway-enabled is "false"
set:
_cluster:
gateway-enabled: "false"
asserts:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+gateway:'
- it: emits _namespace.gateway=tenant-root when _cluster.gateway-enabled is "true"
set:
_cluster:
gateway-enabled: "true"
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+gateway: 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:
path: stringData["values.yaml"]
pattern: '(?m)^\s+etcd: tenant-root$'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+ingress: 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 on — same guard, opposite mode
set:
_cluster:
gateway-enabled: "true"
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+etcd: tenant-root$'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+ingress: tenant-root$'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+monitoring: tenant-root$'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs: tenant-root$'