-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add leaf node remotes config #284
Conversation
pkg/apis/nats/v1alpha2/cluster.go
Outdated
@@ -201,9 +201,16 @@ type RemoteGatewayOpts struct { | |||
URL string `json:"url,omitempty"` | |||
} | |||
|
|||
// LeafNodeRemote is the URL for remote NATS system. | |||
type LeafNodeRemote struct { | |||
URL string `json:"url,omitempty"` |
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 think we should probably also support the array version:
URL []string `json:"urls,omitempty"`
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.
Is this possible NATS config?
leafnodes {
remotes = [
{
url: ["nats-leaf://s3cr3t@foo", "nats-leaf://s3cr3t@bar"]
},
]
}
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.
yes also possible
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.
Ah, okay. Sounds good. 👍
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.
both these are valid:
leafnodes {
remotes = [
{
url: "nats-leaf://s3cr3t@foo,nats-leaf://s3cr3t@bar"
},
]
}
array version:
leafnodes {
remotes = [
{
urls: ["nats-leaf://s3cr3t@foo", "nats-leaf://s3cr3t@bar"]
},
]
}
|
||
leafnodeConfig: | ||
remotes: | ||
- url: nats://1.2.3.4:7422 |
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.
url
can be many comma separated, but can also be an array urls: ["nats://...", "nats://..."]
can be common in case to explicit about the clusters
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! Might be good to have support for array version of the remotes too, also we need to add the option for remote leafnode TLS certs and the volume in a similar way as it is done here with the credentials.
8bf6679
to
303b67d
Compare
303b67d
to
fafdb24
Compare
Okay, so looks like the controller code generator doesn't like if we use However, I exposed two keys in the YAML, so this is possible. leafnodeConfig:
remotes:
- url: nats://1.2.3.4:7422
credentials: /etc/nats-creds/user.ncreds
# and
leafnodeConfig:
remotes:
- urls: [nats://1.2.3.4:7422, nats://1.2.3.4:7423]
credentials: /etc/nats-creds/user.ncreds
# and technically even this
leafnodeConfig:
remotes:
- url: nats://1.2.3.4:7422
urls: [nats://1.2.3.4:7422, nats://1.2.3.4:7423]
credentials: /etc/nats-creds/user.ncreds
# in the above case, all of the URLs get combined into 1 array of URLs All combinations of these URL keys get merged into this.
Change: fafdb24 |
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!
Question for you all, when I start my nats servers I should see some connection logs about the leaf nodes connecting? Is there a way to verify the connections? |
Yeah, you should see something like this.
Source: https://docs.nats.io/nats-server/configuration/leafnodes |
Currently, there is no way to specify leaf node remotes. This adds config
support for leaf node remotes and also includes some example YAML to deploy on
Kubernetes.
Fixes #280