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

Added support for env *_PROXY variables for agent loadbalancer #9070

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

pierre-az
Copy link
Contributor

Types of Changes

To me, this is a bugfix as the doc specifies we can use these env variables for k3s: https://docs.k3s.io/advanced#configuring-an-http-proxy.
There is also this documentation that may be misleading as it suggests that in addition to proxies, you should open your network to various URLs, which is incompatible: https://docs.k3s.io/installation/requirements#networking.

Verification

You can test the new agent on a airgapped environment, where internet access is only possible through an external proxy.

This was tested in production on such environment on my end.

Testing

There are no linked unit tests as this is the first time I'm working on Go.

Linked Issues

Linked issue is: #8976

User-Facing Change

HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables are now taken into account by the agent loadbalancer if K3S_AGENT_HTTP_PROXY_ALLOWED env variable is set to true.
This however doesn't affect local requests as the function used prevents that: https://pkg.go.dev/net/http#ProxyFromEnvironment. 

Further Comments

As this is a known issue for net.Dialer, this fix is based on another library which can be found on: https://github.com/mwitkow/go-http-dialer

Signed-off-by: Yodo <pierre@azmed.co>
@pierre-az
Copy link
Contributor Author

After destroying accidentally #8982, here's the new PR with requested changes, really sorry about the mess.

Copy link

codecov bot commented Dec 19, 2023

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (7101af3) 46.24% compared to head (f3e29dd) 41.59%.

Files Patch % Lines
pkg/agent/loadbalancer/servers.go 32.35% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9070      +/-   ##
==========================================
- Coverage   46.24%   41.59%   -4.66%     
==========================================
  Files         148      148              
  Lines       15924    15954      +30     
==========================================
- Hits         7364     6636     -728     
- Misses       7374     8185     +811     
+ Partials     1186     1133      -53     
Flag Coverage Δ
e2etests ?
inttests 38.81% <32.35%> (-0.07%) ⬇️
unittests 18.35% <32.35%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dereknola dereknola merged commit bbd68f3 into k3s-io:master Jan 2, 2024
15 checks passed
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 2, 2024
Signed-off-by: Yodo <pierre@azmed.co>
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 2, 2024
Signed-off-by: Yodo <pierre@azmed.co>
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 2, 2024
Signed-off-by: Yodo <pierre@azmed.co>
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 2, 2024
Signed-off-by: Yodo <pierre@azmed.co>
Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 2, 2024
Signed-off-by: Yodo <pierre@azmed.co>
Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 2, 2024
Signed-off-by: Yodo <pierre@azmed.co>
Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 7, 2024
Signed-off-by: Yodo <pierre@azmed.co>
Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola pushed a commit to dereknola/k3s that referenced this pull request Jan 12, 2024
Signed-off-by: Yodo <pierre@azmed.co>
Signed-off-by: Derek Nola <derek.nola@suse.com>
brandond pushed a commit that referenced this pull request Jan 12, 2024
Signed-off-by: Yodo <pierre@azmed.co>
Signed-off-by: Derek Nola <derek.nola@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants