From ff47e0a4bd03c0580305f9b138cc7937b63f7900 Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Wed, 19 Jan 2022 06:27:25 +0000 Subject: [PATCH] Sipproxy update for routing affinity (#19254) Risk Level: Medium Testing: unit test & manual testing Docs Changes: update sip proxy docs Release Notes: Platform Specific Features: Signed-off-by: Mingling Ding Co-authored-by: Felix Du Mirrored from https://github.com/envoyproxy/envoy @ 7174c148a0763f2ed5863c3ab341d4a9ce01c54b --- BUILD | 1 + .../network/sip_proxy/tra/v3alpha/BUILD | 13 ++ .../network/sip_proxy/tra/v3alpha/tra.proto | 126 ++++++++++++++++++ .../filters/network/sip_proxy/v3alpha/BUILD | 5 +- .../network/sip_proxy/v3alpha/sip_proxy.proto | 15 +++ versioning/BUILD | 1 + 6 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/BUILD create mode 100644 contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/tra.proto diff --git a/BUILD b/BUILD index 1ba6e68a..2caeb712 100644 --- a/BUILD +++ b/BUILD @@ -80,6 +80,7 @@ proto_library( "//contrib/envoy/extensions/filters/network/postgres_proxy/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/rocketmq_proxy/v3:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/router/v3alpha:pkg", + "//contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/v3alpha:pkg", "//contrib/envoy/extensions/private_key_providers/cryptomb/v3alpha:pkg", "//contrib/envoy/extensions/vcl/v3alpha:pkg", diff --git a/contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/BUILD b/contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/BUILD new file mode 100644 index 00000000..7753cfeb --- /dev/null +++ b/contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/BUILD @@ -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( + has_services = True, + deps = [ + "//envoy/config/core/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/tra.proto b/contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/tra.proto new file mode 100644 index 00000000..ca6baf9f --- /dev/null +++ b/contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/tra.proto @@ -0,0 +1,126 @@ +syntax = "proto3"; + +package envoy.extensions.filters.network.sip_proxy.tra.v3alpha; + +import "envoy/config/core/v3/config_source.proto"; +import "envoy/config/core/v3/grpc_service.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.sip_proxy.tra.v3alpha"; +option java_outer_classname = "TraProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/sip_proxy/tra/v3alpha"; +option java_generic_services = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: TrafficRoutingAssistant] + +service TraService { + rpc Create(TraServiceRequest) returns (TraServiceResponse) { + } + + rpc Update(TraServiceRequest) returns (TraServiceResponse) { + } + + rpc Retrieve(TraServiceRequest) returns (TraServiceResponse) { + } + + rpc Delete(TraServiceRequest) returns (TraServiceResponse) { + } + + rpc Subscribe(TraServiceRequest) returns (stream TraServiceResponse) { + } +} + +message TraServiceConfig { + // Specifies the gRPC service that hosts the rate limit service. The client + // will connect to this cluster when it needs to make rate limit service + // requests. + config.core.v3.GrpcService grpc_service = 1 [(validate.rules).message = {required: true}]; + + // API version for rate limit transport protocol. This describes the rate limit gRPC endpoint and + // version of messages used on the wire. + config.core.v3.ApiVersion transport_api_version = 2 + [(validate.rules).enum = {defined_only: true}]; + + google.protobuf.Duration timeout = 3; +} + +// [#next-free-field: 7] +message TraServiceRequest { + string type = 1; + + oneof request { + CreateRequest create_request = 2; + + UpdateRequest update_request = 3; + + RetrieveRequest retrieve_request = 4; + + DeleteRequest delete_request = 5; + + SubscribeRequest subscribe_request = 6; + } +} + +// [#next-free-field: 9] +message TraServiceResponse { + string type = 1; + + int32 ret = 2; + + string reason = 3; + + oneof response { + CreateResponse create_response = 4; + + UpdateResponse update_response = 5; + + RetrieveResponse retrieve_response = 6; + + DeleteResponse delete_response = 7; + + SubscribeResponse subscribe_response = 8; + } +} + +message CreateRequest { + map data = 1; +} + +message CreateResponse { +} + +message UpdateRequest { + map data = 1; +} + +message UpdateResponse { +} + +message RetrieveRequest { + string key = 1; +} + +message RetrieveResponse { + map data = 1; +} + +message DeleteRequest { + string key = 1; +} + +message DeleteResponse { +} + +message SubscribeRequest { +} + +message SubscribeResponse { + map data = 1; +} diff --git a/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/BUILD b/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/BUILD index ee92fb65..808cd297 100644 --- a/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/BUILD +++ b/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/BUILD @@ -5,5 +5,8 @@ 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"], + deps = [ + "//contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], ) diff --git a/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/sip_proxy.proto b/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/sip_proxy.proto index 5347eb77..d13c2cde 100644 --- a/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/sip_proxy.proto +++ b/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/sip_proxy.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package envoy.extensions.filters.network.sip_proxy.v3alpha; +import "contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha/tra.proto"; import "contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/route.proto"; import "google/protobuf/any.proto"; @@ -65,6 +66,8 @@ message SipProxy { // points to domain match with own_domain string domain_match_parameter_name = 3; + + tra.v3alpha.TraServiceConfig tra_service_config = 4; } // The human readable prefix to use when emitting statistics. @@ -106,4 +109,16 @@ message SipProtocolOptions { // The Register with Authorization header should go to the same endpoint which send out the 401 Unauthorized. bool registration_affinity = 2; + + // Customized affinity + repeated CustomizedAffinity customized_affinity = 3; +} + +// For affinity +message CustomizedAffinity { + string key_name = 1; + + bool query = 2; + + bool subscribe = 3; } diff --git a/versioning/BUILD b/versioning/BUILD index b2bba15b..33971396 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -17,6 +17,7 @@ proto_library( "//contrib/envoy/extensions/filters/network/postgres_proxy/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/rocketmq_proxy/v3:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/router/v3alpha:pkg", + "//contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/v3alpha:pkg", "//contrib/envoy/extensions/private_key_providers/cryptomb/v3alpha:pkg", "//contrib/envoy/extensions/vcl/v3alpha:pkg",