olaris.polaris-all.1.15.5.source-code.routing.proto Maven / Gradle / Ivy
syntax = "proto3";
package v1;
import "google/protobuf/wrappers.proto";
import "google/protobuf/any.proto";
import "model.proto";
option go_package = "github.com/polarismesh/specification/source/go/api/v1/traffic_manage";
option java_package = "com.tencent.polaris.specification.api.v1.traffic.manage";
option java_outer_classname = "RoutingProto";
message Routing {
// 规则所属服务以及命名空间
google.protobuf.StringValue service = 1;
google.protobuf.StringValue namespace = 2;
// 每个服务可以配置多条入站或者出站规则
// 对于每个请求,从上到下依次匹配,若命中则终止
repeated Route inbounds = 3;
repeated Route outbounds = 4;
google.protobuf.StringValue ctime = 5;
google.protobuf.StringValue mtime = 6;
google.protobuf.StringValue revision = 7;
google.protobuf.StringValue service_token = 8 [ json_name = "service_token" ];
reserved 9 to 20;
// route rules for current service
repeated RouteRule rules = 21;
}
// deprecated: only for compatible to the old version server
message Route {
// 如果匹配Source规则,按照Destination路由
// 多个Source之间的关系为或
repeated Source sources = 1;
repeated Destination destinations = 2;
// extendInfo 用于承载一些额外信息
// case 1: 升级到 v2 版本时,记录对应到 v2 版本的 id 信息
map extendInfo = 3;
}
// deprecated: only for compatible to the old version server
message Source {
// 主调方服务以及命名空间
google.protobuf.StringValue service = 1;
google.protobuf.StringValue namespace = 2;
// 主调方服务实例标签或者请求标签
// value支持正则匹配
map metadata = 3;
}
// deprecated: only for compatible to the old version server
message Destination {
// 被调方服务以及命名空间
google.protobuf.StringValue service = 1;
google.protobuf.StringValue namespace = 2;
// 被调方服务实例标签
// value支持正则匹配
map metadata = 3;
// 根据服务名和服务实例metadata筛选符合条件的服务实例子集
// 服务实例子集可以设置优先级和权重
// 优先级:整型,范围[0, 9],最高优先级为0
// 权重:整型
// 先按优先级路由,如果存在高优先级,不会使用低优先级
// 如果存在优先级相同的子集,再按权重分配
// 优先级和权重可以都不设置/设置一个/设置两个
// 如果部分设置优先级,部分没有设置,认为没有设置的优先级最低
// 如果部分设置权重,部分没有设置,认为没有设置的权重为0
// 如果全部没有设置权重,认为权重相同
google.protobuf.UInt32Value priority = 4;
google.protobuf.UInt32Value weight = 5;
// 将请求转发到代理服务
google.protobuf.StringValue transfer = 6;
//是否对该set执行隔离,隔离后,不会再分配流量
google.protobuf.BoolValue isolate = 7;
// 实例分组名
google.protobuf.StringValue name = 8;
}
enum RoutingPolicy {
// Route by rule rule => RuleRoutingConfig
RulePolicy = 0;
// Route by destination metadata ==> MetadataRoutingConfig
MetadataPolicy = 1;
}
// configuration root for route
message RouteRule {
string id = 1;
// route rule name
string name = 2;
// namespace namingspace of routing rules
string namespace = 3;
// Enable this router
bool enable = 4;
// Router type
RoutingPolicy routing_policy = 5 [ json_name = "routing_policy" ];
// Routing configuration for router
google.protobuf.Any routing_config = 6 [ json_name = "routing_config" ];
// revision routing version
string revision = 7;
// ctime create time of the rules
string ctime = 8;
// mtime modify time of the rules
string mtime = 9;
// etime enable time of the rules
string etime = 10;
// priority rules priority
uint32 priority = 11;
// description simple description rules
string description = 12;
// extendInfo 用于承载一些额外信息
// case 1: 升级到 v2 版本时,记录对应到 v1 版本的 id 信息
map extendInfo = 20;
}
message MetadataFailover {
enum FailoverRange {
// ALL return all instances
ALL = 0;
// OTHERS retuen without thie labels instances
OTHERS = 1;
// OTHER_KEYS return other instances which match keys
OTHER_KEYS = 2;
}
// failover_range metadata route bottom type
FailoverRange failover_range = 1;
// only use to failover_range == OTHER_KEYS
map labels = 2;
}
// MetadataRoutingConfig metadata routing configuration
message MetadataRoutingConfig {
// service
string service = 1;
// namespace
string namespace = 2;
map labels = 3;
// When metadata not found, it will fall back to the
MetadataFailover failover = 4;
}
// RuleRoutingConfig routing configuration
message RuleRoutingConfig {
// source source info
// deprecated: only for compatible to the old version server
repeated SourceService sources = 1;
// destination destinations info
// deprecated: only for compatible to the old version server
repeated DestinationGroup destinations = 2;
// rule route chain
repeated SubRuleRouting rules = 3;
}
// SubRuleRouting sub routing configuration
message SubRuleRouting {
// sub routing rule name
string name = 1;
// source source info
repeated SourceService sources = 2;
// destination destinations info
repeated DestinationGroup destinations = 3;
}
message SourceService {
// Main tuning service and namespace
string service = 1;
string namespace = 2;
// Master Control Service Example Tag or Request Label
// Value supports regular matching
repeated SourceMatch arguments = 3;
}
message DestinationGroup {
// Templated service and namespace
string service = 1;
string namespace = 2;
// Templated service example label
// Value supports regular matching
map labels = 3;
// According to the service name and service instance Metadata Filter the
// qualified service instance subset Service instance subset can set priority
// and weight Priority: integer, range [0, 9], the highest priority is 0
// Weight: Integer
// Press priority routing, if there is high priority, low priority will not
// use If there is a subset of the same priority, then assign by weight
// Priority and weight can be not set / set up one / set two
// If the section is set priority, some are not set, it is considered that the
// priority is not set. If the part is set, some is not set, it is considered
// that the weight is not set to 0 If you have no weight, you think the weight
// is the same
uint32 priority = 4;
uint32 weight = 5;
// Forward requests to proxy service
string transfer = 6;
// Whether to isolate the SET, after isolation, no traffic will be allocated
bool isolate = 7;
// name desition name
string name = 8;
}
// SourceMatch
message SourceMatch {
// label type for gateway request
enum Type {
// custom arguments
CUSTOM = 0;
// method, match the http post/get/put/delete or grpc method
METHOD = 1;
// header, match the http header, dubbo attachment, grpc header
HEADER = 2;
// query, match the http query, dubbo argument
QUERY = 3;
// caller host ip
CALLER_IP = 4;
// path, math the http url
PATH = 5;
// cookie match http cookie
COOKIE = 6;
}
Type type = 1;
// header key or query key
string key = 2;
// header value or query value
MatchString value = 3;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy