Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Track resources with a label selector #367

Merged
merged 3 commits into from
May 12, 2023
Merged

Track resources with a label selector #367

merged 3 commits into from
May 12, 2023

Conversation

scothis
Copy link
Contributor

@scothis scothis commented May 9, 2023

Update tracker package to the latest from knative.dev/pkg/tracker, and then heavily modified to remove dependence on Knative packages and align with controller-runtime.

The Tracker can now track resources by name or by selector. The Everything selector along with an empty namespace can be used to implicitly track all resource of a given type.

The Tracker#TrackReference method can specify either a name or selector used to match resource. The Tracker#TrackObject method is a convenience method to convert a client.Object into a tracker.Reference.

Similar to the existing Config#TrackAndGet method, there is a new Config#TrackAndList method that follows the contract for client.List while also tracking resources matching the query.

Direct users of the Tracker will need to adapt to the new interface, however, indirect uses (like reconciler tests) are preserved.

Update tracker package to the latest from knative.dev/pkg/tracker, and
then heavily modified to remove dependence on Knative packages and align
with controller-runtime.

The Tracker can now track resources by name or by selector. The
Everything selector along with an empty namespace can be used to
implicitly track all resource of a given type.

The Tracker#TrackReference method can specify either a name or selector
used to match resource. The Tracker#TrackObject method is a convenience
method to convert a client.Object into a tracker.Reference.

Similar to the existing Config#TrackAndGet method, there is a new
Config#TrackAndList method that follows the contract for client.List
while also tracking resources matching the query.

Direct users of the Tracker will need to adapt to the new interface,
however, indirect uses (like reconciler tests) are preserved.

Signed-off-by: Scott Andrews <[email protected]>
@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Patch coverage: 75.11% and project coverage change: +1.61 🎉

Comparison is base (3cbd87e) 58.12% compared to head (8196817) 59.74%.

❗ Current head 8196817 differs from pull request most recent head fbe86d1. Consider uploading reports for the commit fbe86d1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #367      +/-   ##
==========================================
+ Coverage   58.12%   59.74%   +1.61%     
==========================================
  Files          14       16       +2     
  Lines        1956     2124     +168     
==========================================
+ Hits         1137     1269     +132     
- Misses        741      773      +32     
- Partials       78       82       +4     
Impacted Files Coverage Δ
reconcilers/enqueuer.go 0.00% <0.00%> (ø)
tracker/interface.go 0.00% <0.00%> (ø)
testing/tracker.go 67.64% <75.00%> (+1.85%) ⬆️
tracker/enqueue.go 79.64% <79.64%> (ø)
reconcilers/reconcilers.go 76.15% <81.25%> (+0.39%) ⬆️
testing/config.go 87.50% <100.00%> (+0.05%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@mamachanko mamachanko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hits approve button multiples times

@scothis scothis marked this pull request as ready for review May 12, 2023 18:53
@scothis scothis merged commit 615186e into vmware-labs:main May 12, 2023
@scothis scothis deleted the track-selector branch May 12, 2023 19:03
@mamachanko
Copy link
Collaborator

Thanks a lot for implementing this, @scothis!

🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants