-
Notifications
You must be signed in to change notification settings - Fork 2k
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
agent: support multiple http address in addresses.http #11582
Conversation
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.
Hi @kevinschoonover! Thanks for this PR -- this is looking really good! I've left a few comments in command/agent/http.go
where I think it'd be good to see what's safe to reuse across listeners.
Hoping to get some feedback if this is the approach that should be take or something like consul is doing by abstracting the servers into apiserver.go.
Nomad's has a bit of a stronger difference in the RPC server between servers and clients than Consul does, so I think trying to abstract it the way they've done would probably be more trouble than it's worth (especially at this point in time). The approach you've got here works fine for HTTP. I think RPC is going to prove to be more complicated if we try to do that.
Hey @tgross, anything left pending for me on this PR that I can help address? |
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.
Hi @kevinschoonover! I think I missed one last item and that should get this into good shape.
command/agent/http.go
Outdated
srv.registerHandlers(config.EnableDebug) | ||
// NewHTTPServers starts an HTTP server for every address.http configured in | ||
// the agent. | ||
func NewHTTPServers(agent *Agent, config *Config) ([]HTTPServer, error) { |
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.
Sorry, I think I missed this in the first pass, but we'll want this to return a slice of pointers (ex []*HTTPServer
) so that we're not changing the semantics of mutability on the servers. See https://play.golang.com/p/JzckJ_BBiXb as an example of why.
creates multiple http server but doesn't handle cleanup / refresh. See TODOs for more details.
45e3ce2
to
3e5169f
Compare
@tgross should be good now and I reran the tests and everything looks good. One thing I did notice is that when I ran the
but I also see that on master so I think its unrelated to the changes. |
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.
LGTM! Thanks @kevinschoonover!
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
naive partial support for #9257 (HTTP addresses only) by creating a
http.Server
for every space-seperated address defined inaddresses.http
. Example:Hoping to get some feedback if this is the approach that should be take or something like consul is doing by abstracting the servers into apiserver.go. There are also one or two TODOs I am not sure the best approach to take.