Matchers: Add dynamic metadata to the http inputs (#34891)

fixes: https://github.com/envoyproxy/envoy/issues/34092

---------

Signed-off-by: Vikas Choudhary <choudharyvikas16@gmail.com>

Mirrored from https://github.com/envoyproxy/envoy @ 520d88e4cb4e8c5014531281a88dcc8076e18bfd
main
update-envoy[bot] 6 months ago
parent 7354d0f64f
commit 6bda82815c
  1. 1
      BUILD
  2. 45
      envoy/extensions/matching/common_inputs/network/v3/network_inputs.proto
  3. 12
      envoy/extensions/matching/input_matchers/metadata/v3/BUILD
  4. 26
      envoy/extensions/matching/input_matchers/metadata/v3/metadata.proto
  5. 1
      versioning/BUILD

@ -291,6 +291,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/metadata/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",

@ -103,3 +103,48 @@ message ApplicationProtocolInput {
message FilterStateInput {
string key = 1 [(validate.rules).string = {min_len: 1}];
}
// Input that matches dynamic metadata by key.
// DynamicMetadataInput provides a general interface using ``filter`` and ``path`` to retrieve value from
// :ref:`Metadata <envoy_v3_api_msg_config.core.v3.Metadata>`.
//
// For example, for the following Metadata:
//
// .. code-block:: yaml
//
// filter_metadata:
// envoy.xxx:
// prop:
// foo: bar
// xyz:
// hello: envoy
//
// The following DynamicMetadataInput will retrieve a string value "bar" from the Metadata.
//
// .. code-block:: yaml
//
// filter: envoy.xxx
// path:
// - key: prop
// - key: foo
//
// [#extension: envoy.matching.inputs.dynamic_metadata]
message DynamicMetadataInput {
// Specifies the segment in a path to retrieve value from Metadata.
// Note: Currently it's not supported to retrieve a value from a list in Metadata. This means that
// if the segment key refers to a list, it has to be the last segment in a path.
message PathSegment {
oneof segment {
option (validate.required) = true;
// If specified, use the key to retrieve the value in a Struct.
string key = 1 [(validate.rules).string = {min_len: 1}];
}
}
// The filter name to retrieve the Struct from the Metadata.
string filter = 1 [(validate.rules).string = {min_len: 1}];
// The path to retrieve the Value from the Struct.
repeated PathSegment path = 2 [(validate.rules).repeated = {min_items: 1}];
}

@ -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/type/matcher/v3:pkg",
"@com_github_cncf_xds//udpa/annotations:pkg",
],
)

@ -0,0 +1,26 @@
syntax = "proto3";
package envoy.extensions.matching.input_matchers.metadata.v3;
import "envoy/type/matcher/v3/value.proto";
import "udpa/annotations/status.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.matching.input_matchers.metadata.v3";
option java_outer_classname = "MetadataProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/matching/input_matchers/metadata/v3;metadatav3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#protodoc-title: metadata matcher]
// [#extension: envoy.matching.matchers.metadata_matcher]
// Metadata matcher for metadata from http matching input data.
message Metadata {
// The Metadata is matched if the value retrieved by metadata matching input is matched to this value.
type.matcher.v3.ValueMatcher value = 1 [(validate.rules).message = {required: true}];
// If true, the match result will be inverted.
bool invert = 4;
}

@ -230,6 +230,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/metadata/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",

Loading…
Cancel
Save