-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add advertise_addrs. #1004
Add advertise_addrs. #1004
Conversation
base.SerfWANConfig.MemberlistConfig.AdvertiseAddr = addr.IP.String() | ||
base.SerfWANConfig.MemberlistConfig.AdvertisePort = addr.Port | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of printing a message for both of the above and allowing Consul to start even with a bad advertise address specified in its config, can we store the *net.TCPAddr
s in the AdvertiseAddrs struct and parse the address while we are decoding? This would also make a config merge pretty easy for these fields. We do a similar thing with parsing time values.
Hey @i0rek, I took a quick look through what you have so far and I think you're on the right track. We are missing a few things. See my comment above. We will also need to add the new config fields to the |
Thank you very much for the suggestions @ryanuber! I will take care of them beginning next week. |
@ryanuber I think I added everything you suggested. Still have to test it though. |
addr, err := net.ResolveTCPAddr("tcp", result.AdvertiseAddrs.SerfLanRaw) | ||
if err != nil { | ||
return nil, fmt.Errorf("AdvertiseAddrs.SerfLan is invalid: %v", err) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit-pick but let's drop these else
statements, since we already return in the error path above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, I should've paid more attention to the other code.
@i0rek this is looking good. Ping me when you feel it is complete and I'll give it another once-over! |
In theory this could be necessary for CLI RPC, HTTP API and DNS Interface too. What do you think? When any of the above available from the outside it would be good to include them in the |
Ok, it works fine for our usecase. Which is letting consul run in two containers on one host, connecting to a remote server. This is the configuration I used:
I don't think RPC works yet, but I could add that afterwards.
|
@ryanuber I added RPC to the mix, because that was missing. I also added a little bit of documentation, not sure how you handle that. I was planning to rebase a last time after you looked at it so that you have a nice commit you can merge. I am not sure how you handle that either. |
} | ||
if b.AdvertiseAddrs.RPC != nil { | ||
result.AdvertiseAddrs.RPC = b.AdvertiseAddrs.RPC | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we are missing tests for this. Let's definitely make sure this is tested.
@i0rek this looks good, just some minor notes about test coverage but overall this is really close! The documentation looks right. Also, no need to rebase this, since it can be cleanly applied against master in its current state. |
Thanks for the review @ryanuber. I added the tests. |
Great! Will review again soon! On June 13, 2015 3:40:35 PM PDT, Hans Hasselberg notifications@github.com wrote:
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
When I said rebasing, I meant squashing. I couldn't resist. |
I added tests to agent_test to make sure the configured values are used. |
@ryanuber any progress on this? Seems ready to merge to me. Thanks |
@@ -322,6 +322,16 @@ definitions support being updated during a reload. | |||
* <a name="advertise_addr"></a><a href="#advertise_addr">`advertise_addr`</a> Equivalent to | |||
the [`-advertise` command-line flag](#_advertise). | |||
|
|||
* <a name="advertise_addrs"></a><a href="#advertise_addrs">`advertise_addrs`</a> Allows to set | |||
the advertised addresses for SerfLan, SerfLan and RPC together with the port. This gives |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we meant for this to be SerfLan, SerfWan, and RPC
?
@i0rek sorry for the delay! It's been busy. Left a super-minor comment but otherwise let's get this merged. Great work! |
Fixes #550. This will make it possible to configure the advertised adresses for SerfLan, SerfWan and RPC. It will enable multiple consul clients on a single host which is very useful in a container environment. This option might override advertise_addr and advertise_addr_wan depending on the configuration. It will be configureable with advertise_addrs. Example: { "advertise_addrs": { "serf_lan": "10.0.120.91:4424", "serf_wan": "201.20.10.61:4423", "rpc": "10.20.10.61:4424" } }
@ryanuber no worries. I changed the typo! |
LGTM, thanks again! |
BIG props!!! 👍 |
❤️ |
Fixes #550.
This will make it possible to configure the advertised adresses for SerfLan, SerfWan and RPC. It will enable multiple consul clients on a single host which is very useful in a container environment.
This option might override
advertise_addr
andadvertise_addr_wan
depending on the configuration.It will be configureable with
advertise_addrs
. Example: