Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L3 default support for Network Load Balancer #5059

Merged
merged 2 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions mmv1/products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2654,6 +2654,7 @@ objects:
- :TCP
- :UDP
- :GRPC
- :UNSPECIFIED
- !ruby/object:Api::Type::Enum
name: 'sessionAffinity'
description: |
Expand Down Expand Up @@ -3697,6 +3698,7 @@ objects:
- :AH
- :SCTP
- :ICMP
- :L3_DEFAULT
drebes marked this conversation as resolved.
Show resolved Hide resolved
# This is a multi-resource resource reference (BackendService (global), RegionBackendService)
# We have custom expands that manage this.
- !ruby/object:Api::Type::ResourceRef
Expand Down Expand Up @@ -3770,15 +3772,18 @@ objects:
name: 'ports'
max_size: 5
description: |
This field is used along with the backend_service field for internal
load balancing.
This field is used along with internal load balancing and network
load balancer when the forwarding rule references a backend service
and when protocol is not L3_DEFAULT.

When the load balancing scheme is INTERNAL, a single port or a comma
separated list of ports can be configured. Only packets addressed to
these ports will be forwarded to the backends configured with this
forwarding rule.
A single port or a comma separated list of ports can be configured.
Only packets addressed to these ports will be forwarded to the backends
configured with this forwarding rule.

You may specify a maximum of up to 5 ports.
You can only use one of ports and portRange, or allPorts.
The three are mutually exclusive.

You may specify a maximum of up to 5 ports, which can be non-contiguous.
item_type: Api::Type::String
- !ruby/object:Api::Type::ResourceRef
name: 'subnetwork'
Expand Down Expand Up @@ -3832,11 +3837,13 @@ objects:
- !ruby/object:Api::Type::Boolean
name: 'allPorts'
description: |
For internal TCP/UDP load balancing (i.e. load balancing scheme is
INTERNAL and protocol is TCP/UDP), set this to true to allow packets
addressed to any ports to be forwarded to the backends configured
with this forwarding rule. Used with backend service. Cannot be set
if port or portRange are set.
This field can be used with internal load balancer or network load balancer
when the forwarding rule references a backend service, or with the target
field when it references a TargetInstance. Set this to true to
allow packets addressed to any ports to be forwarded to the backends configured
with this forwarding rule. This can be used when the protocol is TCP/UDP, and it
must be set to true when the protocol is set to L3_DEFAULT.
Cannot be set if port or portRange are set.
- !ruby/object:Api::Type::Enum
name: 'networkTier'
description: |
Expand Down
8 changes: 8 additions & 0 deletions mmv1/products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,14 @@ overrides: !ruby/object:Overrides::ResourceOverrides
vars:
forwarding_rule_name: "website-forwarding-rule"
target_pool_name: "website-target-pool"
- !ruby/object:Provider::Terraform::Examples
name: "forwarding_rule_l3_default"
primary_resource_id: "fwd_rule"
vars:
forwarding_rule_name: "l3-forwarding-rule"
service_name: "service"
health_check_name: "health-check"
min_version: beta
- !ruby/object:Provider::Terraform::Examples
name: "forwarding_rule_internallb"
primary_resource_id: "default"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
name = "<%= ctx[:vars]['forwarding_rule_name'] %>"
backend_service = google_compute_region_backend_service.service.id
ip_protocol = "L3_DEFAULT"
all_ports = true
}

resource "google_compute_region_backend_service" "service" {
provider = google-beta
region = "us-central1"
name = "<%= ctx[:vars]['service_name'] %>"
health_checks = [google_compute_region_health_check.health_check.id]
protocol = "UNSPECIFIED"
load_balancing_scheme = "EXTERNAL"
}

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
}
}