mirror of
https://github.com/lukaszraczylo/kubemirror.git
synced 2026-06-29 00:54:42 +00:00
fix(controller): stop self-triggered reconcile loops
C2: updateLastSyncStatus wrote the sync-status annotation on every
successful reconcile. Because the source's watch predicate is the
'enabled' label (server-side filter), that Update fires a watch event
that re-enters Reconcile. With reconciled/error counts varying across
cycles, the value differs each time, so the API server bumps RV and
the loop never quiesces. Now skips the Update when the value matches
the existing annotation.
C3: NamespaceReconciler's happy-path returned RequeueAfter=3s
unconditionally. Every namespace in the cluster re-reconciled every
3 seconds forever, generating constant List calls per source kind.
Now returns ctrl.Result{}; cache-staleness windows are handled by
the manager's resync period and source freshness verification.
This commit is contained in:
@@ -203,8 +203,13 @@ func TestNamespaceReconciler_CleanupWhenNamespaceNoLongerTarget(t *testing.T) {
|
||||
Name: tt.namespace.Name,
|
||||
},
|
||||
}
|
||||
_, err := reconciler.Reconcile(ctx, req)
|
||||
result, err := reconciler.Reconcile(ctx, req)
|
||||
require.NoError(t, err)
|
||||
// Regression: never schedule an unconditional re-reconcile. The
|
||||
// previous implementation returned RequeueAfter=3s for every
|
||||
// namespace event, which scaled to one re-reconcile per namespace
|
||||
// every 3 seconds forever.
|
||||
assert.Zero(t, result.RequeueAfter, "happy-path Reconcile must not schedule a periodic requeue")
|
||||
|
||||
// Verify mirrors were deleted as expected
|
||||
for _, mirrorName := range tt.expectedDeleted {
|
||||
|
||||
Reference in New Issue
Block a user