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 a transport socket match in cluster. #8100

Merged
merged 27 commits into from
Sep 23, 2019
Merged

Add a transport socket match in cluster. #8100

merged 27 commits into from
Sep 23, 2019

Conversation

incfly
Copy link
Contributor

@incfly incfly commented Aug 30, 2019

Signed-off-by: Jianfei Hu jianfeih@google.com

API for #8016

Context

Customers adopting service mesh likes mTLS ability. However, rolling it out without breaking existing traffic is hard. This is because mTLS is configured on per cluster basis. In reality, a service consists of multiple endpoints, mixed with having Envoy sidecar and without-sidecar endpoints. Client envoy can't send mTLS traffic until all server migrated to having Envoy sidecar.

This API tries to solve the issue by allowing mTLS/transport socket to configured at finer granularity, e.g. endpoint level. The endpoint has metadata label information, which will be used to decide which transport socket configuration to use from a map specified in the cluster.

So the outcome is that, xDS management server is able to configure client envoy talks to endpoints with sidecar in mTLS and plain text to endpoints without sidecar, for a single cluster.

Description:
Risk Level: N/A (API change only)
Release Notes: Cluster API change to use different transport socket based on endpoint label.

Signed-off-by: Jianfei Hu <jianfeih@google.com>
@incfly
Copy link
Contributor Author

incfly commented Aug 30, 2019

/cc @lizan @rshriram @PiotrSikora

@lizan lizan requested a review from htuch August 30, 2019 01:00
@htuch htuch self-assigned this Aug 30, 2019
@htuch
Copy link
Member

htuch commented Aug 30, 2019

I'm generally opposed to using unstructured metadata for this purpose. If we are going to go down this path (see above comment about needing to understand design rationale and motivation), then we need to add an explicit label field to EDS endpoints.

@htuch
Copy link
Member

htuch commented Aug 30, 2019

@incfly FYI, for changes to Envoy's APIs, you should tag @envoyproxy/api-shepherds on any design review.

@rshriram
Copy link
Member

So @htuch , how about this:

cluster:
  tlsContextMap:
    mtls: …, default
    plaintext: …
  endpoints:
    1.1.1.1, tlsContext-to-use: mtls
    2.2.2.2 tlsContext-to-use: plaintext

effectively, we ship a bunch of named TLS contexts to the cluster and then in the EDS, we can ship the TLS context to use for a given endpoint. This has the same effect of using label selectors in the TLS context.

@lizan
Copy link
Member

lizan commented Aug 30, 2019

@rshriram lets iterate on the doc a bit more, I like labels more for its flexibility, a tlscontextmap (or transport socket map) potentially explodes when you have multiple factor to select. (supports mTLS/TLS/cleartext)

@incfly
Copy link
Contributor Author

incfly commented Aug 30, 2019

@lizan not sure if I get it.

The value of the endpoint.transport_socket_selector (single hardcoded name) is used to retrieve entries from the map. So this is selection based on single factor, and deterministically, right?

By label do you refer to actual endpoint.metadata or it does not matter, can be a field in message Endpoint as well?

Signed-off-by: Jianfei Hu <jianfeih@google.com>
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #8100 was synchronize by incfly.

see: more, trace.

Signed-off-by: Jianfei Hu <jianfeih@google.com>
@incfly
Copy link
Contributor Author

incfly commented Sep 3, 2019

PR has been modified to match the proposal, using actual fields in endpoints plus match semantics for transport socket. @htuch @lizan
PTAL, thanks.

@@ -74,6 +80,8 @@ message LbEndpoint {
// to subset the endpoints considered in cluster load balancing.
core.Metadata metadata = 3;

repeated Label labels = 6;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

So @htuch / @lizan I have been giving this some thought. I think its better to have a named TLS context rather than a label selector because named TLS contexts refer to exactly one context to use. Label selectors could select multiple contexts and then we would have to define some first match wins semantics which gets clunky.

Copy link
Member

@lizan lizan Sep 3, 2019

Choose a reason for hiding this comment

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

I'd like to this be first match wins (similar to FCM), the context map couples EDS with CDS too tightly, and the matcher semantics here is more flexible to match a subset has two labels etc.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, let's just have a string field here pointing at a specific TLS context. This will be the clearest I reckon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

Copy link
Member

Choose a reason for hiding this comment

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

Switching back into this review after some time out, it seems that we still have a label match scheme. If the consensus is heading towards this being necessary, there are two things I'd ask:

  1. Document a clear use case of why we have this in endpoint_transport_socket_matchers comments.
  2. Use the existing metadata; I originally pushed back on this as I felt we could just specify a transport socket name here, but now that we are going to a "label" scheme, we already have a source of this information, the endpoint metadata. There should be well-known key name for this, envoy.transport_socket.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Added a use case in the end of this field comments. @lizan fyi.

I also renamed the field by removing "endpoint_", since as @rshriram points out, it's possible to add metadata for DNS based endpoint as well.

Jianfei Hu added 4 commits September 4, 2019 01:42
Signed-off-by: Jianfei Hu <jianfeih@google.com>
Signed-off-by: Jianfei Hu <jianfeih@google.com>
Signed-off-by: Jianfei Hu <jianfeih@google.com>
…nsport-socket-matcher

Signed-off-by: Jianfei Hu <jianfeih@google.com>
@rshriram
Copy link
Member

ping. any updates? Its been two weeks.

Jianfei Hu added 4 commits September 12, 2019 05:10
Signed-off-by: Jianfei Hu <jianfeih@google.com>
…nsport-socket-matcher

Signed-off-by: Jianfei Hu <jianfeih@google.com>
Signed-off-by: Jianfei Hu <jianfeih@google.com>
Signed-off-by: Jianfei Hu <jianfeih@google.com>
@incfly
Copy link
Contributor Author

incfly commented Sep 12, 2019

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: release (failed build)

🐱

Caused by: a #8100 (comment) was created by @incfly.

see: more, trace.

Signed-off-by: Jianfei Hu <jianfeih@google.com>
Signed-off-by: Jianfei Hu <jianfeih@google.com>
Jianfei Hu added 3 commits September 18, 2019 19:08
Signed-off-by: Jianfei Hu <jianfeih@google.com>
Signed-off-by: Jianfei Hu <jianfeih@google.com>
…nsport-socket-matcher

Signed-off-by: Jianfei Hu <jianfeih@google.com>
@incfly
Copy link
Contributor Author

incfly commented Sep 19, 2019

/retest

@repokitteh-read-only
Copy link

🐴 hold your horses - no failures detected, yet.

🐱

Caused by: a #8100 (comment) was created by @incfly.

see: more, trace.

@incfly
Copy link
Contributor Author

incfly commented Sep 19, 2019

All tests passed now, PTAL, thanks.

// Optional endpoint metadata match criteria.
// The connection to the endpoint with metadata matching what is set in this field
// will use the transport socket configuration specified here.
// The endpoints metadata entry in *envoy.transport_socket* is used to match
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@htuch @lizan

I'm reading well_known_names.h, and see we already have envoy.transport_sockets.xxx (alts) for socket name, this makes me think using envoy.transport_socket to extract endpoint info can cause confusion.
https://github.com/envoyproxy/envoy/blob/master/source/extensions/transport_sockets/well_known_names.h#L17

how about renaming this to envoy.transport_socket_match or envoy.transport_socket_selector?

wdty?

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks, generally LGTM with a few small comments.

/wait

Signed-off-by: Jianfei Hu <jianfeih@google.com>
mattklein123
mattklein123 previously approved these changes Sep 19, 2019
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks this LGTM. I will defer to others for further review.

Signed-off-by: Jianfei Hu <jianfeih@google.com>
@incfly
Copy link
Contributor Author

incfly commented Sep 20, 2019

@htuch Could you take a look to see anything else we need to update before merging?

htuch
htuch previously approved these changes Sep 20, 2019
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks, the explanation is now more helpful. LGTM modulo nit and merging master.

Signed-off-by: Jianfei Hu <jianfeih@google.com>
…nsport-socket-matcher

Signed-off-by: Jianfei Hu <jianfeih@google.com>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks!

@htuch htuch merged commit 1f7f90f into envoyproxy:master Sep 23, 2019
htuch pushed a commit that referenced this pull request Sep 24, 2019
#8309 and #8100 collided

Risk Level: Low (cleanup)

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
API for envoyproxy#8016

Customers adopting service mesh likes mTLS ability. However, rolling it out without breaking existing traffic is hard. This is because mTLS is configured on per cluster basis. In reality, a service consists of multiple endpoints, mixed with having Envoy sidecar and without-sidecar endpoints. Client envoy can't send mTLS traffic until all server migrated to having Envoy sidecar.

This API tries to solve the issue by allowing mTLS/transport socket to configured at finer granularity, e.g. endpoint level. The endpoint has metadata label information, which will be used to decide which transport socket configuration to use from a map specified in the cluster.

So the outcome is that, xDS management server is able to configure client envoy talks to endpoints with sidecar in mTLS and plain text to endpoints without sidecar, for a single cluster.

Description:
Risk Level: N/A (API change only)
Release Notes: Cluster API change to use different transport socket based on endpoint label.

Signed-off-by: Jianfei Hu <jianfeih@google.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
envoyproxy#8309 and envoyproxy#8100 collided

Risk Level: Low (cleanup)

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review-required API review required by @envoyproxy/api-shepherds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants