Skip to content

docs: document type URLs for extensions#21707

Merged
mattklein123 merged 16 commits intoenvoyproxy:mainfrom
kyessenov:extension_type_urls
Jun 23, 2022
Merged

docs: document type URLs for extensions#21707
mattklein123 merged 16 commits intoenvoyproxy:mainfrom
kyessenov:extension_type_urls

Conversation

@kyessenov
Copy link
Copy Markdown
Contributor

@kyessenov kyessenov commented Jun 15, 2022

Signed-off-by: Kuat Yessenov kuat@google.com

Commit Message: document type URLs for extensions
Additional Description: add validation to extension metadata (and fix discovered issue), annotate with type URLs, and print type URLs on extension pages. The end-result is that every extension is now annotated with type URLs it accepts, making it easier to get started using them. This is accomplished by adding a new field type_url to the extension manifest. While doing so, I found several inconsistencies. There are three places where extension names and categories are used, and they don't always match:

  1. In the code itself, as override for name and category. These names should not be changed ideally, as the names are literal in configs, and it's possible for the old config to be rejected.
  2. In the protodoc comments, e.g. #extension-category. I think these are fine to change as long as the docs are improved.
  3. In the bazel extension.bzl file. These are purely build artifacts, so should be fairly safe to change. The only side-effect is downstream repos will need to copy the changes.

There are too many mis-matches to fix at once, so I only fixed few most visible:

  1. Updated (2) and (3) for envoy.access_loggers.stream to reflect the reality that there are two extensions stdout and stderr.
  2. Updated (1) for envoy.access_loggers.extension_filters per discussion with @adisuissa.
  3. Updated (2) and (3) for envoy.extensions.http.cache.simple.

Risk Level: medium
Testing: yes
Docs Changes: yes
Release Notes: none
Issue: #13167

Signed-off-by: Kuat Yessenov <kuat@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

Docs for this Pull Request will be rendered here:

https://storage.googleapis.com/envoy-pr/21707/docs/index.html

The docs are (re-)rendered each time the CI envoy-presubmit (precheck docs) job completes.

🐱

Caused by: #21707 was opened by kyessenov.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #21707 was opened by kyessenov.

see: more, trace.

Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov
Copy link
Copy Markdown
Contributor Author

@phlax Could you help me to fix the extensions schema linter error? I can't find the code that executes it.

@phlax
Copy link
Copy Markdown
Member

phlax commented Jun 15, 2022

yep - the error messages are not great here (i raised a bug upstream to try and improve)

the "shape" it is expecting - is here typing.Dict[str, envoy.code.check.typing.ExtensionMetadataDict]

which translates to the spec here https://github.com/envoyproxy/pytooling/blob/603f4f2d0b53aabc41c5a6b59ea961131ee5f754/envoy.code.check/envoy/code/check/typing.py#L22

let me check the change...

@phlax
Copy link
Copy Markdown
Member

phlax commented Jun 15, 2022

we need to add type_urls into the spec - will they be required ?

@kyessenov
Copy link
Copy Markdown
Contributor Author

Thanks, @phlax No, type_urls is not required, some extensions are still un-typed, but most are. There are gaps also in the manifest, but now it's all easy to see in one document.

@phlax
Copy link
Copy Markdown
Member

phlax commented Jun 15, 2022

cool for non required then it wants to be added here https://github.com/envoyproxy/pytooling/blob/main/envoy.code.check/envoy/code/check/typing.py#L18

do you want me to do it - happy to review if you want to

@kyessenov
Copy link
Copy Markdown
Contributor Author

Sent envoyproxy/toolshed#574.

@zhxie
Copy link
Copy Markdown
Contributor

zhxie commented Jun 16, 2022

A suggestion, maybe we can show category, qualified name and type URL in a single tips, or at least qualified name and type URL?

Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov
Copy link
Copy Markdown
Contributor Author

@zhxie combined categories and type URLs together.

Copy link
Copy Markdown
Contributor

@adisuissa adisuissa 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 validating the extensions yaml file!
Left small comment.

Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov kyessenov requested a review from jmarantz as a code owner June 17, 2022 05:09
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov
Copy link
Copy Markdown
Contributor Author

There's a bunch of missing extensions that will need follow-up:

  1. Core (untyped) extensions:
    'envoy.transport_sockets.quic' from category 'envoy.transport_sockets.downstream'.
    'envoy.transport_sockets.quic' from category 'envoy.transport_sockets.upstream'.
    'envoy.ip' from category 'envoy.resolvers'.
    'envoy.filters.http.match_delegate' from category 'envoy.filters.http'.
    'composite-action' from category 'envoy.matching.action'.
    'skip' from category 'envoy.matching.action'.
    'preserve_case' from category 'envoy.http.stateful_header_formatters'.
    'envoy.extensions.network.socket_interface.default_socket_interface' from category 'envoy.bootstrap'.
    'envoy.extensions.upstreams.http.v3.HttpProtocolOptions' from category 'envoy.upstream_options'.
    'envoy.tls.cert_validator.default' from category 'envoy.tls.cert_validator'.
    'default' from category 'network.connection.client'.

  2. Mis-matched name in schema/code:
    'envoy.matching.matchers.consistent_hashing' from category 'envoy.matching.input_matchers'.
    'envoy.matching.matchers.ip' from category 'envoy.matching.input_matchers'.
    'envoy.filters.thrift.rate_limit' from category 'envoy.thrift_proxy.filters'.
    'envoy.config.validators.minimum_clusters_validator' from category 'envoy.config.validators'.
    'envoy.filters.udp.dns_filter' from category 'envoy.filters.udp_listener'.
    'envoy_internal' from category 'network.connection.client'.

  3. Need typing registration:
    'envoy.watchdog.abort_action' from category 'envoy.guarddog_actions'.
    'envoy.cluster.eds' from category 'envoy.clusters'.
    'envoy.cluster.logical_dns' from category 'envoy.clusters'.
    'envoy.cluster.original_dst' from category 'envoy.clusters'.
    'envoy.cluster.static' from category 'envoy.clusters'.
    'envoy.cluster.strict_dns' from category 'envoy.clusters'.
    'envoy.grpc_credentials.default' from category 'envoy.grpc_credentials'.
    'envoy.filters.connection_pools.tcp.generic' from category 'envoy.upstreams'.

  4. Dubbo/thrift:
    'dubbo.hessian2' from category 'envoy.dubbo_proxy.serializers'.
    'auto' from category 'envoy.thrift_proxy.transports'.
    'framed' from category 'envoy.thrift_proxy.transports'.
    'header' from category 'envoy.thrift_proxy.transports'.
    'unframed' from category 'envoy.thrift_proxy.transports'.
    'envoy.filters.dubbo.router' from category 'envoy.dubbo_proxy.filters'.
    'dubbo' from category 'envoy.dubbo_proxy.protocols'.
    'auto' from category 'envoy.thrift_proxy.protocols'.
    'binary' from category 'envoy.thrift_proxy.protocols'.
    'binary/non-strict' from category 'envoy.thrift_proxy.protocols'.
    'compact' from category 'envoy.thrift_proxy.protocols'.
    'twitter' from category 'envoy.thrift_proxy.protocols'.

We can follow-up with the clean-up after this PR.

Copy link
Copy Markdown
Contributor

@adisuissa adisuissa 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.
I think this PR should have another pair of eyes assessing the impact of the extensions "names" and the "envoy.access_logger.extensions_filters" category name modifications.
@mattklein123 can you review this or suggest someone?

@mattklein123 mattklein123 self-assigned this Jun 21, 2022
@mattklein123
Copy link
Copy Markdown
Member

@kyessenov can you provide a more detailed summary of what this change does? I'm not really sure what the end user impact is. Is this going to break anyone's existing configuration? Thank you.

/wait-any

@kyessenov
Copy link
Copy Markdown
Contributor Author

@mattklein123 Posted updated description. This change is mostly docs- and build-related, except for the new extension envoy.access_loggers.extension_filters which appears to be mis-labelled, so we fixed that.

Copy link
Copy Markdown
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

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

this is definitely the missing piece in the api/config docs so in general i would be inclined to land and iterate

that said, i still think we need to clarify the relationship between extension qualified names and type urls - their necessity/specificity etc

the other thing im a little confused by (i think you may have answered this elswhere, and i guess may related to use or otherwise of typed_config) some of the extensions only have qualified names

{% endfor %}

{% if type_urls|length > 0 %}
This extension can be configured with the following type URLs:
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.

my main concern here is that its not clear what this means - either if you are coming from a position of zero-knowledge, or trying to discriminate/associate/understand type_urls and extension name

in most cases at least, would it not be more correct to say that this extensions must be configured with this type URL ?

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.

+1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, changing to must.

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 for working on this. A few comments/questions. Very happy to see the docs improved in this area.

/wait

// [#protodoc-title: SimpleHttpCache CacheFilter storage plugin]

// [#extension: envoy.cache.simple_http_cache]
// [#extension: envoy.extensions.http.cache.simple]
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 this right? Per below shouldn't it be envoy.http.cache.simple ? Something seems off.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

virtual bool disableFactory(absl::string_view) PURE;
virtual bool isFactoryDisabled(absl::string_view) const PURE;
virtual absl::flat_hash_map<std::string, std::vector<std::string>> registeredTypes() const PURE;
virtual absl::string_view canonicalFactoryName(absl::string_view) const PURE;
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.

cc @wbpcode as it relates to #21525. I want to make sure we are all working towards the same goal and I will be honest this is also very hazy to me, so I'm glad we are improving things.

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.

This function is used deprecated filter name to get canonical filter name. For example, use envoy.router to get envoy.filters.http.router. So I think it not relates to #21525 directly.

Runtime::Loader& runtime, Random::RandomGenerator& random) PURE;

std::string category() const override { return "envoy.access_logger.extension_filters"; }
std::string category() const override { return "envoy.access_loggers.extension_filters"; }
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.

This is potentially a breaking change? Is this the only one? What are the implications? Can we avoid breaking people and if not we should at the very least have a release note?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding release notes. This was added recently by @douglas-reid so I'll make sure we don't break us. I couldn't think of a reason why category name is significant for users.

# CacheFilter plugins
#
"envoy.cache.simple_http_cache": "//source/extensions/filters/http/cache/simple_http_cache:config",
"envoy.extensions.http.cache.simple": "//source/extensions/filters/http/cache/simple_http_cache:config",
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.

Same question about "extensions"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This aligns to what is in the code as well.

{% endfor %}

{% if type_urls|length > 0 %}
This extension can be configured with the following type URLs:
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.

+1

@kyessenov
Copy link
Copy Markdown
Contributor Author

@phlax Re: question about missing type URLs for some extensions. There are several reasons for that which I mentioned above. One is that they are just labelled differently internally in the code and in extension schema, so we need to fix that later on a case by case basis. Another is some extensions are purely internal and never need to be configured.

Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>

{% if type_urls|length > 0 %}
This extension can be configured with the following type URLs:
This extension must be configured with the following type URLs:
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.

Suggested change
This extension must be configured with the following type URLs:
This extension must be configured with one of the following type URLs:

not sure about this suggestion, and the pluralization is a bit wierd - but i think this could mean must be configured with all type urls

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, updated once again. It's just one URL 90% cases, so we can maybe add two types of templates, for single one and plural separately.

Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
mattklein123
mattklein123 previously approved these changes Jun 23, 2022
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 to ship and iterate. Thank you so much! Unfortunately I think needs another main merge. Let's just do that and we can quickly get this in. Thank you.

Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
@mattklein123 mattklein123 merged commit 78e5406 into envoyproxy:main Jun 23, 2022
Amila-Rukshan pushed a commit to Amila-Rukshan/envoy that referenced this pull request Jun 28, 2022
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Amila Senadheera <amila.15@cse.mrt.ac.lk>
htuch pushed a commit that referenced this pull request Jun 29, 2022
Follow-up to #21707 with a focus on back-filling more extension type URLs. Renames extensions_build_config and extensions_metadata to the names in the internal extension registry. For preserve_case, we deprecate the short name with the fully qualified name (both names are valid in the interim).

Risk Level: medium, only preserve_case name changes
Testing: regression
Docs Changes: yes
Release Notes: yes

Signed-off-by: Kuat Yessenov <kuat@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.

6 participants