Skip to content

api: Google gRPC client library configuration.#398

Merged
htuch merged 8 commits intoenvoyproxy:masterfrom
htuch:grpc-api
Jan 9, 2018
Merged

api: Google gRPC client library configuration.#398
htuch merged 8 commits intoenvoyproxy:masterfrom
htuch:grpc-api

Conversation

@htuch
Copy link
Copy Markdown
Member

@htuch htuch commented Jan 5, 2018

In support of envoyproxy/envoy#2200 and some
Google internal needs, we are planning on adding support to Envoy to
allow a configuration (or possibly build) driven decision on whether to
using the existing Envoy in-built Grpc::AsyncClient or
the Google C++ gRPC client library (https://grpc.io/grpc/cpp/index.html).

To move in this direction, the idea is we have the xDS ApiConfigSources,
rate limit service config and other filter configurations point at a
GrpcService object. This can be configured to use an Envoy cluster,
where Grpc::AsyncClient will orchestrate communication, or to contain
the config needed to establish a channel in Google C++ gRPC client
library.

Signed-off-by: Harvey Tuch htuch@google.com

In support of envoyproxy/envoy#2200 and some
Google internal needs, we are planning on adding support to Envoy to
allow a configuration (or possibly build) driven decision on whether to
using the existing Envoy in-built Grpc::AsyncClient or
the Google C++ gRPC client library (https://grpc.io/grpc/cpp/index.html).

To move in this direction, the idea is we have the xDS ApiConfigSources,
rate limit service config and other filter configurations point at a
GrpcService object. This can be configured to use an Envoy cluster,
where Grpc::AsyncClient will orchestrate communication, or to contain
the config needed to establish a channel in Google C++ gRPC client
library.

Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Copy Markdown
Member Author

htuch commented Jan 5, 2018

@mattklein123 @wora @ramaraochavali @lizan

I'm not exactly thrilled by this PR, but it's the Least Bad Option IMHO. The fundamental issue is that if we want to support both Envoy's internal notion of specifying backends via clusters for Grpc::AsyncClient and the Google C++ gRPC library, we need to have two overlapping but semantically distinct ways of providing configuration. In particular, it's clear that some bits of the Google C++ gRPC library correspond to Envoy concepts such as UpstreamTlsContext (the SslCredentials), but it seemed clearer to me to use the Google C++ gRPC definitions, as they are much more restricted.

I'm open to ideas on how to better bridge the two worlds, consider this PR a strawman.

@ctiller @markdroth for gRPC-side visibility and comments.

Signed-off-by: Harvey Tuch <htuch@google.com>
// <envoy_api_msg_ApiConfigSource>` and filter configurations.
message GrpcService {
oneof target_specifier {
// The name of the upstream gRPC cluster when using Envoy's gRPC client. SSL
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: s/SSL/TLS everywhere.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We should keep it as SslCredentials to match the terminology used in the Google gRPC library for that specific message, but elsewhere +1.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure sounds good.

}
// A set of credentials that will be composed to form the `channel credentials
// <https://grpc.io/docs/guides/auth.html#credential-types>`_.
repeated Credentials credentials = 4;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WDYT about splitting GrpcService into basically:

  1. Common elements.
  2. A one_of between "envoy gRPC" and "google gRPC." (Which are discrete messages).

IMO ^ is a bit better because then it becomes more clear on what the split is around creds and possibly other things in the future.

None of the code that uses GrpcService is locked yet, but will be soon at Lyft, so now is the time to sort this out for sure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you plan on plumbing Credentials into the Envoy gRPC client? If not, should it go inside Google gRPC client?

Copy link
Copy Markdown
Member Author

@htuch htuch Jan 8, 2018

Choose a reason for hiding this comment

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

I think we want to leave this option open at the API level. For now, there is no immediate plan, as the recommendation will be to "just use the Google gRPC client if you want auth". However, there might emerge later use cases where folks will want to stick with standard Envoy cluster management for their gRPC service backends but want auth, where someone is willing to spend the cycles doing the lifting here. So, let's keep it open. I will document the current limitations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this form of auth common between the types, but SslCredentials are specific to google-grpc?

Signed-off-by: Harvey Tuch <htuch@google.com>
@wora
Copy link
Copy Markdown
Contributor

wora commented Jan 6, 2018 via email

@mattklein123
Copy link
Copy Markdown
Member

We are going to be using this in production at Lyft via the access log service very shortly. I would like to work on Monday to get this into decent shape. I'm not suggesting we split up GrpcService, just have sub-types which include a common part, Envoy gRPC, and Google gRPC. As much as I would like to drop Envoy gRPC and use Google gRPC, until Google gRPC has complete parity with all Envoy router features that is not possible.

htuch added 2 commits January 7, 2018 07:29
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Copy Markdown
Member Author

htuch commented Jan 7, 2018

Updated. I'm hoping this is self-contained enough we can just agree on what GrpcService should look like, but I can split up if that needs to happen first.

Copy link
Copy Markdown
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, I like where this is heading. Two comments.

}
// A set of credentials that will be composed to form the `channel credentials
// <https://grpc.io/docs/guides/auth.html#credential-types>`_.
repeated Credentials credentials = 4;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you plan on plumbing Credentials into the Envoy gRPC client? If not, should it go inside Google gRPC client?

oneof target_specifier {
option (validate.required) = true;

// Envoy's in-built gRPC client.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We will need more documentation/guidance on which to choose, potentially here and in the architecture overview. Do you want to do that as part of this PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will do.

Signed-off-by: Harvey Tuch <htuch@google.com>
mattklein123
mattklein123 previously approved these changes Jan 8, 2018
Copy link
Copy Markdown
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.

LGTM, thanks for the doc additions. I would recommending having @ggreenway and @wora take a look also.


// Specifies the cluster manager cluster name that hosts the rate limit
// service. The client will connect to this cluster when it needs to make rate
// limit service requests.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it worth documenting the difference between the two choices in the one-of? Maybe not, because this one is deprecated. But which gRPC client will get used in the deprecated case? Or is it even the same protocol between these two?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will fix.

}
// A set of credentials that will be composed to form the `channel credentials
// <https://grpc.io/docs/guides/auth.html#credential-types>`_.
repeated Credentials credentials = 4;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this form of auth common between the types, but SslCredentials are specific to google-grpc?

@htuch
Copy link
Copy Markdown
Member Author

htuch commented Jan 8, 2018

@ggreenway The SslCredentials are specific to Google gRPC because they are already there implicitly in the cluster upstream TLS context for Envoy gRPC.

Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch htuch merged commit b796da4 into envoyproxy:master Jan 9, 2018
@htuch htuch deleted the grpc-api branch January 9, 2018 15:03
htuch added a commit to envoyproxy/envoy that referenced this pull request Jan 19, 2018
As part of the switch to envoy::api::v2::GrpcService and preparing the code base for the Google C++
gRPC client, this PR introduces a singleton gRPC async client manager and factory pattern. This
allows for details of TLS and shared state across clients to be hidden from consumers and for
consumers to be agnostic about the type of gRPC client.

This PR also introduces the deprecation of the specification of gRPC services by cluster name,
envoy::api::v2::GrpcService should be used going forward.

Risk Level: Medium (some changes to initialization, API cluster validation)
Testing: New unit tests, validated full coverage.
Docs Changes: envoyproxy/data-plane-api#398
Deprecated: Specifying rate limit and API config sources via cluster names, use the grpc_service(s) fields instead.

Signed-off-by: Harvey Tuch <htuch@google.com>
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.

4 participants