Skip to content

fix(tenant): retry failed monitoring and gateway installs in place - #3633

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/tenant-monitoring-gateway-retry-in-place
Aug 8, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/tenant-monitoring-gateway-retry-in-place

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

The tenant chart renders monitoring and gateway with no install strategy, so they get Flux's default, and install remediation is an uninstall in every case Flux offers. Neither sets spec.uninstall.disableHooks, which defaults to false. So a release that missed nothing but a readiness budget gets uninstalled, and the app chart's post-delete cleanup Job runs against it.

Those Jobs delete on purpose, and they are right to. The monitoring one removes PVCs labelled apps.cozystack.io/application.name=<release>-system. That label is not incidental either: the metrics and logs claim templates stamp it so the operator copies it onto the storage PVCs, and the Job selects on it to stay release-scoped. Both ends were built to meet. The result is that a slow first install deletes the tenant's metrics and logs, and nothing reconstructs them.

The gateway Job deletes the cozystack-acme-account Secret. That key regenerates, 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. Smaller stake, same mechanism, and the two are not one class: only one of them owns storage.

RetryOnFailure keeps the manifests applied and retries the failed release, so no uninstall happens and neither Job runs. Both actions carry the strategy because the controller performs that retry as an upgrade, so with install alone the retry's own failure falls through to upgrade remediation. The remediation blocks stay: an absent release consults install, an out-of-sync one consults upgrade, both by retry count rather than by strategy.

Two things are traded away. A real upgrade failure now retries instead of rolling back, which gives up no stable safety net, since with retries: -1 the default strategy was already rolling back and re-upgrading 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. For a release that owns data that is the right exchange.

This removes the consequence rather than the trigger, and for monitoring the trigger is worth naming separately: the parent HelmRelease here waits 10m, while the child monitoring-system release sets 15m deliberately, with a comment explaining that 10m is too short for the OIDC users-Job inside its activeDeadlineSeconds: 900. The parent's wait covers the child, so the parent can fail while the child is behaving exactly as designed. That mismatch is untouched here and wants its own change.

The chart's etcd and seaweedfs releases lose storage the same way and are outside this change. Beyond those four, computeplane, ingress and info stay on the default strategy, but their charts ship no destructive post-delete hook, so remediation costs them a wasteful teardown rather than data.

Same shape as #3552 and #3581. Relates to #3624.

Screenshots

Downstream repositories

Release note

fix(tenant): retry a failed monitoring or gateway install instead of uninstalling the release, so a slow first install no longer runs the cleanup hooks that delete the tenant's metrics and logs volumes or its ACME account key

Summary by CodeRabbit

  • Reliability Improvements
    • Monitoring and gateway deployments now automatically retry failed installs and upgrades every 30 seconds.
    • Existing unlimited remediation retries remain available, improving recovery from deployment issues.
  • Validation
    • Added automated coverage to verify retry behavior for both monitoring and gateway deployments.

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 <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@github-actions github-actions Bot added size/L This PR changes 100-499 lines, ignoring generated files area/tenant Issues or PRs related to the tenant chart and multi-tenancy kind/bug Categorizes issue or PR as related to a bug labels Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 55793607-2be6-417e-bd34-12ce5a1715f3

📥 Commits

Reviewing files that changed from the base of the PR and between 605030b and a27c341.

📒 Files selected for processing (3)
  • packages/apps/tenant/templates/gateway.yaml
  • packages/apps/tenant/templates/monitoring.yaml
  • packages/apps/tenant/tests/monitoring_gateway_install_retry_test.yaml

📝 Walkthrough

Walkthrough

The tenant monitoring and gateway HelmReleases now retry failed installs and upgrades every 30 seconds. Unlimited remediation retries remain configured. New Helm tests verify both retry strategies and remediation settings.

Changes

Tenant HelmRelease retry remediation

Layer / File(s) Summary
Configure retry strategies
packages/apps/tenant/templates/gateway.yaml, packages/apps/tenant/templates/monitoring.yaml
Both releases use RetryOnFailure with 30-second install and upgrade retry intervals. Existing unlimited remediation retries remain configured.
Validate retry configuration
packages/apps/tenant/tests/monitoring_gateway_install_retry_test.yaml
Tests verify retry settings and unlimited remediation retries for monitoring and gateway installs and upgrades.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: ivanhunters

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: retrying failed tenant monitoring and gateway installs in place.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tenant-monitoring-gateway-retry-in-place

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 92ec49e into main Aug 8, 2026
15 of 16 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the fix/tenant-monitoring-gateway-retry-in-place branch August 8, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tenant Issues or PRs related to the tenant chart and multi-tenancy kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant