Skip to content
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 leafnode sys bridge example #49

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add leafnode sys bridge example #49

wants to merge 2 commits into from

Conversation

bruth
Copy link
Collaborator

@bruth bruth commented Aug 17, 2022

@jnmoyne I believe this is what Kevin asked for.. hub user that can bridge the system account in leaf nodes. Here is the output. If you scroll to the bottom the nats server list reports the leaf nodes.

Signed-off-by: Byron Ruth <b@devel.io>
Signed-off-by: Byron Ruth <b@devel.io>
@bruth
Copy link
Collaborator Author

bruth commented Aug 17, 2022

@matthiashanel One follow-up question is that the single ops user in this example is being used for both leaf nodes, rather than a separate one per leaf node. I not sure if this is desirable or there is another way of handling this. Another question I had was regarding an explicit permissions that can/should be set on the ops user.

@bruth
Copy link
Collaborator Author

bruth commented Aug 17, 2022

Just thought of something else.. this is a multi-operator setup, but if the leaf nodes use the same operator, could we instead create separate system accounts per leaf node? (Maybe that was the original, correct idea in the first place).

@bruth
Copy link
Collaborator Author

bruth commented Aug 17, 2022

could we instead create separate system accounts per leaf node?

Nope, that doesn't work. When trying to use a different account in a leaf..

nats-server: system_account in config and operator JWT must be identical

@bruth
Copy link
Collaborator Author

bruth commented Aug 17, 2022

What did work is this kind of config for a leaf in non-operator mode, which makes sense since its a separate auth model for the leaf.

server_name: leaf1
port: 4223
leafnodes: {
  remotes: [
    {
      url: "nats-leaf://0.0.0.0:7422",
      credentials: "path/to/ops.creds",
      account: "$SYS",
    }
  ]
}

accounts: {}

Comment on lines +33 to +34
nsc add user \
--account OPS ops

Choose a reason for hiding this comment

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

is this using the signing key?

# ### Leaf nodes
# Create the operators and system accounts for the leaf nodes.
# No additional accounts or users are required for this example.
nsc add operator \
Copy link

@matthiashanel matthiashanel Aug 18, 2022

Choose a reason for hiding this comment

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

I'm not sure if it helps this example if there is another operator.
Most users have one.

I wonder if for separate operators, ngs could serve as a showcase?

@matthiashanel
Copy link

could we instead create separate system accounts per leaf node?

Nope, that doesn't work. When trying to use a different account in a leaf..

nats-server: system_account in config and operator JWT must be identical

It could work if you clear the system_account from the operator jwt.
But then I'm not sure what that would get us.
Even if you have the same system account, you can always use it with remote credentials pointing to not the system account in the hub.

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.

None yet

2 participants