upstream subset lb: add redundant keys support (#28874)

* upstream subset lb: add redundant keys support

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* add release note

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* fix protobuf format

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update source/extensions/load_balancing_policies/subset/subset_lb.h

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* minor update to address comment

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* fix format

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* minor update

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* update test to address comments

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* enhance test

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/load_balancing_policies/subset/v3/subset.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* address comment and fix format

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>

---------

Signed-off-by: wbpcode <wangbaiping@corp.netease.com>
Signed-off-by: code <wangbaiping@corp.netease.com>
Co-authored-by: Adi (Suissa) Peleg <adip@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ 74bfcb0b591bb692db0b9b0700b4822ef8a6d777
main
update-envoy[bot] 2 years ago
parent 5cffa1f275
commit 66eb4f89d9
  1. 43
      envoy/extensions/load_balancing_policies/subset/v3/subset.proto

@ -21,7 +21,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// Optionally divide the endpoints in this cluster into subsets defined by
// endpoint metadata and selected by route and weighted cluster metadata.
// [#next-free-field: 10]
// [#next-free-field: 11]
message Subset {
option (udpa.annotations.versioning).previous_message_type =
"envoy.config.cluster.v3.LbSubsetConfig";
@ -171,6 +171,47 @@ message Subset {
// metadata. The same host may appear in multiple subsets.
repeated LbSubsetSelector subset_selectors = 3;
// By default, only when the request metadata has exactly the **same** keys as one of subset selectors and
// the values of the related keys are matched, the load balancer will have a valid subset for the request.
// For example, given the following subset selectors:
//
// .. code-block:: json
//
// { "subset_selectors": [
// { "keys": [ "version" ] },
// { "keys": [ "stage", "version" ] }
// ]}
//
// A request with metadata ``{"redundant-key": "redundant-value", "stage": "prod", "version": "v1"}`` or
// ``{"redundant-key": "redundant-value", "version": "v1"}`` will not have a valid subset even if the values
// of keys ``stage`` and ``version`` are matched because of the redundant key/value pair in the request
// metadata.
//
// By setting this field to true, the most appropriate keys will be filtered out from the request metadata
// according to the subset selectors. And then the filtered keys and related values will be matched to find
// the valid host subset. By this way, redundant key/value pairs are allowed in the request metadata. The keys
// of a request metadata could be superset of the keys of the subset selectors and need not to be exactly the
// same as the keys of the subset selectors.
//
// More specifically, if the keys of a request metadata is a superset of one of the subset selectors, then only
// the values of the keys that in the selector keys will be matched. Take the above example, if the request
// metadata is ``{"redundant-key": "redundant-value", "stage": "prod", "version": "v1"}``, the load balancer
// will only match the values of ``stage`` and ``version`` to find an appropriate subset because ``stage``
// ``version`` are contained by the second subset selector and the redundant ``redundant-key`` will be
// ignored.
//
// .. note::
// If the keys of request metadata is superset of multiple different subset selectors keys, the subset
// selector with most keys to win. For example, given subset selectors
// ``{"subset_selectors": ["keys": ["A", "B", "C"], ["A", "B"]]}`` and request metadata ``{"A": "-",
// "B": "-", "C": "-", "D": "-"}``, keys ``A``, ``B``, ``C`` will be evaluated.
// If the keys of request metadata is superset of multiple different subset selectors keys and the number
// of selector keys are same, then the one placed in front to win. For example, given subset selectors
// ``{"subset_selectors": ["keys": ["A", "B"], ["C", "D"]]}`` and request metadata ``{"A": "-", "B": "-",
// "C": "-", "D": "-"}``, keys ``A``, ``B`` will be evaluated.
//
bool allow_redundant_keys = 10;
// If true, routing to subsets will take into account the localities and locality weights of the
// endpoints when making the routing decision.
//

Loading…
Cancel
Save