Skip to content

Commit

Permalink
Use Reader.Get() to retrieve the resource outside of cache scope (#2315)
Browse files Browse the repository at this point in the history
* use Reader.get to retrieve the resource outside of ns

Signed-off-by: YuChen <[email protected]>

* hide the msg when the resources are not found for deletion

Signed-off-by: YuChen <[email protected]>

---------

Signed-off-by: YuChen <[email protected]>
  • Loading branch information
YCShen1010 authored Nov 28, 2024
1 parent ee2b64a commit 663f903
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/bootstrap/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,11 +954,11 @@ func (b *Bootstrap) deleteResource(resource client.Object, name, namespace strin
namespacedName.Namespace = namespace
}

if err := b.Client.Get(ctx, namespacedName, resource); err != nil {
if err := b.Reader.Get(ctx, namespacedName, resource); err != nil {
if !errors.IsNotFound(err) {
return err
}
klog.Infof("%s %s/%s not found, skipping deletion", resourceType, namespace, name)
klog.V(2).Infof("%s %s/%s not found, skipping deletion", resourceType, namespace, name)
return nil
}

Expand Down

0 comments on commit 663f903

Please sign in to comment.