Skip to content

Conversation

@rbtr
Copy link
Collaborator

@rbtr rbtr commented Oct 20, 2022

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.

@rbtr rbtr requested a review from a team as a code owner October 20, 2022 23:24
@rbtr rbtr requested review from camrynl, nairashu, rsagasthya and thatmattlong and removed request for a team October 20, 2022 23:24
@rbtr rbtr self-assigned this Oct 20, 2022
@rbtr rbtr added enhancement cns Related to CNS. labels Oct 20, 2022
thatmattlong
thatmattlong previously approved these changes Oct 21, 2022
@rbtr rbtr enabled auto-merge (squash) October 21, 2022 20:58
@rbtr rbtr force-pushed the fix/ctrlcli branch 5 times, most recently from b014764 to 7ea24af Compare October 25, 2022 22:08
@rbtr rbtr force-pushed the fix/ctrlcli branch 2 times, most recently from e187ded to eb3ec7b Compare November 4, 2022 18:28
@rbtr rbtr force-pushed the fix/ctrlcli branch 4 times, most recently from 6940b1d to b6ec0b9 Compare November 11, 2022 20:56
camrynl
camrynl previously approved these changes Nov 11, 2022
@rbtr rbtr force-pushed the fix/ctrlcli branch 3 times, most recently from 5de9ce6 to 9bd98c9 Compare November 16, 2022 23:50
timraymond
timraymond previously approved these changes Nov 17, 2022
Copy link
Member

@timraymond timraymond left a 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.

rbtr added 3 commits December 2, 2022 11:41
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>
@rbtr rbtr merged commit 353b7e0 into Azure:master Dec 6, 2022
@rbtr rbtr deleted the fix/ctrlcli branch December 6, 2022 01:55
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

Labels

cns Related to CNS. enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants