diff --git a/api/v1/service_manage/request.proto b/api/v1/service_manage/request.proto index 49f98b4..bc4bb3e 100644 --- a/api/v1/service_manage/request.proto +++ b/api/v1/service_manage/request.proto @@ -31,6 +31,8 @@ message DiscoverRequest { CUSTOM_ROUTE_RULE = 101; // 就近路由规则 NEARBY_ROUTE_RULE = 102; + // 无损上下线规则 + LOSSLESS = 103; } DiscoverRequestType type = 1; diff --git a/api/v1/service_manage/response.proto b/api/v1/service_manage/response.proto index d04f56e..eb0ffdb 100644 --- a/api/v1/service_manage/response.proto +++ b/api/v1/service_manage/response.proto @@ -16,6 +16,7 @@ import "fault_detector.proto"; import "auth.proto"; import "contract.proto"; import "lane.proto"; +import "lossless.proto"; option go_package = "github.com/polarismesh/specification/source/go/api/v1/service_manage"; option java_package = "com.tencent.polaris.specification.api.v1.service.manage"; @@ -101,6 +102,8 @@ message DiscoverResponse { CUSTOM_ROUTE_RULE = 101; // 就近路由规则 NEARBY_ROUTE_RULE = 102; + // 无损上下线规则 + LOSSLESS = 103; } DiscoverResponseType type = 3; @@ -119,6 +122,8 @@ message DiscoverResponse { repeated RouteRule customRouteRules = 23; // 就近路由规则内容 repeated RouteRule nearbyRouteRules = 24; + // 无损上下线规则内容 + LosslessRule losslessRule = 25; } message OptionSwitch { map options = 1; } diff --git a/api/v1/traffic_manage/lossless.proto b/api/v1/traffic_manage/lossless.proto new file mode 100644 index 0000000..862e059 --- /dev/null +++ b/api/v1/traffic_manage/lossless.proto @@ -0,0 +1,86 @@ +syntax = "proto3"; + +package v1; + +import "google/protobuf/wrappers.proto"; +import "google/protobuf/duration.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 = "LosslessProto"; + +// 优雅上下线规则的模型 +message LosslessRule { + // rule id + string id = 1 [ json_name = "id" ]; + // service for rule belongs to + string service = 2 [ json_name = "service" ]; + // namespace for rule belongs to + string namespace = 3 [ json_name = "namespace" ]; + // revision routing version + string revision = 4 [ json_name = "revision" ]; + // ctime create time of the rules + string ctime = 5 [ json_name = "ctime" ]; + // mtime modify time of the rules + string mtime = 6 [ json_name = "mtime" ]; + // configuration for lossless online + LosslessOnline losslessOnline = 7 [ json_name = "lossless_online" ]; + // configuration for lossless offline + LosslessOffline losslessOffline = 8 [ json_name = "lossless_offline" ]; +} + +message LosslessOnline { + // configuration for delayRegister + DelayRegister delayRegister = 1 [ json_name = "delay_register" ]; + // configuration for warmup + Warmup warmup = 2 [ json_name = "warmup" ]; + // configuration for readiness probe + Readiness readiness = 3 [ json_name = "readiness" ]; +} + +message DelayRegister { + // enable delay registry + bool enable = 1 [ json_name = "enable" ]; + enum DelayStrategy { + // register instance after delay specific time + DELAY_BY_TIME = 0; + // register instance until health check successfully + DELAY_BY_HEALTH_CHECK = 1; + } + // delay register strategy + DelayStrategy strategy = 2 [ json_name = "strategy" ]; + // delay register time by second, active when strategy == DELAY_BY_TIME + int32 intervalSecond = 3 [ json_name = "interval_second" ]; + // protocol to do health check, default http, active when strategy == DELAY_BY_HEALTH_CHECK + string healthCheckProtocol = 4 [ json_name = "health_check_protocol" ]; + // method to do health check, default GET, active when strategy == DELAY_BY_HEALTH_CHECK + string healthCheckMethod = 5 [ json_name = "health_check_method" ]; + // path to do health check, no default value, active when strategy == DELAY_BY_HEALTH_CHECK + string healthCheckPath = 6 [ json_name = "health_check_path" ]; + // health check interval second, default is 30, active when strategy == DELAY_BY_HEALTH_CHECK + string healthCheckIntervalSecond = 7 [ json_name = "health_check_interval_second" ]; +} + +message Warmup { + // enable warmup + bool enable = 1 [ json_name = "enable" ]; + // total warmup interval by second + int32 intervalSecond = 2 [ json_name = "interval_second" ]; + // warmup stop when most of the instances in service are in warmup status + bool enableOverloadProtection = 3 [ json_name = "enable_overload_protection" ]; + // the threshold to active overload protection, default is 50, threshld = sum(WarmupInstances)/sum(AllInstances)*100 + int32 overloadProtectionThreshold = 4 [ json_name = "overload_protection_threshold" ]; + // curvature for warmup register, default is 1 + int32 curvature = 5 [ json_name = "curvature" ]; +} + +message Readiness { + // enable /readiness expose + bool enable = 1 [ json_name = "enable" ]; +} + +message LosslessOffline { + // enable /offline expose + bool enable = 1 [ json_name = "enable" ]; +}