cozystack/internal
Andrei Kvapil b0b1a1f1f9
[platform] Add flux-plunger controller to fix HelmRelease errors (#1843)
## What this PR does

This PR introduces a new flux-plunger controller that automatically
fixes HelmRelease resources experiencing "has no deployed releases"
errors by cleaning up corrupted Helm release secrets.

### Problem

When Helm releases fail with "has no deployed releases" error, FluxCD
cannot recover automatically. This typically happens when:
- Helm release secrets are corrupted
- Failed upgrades leave the release in an inconsistent state
- Manual intervention is required to delete the problematic secret

### Solution

The flux-plunger controller:
1. Watches HelmRelease resources for "has no deployed releases" errors
2. Suspends the HelmRelease (with `flux-client-side-apply` field
manager)
3. Identifies and deletes the latest (problematic) Helm release secret
4. Tracks processed versions via annotation to prevent recursive
deletion
5. Unsuspends the HelmRelease to allow FluxCD to retry

**Key features:**
- Only deletes one secret at a time (prevents cascading deletions)
- Uses version tracking: if `latest+1 == processed`, skips (already
handled)
- Handles suspended HelmReleases: only unsuspends if it was suspended by
flux-plunger itself
- Gracefully handles invalid annotations by treating them as unprocessed

### Components

- **Controller:** `internal/controller/fluxplunger/flux_plunger.go`
- **Main:** `cmd/flux-plunger/main.go`  
- **Helm Chart:** `packages/system/flux-plunger/`
- **Platform Integration:** Added to `paas-full.yaml` bundle

### Release note

```release-note
[platform] Add flux-plunger controller to automatically fix HelmRelease resources with "has no deployed releases" error by cleaning up corrupted Helm secrets
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

* **New Features**
* Introduced a new controller that automatically resolves HelmRelease
resource failures with built-in health probes and graceful recovery
procedures.
  * Enabled by default in system installations.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-01-20 01:56:00 +01:00
..
backupcontroller [backups] Add templating of velero backups 2026-01-04 13:31:15 +03:00
controller [platform] Add flux-plunger controller to fix HelmRelease errors (#1843) 2026-01-20 01:56:00 +01:00
cozyvaluesreplicator Improve Reconcile function 2026-01-06 18:53:17 +03:00
fluxinstall Fix tolerations for uninitialized nodes 2026-01-19 14:20:02 +01:00
lineagecontrollerwebhook refactor(api): rename CozystackResourceDefinition to ApplicationDefinition 2026-01-15 22:35:56 +01:00
operator feat(flux): implement flux sharding for tenant HelmReleases 2026-01-15 14:15:09 +01:00
shared/crdmem refactor(api): rename CozystackResourceDefinition to ApplicationDefinition 2026-01-15 22:35:56 +01:00
sse [kubeovn] Implement the KubeOVN plunger 2025-09-11 02:11:58 +03:00
telemetry refactor(labels): remove cozystack.io/ui label 2026-01-19 13:59:29 +01:00
template [backups] Add templating of velero backups 2026-01-04 13:31:15 +03:00