-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Reload Typha addresses between connection attempts. #7176
Conversation
2bcfe6b
to
841bd24
Compare
48ec750
to
8964e13
Compare
@@ -21,53 +21,128 @@ import ( | |||
) | |||
|
|||
type Interface interface { | |||
NodesClient |
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 split out these smaller interfaces to make mocking easier. Then I refactored the code and I didn't need to mock the NodeClient any more. Nevertheless, it seemed like a good idea to make mocking easier in future...
Rework Typha discovery: - Extract out a Discoverer object to keep track of state. - Replace loop over slice of Typhas with an object that handles refreshing the list of Typhas.
8964e13
to
5508fb5
Compare
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 good to me! The integration with the existing bootstrap for WireGuard has been done quite nicely. There shouldn't be any concern if the post-filter discovery function ends up calling bootstrap (that will remove WireGuard config) more than once.
typha/pkg/syncclient/sync_client.go
Outdated
|
||
// Defensive: set a sanity limit in case NextAddr() keeps finding new Typha addresses. | ||
maxTries := len(s.discoverer.CachedTyphaAddrs()) * 2 | ||
if maxTries < 6 { |
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.
nit: 6 seems to be a reasonable number given we typically see 3 typhas.. I guess we could explain why it's currently 6 in a comment? and maybe making this configurable is going to be overkill, too
Description
Rework Typha discovery to avoid a long timeout if we happen to race with a Typha upgrade. Previously we could:
This change makes sure that we reload the list of Typhas between calls:
Related issues/PRs
Todos
Release Note
Reminder for the reviewer
Make sure that this PR has the correct labels and milestone set.
Every PR needs one
docs-*
label.docs-pr-required
: This change requires a change to the documentation that has not been completed yet.docs-completed
: This change has all necessary documentation completed.docs-not-required
: This change has no user-facing impact and requires no docs.Every PR needs one
release-note-*
label.release-note-required
: This PR has user-facing changes. Most PRs should have this label.release-note-not-required
: This PR has no user-facing changes.Other optional labels:
cherry-pick-candidate
: This PR should be cherry-picked to an earlier release. For bug fixes only.needs-operator-pr
: This PR is related to install and requires a corresponding change to the operator.