-
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
Change behaviour gateway addressess override in Link command #11564
Conversation
When linking two clusters, a `--gateway-addresses` override can be passed to the command. If applied, the override populates the Link resource with a set of addresses received from the flag, instead of reading them from Linkerd's Gateway LoadBalancer service. Currently, the override is used only when the LoadBalancer service does not exist (or does not contain any IPs). An override should take precedence over default behaviour. As it stands, the user experience is confusing; it can also make manual testing for changes hard (when an override has to be passed) and it can inhibit users from passing in a static IP or DNS addresses to avoid relying on dynamic IPs in the LoadBalancer service. This change makes the override behave as expected. Signed-off-by: Matei David <[email protected]>
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.
How about making this extra-clearer by extracting this logic into a helper function func getGatewayAddresses(gateway *corev1.Service, opts *linkOptions) (string, error)
which would immediately return opts.gatewayAddresses
if not empty, followed by the other conditions that no longer have to take into account that option?
@alpeb sure! Think there's potential for a clean up here and the suggestion sounds good 👍🏻 |
multicluster/cmd/link.go
Outdated
@@ -247,7 +247,7 @@ A full list of configurable values can be found at https://github.com/linkerd/li | |||
if len(gwAddresses) == 0 && opts.gatewayAddresses == "" { |
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.
an alternative way to structure this for clarity:
if opts.gatewayAddresses != "" {
gatewayAddresses = opts.gatewayAddresses
} else if len(gwAddresses) > 0 {
gatewayAddresses = strings.Join(gwAddresses, ",")
} else {
return fmt.Errorf(...)
}
This condenses the error handling and gateway population into the same if-else block and makes the prescience clearer: opt then LB then error.
Signed-off-by: Matei David <[email protected]>
Thanks both. Tried a few things, including extracting some of the logic into a separate function. In the end, took Alex's suggestion since it's a relatively simple conditional. Took it a bit further and eliminated
|
This edge release fixes a bug where Linkerd could cause EOF errors during bursts of TCP connections. * Fixed a bug where the `linkerd multicluster link` command's `--gateway-addresses` flag was not respected when a remote gateway exists ([#11564]) * proxy: Increased DEFAULT_OUTBOUND_TCP_QUEUE_CAPACITY to prevent EOF errors during bursts of TCP connections [#11564]: #11564 Signed-off-by: Alex Leong <[email protected]>
When linking two clusters, a
--gateway-addresses
override can be passed to the command. If applied, the override populates the Link resource with a set of addresses received from the flag, instead of reading them from Linkerd's Gateway LoadBalancer service. Currently, the override is used only when the LoadBalancer service does not exist (or does not contain any IPs).An override should take precedence over default behaviour. As it stands, the user experience is confusing; it can also make manual testing for changes hard (when an override has to be passed) and it can inhibit users from passing in a static IP or DNS addresses to avoid relying on dynamic IPs in the LoadBalancer service.
This change makes the override behave as expected.
Manual QA
Before:
After: