Skip to content

Commit

Permalink
only move on if the binding is already synced
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Zhang committed Oct 25, 2024
1 parent 1a51493 commit 78db570
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/controllers/workgenerator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ func (r *Reconciler) syncAllWork(ctx context.Context, resourceBinding *fleetv1be

// areAllWorkSynced checks if all the works are synced with the resource binding.
func areAllWorkSynced(existingWorks map[string]*fleetv1beta1.Work, resourceBinding *fleetv1beta1.ClusterResourceBinding, _, _ string) bool {
syncedCondition := resourceBinding.GetCondition(string(fleetv1beta1.ResourceBindingWorkSynchronized))
if !condition.IsConditionStatusTrue(syncedCondition, resourceBinding.Generation) {
// The binding has to be synced first before we can check the works
return false
}
// TODO: check resourceOverrideSnapshotHash and clusterResourceOverrideSnapshotHash after all the work has the ParentResourceOverrideSnapshotHashAnnotation and ParentClusterResourceOverrideSnapshotHashAnnotation
resourceSnapshotName := resourceBinding.Spec.ResourceSnapshotName
for _, work := range existingWorks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,6 @@ var _ = Describe("Test Work Generator Controller", func() {
// binding should have a finalizer
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: binding.Name}, binding)).Should(Succeed())
Expect(len(binding.Finalizers)).Should(Equal(1))

Eventually(func() string {
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: binding.Name}, binding)).Should(Succeed())
wantStatus := placementv1beta1.ResourceBindingStatus{
Expand Down

0 comments on commit 78db570

Please sign in to comment.