-
Notifications
You must be signed in to change notification settings - Fork 10
Integrate consul-server-connection-manager library #7
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
Conversation
a98b75c to
1842d2d
Compare
1842d2d to
3e9a358
Compare
jshahriddhi
left a comment
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 🎉
pglass
left a comment
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.
👍 a few little things, but looks great!
go.mod
Outdated
| github.com/golang/protobuf v1.5.2 // indirect | ||
| github.com/google/go-cmp v0.5.8 // indirect | ||
| github.com/google/uuid v1.1.2 // indirect | ||
| github.com/hashicorp/consul-server-connection-manager v0.0.0-20220908112242-b9f43f15d156 // indirect |
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.
merged some code and (per your PR suggestion) if you bump consul-server-connection-manager the uuid dependency will go away
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.
Nice! Will wait until the login stuff is merged 🙇🏻♂️
126c881 to
f22826a
Compare
| return err | ||
| } | ||
| go watcher.Run() | ||
| defer watcher.Stop() |
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.
One thing I found in my testing is to make sure that Stop is called when the ctx used by Watcher is not yet canceled because otherwise Logout call will fail.
For example, this ctx is passed in from main I believe and the cancel function for it gets called when an Interrupt signal is received. Let's say an interrupt signal is received and we cancel the context from main. In that case, we'll fall into case <-ctx.Done() below and this defer will be called after the for-select loop exits. At this point, the context will be already canceled and so logout will fail.
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.
Discussion/fix here: hashicorp/consul-server-connection-manager#9 (comment)
This PR swaps out the direct use of go-netaddrs for Consul server discovery with the new consul-server-connection manager library, which consumes streaming server health updates via gRPC and also handles feature negotiation, authentication, TLS, and reconnecting when a Consul server terminates the stream to rebalance load.
It depends on the following unmerged PRs: