matcher: Add RuntimeFraction input matcher (#26958)

* matcher: Add RuntimeFraction input matcher

Signed-off-by: Ruslan Nigmatullin <elessar@dropbox.com>

Mirrored from https://github.com/envoyproxy/envoy @ a380096537d1439206c89f413e44d44a8d8a01cb
pull/626/head
data-plane-api(Azure Pipelines) 2 years ago
parent 28fc77eb3c
commit 21707ffaf6
  1. 1
      BUILD
  2. 12
      envoy/extensions/matching/input_matchers/runtime_fraction/v3/BUILD
  3. 35
      envoy/extensions/matching/input_matchers/runtime_fraction/v3/runtime_fraction.proto
  4. 1
      versioning/BUILD

@ -263,6 +263,7 @@ proto_library(
"//envoy/extensions/matching/common_inputs/ssl/v3:pkg",
"//envoy/extensions/matching/input_matchers/consistent_hashing/v3:pkg",
"//envoy/extensions/matching/input_matchers/ip/v3:pkg",
"//envoy/extensions/matching/input_matchers/runtime_fraction/v3:pkg",
"//envoy/extensions/network/dns_resolver/apple/v3:pkg",
"//envoy/extensions/network/dns_resolver/cares/v3:pkg",
"//envoy/extensions/network/dns_resolver/getaddrinfo/v3:pkg",

@ -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_udpa//udpa/annotations:pkg",
],
)

@ -0,0 +1,35 @@
syntax = "proto3";
package envoy.extensions.matching.input_matchers.runtime_fraction.v3;
import "envoy/config/core/v3/base.proto";
import "udpa/annotations/status.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.matching.input_matchers.runtime_fraction.v3";
option java_outer_classname = "RuntimeFractionProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/matching/input_matchers/runtime_fraction/v3;runtime_fractionv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#protodoc-title: Runtime matcher]
// [#extension: envoy.matching.matchers.runtime_fraction]
// The runtime fraction matchers computes a hash from the input and matches if runtime feature is enabled
// for the the resulting hash. Every time the input is considered for a match, its hash must fall within
// the percentage of matches indicated by this field. For a fraction N/D, a number is computed as a hash
// of the input on a field in the range [0,D). If the number is less than or equal to the value of the
// numerator N, the matcher evaluates to true. A runtime_fraction input matcher can be used to gradually
// roll out matcher changes without requiring full code or configuration deployments.
// Note that distribution of matching results is only as good as one of the input.
message RuntimeFraction {
// Match the input against the given runtime key. The specified default value is used if key is not
// present in the runtime configuration.
config.core.v3.RuntimeFractionalPercent runtime_fraction = 1
[(validate.rules).message = {required: true}];
// Optional seed passed through the hash function. This allows using additional information when computing
// the hash value: by changing the seed value, a potentially different outcome can be achieved for the same input.
uint64 seed = 2;
}

@ -202,6 +202,7 @@ proto_library(
"//envoy/extensions/matching/common_inputs/ssl/v3:pkg",
"//envoy/extensions/matching/input_matchers/consistent_hashing/v3:pkg",
"//envoy/extensions/matching/input_matchers/ip/v3:pkg",
"//envoy/extensions/matching/input_matchers/runtime_fraction/v3:pkg",
"//envoy/extensions/network/dns_resolver/apple/v3:pkg",
"//envoy/extensions/network/dns_resolver/cares/v3:pkg",
"//envoy/extensions/network/dns_resolver/getaddrinfo/v3:pkg",

Loading…
Cancel
Save