Skip to content

Commit

Permalink
finding the target ResourceBinding
Browse files Browse the repository at this point in the history
Signed-off-by: huangyanfeng <huangyanfeng1992@gmail.com>
  • Loading branch information
yanfeng1992 committed Jan 21, 2023
1 parent 6bcc7c0 commit 521cfd8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/dependenciesdistributor/dependencies_distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ func (d *DependenciesDistributor) Reconcile(key util.QueueKey) error {
}
klog.V(4).Infof("DependenciesDistributor start to reconcile object: %s", clusterWideKey)

unstructuredObj, err := d.resourceBindingLister.Get(clusterWideKey.NamespaceKey())
bindingObject := &workv1alpha2.ResourceBinding{}
err := d.Client.Get(context.TODO(), client.ObjectKey{Namespace: clusterWideKey.Namespace, Name: clusterWideKey.Name}, bindingObject)
if err != nil {
if apierrors.IsNotFound(err) {
klog.V(4).Infof("ResourceBinding(%s) has been removed.", clusterWideKey.NamespaceKey())
Expand All @@ -180,12 +181,6 @@ func (d *DependenciesDistributor) Reconcile(key util.QueueKey) error {
return err
}

bindingObject := &workv1alpha2.ResourceBinding{}
if err = helper.ConvertToTypedObject(unstructuredObj, bindingObject); err != nil {
klog.Errorf("Failed to convert ResourceBinding(%s) from unstructured object: %v", clusterWideKey.NamespaceKey(), err)
return err
}

var bindingObjectList []runtime.Object
for _, bindingSnapshot := range bindingObject.Spec.RequiredBy {
if bindingSnapshot.Namespace != "" {
Expand Down

0 comments on commit 521cfd8

Please sign in to comment.