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

Commit

Permalink
Add GetOpts to TrackAndGet
Browse files Browse the repository at this point in the history
Restores full compatibility with client.Get

Signed-off-by: Scott Andrews <[email protected]>
  • Loading branch information
scothis committed Sep 5, 2022
1 parent 20a8b8a commit c6c0326
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions reconcilers/reconcilers.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ func (c Config) WithCluster(cluster cluster.Cluster) Config {
// TrackAndGet tracks the resources for changes and returns the current value. The track is
// registered even when the resource does not exists so that its creation can be tracked.
//
// Equivlent to calling both `c.Tracker.Track(...)` and `c.Client.Get(...)`
func (c Config) TrackAndGet(ctx context.Context, key types.NamespacedName, obj client.Object) error {
// Equivalent to calling both `c.Tracker.Track(...)` and `c.Client.Get(...)`
func (c Config) TrackAndGet(ctx context.Context, key types.NamespacedName, obj client.Object, opts ...client.GetOption) error {
c.Tracker.Track(
ctx,
tracker.NewKey(gvk(obj, c.Scheme()), key),
RetrieveRequest(ctx).NamespacedName,
)
return c.Get(ctx, key, obj)
return c.Get(ctx, key, obj, opts...)
}

// NewConfig creates a Config for a specific API type. Typically passed into a
Expand Down

0 comments on commit c6c0326

Please sign in to comment.