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

Ability for keda-operator to connect out using proxy server #2577

Closed
wltbenade opened this issue Jan 28, 2022 · 3 comments · Fixed by #2821
Closed

Ability for keda-operator to connect out using proxy server #2577

wltbenade opened this issue Jan 28, 2022 · 3 comments · Fixed by #2821
Labels
feature-request All issues for new features that have not been committed to needs-discussion

Comments

@wltbenade
Copy link
Contributor

wltbenade commented Jan 28, 2022

Proposal

Currently, there doesn't seem to be any mechanism to allow the keda-operator to connect out using a proxy server, rendering it impossible to connect to external services to pull metric data.

I've tried to set HTTP_PROXY, HTTPS_PROXY, as well as their lowercase counterparts, without result.

It would be highly beneficial to have the operator able to connect to external services using either environment variables, or an explicitly defined proxy definition.

Use-Case

We utilise KEDA's Azure Pipelines scaler in on-prem clusters, which requires all external access to be routed via proxies, including Azure DevOps.

First prize would be to be able to set proxy URL, username, password via environment variables via the helm chart values.

Anything else?

Golang's http package can read proxy variables from the environment using the http.ProxyFromEnvironment(req) function. I just don't know where it should be implemented to make the most sense.

@wltbenade wltbenade added feature-request All issues for new features that have not been committed to needs-discussion labels Jan 28, 2022
@racdev
Copy link

racdev commented Feb 15, 2022

I think all that is required here is to add the following:
Proxy: http.ProxyFromEnvironment
to the Transport definition here: https://github.com/kedacore/keda/blob/main/pkg/util/http.go#L42 i.e.

httpClient := &http.Client{
		Timeout: timeout,
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: unsafeSsl},
                        Proxy: http.ProxyFromEnvironment,
		},
	}

@wltbenade
Copy link
Contributor Author

Thanks, @racdev. I'm not a developer, so I didn't want to take the chance.

I'll try this locally to see if it works, then submit a PR.

@anton-dealmeida
Copy link

Thanks @racdev!

wltbenade added a commit to wltbenade/keda that referenced this issue Mar 25, 2022
This patch addresses kedacore#2577

Simple implementation to allow the HTTPClient to read proxy variables, if available, from the environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request All issues for new features that have not been committed to needs-discussion
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants