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 authored and github-actions[bot] committed 2026-03-13 15:23:34 +00:00
1 parent c10fdc36b8
commit 5e897ef207
1 file changed
+3 -2
+3 -2
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