Handle multiple reconciliations of sylva-units HelmRelease

In order to support 2-step upgrades that were initially discussed in sylva-projects#73 (closed), and more precisely to support two kubernetes version jumps while upgrading from sylva 1.6 to 1.7 (described in sylva-projects/sylva-core#3782 (closed)), we need to allow the operator to perform multiple upgrades of sylva-units HelmRelease.

Here is the proposed solution:

  • When sylva-units HelmRelease code (or possibly another component) detects that it won't be able to upgrade everything in a single step, and will need an extra reconciliation, it'll add a specific annotation to sylva-units-status kustomization:
sylva-units.sylva-project.org/additional-reconciliation-requested: sylva-units-revision-42
  • At the end of the reconciliation, when the sylva-units-status Kustomization becomes ready, the operator will check if this annotation is present. In that case it'll copy its value to sylva units HelmRelease annotations to trigger a new reconciliation
sylva-units.sylva-project.org/additional-reconciliation-requested: sylva-units-revision-42
reconcile.fluxcd.io/requestedAt: sylva-units-revision-42
reconcile.fluxcd.io/forceAt: sylva-units-revision-42

sylva-units.sylva-project.org/additional-reconciliation-requested annotation is also added to sylva-units HelmRelease to ensure that the operator will only request reconciliation once (it'll check for that annotation prior to force-reconcile the HelmRelease)

  • In order to prevent race conditions and consider that sylva-units HelmRelease is Ready too early, we've also added some extra checks to ensure that status.lastHandledReconcileAt and status.lastHandledForceAt match the corresponding annotations, if any (since the addition of these annotation won't change the object generation, we may consider it as Ready right after annotating it if it is reconciled before helm controller handles the reconcile request)

Note: I also had to update flux CRD versions for test-env as flux api have been upgraded (this is done in a specific commit)

Edited by Francois Eleouet

Merge request reports

Loading