Skip to content

Commit

Permalink
Add WEIGHTED_MAGLEV to localityLbPolicy enum, and update associated d…
Browse files Browse the repository at this point in the history
…ocstrings. (GoogleCloudPlatform#7444)

* Add WEIGHTED_MAGLEV to localityLbPolicy enum, and update associated docstrings.

* Example for WEIGHTED_MAGLEV uses HTTP health check.
  • Loading branch information
uberferg authored and ericayyliu committed Jul 26, 2023
1 parent 0fbcee9 commit b4a1e38
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
21 changes: 19 additions & 2 deletions mmv1/products/compute/BackendService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ properties:
- :RANDOM
- :ORIGINAL_DESTINATION
- :MAGLEV
- :WEIGHTED_MAGLEV
description: |
The load balancing algorithm used within the scope of the locality.
The possible values are:
Expand Down Expand Up @@ -797,16 +798,32 @@ properties:
build times and host selection times. For more information about
Maglev, refer to https://ai.google/research/pubs/pub44824
* `WEIGHTED_MAGLEV`: Per-instance weighted Load Balancing via health check
reported weights. If set, the Backend Service must
configure a non legacy HTTP-based Health Check, and
health check replies are expected to contain
non-standard HTTP response header field
X-Load-Balancing-Endpoint-Weight to specify the
per-instance weights. If set, Load Balancing is weight
based on the per-instance weights reported in the last
processed health check replies, as long as every
instance either reported a valid weight or had
UNAVAILABLE_WEIGHT. Otherwise, Load Balancing remains
equal-weight.
This field is applicable to either:
* A regional backend service with the service_protocol set to HTTP, HTTPS, or HTTP2,
and loadBalancingScheme set to INTERNAL_MANAGED.
* A global backend service with the load_balancing_scheme set to INTERNAL_SELF_MANAGED.
* A regional backend service with loadBalancingScheme set to EXTERNAL (External Network
Load Balancing). Only MAGLEV and WEIGHTED_MAGLEV values are possible for External
Network Load Balancing. The default is MAGLEV.
If session_affinity is not NONE, and this field is not set to MAGLEV or RING_HASH,
session affinity settings will not take effect.
If session_affinity is not NONE, and this field is not set to MAGLEV, WEIGHTED_MAGLEV,
or RING_HASH, session affinity settings will not take effect.
Only ROUND_ROBIN and RING_HASH are supported when the backend service is referenced
by a URL map that is bound to target gRPC proxy that has validate_for_proxyless
Expand Down
27 changes: 25 additions & 2 deletions mmv1/products/compute/RegionBackendService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ examples:
region_backend_service_name: "region-service"
health_check_name: "rbs-health-check"
min_version: beta
- !ruby/object:Provider::Terraform::Examples
name: "region_backend_service_external_weighted"
primary_resource_id: "default"
vars:
region_backend_service_name: "region-service"
health_check_name: "rbs-health-check"
- !ruby/object:Provider::Terraform::Examples
name: "region_backend_service_ilb_ring_hash"
primary_resource_id: "default"
Expand Down Expand Up @@ -781,6 +787,7 @@ properties:
- :RANDOM
- :ORIGINAL_DESTINATION
- :MAGLEV
- :WEIGHTED_MAGLEV
description: |
The load balancing algorithm used within the scope of the locality.
The possible values are:
Expand Down Expand Up @@ -809,16 +816,32 @@ properties:
build times and host selection times. For more information about
Maglev, refer to https://ai.google/research/pubs/pub44824
* `WEIGHTED_MAGLEV`: Per-instance weighted Load Balancing via health check
reported weights. If set, the Backend Service must
configure a non legacy HTTP-based Health Check, and
health check replies are expected to contain
non-standard HTTP response header field
X-Load-Balancing-Endpoint-Weight to specify the
per-instance weights. If set, Load Balancing is weight
based on the per-instance weights reported in the last
processed health check replies, as long as every
instance either reported a valid weight or had
UNAVAILABLE_WEIGHT. Otherwise, Load Balancing remains
equal-weight.
This field is applicable to either:
* A regional backend service with the service_protocol set to HTTP, HTTPS, or HTTP2,
and loadBalancingScheme set to INTERNAL_MANAGED.
* A global backend service with the load_balancing_scheme set to INTERNAL_SELF_MANAGED.
* A regional backend service with loadBalancingScheme set to EXTERNAL (External Network
Load Balancing). Only MAGLEV and WEIGHTED_MAGLEV values are possible for External
Network Load Balancing. The default is MAGLEV.
If session_affinity is not NONE, and this field is not set to MAGLEV or RING_HASH,
session affinity settings will not take effect.
If session_affinity is not NONE, and this field is not set to MAGLEV, WEIGHTED_MAGLEV,
or RING_HASH, session affinity settings will not take effect.
Only ROUND_ROBIN and RING_HASH are supported when the backend service is referenced
by a URL map that is bound to target gRPC proxy that has validate_for_proxyless
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" {
region = "us-central1"
name = "<%= ctx[:vars]['region_backend_service_name'] %>"
health_checks = [google_compute_region_health_check.health_check.id]
protocol = "TCP"
load_balancing_scheme = "EXTERNAL"
locality_lb_policy = "WEIGHTED_MAGLEV"
}

resource "google_compute_region_health_check" "health_check" {
name = "<%= ctx[:vars]['health_check_name'] %>"
region = "us-central1"

http_health_check {
port = 80
}
}

0 comments on commit b4a1e38

Please sign in to comment.