Skip to content
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

Use a single dynamic client in the reconciler #87

Conversation

mprahl
Copy link
Member

@mprahl mprahl commented Jan 4, 2023

This makes the code simpler and removes the overhead of creating separate copies of API configs and dynamic clients on each object being evaluated.


v1err := r.Get(context.TODO(), key, &v1def)
v1def, v1err := r.TargetK8sDynamicClient.Resource(crdGVR).Get(context.TODO(), crdName, metav1.GetOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

I think the CRD will be on the hosting cluster, not the target cluster.

Also, I'm wondering if going through the dynamic client removes the need for #88 ? Since I can't tell how the cache settings there would get to the dynamic client (but maybe I'm missing something)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry about that. I didn't mean to commit this part.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was originally going towards the route of using the dynamic client but then realized it did actually need to be a client pointing to the cluster the config-policy-controller is running on. I decided to not have yet another client on the reconciler and figured the caching provided by #88 might be a good thing rather than query for the CRD on every ConfigurationPolicy deletion.

The latest push removes the code that was accidentally committed.

This makes the code simpler and removes the overhead of creating separate
copies of API configs and dynamic clients on each object being
evaluated.

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
@openshift-ci openshift-ci bot added the lgtm label Jan 4, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jan 4, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JustinKuli, mprahl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Successfully merging this pull request may close these issues.

3 participants