retry host predicate: add new predicate to omit hosts based on endpoint metadata match (#9563)

Currently supported retry host predicates only allow omitting either previously tried or canary hosts. This enhancement is to add a new host predicate that looks at the endpoint metadata match and omits the host in case of a match with the host metadata. See #9531

Risk Level: Low
Testing: Unit testing
Docs Changes: Added new proto for omit_hosts

Signed-off-by: Prakhar Gautam <prakhag@gmail.com>

Mirrored from https://github.com/envoyproxy/envoy @ e2fdf70f0fca0f9a9a66046fd80b280981b3f0ed
master-ci-test
data-plane-api(CircleCI) 5 years ago
parent 699e836a48
commit 4829d33ce4
  1. 2
      BUILD
  2. 1
      docs/BUILD
  3. 12
      envoy/config/retry/omit_host_metadata/v2/BUILD
  4. 26
      envoy/config/retry/omit_host_metadata/v2/omit_host_metadata_config.proto
  5. 13
      envoy/extensions/retry/host/omit_host_metadata/v3/BUILD
  6. 27
      envoy/extensions/retry/host/omit_host_metadata/v3/omit_host_metadata_config.proto

@ -87,6 +87,7 @@ proto_library(
"//envoy/config/resource_monitor/fixed_heap/v2alpha:pkg", "//envoy/config/resource_monitor/fixed_heap/v2alpha:pkg",
"//envoy/config/resource_monitor/injected_resource/v2alpha:pkg", "//envoy/config/resource_monitor/injected_resource/v2alpha:pkg",
"//envoy/config/retry/omit_canary_hosts/v2:pkg", "//envoy/config/retry/omit_canary_hosts/v2:pkg",
"//envoy/config/retry/omit_host_metadata/v2:pkg",
"//envoy/config/retry/previous_hosts/v2:pkg", "//envoy/config/retry/previous_hosts/v2:pkg",
"//envoy/config/retry/previous_priorities:pkg", "//envoy/config/retry/previous_priorities:pkg",
"//envoy/config/trace/v2:pkg", "//envoy/config/trace/v2:pkg",
@ -201,6 +202,7 @@ proto_library(
"//envoy/extensions/filters/network/thrift_proxy/filters/ratelimit/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/filters/ratelimit/v3:pkg",
"//envoy/extensions/filters/network/thrift_proxy/v3:pkg", "//envoy/extensions/filters/network/thrift_proxy/v3:pkg",
"//envoy/extensions/filters/network/zookeeper_proxy/v3:pkg", "//envoy/extensions/filters/network/zookeeper_proxy/v3:pkg",
"//envoy/extensions/retry/host/omit_host_metadata/v3:pkg",
"//envoy/extensions/retry/priority/previous_priorities/v3:pkg", "//envoy/extensions/retry/priority/previous_priorities/v3:pkg",
"//envoy/extensions/transport_sockets/alts/v3:pkg", "//envoy/extensions/transport_sockets/alts/v3:pkg",
"//envoy/extensions/transport_sockets/raw_buffer/v3:pkg", "//envoy/extensions/transport_sockets/raw_buffer/v3:pkg",

@ -93,6 +93,7 @@ proto_library(
"//envoy/config/resource_monitor/fixed_heap/v2alpha:pkg", "//envoy/config/resource_monitor/fixed_heap/v2alpha:pkg",
"//envoy/config/resource_monitor/injected_resource/v2alpha:pkg", "//envoy/config/resource_monitor/injected_resource/v2alpha:pkg",
"//envoy/config/retry/omit_canary_hosts/v2:pkg", "//envoy/config/retry/omit_canary_hosts/v2:pkg",
"//envoy/config/retry/omit_host_metadata/v2:pkg",
"//envoy/config/retry/previous_hosts/v2:pkg", "//envoy/config/retry/previous_hosts/v2:pkg",
"//envoy/config/retry/previous_priorities:pkg", "//envoy/config/retry/previous_priorities:pkg",
"//envoy/config/trace/v2:pkg", "//envoy/config/trace/v2:pkg",

@ -0,0 +1,12 @@
# DO NOT EDIT. This file is generated by tools/proto_sync.py.
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
licenses(["notice"]) # Apache 2
api_proto_package(
deps = [
"//envoy/api/v2/core:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)

@ -0,0 +1,26 @@
syntax = "proto3";
package envoy.config.retry.omit_host_metadata.v2;
import "envoy/api/v2/core/base.proto";
import "udpa/annotations/migrate.proto";
option java_package = "io.envoyproxy.envoy.config.retry.omit_host_metadata.v2";
option java_outer_classname = "OmitHostMetadataConfigProto";
option java_multiple_files = true;
option (udpa.annotations.file_migrate).move_to_package =
"envoy.extensions.retry.host.omit_host_metadata.v3";
// [#protodoc-title: Omit host metadata retry predicate]
// A retry host predicate that can be used to reject a host based on
// predefined metadata match criteria.
// [#extension: envoy.retry_host_predicates.omit_host_metadata]
message OmitHostMetadataConfig {
// Retry host predicate metadata match criteria. The hosts in
// the upstream cluster with matching metadata will be omitted while
// attempting a retry of a failed request. The metadata should be specified
// under the *envoy.lb* key.
api.v2.core.Metadata metadata_match = 1;
}

@ -0,0 +1,13 @@
# DO NOT EDIT. This file is generated by tools/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",
"//envoy/config/retry/omit_host_metadata/v2:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)

@ -0,0 +1,27 @@
syntax = "proto3";
package envoy.extensions.retry.host.omit_host_metadata.v3;
import "envoy/config/core/v3/base.proto";
import "udpa/annotations/versioning.proto";
option java_package = "io.envoyproxy.envoy.extensions.retry.host.omit_host_metadata.v3";
option java_outer_classname = "OmitHostMetadataConfigProto";
option java_multiple_files = true;
// [#protodoc-title: Omit host metadata retry predicate]
// A retry host predicate that can be used to reject a host based on
// predefined metadata match criteria.
// [#extension: envoy.retry_host_predicates.omit_host_metadata]
message OmitHostMetadataConfig {
option (udpa.annotations.versioning).previous_message_type =
"envoy.config.retry.omit_host_metadata.v2.OmitHostMetadataConfig";
// Retry host predicate metadata match criteria. The hosts in
// the upstream cluster with matching metadata will be omitted while
// attempting a retry of a failed request. The metadata should be specified
// under the *envoy.lb* key.
config.core.v3.Metadata metadata_match = 1;
}
Loading…
Cancel
Save