From c3c065716f034e6273e72f8450dfefaa93fb836c Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Thu, 23 Apr 2020 03:31:32 +0000 Subject: [PATCH] rocketmq_proxy: implement rocketmq proxy Implement rocketmq proxy Description: implement rocketmq proxy Risk Level: Low Testing: Unit Tests Docs Changes: N/A Release Notes: N/A Fixes #9431 Signed-off-by: aaron-ai Mirrored from https://github.com/envoyproxy/envoy @ 0a7dba7933af7c5e1ffd842d76d221881dd46a24 --- BUILD | 1 + .../filters/network/rocketmq_proxy/v3/BUILD | 14 +++++ .../network/rocketmq_proxy/v3/README.md | 1 + .../rocketmq_proxy/v3/rocketmq_proxy.proto | 36 ++++++++++++ .../network/rocketmq_proxy/v3/route.proto | 55 +++++++++++++++++++ versioning/BUILD | 1 + 6 files changed, 108 insertions(+) create mode 100644 envoy/extensions/filters/network/rocketmq_proxy/v3/BUILD create mode 100644 envoy/extensions/filters/network/rocketmq_proxy/v3/README.md create mode 100644 envoy/extensions/filters/network/rocketmq_proxy/v3/rocketmq_proxy.proto create mode 100644 envoy/extensions/filters/network/rocketmq_proxy/v3/route.proto diff --git a/BUILD b/BUILD index 97a8554b..d52653eb 100644 --- a/BUILD +++ b/BUILD @@ -214,6 +214,7 @@ proto_library( "//envoy/extensions/filters/network/ratelimit/v3:pkg", "//envoy/extensions/filters/network/rbac/v3:pkg", "//envoy/extensions/filters/network/redis_proxy/v3:pkg", + "//envoy/extensions/filters/network/rocketmq_proxy/v3:pkg", "//envoy/extensions/filters/network/sni_cluster/v3:pkg", "//envoy/extensions/filters/network/sni_dynamic_forward_proxy/v3alpha:pkg", "//envoy/extensions/filters/network/tcp_proxy/v3:pkg", diff --git a/envoy/extensions/filters/network/rocketmq_proxy/v3/BUILD b/envoy/extensions/filters/network/rocketmq_proxy/v3/BUILD new file mode 100644 index 00000000..e6bc5699 --- /dev/null +++ b/envoy/extensions/filters/network/rocketmq_proxy/v3/BUILD @@ -0,0 +1,14 @@ +# DO NOT EDIT. This file is generated by tools/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", + "//envoy/config/route/v3:pkg", + "//envoy/type/matcher/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/filters/network/rocketmq_proxy/v3/README.md b/envoy/extensions/filters/network/rocketmq_proxy/v3/README.md new file mode 100644 index 00000000..3bd849bc --- /dev/null +++ b/envoy/extensions/filters/network/rocketmq_proxy/v3/README.md @@ -0,0 +1 @@ +Protocol buffer definitions for the Rocketmq proxy. \ No newline at end of file diff --git a/envoy/extensions/filters/network/rocketmq_proxy/v3/rocketmq_proxy.proto b/envoy/extensions/filters/network/rocketmq_proxy/v3/rocketmq_proxy.proto new file mode 100644 index 00000000..ee77ab90 --- /dev/null +++ b/envoy/extensions/filters/network/rocketmq_proxy/v3/rocketmq_proxy.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package envoy.extensions.filters.network.rocketmq_proxy.v3; + +import "envoy/extensions/filters/network/rocketmq_proxy/v3/route.proto"; + +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.network.rocketmq_proxy.v3"; +option java_outer_classname = "RocketmqProxyProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: RocketMQ Proxy] +// RocketMQ Proxy :ref:`configuration overview `. +// [#extension: envoy.filters.network.rocketmq_proxy] + +message RocketmqProxy { + // The human readable prefix to use when emitting statistics. + string stat_prefix = 1 [(validate.rules).string = {min_bytes: 1}]; + + // The route table for the connection manager is specified in this property. + RouteConfiguration route_config = 2; + + // The largest duration transient object expected to live, more than 10s is recommended. + google.protobuf.Duration transient_object_life_span = 3; + + // If develop_mode is enabled, this proxy plugin may work without dedicated traffic intercepting + // facility without considering backward compatibility of exiting RocketMQ client SDK. + bool develop_mode = 4; +} diff --git a/envoy/extensions/filters/network/rocketmq_proxy/v3/route.proto b/envoy/extensions/filters/network/rocketmq_proxy/v3/route.proto new file mode 100644 index 00000000..5fe5d33f --- /dev/null +++ b/envoy/extensions/filters/network/rocketmq_proxy/v3/route.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; + +package envoy.extensions.filters.network.rocketmq_proxy.v3; + +import "envoy/config/core/v3/base.proto"; +import "envoy/config/route/v3/route_components.proto"; +import "envoy/type/matcher/v3/string.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.network.rocketmq_proxy.v3"; +option java_outer_classname = "RouteProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Rocketmq Proxy Route Configuration] +// Rocketmq Proxy :ref:`configuration overview `. + +message RouteConfiguration { + // The name of the route configuration. + string name = 1; + + // The list of routes that will be matched, in order, against incoming requests. The first route + // that matches will be used. + repeated Route routes = 2; +} + +message Route { + // Route matching parameters. + RouteMatch match = 1 [(validate.rules).message = {required: true}]; + + // Route request to some upstream cluster. + RouteAction route = 2 [(validate.rules).message = {required: true}]; +} + +message RouteMatch { + // The name of the topic. + type.matcher.v3.StringMatcher topic = 1 [(validate.rules).message = {required: true}]; + + // Specifies a set of headers that the route should match on. The router will check the request’s + // headers against all the specified headers in the route config. A match will happen if all the + // headers in the route are present in the request with the same values (or based on presence if + // the value field is not in the config). + repeated config.route.v3.HeaderMatcher headers = 2; +} + +message RouteAction { + // Indicates the upstream cluster to which the request should be routed. + string cluster = 1 [(validate.rules).string = {min_bytes: 1}]; + + // Optional endpoint metadata match criteria used by the subset load balancer. + config.core.v3.Metadata metadata_match = 2; +} diff --git a/versioning/BUILD b/versioning/BUILD index bbb683d8..f1a0d244 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -96,6 +96,7 @@ proto_library( "//envoy/extensions/filters/network/ratelimit/v3:pkg", "//envoy/extensions/filters/network/rbac/v3:pkg", "//envoy/extensions/filters/network/redis_proxy/v3:pkg", + "//envoy/extensions/filters/network/rocketmq_proxy/v3:pkg", "//envoy/extensions/filters/network/sni_cluster/v3:pkg", "//envoy/extensions/filters/network/sni_dynamic_forward_proxy/v3alpha:pkg", "//envoy/extensions/filters/network/tcp_proxy/v3:pkg",