golang extension: implement cluster_specifier_plugin to choose cluster dynamically (#25677)
* wip: cluster specifier. Signed-off-by: doujiang24 <doujiang24@gmail.com> * goland happy. Signed-off-by: doujiang24 <doujiang24@gmail.com> * go module build ok. Signed-off-by: doujiang24 <doujiang24@gmail.com> * resue the utils module. Signed-off-by: doujiang24 <doujiang24@gmail.com> * golang filter test ok. Signed-off-by: doujiang24 <doujiang24@gmail.com> * wip: C++ not compile ok yet. Signed-off-by: doujiang24 <doujiang24@gmail.com> * c++ compile ok. Signed-off-by: doujiang24 <doujiang24@gmail.com> * simple work. Signed-off-by: doujiang24 <doujiang24@gmail.com> * change go.mod. Signed-off-by: doujiang24 <doujiang24@gmail.com> * http filters test passed. Signed-off-by: doujiang24 <doujiang24@gmail.com> * prepare cluster test. Signed-off-by: doujiang24 <doujiang24@gmail.com> * cluster specifier test. Signed-off-by: doujiang24 <doujiang24@gmail.com> * cluster specifier: make the headermap API simple. Signed-off-by: doujiang24 <doujiang24@gmail.com> * test compile. Signed-off-by: doujiang24 <doujiang24@gmail.com> * code tweak. Signed-off-by: doujiang24 <doujiang24@gmail.com> * configFactory. Signed-off-by: doujiang24 <doujiang24@gmail.com> * compile ok. Signed-off-by: doujiang24 <doujiang24@gmail.com> * test: default_cluster. Signed-off-by: doujiang24 <doujiang24@gmail.com> * tweak. Signed-off-by: doujiang24 <doujiang24@gmail.com> * recover panic. Signed-off-by: doujiang24 <doujiang24@gmail.com> * validator plugin_id from golang. Signed-off-by: doujiang24 <doujiang24@gmail.com> * fix format. Signed-off-by: doujiang24 <doujiang24@gmail.com> * make deps simplier. Signed-off-by: doujiang24 <doujiang24@gmail.com> * tweak proto comments. Signed-off-by: doujiang24 <doujiang24@gmail.com> * update go.mod. Signed-off-by: doujiang24 <doujiang24@gmail.com> * format tweak. Signed-off-by: doujiang24 <doujiang24@gmail.com> * add metadata. Signed-off-by: doujiang24 <doujiang24@gmail.com> * add extenstion categories. Signed-off-by: doujiang24 <doujiang24@gmail.com> * add doc. Signed-off-by: doujiang24 <doujiang24@gmail.com> * doc cluster_specifier. Signed-off-by: doujiang24 <doujiang24@gmail.com> * doc: extension category Signed-off-by: doujiang24 <doujiang24@gmail.com> * used registry in Go filter plugin. Signed-off-by: doujiang24 <doujiang24@gmail.com> * update deps. Signed-off-by: doujiang24 <doujiang24@gmail.com> * upgrade golang/x/* version. Signed-off-by: doujiang24 <doujiang24@gmail.com> * fix dso test. Signed-off-by: doujiang24 <doujiang24@gmail.com> * revert change in examples/grpc-bridge/server/go.mod. Signed-off-by: doujiang24 <doujiang24@gmail.com> * address comments. Signed-off-by: doujiang24 <doujiang24@gmail.com> * style fix: NOLINT(readability-identifier-naming) Signed-off-by: doujiang24 <doujiang24@gmail.com> * remove unused function. Signed-off-by: doujiang24 <doujiang24@gmail.com> * clang code style fix. Signed-off-by: doujiang24 <doujiang24@gmail.com> * address comments. Signed-off-by: doujiang24 <doujiang24@gmail.com> * refactor dso load and Go API regsitry. Signed-off-by: doujiang24 <doujiang24@gmail.com> * rename http/cluster_specifier => router/cluster_specifier. Signed-off-by: doujiang24 <doujiang24@gmail.com> * address comments. Signed-off-by: doujiang24 <doujiang24@gmail.com> * protected => private. Signed-off-by: doujiang24 <doujiang24@gmail.com> * works. Signed-off-by: doujiang24 <doujiang24@gmail.com> * fix format. Signed-off-by: doujiang24 <doujiang24@gmail.com> * fix clang tidy. Signed-off-by: doujiang24 <doujiang24@gmail.com> * address comments. Signed-off-by: doujiang24 <doujiang24@gmail.com> * fix format. Signed-off-by: doujiang24 <doujiang24@gmail.com> --------- Signed-off-by: doujiang24 <doujiang24@gmail.com> Mirrored from https://github.com/envoyproxy/envoy @ 3c7612f595f67fd8905e172129b09d5dce66a89apull/626/head
parent
ed87422da6
commit
2f68fd3c2e
4 changed files with 65 additions and 0 deletions
@ -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", |
||||
], |
||||
) |
@ -0,0 +1,51 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.extensions.router.cluster_specifier.golang.v3alpha; |
||||
|
||||
import "google/protobuf/any.proto"; |
||||
|
||||
import "xds/annotations/v3/status.proto"; |
||||
|
||||
import "udpa/annotations/status.proto"; |
||||
import "validate/validate.proto"; |
||||
|
||||
option java_package = "io.envoyproxy.envoy.extensions.router.cluster_specifier.golang.v3alpha"; |
||||
option java_outer_classname = "GolangProto"; |
||||
option java_multiple_files = true; |
||||
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/router/cluster_specifier/golang/v3alpha"; |
||||
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||
option (xds.annotations.v3.file_status).work_in_progress = true; |
||||
|
||||
// [#protodoc-title: Golang] |
||||
// |
||||
// For an overview of the Golang cluster specifier please see the :ref:`configuration reference documentation <config_http_cluster_specifier_golang>`. |
||||
// [#extension: envoy.router.cluster_specifier_plugin.golang] |
||||
|
||||
// [#extension-category: envoy.router.cluster_specifier_plugin] |
||||
message Config { |
||||
// Globally unique ID for a dynamic library file. |
||||
string library_id = 1 [(validate.rules).string = {min_len: 1}]; |
||||
|
||||
// Path to a dynamic library implementing the |
||||
// :repo:`ClusterSpecifier API <contrib/golang/router/cluster_specifier/source/go/pkg/api.ClusterSpecifier>` |
||||
// interface. |
||||
// [#comment:TODO(wangfakang): Support for downloading libraries from remote repositories.] |
||||
string library_path = 2 [(validate.rules).string = {min_len: 1}]; |
||||
|
||||
// Default cluster. |
||||
// |
||||
// It will be used when the specifier interface return empty string or panic. |
||||
// |
||||
string default_cluster = 3 [(validate.rules).string = {min_len: 1}]; |
||||
|
||||
// Configuration for the Go cluster specifier plugin. |
||||
// |
||||
// .. note:: |
||||
// This configuration is only parsed in the go cluster specifier, and is therefore not validated |
||||
// by Envoy. |
||||
// |
||||
// See the :repo:`StreamFilter API <contrib/golang/router/cluster_specifier/source/go/pkg/cluster_specifier/config.go>` |
||||
// for more information about how the plugin's configuration data can be accessed. |
||||
// |
||||
google.protobuf.Any config = 4; |
||||
} |
Loading…
Reference in new issue