-
Notifications
You must be signed in to change notification settings - Fork 82
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
Multiple endpoints #880
Multiple endpoints #880
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
log.Debug().Msgf("Listening on %s", addr) | ||
|
||
go func(ctx context.Context, errChan chan error, ln net.Listener) { | ||
if err := server.Serve(ln); err != nil && err != http.ErrServerClosed { |
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.
Should we do direct a direct comparison of the error (err != http.ErrServerClosed
), or use the errors.Is()
method?
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.
you mean replacing err != nil && err != http.ErrServerClosed
with err != http.ErrServerClose
?
if so you might end up with sending nil to a chan
case <-forceCh: | ||
log.Debug().Msg("go routine forced closed on exit") |
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'm a bit confused what the purpose of forceCh
and this message are, does this occur when the server closes with a non context.Cancelled
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.
yeah i'm not really sure why this is here. i understand it closes goroutine with main func but not sure why this was a problem and why this was not addressed with cancel contexts.
not touching this atm
Co-authored-by: Michel Laterman <[email protected]>
This pull request is now in conflicts. Could you fix it @michalpristas? 🙏
|
Multiple endpoints
What is the problem this PR solves?
What this PR solves is a problem when agent got unenrolled on heavier load when agent managing fleet server cannot checkin to it's own server so it will fallback to unenroll.
Closes #741
How does this PR solve the problem?
Problem is solved by adding internal endpoint which is used for communication on local network (with agent handling fleet server)
It lets FS to spin up 2 set of handlers, one on public 8220 and one on port defined in config.
How to test this PR locally
This needs to be tested with work on
elastic-agent
Link: elastic/beats#28993Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.