Is charts-syncer respecting proxy vars?
fadecore opened this issue · 3 comments
Actual behavior
When trying to sync a helm chart repository behind a corporate proxy charts-syncer doesn't seem to be able to reach URLs outside the corporate network through proxy. A curl in the same environment works.
bash-5.1$ curl https://okgolove.github.io/helm-charts/index.yaml | tail -n 10
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 26041 100 26041 0 0 414k 0 --:--:-- --:--:-- --:--:-- 416k
maintainers:
- email: okgolove@markeloff.net
name: okgolove
name: kuttle
sources:
- https://github.com/kayrus/kuttle
urls:
- kuttle/kuttle-1.0.0.tgz
version: 1.0.0
generated: "2020-11-09T13:29:11.65598505Z"
bash-5.1$ charts-syncer sync -v 5 --insecure
I0427 12:10:55.435184 277 sync.go:49] Looking for the default config charts-syncer.yaml
I0427 12:10:55.435972 277 config.go:37] 'source.repo.chartsIndex' property is empty. Using "okgolove.github.io//helm-charts/charts-index:latest" default value
I0427 12:10:55.436050 277 syncer.go:124] Using workdir: "/home/charts-syncer/.charts-syncer"
I0427 12:10:55.436082 277 cache.go:38] Allocating cache dir: "/home/charts-syncer/.charts-syncer/f159deb9f82e191349cc9ee7004b4d997290fbe7"
I0427 12:10:55.436119 277 helmclassic.go:48] [52a007c307b4a1268b8f36dcf6c72d97caf48297] GET "https://okgolove.github.io/helm-charts/index.yaml"
Error: reloading "https://okgolove.github.io/helm-charts" chart repo: fetching index.yaml: Get "https://okgolove.github.io/helm-charts/index.yaml": dial tcp 185.199.111.153:443: connect: connection timed out
Expected behavior
Environment variables for setting proxies should be respected.
To Reproduce
Proxy variables used:
bash-5.1$ printenv | grep -i proxy
https_proxy=example.com:8080
http_proxy=example.com:8080
HTTPS_PROXY=example.com:8080
HTTP_PROXY=example.com:8080
example part of charts-syncer.yaml:
source:
repo:
kind: CHARTMUSEUM
url: https://okgolove.github.io/helm-charts # local test source repo
...
I did some investigation in the code, but have to admit that I am not a developer.
I compared the code with the original helm project, that is respecting the proxy envs. (https://github.com/helm/helm/blob/main/pkg/getter/httpgetter.go)
The import of "net/http" already supports proxy vars extraction, so I would assume you can "coppy&paste" the code from helm and add it to charts-syncer.
The result is here: https://github.com/fadecore/charts-syncer/pull/1/files
What would be cool: Some Dev that can take a look, if it is that simple and test&release.
Looking forward hearing from someone :)