-
Notifications
You must be signed in to change notification settings - Fork 260
fix: cns to use controller runtime (cached) clients in reconcilers #1668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or 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
thatmattlong
previously approved these changes
Oct 21, 2022
b014764 to
7ea24af
Compare
e187ded to
eb3ec7b
Compare
6940b1d to
b6ec0b9
Compare
camrynl
previously approved these changes
Nov 11, 2022
5de9ce6 to
9bd98c9
Compare
timraymond
previously approved these changes
Nov 17, 2022
Member
timraymond
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know that I completely follow everything here, but I've got enough of an understanding to approve it (especially given prior approvals). The Go looks good, and I learned something about SharedInformer in the process.
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
thatmattlong
approved these changes
Dec 6, 2022
rjdenney
pushed a commit
to rjdenney/azure-container-networking
that referenced
this pull request
Jan 19, 2023
…zure#1668) * update crd clients to accept existing ctrlcli core clients Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> * fix cns to use managed cached clients for reconcilers Signed-off-by: GitHub <noreply@github.com> Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> Signed-off-by: GitHub <noreply@github.com>
smittal22
pushed a commit
to smittal22/azure-container-networking
that referenced
this pull request
Jan 26, 2023
…zure#1668) * update crd clients to accept existing ctrlcli core clients Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> * fix cns to use managed cached clients for reconcilers Signed-off-by: GitHub <noreply@github.com> Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> Signed-off-by: GitHub <noreply@github.com>
smittal22
pushed a commit
to smittal22/azure-container-networking
that referenced
this pull request
Jan 30, 2023
…zure#1668) * update crd clients to accept existing ctrlcli core clients Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> * fix cns to use managed cached clients for reconcilers Signed-off-by: GitHub <noreply@github.com> Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> Signed-off-by: GitHub <noreply@github.com>
smittal22
pushed a commit
to smittal22/azure-container-networking
that referenced
this pull request
Feb 3, 2023
…zure#1668) * update crd clients to accept existing ctrlcli core clients Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> * fix cns to use managed cached clients for reconcilers Signed-off-by: GitHub <noreply@github.com> Signed-off-by: Evan Baker <rbtr@users.noreply.github.com> Signed-off-by: GitHub <noreply@github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reason for Change:
The scoped CRD clients did not previously accept a controller-runtime client as an input, and instead constructed one from the kubeconfig. This creats direct (uncached) clients, which is okay for one-offs like during initialization, but not for ongoing high frequency usage like in the Reconcilers.
This change modifies the CRD client constructors to accept a client to wrap, which allows embedding the (cached) client provided by the ctrlruntime Manager. This takes full advantage of the sharedinformer pattern, improves efficiency of the reconcilers, and reduces apiserver load.
Issue Fixed:
Requirements:
Notes: I migrated these components away from the Manager's client as part of switching out the scoped clients 😢 that was a mistake, and this is how they should have been from the beginning.