-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
⚠️ Allow setting NewClientFunc w/o implementing an interface #1409
⚠️ Allow setting NewClientFunc w/o implementing an interface #1409
Conversation
35578a3
to
ded66c7
Compare
When we introduced the ClientBuilder we lost the ability to easily overwrite the NewClient func, as interfaces can not be implemented inline. This change reverts us back to using a NewClientFunc but with a slightly changed signature so objects that should not be cached can still be configured. In order to not provide two ways to do the same thing, the ClientBuilder is removed.
ded66c7
to
aa1bfee
Compare
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, 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:
Approvers can indicate their approval by writing |
/retest |
1 similar comment
/retest |
@alvaroaleman: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
type NewClientFunc func(cache cache.Cache, config *rest.Config, options client.Options, uncachedObjects ...client.Object) (client.Client, error) | ||
|
||
// DefaultNewClient creates the default caching client | ||
func DefaultNewClient(cache cache.Cache, config *rest.Config, options client.Options, uncachedObjects ...client.Object) (client.Client, error) { |
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.
we might want to consider making this options or something in the future -- this is getting a bit unwieldy
Breaking Changes: * Refactor/eliminate `ClientBuilder` to use `cluster.NewClientFunc` (see kubernetes-sigs/controller-runtime#1409) * Add stub `RemoveStreams` method on `fakePortForward` Mechanical Changes: * Upgrade K8s dependencies to v0.21.1 (aka 1.21.1) * Upgrade controller-runtime to 0.9.0 (required for K8s v0.21.1 deps) * Upgrade tilt-apiserver to v0.4.0 (requires for K8s v0.21.1 deps) * Remove `moby/term` replace (bug was fixed upstream and older version no longer compiles)
Breaking Changes: * Refactor client init to not use `ClientBuilder` (see kubernetes-sigs/controller-runtime#1409) * Add stub `RemoveStreams` method on `fakePortForward` Mechanical Changes: * Upgrade K8s dependencies to v0.21.1 (aka 1.21.1) * Upgrade controller-runtime to 0.9.0 (required for K8s v0.21.1 deps) * Upgrade tilt-apiserver to v0.4.0 (requires for K8s v0.21.1 deps) * Remove `moby/term` replace (bug was fixed upstream and older version no longer compiles)
Required Changes: * Refactor client init to not use `ClientBuilder` (see kubernetes-sigs/controller-runtime#1409) * Add stub `RemoveStreams` method on `fakePortForward` * Re-generate OpenAPI spec for K8s meta types shared by Tilt apiserver Mechanical Changes: * Upgrade K8s dependencies to v0.21.1 (aka 1.21.1) * Upgrade controller-runtime to 0.9.0 (required for K8s v0.21.1 deps) * Upgrade tilt-apiserver to v0.4.0 (requires for K8s v0.21.1 deps) * Remove `moby/term` replace (bug was fixed upstream and older version no longer compiles)
Required Changes: * Refactor client init to not use `ClientBuilder` (see kubernetes-sigs/controller-runtime#1409) * Add stub `RemoveStreams` method on `fakePortForward` * Re-generate OpenAPI spec for K8s meta types shared by Tilt apiserver Mechanical Changes: * Upgrade K8s dependencies to v0.21.1 (aka 1.21.1) * Upgrade controller-runtime to 0.9.0 (required for K8s v0.21.1 deps) * Upgrade tilt-apiserver to v0.4.0 (requires for K8s v0.21.1 deps) * Remove `moby/term` replace (bug was fixed upstream and older version no longer compiles)
* Upgrade to k/*@v0.21.1 in go.mod * [automated] make revendor for k/* dependencies This deletes pkg/mock/client-go/kubernetes/mocks.go to resolve the following deadlock: make revendor fails because of some dependencies of the file and make generate fails because of missing revendoring. File will be generated again in the next commit. * [automated] make generate for k/* dependencies * Upgrade to c-r@v0.9.0 in go.mod * [automated] make revendor for c-r dependency `make revendor` results in `hack/setup-envtest.sh` being broken, so reset the file after running `make revendor`. Adaption to breaking changes in the upstream file will be done in a later commit. * manager.NewClientBuilder was removed in favor of cluster.DefaultNewClient ref kubernetes-sigs/controller-runtime#1409 * client.*MergeFrom* now take client.Object instead of runtime.Object ref kubernetes-sigs/controller-runtime#1395 * [automated] make generate for c-r dependency * Adapt to changes in labels.NewRequirement ref kubernetes/kubernetes#97538 * Adapt to new setup-envtest tool Makes use of the new setup-envtest tool (kubernetes-sigs/controller-runtime#1488) in hack/setup-envtest.sh instead of vendoring hack/setup-envtest.sh and fetching binaries with that. * [automated] make revendor for setup-envtest tool * Adapt pkg/envtest to upstream changes - Make use of the new Users concept in envtest to provision a dedicated user for gardener-apiserver and a valid kubeconfig - Make use of the new way to configure API server args to easily configure kube-aggregator flags - Also generate certs for aggregation layer on our own instead of reusing the API server ca/certs (which is semantically correct), which allows us to drop our fork including kubernetes-sigs/controller-runtime#1449 * Styling nits
* Upgrade to k/*@v0.21.1 in go.mod * [automated] make revendor for k/* dependencies This deletes pkg/mock/client-go/kubernetes/mocks.go to resolve the following deadlock: make revendor fails because of some dependencies of the file and make generate fails because of missing revendoring. File will be generated again in the next commit. * [automated] make generate for k/* dependencies * Upgrade to c-r@v0.9.0 in go.mod * [automated] make revendor for c-r dependency `make revendor` results in `hack/setup-envtest.sh` being broken, so reset the file after running `make revendor`. Adaption to breaking changes in the upstream file will be done in a later commit. * manager.NewClientBuilder was removed in favor of cluster.DefaultNewClient ref kubernetes-sigs/controller-runtime#1409 * client.*MergeFrom* now take client.Object instead of runtime.Object ref kubernetes-sigs/controller-runtime#1395 * [automated] make generate for c-r dependency * Adapt to changes in labels.NewRequirement ref kubernetes/kubernetes#97538 * Adapt to new setup-envtest tool Makes use of the new setup-envtest tool (kubernetes-sigs/controller-runtime#1488) in hack/setup-envtest.sh instead of vendoring hack/setup-envtest.sh and fetching binaries with that. * [automated] make revendor for setup-envtest tool * Adapt pkg/envtest to upstream changes - Make use of the new Users concept in envtest to provision a dedicated user for gardener-apiserver and a valid kubeconfig - Make use of the new way to configure API server args to easily configure kube-aggregator flags - Also generate certs for aggregation layer on our own instead of reusing the API server ca/certs (which is semantically correct), which allows us to drop our fork including kubernetes-sigs/controller-runtime#1449 * Styling nits
* Upgrade to k/*@v0.21.1 in go.mod * [automated] make revendor for k/* dependencies This deletes pkg/mock/client-go/kubernetes/mocks.go to resolve the following deadlock: make revendor fails because of some dependencies of the file and make generate fails because of missing revendoring. File will be generated again in the next commit. * [automated] make generate for k/* dependencies * Upgrade to c-r@v0.9.0 in go.mod * [automated] make revendor for c-r dependency `make revendor` results in `hack/setup-envtest.sh` being broken, so reset the file after running `make revendor`. Adaption to breaking changes in the upstream file will be done in a later commit. * manager.NewClientBuilder was removed in favor of cluster.DefaultNewClient ref kubernetes-sigs/controller-runtime#1409 * client.*MergeFrom* now take client.Object instead of runtime.Object ref kubernetes-sigs/controller-runtime#1395 * [automated] make generate for c-r dependency * Adapt to changes in labels.NewRequirement ref kubernetes/kubernetes#97538 * Adapt to new setup-envtest tool Makes use of the new setup-envtest tool (kubernetes-sigs/controller-runtime#1488) in hack/setup-envtest.sh instead of vendoring hack/setup-envtest.sh and fetching binaries with that. * [automated] make revendor for setup-envtest tool * Adapt pkg/envtest to upstream changes - Make use of the new Users concept in envtest to provision a dedicated user for gardener-apiserver and a valid kubeconfig - Make use of the new way to configure API server args to easily configure kube-aggregator flags - Also generate certs for aggregation layer on our own instead of reusing the API server ca/certs (which is semantically correct), which allows us to drop our fork including kubernetes-sigs/controller-runtime#1449 * Styling nits
When we introduced the ClientBuilder we lost the ability to easily
overwrite the NewClient func, as interfaces can not be implemented
inline. This change reverts us back to using a NewClientFunc but with a
slightly changed signature so objects that should not be cached can
still be configured. In order to not provide two ways to do the same
thing, the ClientBuilder is removed