From 5d0dac990ec3abb8f5c930f03b47287eb16278ca Mon Sep 17 00:00:00 2001 From: "update-envoy[bot]" <135279899+update-envoy[bot]@users.noreply.github.com> Date: Thu, 28 Dec 2023 12:05:04 +0000 Subject: [PATCH] lua support cluster specifier extension (#31034) * lua cluster specifier api Signed-off-by: wangkai19 * fix api format Signed-off-by: wangkai19 * add validate for api filed Signed-off-by: wangkai19 * fix api format Signed-off-by: wangkai19 * implement lua cluster specifier plugin Signed-off-by: wangkai19 * fix format Signed-off-by: wangkai19 * fix format Signed-off-by: wangkai19 * fix format Signed-off-by: wangkai19 * add example Signed-off-by: wangkai19 * fix format Signed-off-by: wangkai19 * fix format Signed-off-by: wangkai19 * fix example Signed-off-by: wangkai19 * fix review Signed-off-by: wangkai19 * fix dep ci Signed-off-by: wangkai19 * add changelog Signed-off-by: wangkai19 * fix review Signed-off-by: wangkai19 * fix ut Signed-off-by: wangkai19 * add test Signed-off-by: wangkai19 --------- Signed-off-by: wangkai19 Mirrored from https://github.com/envoyproxy/envoy @ 57f23d3092956972f2c23f869280310c7a65ca33 --- BUILD | 1 + .../router/cluster_specifiers/lua/v3/BUILD | 12 +++++++++ .../cluster_specifiers/lua/v3/lua.proto | 27 +++++++++++++++++++ versioning/BUILD | 1 + 4 files changed, 41 insertions(+) create mode 100644 envoy/extensions/router/cluster_specifiers/lua/v3/BUILD create mode 100644 envoy/extensions/router/cluster_specifiers/lua/v3/lua.proto diff --git a/BUILD b/BUILD index e9eb8cd0..16a0037c 100644 --- a/BUILD +++ b/BUILD @@ -309,6 +309,7 @@ proto_library( "//envoy/extensions/retry/host/omit_host_metadata/v3:pkg", "//envoy/extensions/retry/host/previous_hosts/v3:pkg", "//envoy/extensions/retry/priority/previous_priorities/v3:pkg", + "//envoy/extensions/router/cluster_specifiers/lua/v3:pkg", "//envoy/extensions/stat_sinks/graphite_statsd/v3:pkg", "//envoy/extensions/stat_sinks/open_telemetry/v3:pkg", "//envoy/extensions/stat_sinks/wasm/v3:pkg", diff --git a/envoy/extensions/router/cluster_specifiers/lua/v3/BUILD b/envoy/extensions/router/cluster_specifiers/lua/v3/BUILD new file mode 100644 index 00000000..09a37ad1 --- /dev/null +++ b/envoy/extensions/router/cluster_specifiers/lua/v3/BUILD @@ -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 = [ + "//envoy/config/core/v3:pkg", + "@com_github_cncf_xds//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/router/cluster_specifiers/lua/v3/lua.proto b/envoy/extensions/router/cluster_specifiers/lua/v3/lua.proto new file mode 100644 index 00000000..b8ea10a0 --- /dev/null +++ b/envoy/extensions/router/cluster_specifiers/lua/v3/lua.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package envoy.extensions.router.cluster_specifiers.lua.v3; + +import "envoy/config/core/v3/base.proto"; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.router.cluster_specifiers.lua.v3"; +option java_outer_classname = "LuaProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/router/cluster_specifiers/lua/v3;luav3"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Lua] +// +// Lua cluster specifier :ref:`configuration reference documentation `. +// [#extension: envoy.router.cluster_specifier_plugin.lua] + +message LuaConfig { + // The lua code that Envoy will execute to select cluster. + config.core.v3.DataSource source_code = 1 [(validate.rules).message = {required: true}]; + + // Default cluster. It will be used when the lua code execute failure. + string default_cluster = 2; +} diff --git a/versioning/BUILD b/versioning/BUILD index 828efeaa..65ba4dc5 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -248,6 +248,7 @@ proto_library( "//envoy/extensions/retry/host/omit_host_metadata/v3:pkg", "//envoy/extensions/retry/host/previous_hosts/v3:pkg", "//envoy/extensions/retry/priority/previous_priorities/v3:pkg", + "//envoy/extensions/router/cluster_specifiers/lua/v3:pkg", "//envoy/extensions/stat_sinks/graphite_statsd/v3:pkg", "//envoy/extensions/stat_sinks/open_telemetry/v3:pkg", "//envoy/extensions/stat_sinks/wasm/v3:pkg",