Skip to content

[Backport release-1.6] fix(kubernetes): retry the tenant CNI install instead of uninstalling it - #4033

Merged
myasnikovdaniil merged 1 commit into
release-1.6from
backport-3552-to-release-1.6
Sep 3, 2026
Merged

myasnikovdaniil merged 1 commit into
release-1.6from
backport-3552-to-release-1.6

Conversation

@myasnikovdaniil

Copy link
Copy Markdown
Contributor

Backport of #3552 to release-1.6.

Tenant cilium HelmRelease on this branch sets install.remediation.retries: -1 with no strategy:, so helm-controller uses its default install remediation, which is uninstall. Cilium is the tenant cluster's only CNI, so a tenant whose install misses its budget gets the CNI torn down and reinstalled once per cycle, and -1 lets that repeat without end. RetryOnFailure keeps applied manifests in place and retries the failed install as an upgrade instead. Strategy is set on both actions because the retry of a failed install runs as an upgrade.

Shipped broken in v1.6.0, v1.6.1 and v1.6.2. RetryOnFailure appears in none of the 19 helmrelease templates on this branch, and the Flux CRD release-1.6 already ships accepts it - enum at spec.install.strategy.name and spec.upgrade.strategy.name, with the retryInterval CEL guard.

Cost is carried over from the original PR: a genuine upgrade failure now retries on failed manifests instead of rolling back. Controller can't tell a retried install from a real upgrade, and what it replaces was an unbounded rollback-and-retry flap.

Auto backport did not apply here, and it was not a conflict. Bot picked four commits from the PR branch, three of them empty ci: re-run commits, and git cherry-pick exits non-zero on an empty pick with no unmerged paths, which the action reads as a conflict. Picking 80a209044 alone is the whole backport and applies with a line offset only. Resulting tree matches the bot's four-SHA-with-three-skips recipe byte for byte.

Testing

  • make test in packages/apps/kubernetes - 18 suites, 186 tests green.
  • New suite is mutation-proven rather than revert-proven: setting install.strategy.name to Rollback reds exactly the install test, removing the upgrade.strategy block reds exactly the upgrade test, other 185 unaffected both times.
  • make unit-tests and make test-controllers green, make generate leaves no drift.
  • No migration touched, targetVersion still 54.
fix(kubernetes): retry the tenant CNI install instead of uninstalling it

The tenant cilium HelmRelease carried no install strategy, so Flux
applied its default, RemediateOnFailure, which uninstalls the release
between attempts. Cilium is the tenant cluster's only CNI, so every
cycle takes it away and gives it back when the next install applies the
manifests again, and retries: -1 lets that repeat without end.

What sets a cycle off is an install that outruns its budget, which can
happen while the tenant still has no registered node, since the operator
Deployment cannot become Available until one exists. Remediation neither
causes that delay nor is fixed by this change; what it adds is a
repeated teardown of the CNI on top of a delay that resolves itself once
the node arrives. This removes the amplifier, not the cause.

RetryOnFailure keeps the applied manifests in place and retries a failed
install as an upgrade, so the rollout completes on its own once a worker
registers. Both actions carry the strategy because the retry of a failed
install runs as an upgrade, which would otherwise fall back to upgrade
remediation. It is the strategy and retry interval cozystack-api and
cozystack-operator already set on every HelmRelease they generate,
except that they leave remediation nil where this release keeps it. The
other tenant addons the chart renders still carry the remediation-only
shape; this one is where the teardown removes the cluster's only CNI
rather than churning a single component.

The cost is that a genuine upgrade failure no longer rolls back either,
it retries on the failed manifests instead. That is forced, since the
controller cannot tell a retried install from a real upgrade, and what
it replaces was an unbounded rollback-and-retry flap rather than a
stable safety net.

The remediation blocks stay, since they cover the branches no strategy
reaches: an absent release, which consults the install block, and an
out-of-sync one, which consults upgrade.

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
(cherry picked from commit 80a2090)
Signed-off-by: Myasnikov Daniil <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 577d8193-4015-4fe3-a7c5-aef3cfe4ffc1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added size/M This PR changes 30-99 lines, ignoring generated files area/kubernetes Issues or PRs related to the tenant Kubernetes app area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) kind/bug Categorizes issue or PR as related to a bug labels Sep 2, 2026
@myasnikovdaniil
myasnikovdaniil merged commit 7c310e3 into release-1.6 Sep 3, 2026
20 of 22 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the backport-3552-to-release-1.6 branch September 3, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/kubernetes Issues or PRs related to the tenant Kubernetes app area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants