tcp: add FilterState hash policy for TcpProxy and other network filters (#18701)

Adds a new variant to type.v3.HashPolicy to generate a hash from an object in FilterState. This implementation mirrors what already exists for HTTP filters (see RouteAction.HashPolicy.FilterState), and is usable by network filters such as TcpProxy.

Risk Level: low
Testing: updated tests in tcp_proxy:config_test
Docs Changes: N/A
Release Notes: added an entry under tcp
Platform Specific Features: N/A

Signed-off-by: Dan Rosen <mergeconflict@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ 38739c32b39da483782fa18dc5a5aa77cee677ab
pull/626/head
data-plane-api(Azure Pipelines) 3 years ago
parent e81c151e24
commit 10fe9225e4
  1. 4
      envoy/api/v2/route/route_components.proto
  2. 4
      envoy/config/route/v3/route_components.proto
  3. 11
      envoy/type/v3/hash_policy.proto

@ -675,8 +675,8 @@ message RouteAction {
message FilterState {
// The name of the Object in the per-request filterState, which is an
// Envoy::Http::Hashable object. If there is no data associated with the key,
// or the stored object is not Envoy::Http::Hashable, no hash will be produced.
// Envoy::Hashable object. If there is no data associated with the key,
// or the stored object is not Envoy::Hashable, no hash will be produced.
string key = 1 [(validate.rules).string = {min_bytes: 1}];
}

@ -752,8 +752,8 @@ message RouteAction {
"envoy.api.v2.route.RouteAction.HashPolicy.FilterState";
// The name of the Object in the per-request filterState, which is an
// Envoy::Http::Hashable object. If there is no data associated with the key,
// or the stored object is not Envoy::Http::Hashable, no hash will be produced.
// Envoy::Hashable object. If there is no data associated with the key,
// or the stored object is not Envoy::Hashable, no hash will be produced.
string key = 1 [(validate.rules).string = {min_len: 1}];
}

@ -23,9 +23,20 @@ message HashPolicy {
option (udpa.annotations.versioning).previous_message_type = "envoy.type.HashPolicy.SourceIp";
}
// An Object in the :ref:`filterState <arch_overview_data_sharing_between_filters>` will be used
// to compute the hash used by hash-based load balancing algorithms.
message FilterState {
// The name of the Object in the filterState, which is an Envoy::Hashable object. If there is no
// data associated with the key, or the stored object is not Envoy::Hashable, no hash will be
// produced.
string key = 1 [(validate.rules).string = {min_len: 1}];
}
oneof policy_specifier {
option (validate.required) = true;
SourceIp source_ip = 1;
FilterState filter_state = 2;
}
}

Loading…
Cancel
Save