Skip to content

Conversation

@boxofrad
Copy link
Contributor

@boxofrad boxofrad commented Sep 8, 2022

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:

@boxofrad boxofrad requested a review from jshahriddhi September 8, 2022 12:46
@boxofrad boxofrad force-pushed the boxofrad/server-connection-lib branch from a98b75c to 1842d2d Compare September 8, 2022 12:48
Base automatically changed from envoy-ads to main September 8, 2022 16:19
@boxofrad boxofrad force-pushed the boxofrad/server-connection-lib branch from 1842d2d to 3e9a358 Compare September 9, 2022 15:47
Copy link
Contributor

@jshahriddhi jshahriddhi left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Copy link

@pglass pglass left a 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
Copy link

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

Copy link
Contributor Author

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 🙇🏻‍♂️

@boxofrad boxofrad force-pushed the boxofrad/server-connection-lib branch from 126c881 to f22826a Compare September 16, 2022 11:15
return err
}
go watcher.Run()
defer watcher.Stop()
Copy link
Contributor

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.

Let me know if I'm missing something @pglass @boxofrad

Copy link

Choose a reason for hiding this comment

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

@boxofrad boxofrad merged commit 92e6e34 into main Sep 21, 2022
@boxofrad boxofrad deleted the boxofrad/server-connection-lib branch September 21, 2022 10:36
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.

4 participants