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

API: Add extension information the Node message. #9301

Merged
merged 38 commits into from
Jan 8, 2020

Conversation

yanavlasov
Copy link
Contributor

@yanavlasov yanavlasov commented Dec 10, 2019

Report extension information in the Node message.

Risk Level: Low
Testing: Unit Tests
Docs Changes: N/A
Release Notes: N/A
Fixes: #8332

Signed-off-by: Yan Avlasov yavlasov@google.com

Signed-off-by: Yan Avlasov <yavlasov@google.com>
@repokitteh-read-only
Copy link

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

🐱

Caused by: #9301 was opened by yanavlasov.

see: more, trace.

@yanavlasov yanavlasov changed the title Add extension information the Node message. WiP: Add extension information the Node message. Dec 10, 2019
@yanavlasov
Copy link
Contributor Author

This PR is to discuss how to best add versioning and categorization to the extension registry so it can be added to the Node message. Specifically:

  1. do we need to have "canonical" category for the extensions, expressed as enum in the Node proto. This would be broad buckets, like network and http filter, stats sink, cred provider, etc. The existing category is a free form string.
  2. Would it be better to have common base interface for all factories where the "getter" for the version and potentially canonical category can be added. Without the base class it is difficult to retrieve factory specific attributes in a generic manner.

@yanavlasov yanavlasov marked this pull request as ready for review December 11, 2019 03:07
@htuch htuch self-assigned this Dec 11, 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.

@yanavlasov thanks, this is pretty much aligned with what we had previously discussed, so looks great. A few nits and I've tagged folks who might be interested in the review.
/wait

api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
include/envoy/registry/registry.h Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Show resolved Hide resolved
include/envoy/registry/registry.h Show resolved Hide resolved
Copy link
Contributor

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Thanks for looping me in, @htuch!

api/envoy/api/v2/core/base.proto Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
api/envoy/api/v2/core/base.proto Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
docs/root/api/client_features.rst Outdated Show resolved Hide resolved
docs/root/api/client_features.rst Show resolved Hide resolved
include/envoy/registry/registry.h Outdated Show resolved Hide resolved
@htuch htuch added the waiting label Dec 13, 2019
Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
Run proto_format
Fix tests with deprecated build_version

Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
…umented client features

Signed-off-by: Yan Avlasov <yavlasov@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.

Generally looks great, thanks. @jpeach any further comments?
/wait

// configuration, e.g. envoy.router, com.acme.widget.
string name = 1;

// Category of the extension
Copy link
Member

Choose a reason for hiding this comment

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

Can you add docs on where to find these names and some examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Right now the category comes from the factory's category() method. There is no single place where all categories are listed. Also not categories right now do not follow the DNS naming. I.e. tracers use the "tracing" category.
Some things to consider:

  1. Should we consolidate all category names into a common header?
  2. Should we add a notion of a deprecated category name and rename all non-conforming categories to use DNS notation?

Copy link
Member

Choose a reason for hiding this comment

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

I think we could move towards (2), probably file an issue. For now, I think if we could do (1) with decent comments that would be awesome, we could just provide the GitHub URL to that header.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR #9425

docs/root/api/client_features.rst Outdated Show resolved Hide resolved
docs/root/api/client_features.rst Outdated Show resolved Hide resolved
* version is used for registering vendor specific factories that are versioned
* independently of Envoy.
*/
static void registerFactory(Base& factory, absl::string_view name,
Copy link
Member

Choose a reason for hiding this comment

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

Are we registering all the Envoy in-builts as well (using the semver of Envoy itself)? I think we should do this, as end users can optionally build Envoy with/without different filters, and it helps to know which ones are around.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know, yes. There is RegisterInternalFactory that does not register a category, which is used for some internal factories (i.e. SslContext). I'm unsure if these need to be reported as well. Perhaps we should audit these.

Copy link
Member

Choose a reason for hiding this comment

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

Can you pastebin what the full Node looks like somewhere? I'm curious to take a look at this.

Copy link
Contributor Author

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.

I notice that the build version information isn't populated; do we assume it's the same as the Envoy version? I think for semantic version this is fair. For labels, we actually have this metadata already in BUILD rules, see https://github.com/envoyproxy/envoy/blob/master/bazel/envoy_library.bzl#L70.

I wonder if we want to populate labels with the security posture and status of extensions? Seems a pretty cool use of them and should not be too hard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@markdroth will gRPC use SemVer for extension versioning? If not, what is your versioning scheme?
If we make an assumption that an empty extension version means that the version is the same as the "user agent", should the "user_agent_version" include SemVer as well? Will you version your xDS client using SemVer?

Copy link
Contributor

Choose a reason for hiding this comment

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

The gRPC client itself does use semantic versioning, and it definitely makes sense to use SemVer as the format for user_agent_version.

The question of versions for plugins is an interesting one. In principle, it seems reasonable for plugins to use their own semantic versioning, but in order to provide those versions to xDS, gRPC would probably need to provide a way for the plugin to record its version when it registers itself. @ejona86 and @dfawley, thoughts...?

It might be a little confusing to assume that the default extension version matches the user agent version, because there could be some very simple plugins that don't bother to set a version. It might make more sense to just treat an empty version as a unique value.

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 suppose how the empty version is treated is up to the xDS server. Are you suggesting removing the note about empty version from the proto doc?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. I think we should just say that an empty version means no version specified, not that it defaults to the user agent version.

string name = 1;

// Category of the extension
string category = 2;

Choose a reason for hiding this comment

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

Just to clarify, I would assume specific type/name of the WASM filter would go into the category as well? Because its name would be a generic "envoy.wasm" in all cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This field is populated from the factory's category() method. I've read through the #9358 and I'm still clear on what needs to happen for wasm filters. Perhaps WASM filter category should be supplied with the config somehow?

Choose a reason for hiding this comment

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

@PiotrSikora could you please chime in on how WASM could be reporting its specific kind through this API?

Copy link
Member

Choose a reason for hiding this comment

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

Also @jplevyak. I think that we can add some higher-order category support later for things like WASM. Ultimately I'd like to see how this plays out, but we shouldn't block.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wasm doesn't use protobuf for configuration. Do we need an alternative way to categorize / type the Wasm filters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, this would be rather unfortunate to add separate categorization for wasm extensions. What does wasm extensions use for configuration? Can they provide an identity config proto?

Copy link
Contributor

Choose a reason for hiding this comment

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

Wasm just uses an opaque blob. The reason being protobuf limits the choice of languages (and it's pretty slow in general).

Copy link
Member

Choose a reason for hiding this comment

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

I think we can support Wasm additively after this PR ships. While the Wasm extension providing the runtime is a true Envoy extension, its plugins will be their own thing and probably need a structured reporting mechanism. I don't think we break that by going with what is in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 I think wasm can fit into this scheme by having all its plugin to have the same category i.e. "wasm" and add thread safe implementation of the FactoryRegistryProxy that can provide names of available wasm plugins. The name can come from config metadata.

Choose a reason for hiding this comment

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

This should be fine for now, but I hope wasm will develop some first-class integration with xDS/Envoy version reporting mechanism, rather just leaving it for generic "wasm" and then providing opaque blob for the rest. That's a note for wasm in general, not specifically for this implementation.

Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
htuch added a commit that referenced this pull request Jan 8, 2020
This PR extends #9468 to support a distinct notion of transport and
resource API version. The intuition here is that the opaque resources
(and their type URLs) can be delivered via either v2 or v3 xDS, and the
DiscoveryRequest etc. messages have their own versioning.

Currently, the v2 and v3 transport protocols are indistinguishable
modulo service endpoint. As v3 evolves, e.g. with #9301, differences
will be introduced. At this point it will be necessary to have enhanced
support in the gRPC mux and HTTP subscription modules to handle the
protocol differences.

This is technically a breaking v2 API change, but since the field it
breaks was only added today, I think it's safe to assume it is not in
use yet.

Risk level: Low
Testing: Integration tests added to validate service endpoint and type
  URL selection based on transport/resource version.

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

LGTM, need to get CI to pass..

api/envoy/api/v2/core/base.proto Outdated Show resolved Hide resolved
source/server/config_validation/server.cc Outdated Show resolved Hide resolved
Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
@htuch
Copy link
Member

htuch commented Jan 8, 2020

@yanavlasov LGTM, but format CI check is still failing.

Signed-off-by: Yan Avlasov <yavlasov@google.com>
@repokitteh-read-only repokitteh-read-only bot removed the api label Jan 8, 2020
@htuch
Copy link
Member

htuch commented Jan 8, 2020

I'm going to merge this as is, since the envoy-macos check is known to be broken.

@htuch htuch merged commit f5efe4a into envoyproxy:master Jan 8, 2020
htuch added a commit to htuch/envoy that referenced this pull request Jan 9, 2020
This is a followup to envoyproxy#9301, where it was not possible to deprecate a
field on DiscoveryRequest as we were previously assuming identical v2/v3
transport protocols. After this deprecation, build_version can't appear
in v3 messages, and we need to convert back to a true v2
DiscoveryRequest prior to JSON serializing for REST.

There's more work to be done in the future, when we add new v3-only
fields, but this should work for 1.13.0. Future work tracked at
envoyproxy#9619.

Risk level: Low
Testing: coverage of the behaviors for both gRPC and REST config sources
  is provided by api_version_integration_test (failing previously as soon
  as build_version was deprecated).

Fixes envoyproxy#9604

Signed-off-by: Harvey Tuch <htuch@google.com>
htuch added a commit that referenced this pull request Jan 11, 2020
This is a followup to #9301, where it was not possible to deprecate a
field on DiscoveryRequest as we were previously assuming identical v2/v3
transport protocols. After this deprecation, build_version can't appear
in v3 messages, and we need to convert back to a true v2
DiscoveryRequest prior to JSON serializing for REST.

There's more work to be done in the future, when we add new v3-only
fields, but this should work for 1.13.0. Future work tracked at
#9619.

Risk level: Low
Testing: coverage of the behaviors for both gRPC and REST config sources
  is provided by api_version_integration_test (failing previously as soon
  as build_version was deprecated).

Fixes #9604

Signed-off-by: Harvey Tuch <htuch@google.com>
@yanavlasov yanavlasov deleted the node branch February 1, 2021 19:29
@yanavlasov yanavlasov restored the node branch February 1, 2021 19:29
@yanavlasov yanavlasov deleted the node branch December 16, 2022 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api/v3 Major version release @ end of Q3 2019
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node enhancements for stable Envoy versioning
8 participants