fix(operator): requeue packages when dependencies are not ready

When dependencies are not ready the reconciler returned without
requeueing, relying solely on watch events to re-trigger. If a watch
event was missed (controller restart, race condition, dependency already
ready before watch setup), the package would stay stuck in
DependenciesNotReady forever.

Add RequeueAfter: 30s so dependencies are periodically rechecked.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
(cherry picked from commit f906a0d8ad)
This commit is contained in:
Andrei Kvapil 2026-03-13 00:31:56 +01:00 committed by github-actions[bot]
parent 0e3c7fabff
commit 093329cdce

View file

@ -20,6 +20,7 @@ import (
"context"
"fmt"
"strings"
"time"
cozyv1alpha1 "github.com/cozystack/cozystack/api/v1alpha1"
helmv2 "github.com/fluxcd/helm-controller/api/v2"
@ -141,8 +142,8 @@ func (r *PackageReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
if err := r.Status().Update(ctx, pkg); err != nil {
return ctrl.Result{}, err
}
// Return success to avoid requeue, but don't create HelmReleases
return ctrl.Result{}, nil
// Requeue to periodically recheck dependencies in case watch events are missed
return ctrl.Result{RequeueAfter: 30 * time.Second}, nil
}
// Create HelmReleases for components with Install section