Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
41a144b
Add metaprotocol proxy api
zhaohuabing Oct 26, 2021
0067255
move api to core and update pkg name
Oct 28, 2021
71ec328
move api from contrib to core
zhaohuabing Oct 28, 2021
1ad6b24
add some minor new API
Oct 28, 2021
7b00d7d
rename authoriy
Oct 28, 2021
38b6124
Merge pull request #1 from aeraki-framework/minor-update
zhaohuabing Oct 28, 2021
205ac0f
minor change
zhaohuabing Oct 29, 2021
387ecb2
format code
zhaohuabing Oct 29, 2021
5dfdc72
Modify proto according to envoy api style request
zhaohuabing Oct 29, 2021
5a49dd5
Add MetaProtocol proto to build
invalid-email-address Oct 29, 2021
65cd35d
fix typo
zhaohuabing Oct 29, 2021
de25039
fix proto issue
zhaohuabing Oct 29, 2021
e3aa02d
remove whitespace
zhaohuabing Oct 29, 2021
dfb16ec
fix format and proto api version
Oct 30, 2021
ff3c2b6
The MetaProtocol Proxy is still under development
zhaohuabing Oct 30, 2021
0e8e9c0
should be ACTIVE according to definition of UDPA
zhaohuabing Oct 31, 2021
851923d
Use the xds mathcer API for routing
zhaohuabing Nov 5, 2021
57020f0
add validation
zhaohuabing Nov 5, 2021
0437233
Reverted content of api/BUILD.
zhaohuabing Nov 5, 2021
92f0006
addreess comments
zhaohuabing Nov 8, 2021
3ede781
fix check-format
zhaohuabing Nov 8, 2021
005353c
Revert "fix check-format"
zhaohuabing Nov 8, 2021
4d78cac
addreess comments
zhaohuabing Nov 8, 2021
e6bb0a6
fix precheck format
zhaohuabing Nov 8, 2021
88ce891
fix check format
zhaohuabing Nov 9, 2021
b72d0ab
use typedExtensionConfig
zhaohuabing Nov 9, 2021
e93277f
add config example
zhaohuabing Nov 10, 2021
e7c33c9
fix validation error
zhaohuabing Nov 10, 2021
4d415c3
remove aeraki.meta_protocol.filters.router
zhaohuabing Nov 10, 2021
1def61e
minor wording
zhaohuabing Dec 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ proto_library(
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
"//envoy/extensions/filters/network/http_connection_manager/v3:pkg",
"//envoy/extensions/filters/network/local_ratelimit/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/action/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/v3:pkg",
"//envoy/extensions/filters/network/mongo_proxy/v3:pkg",
"//envoy/extensions/filters/network/ratelimit/v3:pkg",
"//envoy/extensions/filters/network/rbac/v3:pkg",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"//envoy/config/route/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
"@com_github_cncf_udpa//xds/annotations/v3:pkg",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
syntax = "proto3";

package envoy.extensions.filters.network.meta_protocol_proxy.matcher.action.v3;

import "envoy/config/route/v3/route_components.proto";

import "xds/annotations/v3/status.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.matcher.action.v3";
option java_outer_classname = "ActionProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

// [#protodoc-title: Meta Protocol Proxy Route Action Configuration]

// Configuration for the route match action.
// [#not-implemented-hide:]
message RouteAction {
oneof cluster_specifier {
option (validate.required) = true;

// Indicates the upstream cluster to which the request should be routed.
string cluster = 1;

// Multiple upstream clusters can be specified for a given route. The request is routed to one
// of the upstream clusters based on weights assigned to each cluster.
// Currently ClusterWeight only supports the name and weight fields.
config.route.v3.WeightedCluster weighted_clusters = 2;
}
}
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.

What's the long term plan here? How much of the existing RouteAction in RDS will be reproduced? If it's the entire thing, then arguably we should just augment existing RouteAction with the ability to match on MetaProtocol attributes (maybe it can already via dynamic metadata matchers?). If not, we should be clear on the long term relationship across these structures.

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 check it.

Copy link
Copy Markdown
Member Author

@zhaohuabing zhaohuabing Nov 8, 2021

Choose a reason for hiding this comment

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

@htuch @wbpcode

I had the same thought about that: should we reuse the existing RouteAction? Or create another similar one?

My concern is the existing RouteAction is highly coupled with the HTTP protocol. If we reuse it, some properties and inner structures may become too ambiguous or useless for the MetaProtocol.

{
  "cluster": "...",
  "cluster_header": "...",
  "weighted_clusters": "{...}",
  "cluster_not_found_response_code": "...",
  "metadata_match": "{...}",
  "prefix_rewrite": "...",
  "regex_rewrite": "{...}",
  "host_rewrite_literal": "...",
  "auto_host_rewrite": "{...}",
  "host_rewrite_header": "...",
  "host_rewrite_path_regex": "{...}",
  "timeout": "{...}",
  "idle_timeout": "{...}",
  "retry_policy": "{...}",
  "request_mirror_policies": [],
  "priority": "...",
  "rate_limits": [],
  "include_vh_rate_limits": "{...}",
  "hash_policy": [],
  "cors": "{...}",
  "max_grpc_timeout": "{...}",
  "grpc_timeout_offset": "{...}",
  "upgrade_configs": [],
  "internal_redirect_policy": "{...}",
  "internal_redirect_action": "...",
  "max_internal_redirects": "{...}",
  "hedge_policy": "{...}",
  "max_stream_duration": "{...}"
}

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.

@zhaohuabing I think so too. May be we should create new RouteAction which is protocol-independent for the meta protocol proxy. cc @htuch

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.

I agree it's not great to have the duplication, but I would be OK starting from scratch and making sure we don't have ambiguity.

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.

https://github.com/cncf/xds/blob/cb28da3451f158a947dfc45090fe92b07b243bc1/xds/type/matcher/v3/matcher.proto#L38-L39

I think different protocols differ on RouteAction, would it be better if we can provide a public interface similar to action in the generic matching?

Copy link
Copy Markdown
Member

@wbpcode wbpcode Nov 12, 2021

Choose a reason for hiding this comment

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

If it's necessary, we can add new google.protobuf.Any type custom_protocol_specific_config field to the RouteAction in the future.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"@com_github_cncf_udpa//udpa/annotations:pkg",
"@com_github_cncf_udpa//xds/annotations/v3:pkg",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
syntax = "proto3";

package envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3;

import "xds/annotations/v3/status.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3";
option java_outer_classname = "MatcherProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

// [#protodoc-title: Meta Protocol Proxy Route Matcher Configuration]

// Used to match request service of the downstream request. Only applicable if a service provided
// by the application protocol.
// [#not-implemented-hide:]
message ServiceMatchInput {
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.

Are service and method just special properties that we think are common enough to have specific types? Or is there something else that makes them special?

I would probably have the comment be a bit more vague here if they are just special properties, like Only applicable if a method provided by the application protocol. gRPC for example is an RPC protocol that doesn't use methods (outside of google.api.annotations)

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.

@snowp your concern is legitimate, not every RPC protocol has these two properties.

}

// Used to match request method of the downstream request. Only applicable if a method provided
// by the application protocol.
// [#not-implemented-hide:]
message MethodMatchInput {
}

// Used to match an arbitrary property of the downstream request.
// These properties are populated by the codecs of application protocols.
// [#not-implemented-hide:]
message PropertyMatchInput {
// The property name to match on.
string property_name = 1 [(validate.rules).string = {min_len: 1}];
}
14 changes: 14 additions & 0 deletions api/envoy/extensions/filters/network/meta_protocol_proxy/v3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"//envoy/config/core/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
"@com_github_cncf_udpa//xds/annotations/v3:pkg",
"@com_github_cncf_udpa//xds/type/matcher/v3:pkg",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
syntax = "proto3";

package envoy.extensions.filters.network.meta_protocol_proxy.v3;

import "envoy/config/core/v3/config_source.proto";
import "envoy/config/core/v3/extension.proto";
import "envoy/extensions/filters/network/meta_protocol_proxy/v3/route.proto";

import "xds/annotations/v3/status.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.v3";
option java_outer_classname = "MetaProtocolProxyProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

// [#protodoc-title: Meta Protocol Proxy]
// Meta Protocol proxy.

// [#not-implemented-hide:]
// [#next-free-field: 6]
message MetaProtocolProxy {
// The human readable prefix to use when emitting statistics.
string stat_prefix = 1 [(validate.rules).string = {min_len: 1}];

// The application protocol built on top of the meta protocol proxy.
ApplicationProtocol application_protocol = 2 [(validate.rules).message = {required: true}];

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

// The meta protocol proxies route table will be dynamically loaded via the meta RDS API.
MetaRds rds = 3;

// The route table for the meta protocol proxy is static and is specified in this property.
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.

You could potentially put examples here, or in the proto docs for RouteConfiguration.

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.

An example of the meta protocol route configuration with matcher API has been added to the route.proto.

RouteConfiguration route_config = 4;
}

// A list of individual Layer-7 filters that make up the filter chain for requests made to the
// meta protocol proxy. Order matters as the filters are processed sequentially as request events
// happen.
repeated config.core.v3.TypedExtensionConfig meta_protocol_filters = 5;
}

