Skip to content

Commit 18b2249

Browse files
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 <[email protected]> (cherry picked from commit 5265ee6)
1 parent 70e61ae commit 18b2249

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

‎packages/apps/tenant/templates/gateway.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ spec:
5050
retryInterval: 30s
5151
remediation:
5252
retries: -1
53+
{{- /* Listener certificates depend on ACME or DNS and, under HTTP-01, on
54+
routes other releases own, so the TenantGateway sits at
55+
Ready=False/ListenersNotReady while any of them is pending, which
56+
kstatus reads as InProgress until the wait runs out. The expression
57+
replaces kstatus for this kind only. Flux still reads InProgress
58+
while status.observedGeneration lags the generation, before any
59+
expression runs, so the release still waits for the controller to
60+
observe the current TenantGateway spec, never for listener or
61+
certificate health. The strategy is pinned because expressions are
62+
read only under poller, and the UseHelm3Defaults gate turns the
63+
default to legacy. */}}
64+
waitStrategy:
65+
name: poller
66+
healthCheckExprs:
67+
- apiVersion: gateway.cozystack.io/v1alpha1
68+
kind: TenantGateway
69+
current: "true"
5370
{{- /* A tenant-selected class overrides the platform default. Rendered
5471
only when set, so a tenant that does not choose one leaves the
5572
gateway chart reading _cluster.gateway-class-name, and the key
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
suite: tenant gateway HelmRelease waits for the TenantGateway generation, not its certificates
2+
3+
# A TenantGateway reads Ready=False/ListenersNotReady while any listener's
4+
# certificate is pending, and kstatus reads that as InProgress, so under the
5+
# default wait every upgrade of this release times out and retries. The release
6+
# swaps kstatus for an always-Current expression on that kind. The wait itself
7+
# must stay on: Flux still holds it while status.observedGeneration lags, and
8+
# that is the only gate left between the gateway spec and its controller. The
9+
# list is pinned whole because a `failed` or `inProgress` expression that reads
10+
# status would wait again, at least until the controller's first status write.
11+
templates:
12+
- templates/gateway.yaml
13+
14+
release:
15+
name: tenant-test
16+
namespace: tenant-test
17+
18+
tests:
19+
- it: reads the TenantGateway through an expression under the poller wait
20+
set:
21+
gateway: true
22+
asserts:
23+
# Pins the document first: the notExists checks below pass on an empty render.
24+
- equal:
25+
path: metadata.name
26+
value: gateway
27+
- equal:
28+
path: spec.waitStrategy.name
29+
value: poller
30+
- equal:
31+
path: spec.healthCheckExprs
32+
value:
33+
- apiVersion: gateway.cozystack.io/v1alpha1
34+
kind: TenantGateway
35+
current: "true"
36+
- notExists:
37+
path: spec.install.disableWait
38+
- notExists:
39+
path: spec.upgrade.disableWait
40+
41+
- it: renders no gateway release when the tenant does not own one
42+
asserts:
43+
- hasDocuments:
44+
count: 0

0 commit comments

Comments
 (0)