mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-02 21:30:46 +09:00
fix(tenant): retry failed monitoring and gateway installs in place
Both releases carry Flux's default install strategy, and install
remediation is an uninstall in every case Flux offers. Neither disables
hooks on it, so a remediated install runs the app chart's post-delete
cleanup Job against a release whose only fault was missing a readiness
budget.
The monitoring Job deletes PVCs labelled
apps.cozystack.io/application.name=<release>-system. That label is not
incidental: the metrics and logs claim templates stamp it precisely so
the operator copies it onto the storage PVCs, and the cleanup Job
selects on it to stay release-scoped. A slow first install therefore
deletes the tenant's metrics and logs, and nothing reconstructs them.
The gateway Job deletes the cozystack-acme-account Secret. That key
regenerates on the next install, so this one costs no data. It costs a
re-registration against the ACME provider, and repeated cycles run into
its rate limits, which can hold certificate issuance for the tenant down
for hours.
RetryOnFailure keeps the manifests applied and retries the failed
release, so no uninstall happens and neither cleanup Job runs. Both
actions carry the strategy because the controller performs that retry as
an upgrade, so on install alone the retry's own failure falls through to
upgrade remediation. Two things are traded away. A real upgrade failure
now retries rather than rolls back, which gives up no stable safety net,
since with retries: -1 and the default strategy upgrade remediation
already rolled back and retried without end. And the uninstall was the
only automatic clean slate, so an install wedged on a bad resource state
retries against that state until an operator removes the release. The
remediation blocks stay because an absent release consults install and
an out-of-sync one consults upgrade, both by retry count rather than by
strategy.
The chart's etcd and seaweedfs releases lose storage the same way and
are outside this change. Beyond those four, computeplane, ingress and
info remain on the default strategy, but their charts ship no
destructive post-delete hook, so remediation costs them a wasteful
teardown rather than data. That is a different question from this one.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
(cherry picked from commit a27c341843)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
d37460ebf6
commit
8f010a774d
3 files changed
+154
No files matched your search
@@ -19,10 +19,35 @@ spec:
|
||||
namespace: cozy-system
|
||||
interval: 5m
|
||||
timeout: 10m
|
||||
{{- /* Install remediation is an uninstall in every case Flux offers, and this
|
||||
release does not disable hooks on it, so a remediated install runs the
|
||||
gateway chart's post-delete cleanup Job. That Job deletes the
|
||||
cozystack-acme-account Secret. The key regenerates on the next install,
|
||||
so unlike the storage-owning releases this costs no data: it costs a
|
||||
re-registration against the ACME provider, and repeated cycles run into
|
||||
its rate limits, which can hold certificate issuance for the tenant
|
||||
down for hours. RetryOnFailure keeps the manifests applied and retries
|
||||
the failed release instead, so no uninstall happens and the cleanup Job
|
||||
never runs. Both actions carry the strategy because the controller
|
||||
performs that retry as an upgrade. Two things are traded away: a real
|
||||
upgrade failure now retries rather than rolls back, which gives up no
|
||||
stable safety net, since with retries: -1 the default strategy already
|
||||
rolled back and retried without end; and the uninstall was the only
|
||||
automatic clean slate, so an install wedged on a bad resource state
|
||||
retries against it until an operator removes the release. The
|
||||
remediation blocks stay because an absent release consults install and
|
||||
an out-of-sync one consults upgrade, both by retry count rather than by
|
||||
strategy. */}}
|
||||
install:
|
||||
strategy:
|
||||
name: RetryOnFailure
|
||||
retryInterval: 30s
|
||||
remediation:
|
||||
retries: -1
|
||||
upgrade:
|
||||
strategy:
|
||||
name: RetryOnFailure
|
||||
retryInterval: 30s
|
||||
remediation:
|
||||
retries: -1
|
||||
valuesFrom:
|
||||
|
||||
@@ -30,10 +30,35 @@ spec:
|
||||
namespace: cozy-system
|
||||
interval: 5m
|
||||
timeout: 10m
|
||||
{{- /* Install remediation is an uninstall in every case Flux offers, and this
|
||||
release does not disable hooks on it, so a remediated install runs the
|
||||
monitoring chart's post-delete cleanup Job. That Job deletes PVCs by
|
||||
apps.cozystack.io/application.name=<release>-system, which is the label
|
||||
the metrics and logs claim templates stamp so the operator copies it
|
||||
onto the storage PVCs. An install that only missed its readiness budget
|
||||
therefore takes the tenant's metrics and logs with it, and nothing
|
||||
reconstructs them. RetryOnFailure keeps the manifests applied and
|
||||
retries the failed release instead, so no uninstall happens and the
|
||||
cleanup Job never runs. Both actions carry the strategy because the
|
||||
controller performs that retry as an upgrade. Two things are traded
|
||||
away: a real upgrade failure now retries rather than rolls back, which
|
||||
gives up no stable safety net, since with retries: -1 the default
|
||||
strategy already rolled back and retried without end; and the uninstall
|
||||
was the only automatic clean slate, so an install wedged on a bad
|
||||
resource state retries against it until an operator removes the
|
||||
release. The remediation blocks stay because an absent release consults
|
||||
install and an out-of-sync one consults upgrade, both by retry count
|
||||
rather than by strategy. */}}
|
||||
install:
|
||||
strategy:
|
||||
name: RetryOnFailure
|
||||
retryInterval: 30s
|
||||
remediation:
|
||||
retries: -1
|
||||
upgrade:
|
||||
strategy:
|
||||
name: RetryOnFailure
|
||||
retryInterval: 30s
|
||||
remediation:
|
||||
retries: -1
|
||||
valuesFrom:
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
suite: monitoring and gateway tenant HelmReleases retry a failed install in place
|
||||
|
||||
# Named after the two releases rather than after a class. They do not share one:
|
||||
# monitoring loses storage and gateway loses a regenerable key. The tenant's
|
||||
# etcd and seaweedfs releases lose storage as well and are outside this suite,
|
||||
# so a class-shaped title here would print as PASS over members it never
|
||||
# looked at.
|
||||
#
|
||||
# Restrict rendering to the two templates asserted on, so a template this suite
|
||||
# makes no claim about cannot fail it. That is not hypothetical: at the time of
|
||||
# writing, dropping the restriction reds all four tests on keycloakgroups.yaml,
|
||||
# which errors with "index of untyped nil" on the `.Values._cluster` the
|
||||
# platform injects and this suite has no reason to set. Adding a template to
|
||||
# the list below is safe.
|
||||
templates:
|
||||
- templates/monitoring.yaml
|
||||
- templates/gateway.yaml
|
||||
|
||||
release:
|
||||
name: tenant-test
|
||||
namespace: tenant-test
|
||||
|
||||
set:
|
||||
monitoring: true
|
||||
gateway: true
|
||||
|
||||
tests:
|
||||
# Install remediation is an uninstall in every case Flux offers, and neither
|
||||
# release disables hooks on it, so a remediated install runs the app chart's
|
||||
# post-delete cleanup Job. The monitoring one deletes PVCs by the
|
||||
# apps.cozystack.io/application.name=<release>-system label, and the metrics
|
||||
# and logs claim templates stamp exactly that label so the operator copies it
|
||||
# onto the storage PVCs. An install that misses its budget therefore deletes
|
||||
# the tenant's metrics and logs, which nothing reconstructs.
|
||||
- it: retries a failed monitoring install instead of deleting the storage
|
||||
asserts:
|
||||
- template: templates/monitoring.yaml
|
||||
equal:
|
||||
path: spec.install.strategy.name
|
||||
value: RetryOnFailure
|
||||
- template: templates/monitoring.yaml
|
||||
equal:
|
||||
path: spec.install.strategy.retryInterval
|
||||
value: 30s
|
||||
|
||||
# The gateway cleanup Job deletes the cozystack-acme-account Secret. That key
|
||||
# regenerates on the next install, so the cost is re-registration against the
|
||||
# ACME provider and its rate limits rather than lost data. Same mechanism,
|
||||
# smaller stake, and worth fixing for the same reason: remediation invokes a
|
||||
# teardown written for an honest uninstall.
|
||||
- it: retries a failed gateway install instead of discarding the ACME account
|
||||
asserts:
|
||||
- template: templates/gateway.yaml
|
||||
equal:
|
||||
path: spec.install.strategy.name
|
||||
value: RetryOnFailure
|
||||
- template: templates/gateway.yaml
|
||||
equal:
|
||||
path: spec.install.strategy.retryInterval
|
||||
value: 30s
|
||||
|
||||
# The controller performs the retry of a failed install as an upgrade, so
|
||||
# without a strategy here that retry's own failure falls through to upgrade
|
||||
# remediation instead of retrying again.
|
||||
- it: carries the strategy on the upgrade action the retry runs as
|
||||
asserts:
|
||||
- template: templates/monitoring.yaml
|
||||
equal:
|
||||
path: spec.upgrade.strategy.name
|
||||
value: RetryOnFailure
|
||||
- template: templates/monitoring.yaml
|
||||
equal:
|
||||
path: spec.upgrade.strategy.retryInterval
|
||||
value: 30s
|
||||
- template: templates/gateway.yaml
|
||||
equal:
|
||||
path: spec.upgrade.strategy.name
|
||||
value: RetryOnFailure
|
||||
- template: templates/gateway.yaml
|
||||
equal:
|
||||
path: spec.upgrade.strategy.retryInterval
|
||||
value: 30s
|
||||
|
||||
# The strategy governs a failed release. An absent release and an out-of-sync
|
||||
# one take different branches, which consult the retry count instead and stop
|
||||
# acting once it is exhausted.
|
||||
- it: keeps unlimited retries for the branches the strategy does not reach
|
||||
asserts:
|
||||
- template: templates/monitoring.yaml
|
||||
equal:
|
||||
path: spec.install.remediation.retries
|
||||
value: -1
|
||||
- template: templates/monitoring.yaml
|
||||
equal:
|
||||
path: spec.upgrade.remediation.retries
|
||||
value: -1
|
||||
- template: templates/gateway.yaml
|
||||
equal:
|
||||
path: spec.install.remediation.retries
|
||||
value: -1
|
||||
- template: templates/gateway.yaml
|
||||
equal:
|
||||
path: spec.upgrade.remediation.retries
|
||||
value: -1
|
||||
Reference in new issue
Block a user