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

⚠️ Allow setting NewClientFunc w/o implementing an interface #1409

Merged
merged 1 commit into from
Mar 11, 2021

Conversation

alvaroaleman
Copy link
Member

@alvaroaleman alvaroaleman commented Mar 3, 2021

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 3, 2021
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 3, 2021
@alvaroaleman alvaroaleman changed the title ✨ Allow setting NewClientFunc w/o re-implementing ClientBuilder ⚠️ Allow setting NewClientFunc w/o re-implementing ClientBuilder Mar 3, 2021
@alvaroaleman alvaroaleman force-pushed the allow-new-client branch 2 times, most recently from 35578a3 to ded66c7 Compare March 3, 2021 20:12
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.
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 11, 2021
@alvaroaleman alvaroaleman changed the title ⚠️ Allow setting NewClientFunc w/o re-implementing ClientBuilder ⚠️ Allow setting NewClientFunc w/o implementing an interface Mar 11, 2021
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2021
@k8s-ci-robot
Copy link
Contributor

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

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

@vincepri
Copy link
Member

/retest

1 similar comment
@alvaroaleman
Copy link
Member Author

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Mar 11, 2021

@alvaroaleman: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-apidiff-master aa1bfee link /test pull-controller-runtime-apidiff-master

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) {
Copy link
Contributor

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

milas added a commit to tilt-dev/tilt that referenced this pull request Jun 8, 2021
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)
milas added a commit to tilt-dev/tilt that referenced this pull request Jun 8, 2021
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)
milas added a commit to tilt-dev/tilt that referenced this pull request Jun 9, 2021
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)
landism pushed a commit to tilt-dev/tilt that referenced this pull request Jun 9, 2021
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)
timebertt added a commit to gardener/gardener that referenced this pull request Jun 16, 2021
* 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
krgostev pushed a commit to krgostev/gardener that referenced this pull request Apr 21, 2022
* 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
krgostev pushed a commit to krgostev/gardener that referenced this pull request Jul 5, 2022
* 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
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

4 participants