Skip to content

[cache-filter] Add disabled option#25916

Merged
ravenblackx merged 8 commits into
envoyproxy:mainfrom
ravenblackx:disable_cache
Mar 14, 2023
Merged

[cache-filter] Add disabled option#25916
ravenblackx merged 8 commits into
envoyproxy:mainfrom
ravenblackx:disable_cache

Conversation

@ravenblackx
Copy link
Copy Markdown
Contributor

@ravenblackx ravenblackx commented Mar 3, 2023

Commit Message: [cache-filter] Add disabled option
Additional Description: Adds the ability to have cache filter present but disabled. This makes it so a cache filter can more easily be configured with ECDS, and is a good precursor to making the configuration "inheritable". Addresses part of #25819.
This model is forward-compatible with the idea of inheritable/overrideable config, and the implementation is backward-compatible with existing config.
Risk Level: Low - cache filter is WIP, and change should be no-op for existing configs.
Testing: Added unit test coverage.
Docs Changes: Automatic from proto.
Release Notes: n/a
Platform Specific Features: n/a

Signed-off-by: Raven Black <ravenblack@dropbox.com>
@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #25916 was opened by ravenblackx.

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 @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #25916 was opened by ravenblackx.

see: more, trace.

Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
@ravenblackx ravenblackx marked this pull request as ready for review March 3, 2023 21:50
@ravenblackx ravenblackx requested a review from jmarantz as a code owner March 3, 2023 21:50
@ravenblackx
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #25916 (comment) was created by @ravenblackx.

see: more, trace.

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!
Left a high-level comment about API.

// Config specific to the cache storage implementation.
// [#extension-category: envoy.http.cache]
google.protobuf.Any typed_config = 1 [(validate.rules).any = {required: true}];
oneof cache_implementation {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unfortunately this breaks backwards compatibility.
Annotation will be needed here.

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 catch, I always forget about Golang ruining oneof for everyone else.

Changed to just making it a separate field, which is more forward-looking anyway (in that this way is compatible with merge-inheritable config).

Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
@ravenblackx
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #25916 (comment) was created by @ravenblackx.

see: more, trace.

@ravenblackx ravenblackx requested a review from adisuissa March 6, 2023 21:33
Comment thread api/envoy/extensions/filters/http/cache/v3/cache.proto
@ravenblackx ravenblackx requested a review from markdroth March 7, 2023 16:29
@markdroth
Copy link
Copy Markdown
Contributor

/lgtm api

@repokitteh-read-only repokitteh-read-only Bot removed the api label Mar 9, 2023
@wbpcode
Copy link
Copy Markdown
Member

wbpcode commented Mar 10, 2023

Related to #25927. May the #25927 be a generic way to disable a specific filter?

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!
What do you think about @wbpcode's comment?

google.protobuf.Any typed_config = 1 [(validate.rules).any = {required: true}];
google.protobuf.Any typed_config = 1;

// When true, the cache filter is a no-op filter.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The comment should describe the use-cases where this is true (e.g., override by route and enable it).

Copy link
Copy Markdown
Contributor Author

@ravenblackx ravenblackx Mar 13, 2023

Choose a reason for hiding this comment

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

Again, doing that would probably be more confusing than helpful at this point because overriding by route isn't actually implemented yet. Describing things you can't actually do in the documentation seems worse than nothing.

At this version, the use for supporting disabling (until route overrides are available) is allowing ECDS to turn the filter off.

Which is also why the route-level generic disable isn't useful for this case - you can't toggle that with ECDS, you'd have to update some larger entity (the listener?).

The generic disable also doesn't allow for providing a disabled config at the base level and overriding it to enabled per-route (once per-route overrides are implemented).

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.

Suggestion was to add the ECDS use case to the doc even though it's a less-likely one, and the unimplemented one as a [#comment:]; done.

Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
@markdroth
Copy link
Copy Markdown
Contributor

/lgtm api

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.
LGTM modulo small doc nit.

cc'ing other code-owner for review.
@toddmgreer @jmarantz @penguingao @mpwarres @capoferro

/assign-from @envoyproxy/senior-maintainers

// When true, the cache filter is a no-op filter.
//
// Possible use-cases for this include:
// - Turning a filter on and off with [ECDS](https://www.envoyproxy.io/docs/envoy/latest/api-v3/service/extension/v3/config_discovery.proto).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: use :ref:... to take advantage of docs linking.

@repokitteh-read-only
Copy link
Copy Markdown

@envoyproxy/senior-maintainers assignee is @alyssawilk

🐱

Caused by: a #25916 (review) was submitted by @adisuissa.

see: more, trace.

Signed-off-by: Raven Black <ravenblack@dropbox.com>
@markdroth
Copy link
Copy Markdown
Contributor

/lgtm api

@ravenblackx ravenblackx merged commit c430a5a into envoyproxy:main Mar 14, 2023
@ravenblackx ravenblackx deleted the disable_cache branch March 14, 2023 21:09
@yongzhang
Copy link
Copy Markdown

Does it have a config example please? I'm struggling with enabling per-route caching filter.

@ravenblackx
Copy link
Copy Markdown
Contributor Author

Does it have a config example please? I'm struggling with enabling per-route caching filter.

It still doesn't have any per-route support, this change was just a first small step towards that.

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