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

connect: simplify the compiled discovery chain data structures #6242

Merged
merged 1 commit into from
Aug 2, 2019

Conversation

rboyer
Copy link
Member

@rboyer rboyer commented Jul 30, 2019

This should make them better for sending over RPC or the API.

Instead of a chain implemented explicitly like a linked list (nodes
holding pointers to other nodes) instead switch to a flat map of named
nodes with nodes linking other other nodes by name. The shipped
structure is just a map and a string to indicate which key to start
from.

Other changes:

  • inline the compiler option InferDefaults as true

  • introduce compiled target config to avoid needing to send back
    additional maps of Resolvers; future target-specific compiled state
    can go here

  • move compiled MeshGateway out of the Resolver and into the
    TargetConfig where it makes more sense.

@rboyer rboyer added the theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies label Jul 30, 2019
@rboyer rboyer added this to the 1.6.0-rc1 milestone Jul 30, 2019
@rboyer rboyer requested a review from a team July 30, 2019 16:44
@rboyer rboyer self-assigned this Jul 30, 2019
Copy link
Member

@banks banks left a comment

Choose a reason for hiding this comment

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

LGTM other than some minor bikeshedding.

var buf bytes.Buffer
buf.WriteString(url.QueryEscape(t.Service))
buf.WriteRune(',')
buf.WriteString(url.QueryEscape(t.ServiceSubset))
buf.WriteString(url.QueryEscape(t.ServiceSubset)) // TODO(rb): move this first so the scoping flows from small->large?
Copy link
Member

Choose a reason for hiding this comment

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

If this is empty we end up with something like web,,dc1 or web,,namespace,dc1. Is there a reason to make namespace be optional but not subset? I'd expect subset empty to be 99.9% of cases.

Is there an argument to format this as subset.name.namespace.dc to match SNI or reverse that to match natural precedence dc/namespace/name/subset or something?

All bikesheds as none really affect the behaviour just seems we should do one that makes sense. Is there a specific reason it's URI encoded?

Copy link
Member Author

Choose a reason for hiding this comment

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

The query encoding was because I wasn't entirely sure what was and was not a reserved character for 3 of the 4 components (I know I validated subsets).

This encoding predates the bulk envoy naming SNI changes. And given no escaping happens there already then there's no point of escaping stuff here. I actually was thinking of switching the DiscoveryTarget marshalling over to the SNI variant already.

Copy link
Member Author

Choose a reason for hiding this comment

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

Going to handle this in #6248 instead.

@rboyer rboyer force-pushed the simplifed-compiled-discovery-chain branch from 5b246f0 to f66c962 Compare August 1, 2019 19:14
@rboyer rboyer changed the base branch from upstreams-in-chain to release/1-6 August 2, 2019 03:11
This should make them better for sending over RPC or the API.

Instead of a chain implemented explicitly like a linked list (nodes
holding pointers to other nodes) instead switch to a flat map of named
nodes with nodes linking other other nodes by name. The shipped
structure is just a map and a string to indicate which key to start
from.

Other changes:

* inline the compiler option InferDefaults as true

* introduce compiled target config to avoid needing to send back
  additional maps of Resolvers; future target-specific compiled state
  can go here

* move compiled MeshGateway out of the Resolver and into the
  TargetConfig where it makes more sense.
@rboyer rboyer force-pushed the simplifed-compiled-discovery-chain branch from f66c962 to a8e1888 Compare August 2, 2019 03:18
@rboyer rboyer merged commit f02924f into release/1-6 Aug 2, 2019
@rboyer rboyer deleted the simplifed-compiled-discovery-chain branch August 2, 2019 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants