fix(tenant): stop the gateway release waiting on TenantGateway listeners and certificates

helm-controller waits on every object of a release with the kstatus
poller on install and on every upgrade. kstatus reads a TenantGateway at
Ready=False/ListenersNotReady as InProgress, and a TenantGateway sits
there whenever one listener certificate is pending, which depends on
ACME or DNS and, under HTTP-01, on routes that other releases own. After
a platform upgrade the gateway release therefore times out, retries
without end under RetryOnFailure, holds a helm-controller worker
meanwhile, and fails the tenant release that waits on it. It used to
pass because health is judged only inside a Helm action: the release
was installed while the TenantGateway had no status yet or was still
Ready, and the listeners whose certificates do not issue came later
with other releases' routes.

An always-true expression replaces kstatus for TenantGateway and keeps
the wait on. Flux checks status.observedGeneration against the
generation before it evaluates any expression, so the release still
waits until the controller has observed the new spec, but not for
listener or certificate health. The poller strategy is set explicitly
because expressions are only evaluated under it.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
(cherry picked from commit 5265ee662c)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
Myasnikov Daniil committed 2026-11-26 16:19:31 +00:00
1 parent 772f08b966
commit eca11fa58f
2 files changed
+61

No files matched your search

@@ -50,6 +50,23 @@ spec:
retryInterval: 30s
remediation:
retries: -1
{{- /* Listener certificates depend on ACME or DNS and, under HTTP-01, on
routes other releases own, so the TenantGateway sits at
Ready=False/ListenersNotReady while any of them is pending, which
kstatus reads as InProgress until the wait runs out. The expression
replaces kstatus for this kind only. Flux still reads InProgress
while status.observedGeneration lags the generation, before any
expression runs, so the release still waits for the controller to
observe the current TenantGateway spec, never for listener or
certificate health. The strategy is pinned because expressions are
read only under poller, and the UseHelm3Defaults gate turns the
default to legacy. */}}
waitStrategy:
name: poller
healthCheckExprs:
- apiVersion: gateway.cozystack.io/v1alpha1
kind: TenantGateway
current: "true"
valuesFrom:
- kind: Secret
name: cozystack-values
@@ -0,0 +1,44 @@
suite: tenant gateway HelmRelease waits for the TenantGateway generation, not its certificates
# A TenantGateway reads Ready=False/ListenersNotReady while any listener's
# certificate is pending, and kstatus reads that as InProgress, so under the
# default wait every upgrade of this release times out and retries. The release
# swaps kstatus for an always-Current expression on that kind. The wait itself
# must stay on: Flux still holds it while status.observedGeneration lags, and
# that is the only gate left between the gateway spec and its controller. The
# list is pinned whole because a `failed` or `inProgress` expression that reads
# status would wait again, at least until the controller's first status write.
templates:
- templates/gateway.yaml
release:
name: tenant-test
namespace: tenant-test
tests:
- it: reads the TenantGateway through an expression under the poller wait
set:
gateway: true
asserts:
# Pins the document first: the notExists checks below pass on an empty render.
- equal:
path: metadata.name
value: gateway
- equal:
path: spec.waitStrategy.name
value: poller
- equal:
path: spec.healthCheckExprs
value:
- apiVersion: gateway.cozystack.io/v1alpha1
kind: TenantGateway
current: "true"
- notExists:
path: spec.install.disableWait
- notExists:
path: spec.upgrade.disableWait
- it: renders no gateway release when the tenant does not own one
asserts:
- hasDocuments:
count: 0