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

⚠️ make *http.Client configurable and use/ share the same http.Client in the default configuration #2122

Merged

Conversation

inteon
Copy link
Member

@inteon inteon commented Jan 8, 2023

client-go has all these fancy NewForConfigAndClient constructor functions.
Let's expose this functionality to the controller-runtime user too & reduce the number of different http.Clients that we use.

In kubernetes/kubernetes#105490, the decision for making http.Client configurable is explained: "when using a custom transport, this has the consequence that each group/version had an independent TCP connection to the API server"
By re-using the same http client for all the clients, we can share customized transports, resulting in no additional TCP connections (see https://github.com/kubernetes/kubernetes/blob/5681b0da14f11165fc53ad82a3400fd027979fc4/test/integration/apiserver/apiserver_test.go#L2517-L2574 for an example)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 8, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @inteon. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 8, 2023
pkg/cache/cache.go Outdated Show resolved Hide resolved
pkg/client/client.go Outdated Show resolved Hide resolved
pkg/client/watch.go Outdated Show resolved Hide resolved
pkg/cache/cache.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 17, 2023
@inteon inteon force-pushed the configurable_http_client branch from d5ec191 to 95f906e Compare January 17, 2023 18:49
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 17, 2023
@vincepri
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 17, 2023
@inteon inteon force-pushed the configurable_http_client branch 2 times, most recently from 4cd6e24 to e424441 Compare January 18, 2023 09:26
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 18, 2023
@inteon inteon force-pushed the configurable_http_client branch from e424441 to 27aec77 Compare January 23, 2023 09:26
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 23, 2023
pkg/cache/cache.go Outdated Show resolved Hide resolved
pkg/client/apiutil/apimachinery.go Outdated Show resolved Hide resolved
pkg/client/apiutil/apimachinery.go Outdated Show resolved Hide resolved
pkg/cluster/cluster.go Show resolved Hide resolved
@inteon inteon force-pushed the configurable_http_client branch from 27aec77 to 409b067 Compare January 24, 2023 08:40
pkg/client/apiutil/apimachinery.go Show resolved Hide resolved
pkg/client/apiutil/dynamicrestmapper.go Show resolved Hide resolved
pkg/client/client.go Show resolved Hide resolved
pkg/client/watch.go Outdated Show resolved Hide resolved
pkg/cluster/cluster.go Show resolved Hide resolved
pkg/cache/cache.go Show resolved Hide resolved
@inteon inteon force-pushed the configurable_http_client branch from 7f24212 to 4fd4f6e Compare January 31, 2023 08:50
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2023
@sbueringer
Copy link
Member

Thx!

/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 31, 2023
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

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 31, 2023
@vincepri
Copy link
Member

/retest

1 similar comment
@vincepri
Copy link
Member

/retest

lyarwood added a commit to lyarwood/ssp-operator that referenced this pull request Jun 26, 2023
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0

* Make `*http.Client` configurable and use/share the same client by
  default kubernetes-sigs/controller-runtime#2122

* Remove dependency injection functions
  kubernetes-sigs/controller-runtime#2134,
  kubernetes-sigs/controller-runtime#2120

* Add context to EventHandler(s)
  kubernetes-sigs/controller-runtime#2139

* `Validator` and `CustomValidator` interfaces have been modified to
  allow returning warnings
  kubernetes-sigs/controller-runtime#2014

* operator-framework is also pinned to ecb9be48837 until a new release
  is cut supporting controller-runtime v0.15.0

Signed-off-by: Lee Yarwood <[email protected]>
ary1992 added a commit to ary1992/gardener that referenced this pull request Jun 28, 2023
lyarwood added a commit to lyarwood/ssp-operator that referenced this pull request Jun 28, 2023
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0

* Make `*http.Client` configurable and use/share the same client by
  default kubernetes-sigs/controller-runtime#2122

* Remove dependency injection functions
  kubernetes-sigs/controller-runtime#2134,
  kubernetes-sigs/controller-runtime#2120

* Add context to EventHandler(s)
  kubernetes-sigs/controller-runtime#2139

* `Validator` and `CustomValidator` interfaces have been modified to
  allow returning warnings
  kubernetes-sigs/controller-runtime#2014

* operator-framework is also pinned to ecb9be48837 until a new release
  is cut supporting controller-runtime v0.15.0

Signed-off-by: Lee Yarwood <[email protected]>
takirala added a commit to mesosphere/kubefed that referenced this pull request Aug 3, 2023
lyarwood added a commit to lyarwood/ssp-operator that referenced this pull request Aug 9, 2023
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0

* Make `*http.Client` configurable and use/share the same client by
  default kubernetes-sigs/controller-runtime#2122

* Remove dependency injection functions
  kubernetes-sigs/controller-runtime#2134,
  kubernetes-sigs/controller-runtime#2120

* Add context to EventHandler(s)
  kubernetes-sigs/controller-runtime#2139

* `Validator` and `CustomValidator` interfaces have been modified to
  allow returning warnings
  kubernetes-sigs/controller-runtime#2014

* operator-framework is also pinned to ecb9be48837 until a new release
  is cut supporting controller-runtime v0.15.0

Signed-off-by: Lee Yarwood <[email protected]>
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants