Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Streamline the flow for looking up a resource and watching it for changes. The Tracker has long lived on the Config object as a peer to the Client, it's very common to Track() a resource and then Get() that same resource. Now we can do both, this effectively makes tracking transparent as TrackAndGet() and Get() have the same method signature. Before: c.Tracker.Track( ctx, tracker.NewKey( schema.GroupVersionKind{Version: "v1", Kind: "ServiceAccount"}, types.NamespacedName{Namespace: parent.Namespace, Name: serviceAccountName}, ), types.NamespacedName{Namespace: parent.Namespace, Name: parent.Name}, ) serviceAccount := corev1.ServiceAccount{} err := c.Get(ctx, types.NamespacedName{Namespace: parent.Namespace, Name: serviceAccountName}, &serviceAccount) After: serviceAccount := corev1.ServiceAccount{} err := c.TrackAndGet(ctx, types.NamespacedName{Namespace: parent.Namespace, Name: serviceAccountName}, &serviceAccount) The implementation assumes the ctx extends from a ParentReconciler. Signed-off-by: Scott Andrews <andrewssc@vmware.com>
- Loading branch information
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters