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

🐛 pkg/client: optionally allow caching of unstructured objects #1332

Conversation

joelanford
Copy link
Member

Based on #615, it seems like there is intent to allow the DelegatingClient to cache unstructured objects. This is behavior that was possible to use before v0.7.0 by using the NewClientFunc manager option and creating a custom DelegatingClient.

IMO, this could be considered a regression, but since a large chunk of this code was restructured in v0.7.0, I'm not sure if dropping support for unstructured caching was intentional.

This PR adds a new boolean field to the NewDelegatingClientInput struct that allows users to opt-in to caching unstructured objects.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 13, 2021
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 13, 2021
@joelanford
Copy link
Member Author

/retest

@joelanford joelanford force-pushed the fix/allow-cached-unstructured-reads branch from c3ee29b to eb0f1d4 Compare January 13, 2021 16:31
@joelanford
Copy link
Member Author

/hold

For discussion.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 13, 2021
@joelanford
Copy link
Member Author

Looks like #1058 removed the exported DelegatingClient struct, which I think is the root cause of the regression, unless I'm missing something about how we can support caching unstructured objects without forcing users to reimplement their own delegating client.

Copy link
Contributor

@estroz estroz left a comment

Choose a reason for hiding this comment

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

Agreed that this is a regression.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 13, 2021
@vincepri
Copy link
Member

I'm +1 having the option to cache unstructured objects as well.

IIRC, the earlier version of the DelegatingClient was meant to be used to always go to a live client for unstructured objects https://github.com/kubernetes-sigs/controller-runtime/blob/release-0.5/pkg/client/split.go#L45-L61, we kept that behavior.

That said, as you mentioned the NewClientFunc option, which was replaced with NewClientBuider and an interface where folks can fill in with their own struct https://github.com/kubernetes-sigs/controller-runtime/blob/release-0.7/pkg/manager/client_builder.go#L25-L33, so I'm +1 supporting this as an option

/approve

@vincepri vincepri added this to the v0.8.x milestone Jan 14, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: estroz, joelanford, vincepri

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:
  • OWNERS [joelanford,vincepri]

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

@coderanger
Copy link
Contributor

Might also be good to set this up as a manager option too?

@joelanford
Copy link
Member Author

/hold cancel

I'll add a manager option in a follow-up.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 14, 2021
@k8s-ci-robot k8s-ci-robot merged commit 818a2ce into kubernetes-sigs:master Jan 14, 2021
@joelanford joelanford deleted the fix/allow-cached-unstructured-reads branch January 14, 2021 21:41
@estroz
Copy link
Contributor

estroz commented Jan 20, 2021

/cherry-pick release-0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants