From 2ce6bc4ad4ea06ce3c827dc70ca604e76f69dab5 Mon Sep 17 00:00:00 2001 From: Ferg Date: Wed, 8 Mar 2023 15:51:01 +0000 Subject: [PATCH 1/2] Add WEIGHTED_MAGLEV to localityLbPolicy enum, and update associated docstrings. --- mmv1/products/compute/BackendService.yaml | 21 +++++++++++++++++-- .../compute/RegionBackendService.yaml | 21 +++++++++++++++++-- mmv1/products/compute/terraform.yaml | 7 +++++++ ...n_backend_service_external_weighted.tf.erb | 19 +++++++++++++++++ 4 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb diff --git a/mmv1/products/compute/BackendService.yaml b/mmv1/products/compute/BackendService.yaml index 55b2142e6e25..3fecac73d655 100644 --- a/mmv1/products/compute/BackendService.yaml +++ b/mmv1/products/compute/BackendService.yaml @@ -659,6 +659,7 @@ properties: - :RANDOM - :ORIGINAL_DESTINATION - :MAGLEV + - :WEIGHTED_MAGLEV description: | The load balancing algorithm used within the scope of the locality. The possible values are: @@ -687,16 +688,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 diff --git a/mmv1/products/compute/RegionBackendService.yaml b/mmv1/products/compute/RegionBackendService.yaml index 2d9aa85eceef..f947638c157e 100644 --- a/mmv1/products/compute/RegionBackendService.yaml +++ b/mmv1/products/compute/RegionBackendService.yaml @@ -684,6 +684,7 @@ properties: - :RANDOM - :ORIGINAL_DESTINATION - :MAGLEV + - :WEIGHTED_MAGLEV description: | The load balancing algorithm used within the scope of the locality. The possible values are: @@ -712,16 +713,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 diff --git a/mmv1/products/compute/terraform.yaml b/mmv1/products/compute/terraform.yaml index a816ec2bd58a..e2fdc9831b92 100644 --- a/mmv1/products/compute/terraform.yaml +++ b/mmv1/products/compute/terraform.yaml @@ -459,6 +459,13 @@ overrides: !ruby/object:Overrides::ResourceOverrides 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" + min_version: beta - !ruby/object:Provider::Terraform::Examples name: "region_backend_service_ilb_ring_hash" primary_resource_id: "default" diff --git a/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb b/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb new file mode 100644 index 000000000000..bebd76705614 --- /dev/null +++ b/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb @@ -0,0 +1,19 @@ +resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { + provider = google-beta + 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" { + provider = google-beta + name = "<%= ctx[:vars]['health_check_name'] %>" + region = "us-central1" + + tcp_health_check { + port = 80 + } +} From 32a027d74e1ea738769d37c34136c4462bf58140 Mon Sep 17 00:00:00 2001 From: Ferg Date: Tue, 21 Mar 2023 15:32:29 +0000 Subject: [PATCH 2/2] Example for WEIGHTED_MAGLEV uses HTTP health check. --- .../examples/region_backend_service_external_weighted.tf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb b/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb index 8e61feb94a0f..a09a7c4295e9 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb +++ b/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.erb @@ -11,7 +11,7 @@ resource "google_compute_region_health_check" "health_check" { name = "<%= ctx[:vars]['health_check_name'] %>" region = "us-central1" - tcp_health_check { + http_health_check { port = 80 } }