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

Dynamic RPC Server and Node connection map #3721

Merged
merged 5 commits into from
Jan 11, 2018
Merged

Conversation

dadgar
Copy link
Contributor

@dadgar dadgar commented Jan 5, 2018

This PR introduces a dynamic RPC server per connection and adds a mapping between node IDs and connections.

n.ctx.NodeID = args.NodeID
n.srv.addNodeConn(n.ctx)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why only a few endpoints attempt to add a valid connection like this? for e.g why not do the same thing in GetNode?

Copy link
Contributor Author

@dadgar dadgar Jan 10, 2018

Choose a reason for hiding this comment

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

I am only adding it to RPCs that are only ever called by a Nomad node. The mapping should only map connections to clients. So that is why I only added to a few.

nomad/rpc.go Outdated

// Parse the region and role from the TLS certificate
state := tlsConn.ConnectionState()
parts := strings.SplitN(state.ServerName, ".", 3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this name guarenteed to be in this format always?

Copy link
Contributor Author

@dadgar dadgar Jan 11, 2018

Choose a reason for hiding this comment

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

It should be in the case of verifying hostnames but it is a bit brittle. Going to rework

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See newest commit. I store the whole verified chain so we can work with the certificates where needed.

nomad/rpc.go Outdated
state := tlsConn.ConnectionState()
parts := strings.SplitN(state.ServerName, ".", 3)
if len(parts) != 3 || (parts[0] != "server" && parts[0] != "client") || parts[2] != "nomad" {
s.logger.Printf("[WARN] nomad.rpc: invalid server name %q on verified TLS connection", state.ServerName)
Copy link
Contributor

@preetapan preetapan Jan 10, 2018

Choose a reason for hiding this comment

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

This validation is hard to follow, why do we care about parts[2] == "nomad" if we only ever read parts [0] and [1]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@dadgar dadgar force-pushed the f-server-rpc-dynamic branch from 146144a to a495c83 Compare January 11, 2018 01:03
Copy link
Contributor

@preetapan preetapan left a comment

Choose a reason for hiding this comment

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

I didn't see verifiedchains being used anywhere, but that's probably coming in another PR. LGTM

@dadgar dadgar merged this pull request into f-tunnel Jan 11, 2018
@dadgar dadgar deleted the f-server-rpc-dynamic branch January 11, 2018 17:53
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants