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

Find one scalable pattern to wrap clients, and deprecate others #2888

Open
dlipovetsky opened this issue Jul 24, 2024 · 1 comment
Open

Find one scalable pattern to wrap clients, and deprecate others #2888

dlipovetsky opened this issue Jul 24, 2024 · 1 comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@dlipovetsky
Copy link
Contributor

As @sbueringer observed in #2860 (comment),
we have, as of now, at least four different ways to wrap the client:

  • intercept.NewClient
  • NewDryRunClient
  • WithFieldOwner
  • WithStrictFieldValidation

... I think we should find a more scalable pattern to wrap clients.
If we continue to introduce a new wrapper for every single option we will end up with a lot of wrappers.

If we continue to introduce a new wrapper for every single option we will end up with a lot of wrappers.

I guess the same way we could either:

  • only have one wrapper taking various options and acting accordingly
    • This also makes the options more discoverable for users
    • Pretty sure we end up with more consistency then (see the list of wrappers below)
  • add options to the main client (that's probalby not good because then they cannot be used with the fake client)

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 24, 2024
@alvaroaleman
Copy link
Member

When building this we should also try to solve: #2967
All the wrappers we have don't properly deal with client.WithWatch and end up removing the Watch functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants