Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Fix syncing cache behind HTTP proxy #326

Merged

Conversation

AlexanderEkdahl
Copy link
Contributor

This mimics the default RoundTripper and it uses http.ProxyFromEnvironment as directed by the $HTTP_PROXY and $NO_PROXY (or $http_proxy and $no_proxy) environment variables. This allows the Transport to work behind a proxy.

See https://golang.org/pkg/net/http/#Transport and https://golang.org/pkg/net/http/#RoundTripper for more details.

I assume registering custom protocol is due to internal requirements as it is not necessary when downloading files from GitHub.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@kubeflow-bot
Copy link

This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @AlexanderEkdahl. Thanks for your PR.

I'm waiting for a kubeflow 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.

@AlexanderEkdahl
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@kkasravi
Copy link
Contributor

kkasravi commented May 6, 2020

/ok-to-test

@@ -516,7 +516,9 @@ func (c *KfConfig) SyncCache() error {
return errors.WithStack(err)
}
} else {
t := &http.Transport{}
t := &http.Transport{
Proxy: http.ProxyFromEnvironment,
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to provide a test for this?

Copy link
Contributor Author

@AlexanderEkdahl AlexanderEkdahl May 10, 2020

Choose a reason for hiding this comment

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

This can certainly be tested and the behavior is tested in detail here: https://github.com/golang/net/blob/master/http/httpproxy/proxy_test.go. However, I don't think it is valuable to test this in kfctl as it introduces undue maintenance burden on the kfctl developers.

Using http.ProxyFromEnvironment is the default behavior for all HTTP request in Go(link) and this PR simply ensures the same behavior as the transport happens to be overridden in kfctl.

@linkvt
Copy link

linkvt commented Jun 4, 2020

Hi @kkasravi , could you please check again if this PR can be merged?
Proxy support is a really important feature for everyone behind a corporate proxy as this requires currently workarounds that almost no other tool needs, as practically everything supports proxies - and this change seems really minor.
Thanks

@Jeffwan
Copy link
Member

Jeffwan commented Aug 27, 2020

/retest

@k8s-ci-robot
Copy link
Contributor

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

Test name Commit Details Rerun command
kubeflow-kfctl-presubmit 177ca0d link /test kubeflow-kfctl-presubmit

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.

@AlexanderEkdahl
Copy link
Contributor Author

@Jeffwan I can't make sense of the apparent test failure. From what I can tell all of the tests passed?

@PatrickXYS
Copy link
Member

@AlexanderEkdahl

Can you rebase and run tests?

@PatrickXYS
Copy link
Member

/test ?

@aws-kf-ci-bot
Copy link

@PatrickXYS: The following commands are available to trigger jobs:

  • /test kubeflow-kfctl-presubmit-e2e

Use /test all to run all jobs.

In response to this:

/test ?

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

@PatrickXYS: No presubmit jobs available for kubeflow/kfctl@master

In response to this:

/test ?

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.

@Jeffwan
Copy link
Member

Jeffwan commented Nov 4, 2020

/lgtm
/approve

Thanks for the contribution

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AlexanderEkdahl, Jeffwan

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 merged commit cee16ff into kubeflow:master Nov 4, 2020
daha pushed a commit to daha/opendatahub-operator that referenced this pull request Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants