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
Close leafnode connection when same cluster name detected #3232
Conversation
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, some tests fail due to usage of DefaultOptions
@@ -1262,6 +1262,7 @@ func TestLeafNodePermissions(t *testing.T) {
u, _ := url.Parse(fmt.Sprintf("nats://%s:%d", lo1.LeafNode.Host, lo1.LeafNode.Port))
lo2 := DefaultOptions()
+ lo2.Cluster.Name = "cde"
lo2.LeafNode.ReconnectInterval = 5 * time.Millisecond
lo2.LeafNode.connDelay = 100 * time.Millisecond
lo2.LeafNode.Remotes = []*RemoteLeafOpts{
@@ -1405,6 +1406,7 @@ func TestLeafNodePermissionsConcurrentAccess(t *testing.T) {
u, _ := url.Parse(fmt.Sprintf("nats://%s:%d", lo1.LeafNode.Host, lo1.LeafNode.Port))
lo2 := DefaultOptions()
+ lo2.Cluster.Name = "cde"
lo2.LeafNode.ReconnectInterval = 5 * time.Millisecond
lo2.LeafNode.connDelay = 500 * time.Millisecond
lo2.LeafNode.Remotes = []*RemoteLeafOpts{
@@ -1705,6 +1707,7 @@ func TestLeafNodeTLSVerifyAndMap(t *testing.T) {
} {
t.Run(test.name, func(t *testing.T) {
o := DefaultOptions()
+ o.Cluster.Name = "cde"
o.Accounts = []*Account{acc}
o.LeafNode.Host = "127.0.0.1"
o.LeafNode.Port = -1
@@ -1969,7 +1972,7 @@ func TestLeafNodeOriginClusterInfo(t *testing.T) {
remotes [ { url: "nats://127.0.0.1:%d" } ]
}
cluster {
- name: "abc"
+ name: "cde"
listen: "127.0.0.1:-1"
}
`, hopts.LeafNode.Port)))
@@ -1987,7 +1990,7 @@ func TestLeafNodeOriginClusterInfo(t *testing.T) {
checkLeafNodeConnected(t, s)
l = grabLeaf()
- if rc := l.remoteCluster(); rc != "abc" {
+ if rc := l.remoteCluster(); rc != "cde" {
t.Fatalf("Expected a remote cluster name of \"abc\", got %q", rc)
}
pcid := l.cid
@@ -4101,15 +4104,16 @@ leafnodes:{
test(jsAA, jsLL)
}
5c1bd76
to
c9e59a9
Compare
Fixed test. |
This test seem to fail too, is that the one that was fixed?
|
c9e59a9
to
0993680
Compare
@derekcollison Maybe one more test?
|
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, assuming that we are able to get a green on Travis.
Will squash once green then merge. |
Signed-off-by: Derek Collison <derek@nats.io>
2e02dc3
to
e6479da
Compare
We will need to call this out in release notes warning people before upgrade it might end up splitting their networks and require config changes to fix that |
@ripienaar Added the the "CHANGED" section of the release notes, but noted I will probably a section at the top to point to that one. |
I'm trying to understand the implications of this change on my NATS configuration. I see that "spoke" and "hub" cluster names for leaf clusters must now be unique. However does this mean that if there are multiple "spoke" leaf clusters they all require unique names? Or can leaf clusters have the same name as long as it is different to the "hub" cluster name? Could anyone comment on the motivation for this change? |
@smlx The motivation is that cluster name is required to properly route messages between hub and spoke and with separate leaf clusters but with the same name, the hub would not be able to know where to route messages. |
Ok thanks. So that means every leaf cluster needs a unique name? |
Yes. |
Signed-off-by: Derek Collison derek@nats.io
/cc @nats-io/core