// [#not-implemented-hide:]
message ApplicationProtocol {
// The name of the application protocol.
string name = 1 [(validate.rules).string = {min_len: 1}];

// The codec which encodes and decodes the application protocol.
config.core.v3.TypedExtensionConfig codec = 2 [(validate.rules).message = {required: true}];
}

// [#not-implemented-hide:]
message MetaRds {
// Configuration source specifier for RDS.
config.core.v3.ConfigSource config_source = 1 [(validate.rules).message = {required: true}];

// The name of the route configuration. This name will be passed to the RDS API. This allows an
// Envoy configuration with multiple meta protocol proxies to use different route configurations.
string route_config_name = 2 [(validate.rules).string = {min_len: 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.

This should all be TypedExtensionConfig

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.

get it.

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.

fixed

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
syntax = "proto3";

package envoy.extensions.filters.network.meta_protocol_proxy.v3;

import "xds/annotations/v3/status.proto";
import "xds/type/matcher/v3/matcher.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.v3";
option java_outer_classname = "RouteProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

// [#protodoc-title: Meta Protocol Proxy Route Configuration]
// The meta protocol proxy makes use of the `xds matching API` for routing configurations.
//
// In the below example, we combine a top level tree matcher with a linear matcher to match
// the incoming requests, and send the matching requests to v1 of the upstream service.
//
// name: demo-v1
// route:
// matcher_tree:
// input:
// name: request-service
// typed_config:
// "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3.ServiceMatchInput
// exact_match_map:
// map:
// org.apache.dubbo.samples.basic.api.DemoService:
// matcher:
// matcher_list:
// matchers:
// - predicate:
// and_matcher:
// predicate:
// - single_predicate:
// input:
// name: request-properties
// typed_config:
// "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3.PropertyMatchInput
// property_name: version
// value_match:
// exact: v1
// - single_predicate:
// input:
// name: request-properties
// typed_config:
// "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3.PropertyMatchInput
// property_name: user
// value_match:
// exact: john
// on_match:
// action:
// name: route
// typed_config:
// "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.action.v3.routeAction
// cluster: outbound|20880|v1|org.apache.dubbo.samples.basic.api.demoservice
// [#not-implemented-hide:]
message RouteConfiguration {
// The name of the route configuration. For example, it might match route_config_name in
// envoy.extensions.filters.network.meta_protocol_proxy.v3.Rds.
string name = 1 [(validate.rules).string = {min_len: 1}];

// The match tree to use when resolving route actions for incoming requests.
xds.type.matcher.v3.Matcher route = 2 [(validate.rules).message = {required: true}];
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.

Nice to see the switch to this (CC @snowp). Have you a working implementation yet based on these matchers? Any reference PR with all the pieces connected together?

In general the strategy of small incremental PRs is good, but it's also good to have some branch or PR to refer to that connects this.

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.

Thanks. We have implemented part of it and plan to submit a new PR after the API is merged. All progress and PR will be recorded in #18209.

}
3 changes: 3 additions & 0 deletions api/versioning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ proto_library(
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
"//envoy/extensions/filters/network/http_connection_manager/v3:pkg",
"//envoy/extensions/filters/network/local_ratelimit/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/action/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/v3:pkg",
"//envoy/extensions/filters/network/mongo_proxy/v3:pkg",
"//envoy/extensions/filters/network/ratelimit/v3:pkg",
"//envoy/extensions/filters/network/rbac/v3:pkg",
Expand Down