From ae82c41032da468faa1539d67cc56d73929450cf Mon Sep 17 00:00:00 2001 From: ZHANG Dapeng Date: Thu, 21 Jan 2021 09:56:57 -0800 Subject: [PATCH] xds: import fault proto --- xds/third_party/envoy/import.sh | 4 +- .../filters/common/fault/v3/fault.proto | 98 ++++++++++++ .../filters/http/fault/v3/fault.proto | 144 ++++++++++++++++++ 3 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 xds/third_party/envoy/src/main/proto/envoy/extensions/filters/common/fault/v3/fault.proto create mode 100644 xds/third_party/envoy/src/main/proto/envoy/extensions/filters/http/fault/v3/fault.proto diff --git a/xds/third_party/envoy/import.sh b/xds/third_party/envoy/import.sh index 8a6847ded9..34903428eb 100755 --- a/xds/third_party/envoy/import.sh +++ b/xds/third_party/envoy/import.sh @@ -16,7 +16,7 @@ # Update VERSION then in this directory run ./import.sh set -e -BRANCH=master +BRANCH=main # import VERSION from one of the google internal CLs VERSION=af17f954653afcab6a189673e3500b2e988f1aef GIT_REPO="https://github.com/envoyproxy/envoy.git" @@ -114,6 +114,8 @@ envoy/config/trace/v3/service.proto envoy/config/trace/v3/zipkin.proto envoy/config/rbac/v2/rbac.proto envoy/extensions/clusters/aggregate/v3/cluster.proto +envoy/extensions/filters/common/fault/v3/fault.proto +envoy/extensions/filters/http/fault/v3/fault.proto envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto envoy/extensions/transport_sockets/tls/v3/cert.proto envoy/extensions/transport_sockets/tls/v3/common.proto diff --git a/xds/third_party/envoy/src/main/proto/envoy/extensions/filters/common/fault/v3/fault.proto b/xds/third_party/envoy/src/main/proto/envoy/extensions/filters/common/fault/v3/fault.proto new file mode 100644 index 0000000000..dc4f2c34ef --- /dev/null +++ b/xds/third_party/envoy/src/main/proto/envoy/extensions/filters/common/fault/v3/fault.proto @@ -0,0 +1,98 @@ +syntax = "proto3"; + +package envoy.extensions.filters.common.fault.v3; + +import "envoy/type/v3/percent.proto"; + +import "google/protobuf/duration.proto"; + +import "envoy/annotations/deprecation.proto"; +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.common.fault.v3"; +option java_outer_classname = "FaultProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Common fault injection types] + +// Delay specification is used to inject latency into the +// HTTP/gRPC/Mongo/Redis operation or delay proxying of TCP connections. +// [#next-free-field: 6] +message FaultDelay { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.fault.v2.FaultDelay"; + + enum FaultDelayType { + // Unused and deprecated. + FIXED = 0; + } + + // Fault delays are controlled via an HTTP header (if applicable). See the + // :ref:`HTTP fault filter ` documentation for + // more information. + message HeaderDelay { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.fault.v2.FaultDelay.HeaderDelay"; + } + + reserved 2, 1; + + reserved "type"; + + oneof fault_delay_secifier { + option (validate.required) = true; + + // Add a fixed delay before forwarding the operation upstream. See + // https://developers.google.com/protocol-buffers/docs/proto3#json for + // the JSON/YAML Duration mapping. For HTTP/Mongo/Redis, the specified + // delay will be injected before a new request/operation. For TCP + // connections, the proxying of the connection upstream will be delayed + // for the specified period. This is required if type is FIXED. + google.protobuf.Duration fixed_delay = 3 [(validate.rules).duration = {gt {}}]; + + // Fault delays are controlled via an HTTP header (if applicable). + HeaderDelay header_delay = 5; + } + + // The percentage of operations/connections/requests on which the delay will be injected. + type.v3.FractionalPercent percentage = 4; +} + +// Describes a rate limit to be applied. +message FaultRateLimit { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.fault.v2.FaultRateLimit"; + + // Describes a fixed/constant rate limit. + message FixedLimit { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.fault.v2.FaultRateLimit.FixedLimit"; + + // The limit supplied in KiB/s. + uint64 limit_kbps = 1 [(validate.rules).uint64 = {gte: 1}]; + } + + // Rate limits are controlled via an HTTP header (if applicable). See the + // :ref:`HTTP fault filter ` documentation for + // more information. + message HeaderLimit { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.fault.v2.FaultRateLimit.HeaderLimit"; + } + + oneof limit_type { + option (validate.required) = true; + + // A fixed rate limit. + FixedLimit fixed_limit = 1; + + // Rate limits are controlled via an HTTP header (if applicable). + HeaderLimit header_limit = 3; + } + + // The percentage of operations/connections/requests on which the rate limit will be injected. + type.v3.FractionalPercent percentage = 2; +} diff --git a/xds/third_party/envoy/src/main/proto/envoy/extensions/filters/http/fault/v3/fault.proto b/xds/third_party/envoy/src/main/proto/envoy/extensions/filters/http/fault/v3/fault.proto new file mode 100644 index 0000000000..d28ed28b11 --- /dev/null +++ b/xds/third_party/envoy/src/main/proto/envoy/extensions/filters/http/fault/v3/fault.proto @@ -0,0 +1,144 @@ +syntax = "proto3"; + +package envoy.extensions.filters.http.fault.v3; + +import "envoy/config/route/v3/route_components.proto"; +import "envoy/extensions/filters/common/fault/v3/fault.proto"; +import "envoy/type/v3/percent.proto"; + +import "google/protobuf/wrappers.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.http.fault.v3"; +option java_outer_classname = "FaultProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Fault Injection] +// Fault Injection :ref:`configuration overview `. +// [#extension: envoy.filters.http.fault] + +// [#next-free-field: 6] +message FaultAbort { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.http.fault.v2.FaultAbort"; + + // Fault aborts are controlled via an HTTP header (if applicable). See the + // :ref:`HTTP fault filter ` documentation for + // more information. + message HeaderAbort { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.http.fault.v2.FaultAbort.HeaderAbort"; + } + + reserved 1; + + oneof error_type { + option (validate.required) = true; + + // HTTP status code to use to abort the HTTP request. + uint32 http_status = 2 [(validate.rules).uint32 = {lt: 600 gte: 200}]; + + // gRPC status code to use to abort the gRPC request. + uint32 grpc_status = 5; + + // Fault aborts are controlled via an HTTP header (if applicable). + HeaderAbort header_abort = 4; + } + + // The percentage of requests/operations/connections that will be aborted with the error code + // provided. + type.v3.FractionalPercent percentage = 3; +} + +// [#next-free-field: 15] +message HTTPFault { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.filter.http.fault.v2.HTTPFault"; + + // If specified, the filter will inject delays based on the values in the + // object. + common.fault.v3.FaultDelay delay = 1; + + // If specified, the filter will abort requests based on the values in + // the object. At least *abort* or *delay* must be specified. + FaultAbort abort = 2; + + // Specifies the name of the (destination) upstream cluster that the + // filter should match on. Fault injection will be restricted to requests + // bound to the specific upstream cluster. + string upstream_cluster = 3; + + // Specifies a set of headers that the filter should match on. The fault + // injection filter can be applied selectively to requests that match a set of + // headers specified in the fault filter config. The chances of actual fault + // injection further depend on the value of the :ref:`percentage + // ` field. + // The filter will check the request's headers against all the specified + // headers in the filter config. A match will happen if all the headers in the + // config are present in the request with the same values (or based on + // presence if the *value* field is not in the config). + repeated config.route.v3.HeaderMatcher headers = 4; + + // Faults are injected for the specified list of downstream hosts. If this + // setting is not set, faults are injected for all downstream nodes. + // Downstream node name is taken from :ref:`the HTTP + // x-envoy-downstream-service-node + // ` header and compared + // against downstream_nodes list. + repeated string downstream_nodes = 5; + + // The maximum number of faults that can be active at a single time via the configured fault + // filter. Note that because this setting can be overridden at the route level, it's possible + // for the number of active faults to be greater than this value (if injected via a different + // route). If not specified, defaults to unlimited. This setting can be overridden via + // `runtime ` and any faults that are not injected + // due to overflow will be indicated via the `faults_overflow + // ` stat. + // + // .. attention:: + // Like other :ref:`circuit breakers ` in Envoy, this is a fuzzy + // limit. It's possible for the number of active faults to rise slightly above the configured + // amount due to the implementation details. + google.protobuf.UInt32Value max_active_faults = 6; + + // The response rate limit to be applied to the response body of the stream. When configured, + // the percentage can be overridden by the :ref:`fault.http.rate_limit.response_percent + // ` runtime key. + // + // .. attention:: + // This is a per-stream limit versus a connection level limit. This means that concurrent streams + // will each get an independent limit. + common.fault.v3.FaultRateLimit response_rate_limit = 7; + + // The runtime key to override the :ref:`default ` + // runtime. The default is: fault.http.delay.fixed_delay_percent + string delay_percent_runtime = 8; + + // The runtime key to override the :ref:`default ` + // runtime. The default is: fault.http.abort.abort_percent + string abort_percent_runtime = 9; + + // The runtime key to override the :ref:`default ` + // runtime. The default is: fault.http.delay.fixed_duration_ms + string delay_duration_runtime = 10; + + // The runtime key to override the :ref:`default ` + // runtime. The default is: fault.http.abort.http_status + string abort_http_status_runtime = 11; + + // The runtime key to override the :ref:`default ` + // runtime. The default is: fault.http.max_active_faults + string max_active_faults_runtime = 12; + + // The runtime key to override the :ref:`default ` + // runtime. The default is: fault.http.rate_limit.response_percent + string response_rate_limit_percent_runtime = 13; + + // The runtime key to override the :ref:`default ` + // runtime. The default is: fault.http.abort.grpc_status + string abort_grpc_status_runtime = 14; +}