Skip to content

Commit

Permalink
generic proxy: move generic proxy from contrib into extensions (#34892)
Browse files Browse the repository at this point in the history
Commit Message: generic proxy: move generic proxy from contrib into
extensions
Additional Description:

The generic proxy is designed as a framework to empower the developers
to develop new L7 proxy for various L7 protocols.
It's be used for multiple different private protocols now in the
production env of our users. And recently, I complete the last part of
generic proxy: the filter chain support to the variable length stream.
And except the private protocols, we use the generic proxy implement the
kafka proxing and pulsar proxing and conditional traffic routing. (part
of these works are contributed back to the envoy).

After an offline discussion with other maintainers, I prepare to move
the generic proxy to the extensions now.

Risk Level: low.
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.

---------

Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: wbpcode <wbphub@gmail.com>
Co-authored-by: wbpcode <wbphub@live.com>
  • Loading branch information
wbpcode and wbpcode committed Jul 9, 2024
1 parent a74baeb commit 0dbd441
Show file tree
Hide file tree
Showing 97 changed files with 2,558 additions and 1,018 deletions.
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ extensions/filters/http/oauth2 @derekargueta @mattklein123
/*/extensions/geoip_providers/maxmind @nezdolik @ravenblackx
# Match delegate extension
/*/extensions/filters/http/match_delegate @wbpcode @jstraceski @tyxia
# Generic proxy and related extensions
/*/extensions/filters/network/generic_proxy/ @wbpcode @soulxu

/*/extensions/health_checkers/common @zuercher @botengyao

Expand Down
12 changes: 6 additions & 6 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,7 @@ proto_library(
"//contrib/envoy/extensions/filters/http/squash/v3:pkg",
"//contrib/envoy/extensions/filters/http/sxg/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/client_ssl_auth/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/action/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/codecs/dubbo/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/codecs/http1/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/codecs/kafka/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/router/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/v3:pkg",
"//contrib/envoy/extensions/filters/network/golang/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/kafka_broker/v3:pkg",
"//contrib/envoy/extensions/filters/network/kafka_mesh/v3alpha:pkg",
Expand Down Expand Up @@ -230,6 +224,12 @@ proto_library(
"//envoy/extensions/filters/network/dubbo_proxy/v3:pkg",
"//envoy/extensions/filters/network/echo/v3:pkg",
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/action/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/codecs/dubbo/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/codecs/http1/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/matcher/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/router/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/v3:pkg",
"//envoy/extensions/filters/network/http_connection_manager/v3:pkg",
"//envoy/extensions/filters/network/local_ratelimit/v3:pkg",
"//envoy/extensions/filters/network/mongo_proxy/v3:pkg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.action.v3";
option java_outer_classname = "ActionProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/generic_proxy/action/v3;actionv3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/action/v3;actionv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "udpa/annotations/status.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.codecs.dubbo.v3";
option java_outer_classname = "DubboProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/generic_proxy/codecs/dubbo/v3;dubbov3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/codecs/dubbo/v3;dubbov3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "udpa/annotations/status.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.codecs.http1.v3";
option java_outer_classname = "Http1Proto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/generic_proxy/codecs/http1/v3;http1v3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/codecs/http1/v3;http1v3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.matcher.v3";
option java_outer_classname = "MatcherProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3;matcherv3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/matcher/v3;matcherv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "udpa/annotations/status.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.router.v3";
option java_outer_classname = "RouterProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/generic_proxy/router/v3;routerv3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/router/v3;routerv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ syntax = "proto3";

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

import "contrib/envoy/extensions/filters/network/generic_proxy/v3/route.proto";
import "envoy/config/accesslog/v3/accesslog.proto";
import "envoy/config/core/v3/config_source.proto";
import "envoy/config/core/v3/extension.proto";
import "envoy/extensions/filters/network/generic_proxy/v3/route.proto";
import "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto";

import "xds/annotations/v3/status.proto";
Expand All @@ -16,7 +16,7 @@ import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.v3";
option java_outer_classname = "GenericProxyProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/generic_proxy/v3;generic_proxyv3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/v3;generic_proxyv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.v3";
option java_outer_classname = "RouteProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/generic_proxy/v3;generic_proxyv3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/v3;generic_proxyv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

Expand Down
12 changes: 6 additions & 6 deletions api/versioning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ proto_library(
"//contrib/envoy/extensions/filters/http/squash/v3:pkg",
"//contrib/envoy/extensions/filters/http/sxg/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/client_ssl_auth/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/action/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/codecs/dubbo/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/codecs/http1/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/codecs/kafka/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/router/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/v3:pkg",
"//contrib/envoy/extensions/filters/network/golang/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/kafka_broker/v3:pkg",
"//contrib/envoy/extensions/filters/network/kafka_mesh/v3alpha:pkg",
Expand Down Expand Up @@ -168,6 +162,12 @@ proto_library(
"//envoy/extensions/filters/network/dubbo_proxy/v3:pkg",
"//envoy/extensions/filters/network/echo/v3:pkg",
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/action/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/codecs/dubbo/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/codecs/http1/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/matcher/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/router/v3:pkg",
"//envoy/extensions/filters/network/generic_proxy/v3:pkg",
"//envoy/extensions/filters/network/http_connection_manager/v3:pkg",
"//envoy/extensions/filters/network/local_ratelimit/v3:pkg",
"//envoy/extensions/filters/network/mongo_proxy/v3:pkg",
Expand Down
4 changes: 0 additions & 4 deletions contrib/contrib_build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CONTRIB_EXTENSIONS = {
"envoy.filters.network.mysql_proxy": "//contrib/mysql_proxy/filters/network/source:config",
"envoy.filters.network.postgres_proxy": "//contrib/postgres_proxy/filters/network/source:config",
"envoy.filters.network.rocketmq_proxy": "//contrib/rocketmq_proxy/filters/network/source:config",
"envoy.filters.network.generic_proxy": "//contrib/generic_proxy/filters/network/source:config",
"envoy.filters.network.golang": "//contrib/golang/filters/network/source:config",

#
Expand Down Expand Up @@ -71,9 +70,6 @@ CONTRIB_EXTENSIONS = {
#
# Extensions for generic proxy
#
"envoy.filters.generic.router": "//contrib/generic_proxy/filters/network/source/router:config",
"envoy.generic_proxy.codecs.dubbo": "//contrib/generic_proxy/filters/network/source/codecs/dubbo:config",
"envoy.generic_proxy.codecs.http1": "//contrib/generic_proxy/filters/network/source/codecs/http1:config",
"envoy.generic_proxy.codecs.kafka": "//contrib/generic_proxy/filters/network/source/codecs/kafka:config",

#
Expand Down
26 changes: 0 additions & 26 deletions contrib/extensions_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,39 +118,13 @@ envoy.xds_delegates.kv_store:
- envoy.xds_delegates
security_posture: data_plane_agnostic
status: wip
envoy.filters.network.generic_proxy:
categories:
- envoy.filters.network
security_posture: requires_trusted_downstream_and_upstream
status: wip
envoy.filters.generic.router:
categories:
- envoy.generic_proxy.filters
security_posture: requires_trusted_downstream_and_upstream
status: wip
type_urls:
- envoy.extensions.filters.network.generic_proxy.router.v3.Router
envoy.generic_proxy.codecs.dubbo:
categories:
- envoy.generic_proxy.codecs
security_posture: requires_trusted_downstream_and_upstream
status: wip
type_urls:
- envoy.extensions.filters.network.generic_proxy.codecs.dubbo.v3.DubboCodecConfig
envoy.generic_proxy.codecs.kafka:
categories:
- envoy.generic_proxy.codecs
security_posture: requires_trusted_downstream_and_upstream
status: wip
type_urls:
- envoy.extensions.filters.network.generic_proxy.codecs.kafka.v3.KafkaCodecConfig
envoy.generic_proxy.codecs.http1:
categories:
- envoy.generic_proxy.codecs
security_posture: requires_trusted_downstream_and_upstream
status: wip
type_urls:
- envoy.extensions.filters.network.generic_proxy.codecs.http1.v3.Http1CodecConfig
envoy.router.cluster_specifier_plugin.golang:
categories:
- envoy.router.cluster_specifier_plugin
Expand Down
24 changes: 0 additions & 24 deletions contrib/generic_proxy/filters/network/source/codecs/dubbo/BUILD

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ envoy_cc_contrib_extension(
"config.h",
],
deps = [
"//contrib/generic_proxy/filters/network/source/interface:codec_interface",
"//contrib/kafka/filters/network/source:kafka_request_codec_lib",
"//contrib/kafka/filters/network/source:kafka_response_codec_lib",
"//source/extensions/filters/network/generic_proxy/interface:codec_interface",
"@envoy_api//contrib/envoy/extensions/filters/network/generic_proxy/codecs/kafka/v3:pkg_cc_proto",
],
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "source/common/buffer/buffer_impl.h"
#include "source/extensions/filters/network/generic_proxy/interface/codec.h"

#include "contrib/envoy/extensions/filters/network/generic_proxy/codecs/kafka/v3/kafka.pb.h"
#include "contrib/generic_proxy/filters/network/source/interface/codec.h"
#include "contrib/kafka/filters/network/source/request_codec.h"
#include "contrib/kafka/filters/network/source/response_codec.h"

Expand Down
105 changes: 0 additions & 105 deletions contrib/generic_proxy/filters/network/source/interface/BUILD

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ envoy_cc_test(
],
deps = [
"//contrib/generic_proxy/filters/network/source/codecs/kafka:config",
"//contrib/generic_proxy/filters/network/test/mocks:codec_mocks",
"//test/extensions/filters/network/generic_proxy/mocks:codec_mocks",
"//test/mocks/server:factory_context_mocks",
],
)
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <cstdint>
#include <memory>

#include "test/extensions/filters/network/generic_proxy/mocks/codec.h"
#include "test/mocks/server/factory_context.h"

#include "contrib/generic_proxy/filters/network/source/codecs/kafka/config.h"
#include "contrib/generic_proxy/filters/network/test/mocks/codec.h"
#include "contrib/kafka/filters/network/source/external/requests.h"
#include "contrib/kafka/filters/network/source/external/responses.h"
#include "gtest/gtest.h"
Expand Down
Loading

0 comments on commit 0dbd441

Please sign in to comment.