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

Use custom gRPC dialer to override default proxy dialer #2802

Merged
merged 1 commit into from
Mar 5, 2019

Conversation

dani-docker
Copy link
Contributor

Signed-off-by: Dani Louca dani.louca@docker.com

- What I did
Followed the same logic as in #2419 to use a custom grpc dialer and prevent the use of default dialer which picks up the proxy env variable when a manager is joining the cluster.
The affected method dial is only used when manager is joining the cluster and part of checkHealth which is also called on join.

- How to test it

Actual Result:

[centos@esc-1003-1 ~]$ docker swarm join --token SWMTKN-1-2v3cay35o2yavb2bqge6wvyhg6esdn47g82ydi534npgcd4cym-4rmvy3uo2acmbenjvmf8tkx52 10.10.13.91:2377
Error response from daemon: manager stopped: can't initialize raft node: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp: lookup proxy.example.com on 10.10.0.2:53: no such host"

Expected Result (with this PR):
Node joins successfully

[root@esc-1003-1 ~]# docker swarm join --token SWMTKN-1-2v3cay35o2yavb2bqge6wvyhg6esdn47g82ydi534npgcd4cym-4rmvy3uo2acmbenjvmf8tkx52 10.10.13.91:2377
This node joined a swarm as a manager.

- Description for the changelog
Fix manager node join when HTTP_PROXY, HTTPS_PROXY, or NO_PROXY are used

@dani-docker
Copy link
Contributor Author

cc: @anshulpundir @dperny

@dperny
Copy link
Collaborator

dperny commented Jan 8, 2019

LGTM. Pretty sure the test failure is known so I'm rebuilding.

@thaJeztah
Copy link
Member

Should we have an integration test for this that set an invalid domain (HTTPS_PROXY=myproxy.invalid) as a proxy, then tries to join?

@thaJeztah
Copy link
Member

Looks like this is related to moby/moby#36951 and moby/moby#35395 (comment)

@trapier
Copy link

trapier commented Feb 9, 2019

We still waiting on CI here? Current failure doesn't look related.

@thaJeztah
Copy link
Member

Not a maintainer here, but ideally;

I prepared backports, but those will have to be updated if this PR is updated before it's merged

I also triggered CI, but it's now failing on

gometalinter: error: unknown linters: gosimple
make: *** [check] Error 1
Exited with code 2

which should be fixed by #2811 after rebasing this PR

@wk8
Copy link
Contributor

wk8 commented Feb 13, 2019

Agreed an integration test would be great :)

@anshulpundir
Copy link
Contributor

+1 for #2802 (comment)

@thaJeztah
Copy link
Member

ping @dani-docker can you address the review comments?

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "esc-1003" git@github.com:dani-docker/swarmkit.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842357316928
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

Signed-off-by: Dani Louca <dani.louca@docker.com>
@dani-docker dani-docker changed the title use a custom grpc dialer to avoid proxy Use custom gRPC dialer to override default proxy dialer Mar 4, 2019
@dani-docker
Copy link
Contributor Author

@thaJeztah
I rebased and updated the comment as requested.
As for the test case, this issue completes the fix in #2419 which is also missing a test, I will look into a test shortly

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

Discussing on slack; the tricky bit with writing a test for this, is that Golang won't use a proxy for local IP-addresses, so there's some work needed to write a test for this.

The change has been manually tests, and works, so I'm ok with going ahead for now and do a test as follow-up

@codecov
Copy link

codecov bot commented Mar 5, 2019

Codecov Report

Merging #2802 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2802      +/-   ##
==========================================
+ Coverage   62.12%   62.16%   +0.03%     
==========================================
  Files         139      139              
  Lines       22294    22297       +3     
==========================================
+ Hits        13851    13861      +10     
+ Misses       6973     6964       -9     
- Partials     1470     1472       +2

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.

7 participants