Skip to content

Commit

Permalink
fix the attached binding deletion problem
Browse files Browse the repository at this point in the history
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
  • Loading branch information
whitewindmills committed Jan 10, 2025
1 parent be674c7 commit 49bb3d1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/dependenciesdistributor/dependencies_distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@ func (d *DependenciesDistributor) createOrUpdateAttachedBinding(attachedBinding
bindingKey := client.ObjectKeyFromObject(attachedBinding)
err := d.Client.Get(context.TODO(), bindingKey, existBinding)
if err == nil {
// When a dependent resource is deleted, it's ResourceBinding deletion may be delayed, depending on the system load status.
// If it is recreated again, it's ResourceBinding may not be recreated because the previous ResourceBinding deletion has not yet completed.
// We return an error here to wait for it's ResourceBinding deletion to complete, this will ensure it's ResourceBinding is recreated correctly.
if !existBinding.DeletionTimestamp.IsZero() {
return fmt.Errorf("unable to update resourceBinding(%s) because it's being deleted", bindingKey)
}

// If the spec.Placement is nil, this means that existBinding is generated by the dependency mechanism.
// If the spec.Placement is not nil, then it must be generated by PropagationPolicy.
if existBinding.Spec.Placement == nil {
Expand Down

0 comments on commit 49bb3d1

Please sign in to comment.