Skip to content

Commit bdf17e6

Browse files
Fix the issue that the cache is out of sync within the resource interpreter when using karmadactl promote
Signed-off-by: changzhen <[email protected]>
1 parent 1c6f1db commit bdf17e6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/karmadactl/promote/promote.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,6 @@ func (o *CommandPromoteOption) promoteDeps(memberClusterFactory cmdutil.Factory,
462462
serviceLister := sharedFactory.Core().V1().Services().Lister()
463463
sharedFactory.Start(ctx.Done())
464464
sharedFactory.WaitForCacheSync(ctx.Done())
465-
controlPlaneInformerManager.Start()
466-
if sync := controlPlaneInformerManager.WaitForCacheSync(); sync == nil {
467-
return errors.New("informer factory for cluster does not exist")
468-
}
469465

470466
defaultInterpreter := native.NewDefaultInterpreter()
471467
thirdpartyInterpreter := thirdparty.NewConfigurableInterpreter()
@@ -475,6 +471,11 @@ func (o *CommandPromoteOption) promoteDeps(memberClusterFactory cmdutil.Factory,
475471
return fmt.Errorf("failed to create customized interpreter: %v", err)
476472
}
477473

474+
controlPlaneInformerManager.Start()
475+
if syncs := controlPlaneInformerManager.WaitForCacheSync(); len(syncs) == 0 {
476+
return errors.New("no informers registered in the informer factory")
477+
}
478+
478479
// check if the resource interpreter supports to interpret dependencies
479480
if !defaultInterpreter.HookEnabled(obj.GroupVersionKind(), configv1alpha1.InterpreterOperationInterpretDependency) &&
480481
!thirdpartyInterpreter.HookEnabled(obj.GroupVersionKind(), configv1alpha1.InterpreterOperationInterpretDependency) &&

0 commit comments

Comments
 (0)