Skip to content

Commit 297bd66

Browse files
Compress the H4D blueprint with multivpc and vpc module update (#5133)
1 parent cf066c9 commit 297bd66

8 files changed

Lines changed: 48 additions & 49 deletions

File tree

examples/gke-h4d/gke-h4d.yaml

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ deployment_groups:
5656
subnetworks:
5757
- subnet_name: $(vars.deployment_name)-sub
5858
subnet_region: $(vars.region)
59-
subnet_ip: 192.168.0.0/24
59+
subnet_ip: 10.10.0.0/20
6060
secondary_ranges_list:
6161
- subnetwork_name: $(vars.deployment_name)-sub
6262
ranges:
6363
- range_name: pods
64-
ip_cidr_range: 10.64.0.0/19
64+
ip_cidr_range: 10.11.0.0/16
6565
- range_name: services
66-
ip_cidr_range: 10.65.0.0/19
66+
ip_cidr_range: 10.10.16.0/20
6767
firewall_rules:
6868
- name: $(vars.deployment_name)-internal
69-
ranges: [192.168.0.0/24]
69+
ranges: ["10.10.0.0/15"]
7070
allow:
7171
- protocol: tcp
7272
ports: ["0-65535"]
@@ -75,18 +75,19 @@ deployment_groups:
7575
- protocol: icmp
7676

7777
- id: gke-h4d-rdma-net
78-
source: modules/network/vpc
78+
source: modules/network/multivpc
7979
settings:
80-
network_name: $(vars.deployment_name)-rdma-net
80+
network_name_prefix: $(vars.deployment_name)-rdma-net
8181
network_profile: https://www.googleapis.com/compute/beta/projects/$(vars.project_id)/global/networkProfiles/$(vars.zone)-vpc-falcon
82-
network_routing_mode: REGIONAL
82+
network_routing_mode: "REGIONAL"
83+
network_count: 1
8384
enable_cloud_router: false
8485
enable_cloud_nat: false
85-
subnetworks:
86-
- subnet_name: $(vars.deployment_name)-rdma-sub
87-
subnet_region: $(vars.region)
88-
subnet_ip: 192.168.1.0/24
89-
region: $(vars.region)
86+
global_ip_address_range: 10.20.0.0/16
87+
subnetwork_cidr_suffix: 24
88+
subnetwork_private_access: false
89+
network_interface_defaults:
90+
nic_type: "IRDMA"
9091

9192
- id: node_pool_service_account
9293
source: modules/project/service-account
@@ -114,7 +115,7 @@ deployment_groups:
114115

115116
- id: h4d-cluster
116117
source: modules/scheduler/gke-cluster
117-
use: [gke-h4d-net, workload_service_account]
118+
use: [gke-h4d-net, gke-h4d-rdma-net, workload_service_account]
118119
settings:
119120
system_node_pool_machine_type: "e2-standard-16"
120121
system_node_pool_disk_size_gb: $(vars.system_node_pool_disk_size_gb)
@@ -127,21 +128,6 @@ deployment_groups:
127128
master_authorized_networks:
128129
- cidr_block: $(vars.authorized_cidr) # Allows your machine to run the kubectl command. Required for multi network setup.
129130
display_name: "kubectl-access-network"
130-
additional_networks:
131-
$(concat(
132-
[{
133-
network=gke-h4d-rdma-net.network_name,
134-
subnetwork=gke-h4d-rdma-net.subnetwork_name,
135-
subnetwork_project=vars.project_id,
136-
nic_type="IRDMA",
137-
queue_count=null,
138-
network_ip=null,
139-
stack_type=null,
140-
access_config=[{nat_ip=null, public_ptr_domain_name=null, network_tier=null}],
141-
ipv6_access_config=[],
142-
alias_ip_range=[]
143-
}]
144-
))
145131
# Cluster versions cannot be updated through the toolkit after creation
146132
# Please manage cluster version from the Google Cloud Console directly
147133
version_prefix: "1.32."
@@ -155,7 +141,7 @@ deployment_groups:
155141

156142
- id: h4d-pool
157143
source: modules/compute/gke-node-pool
158-
use: [h4d-cluster, node_pool_service_account]
144+
use: [h4d-cluster, gke-h4d-rdma-net, node_pool_service_account]
159145
settings:
160146
machine_type: h4d-highmem-192-lssd
161147
auto_upgrade: true
@@ -183,21 +169,6 @@ deployment_groups:
183169
effect: NO_SCHEDULE
184170
placement_policy:
185171
type: COMPACT
186-
additional_networks:
187-
$(concat(
188-
[{
189-
network=gke-h4d-rdma-net.network_name,
190-
subnetwork=gke-h4d-rdma-net.subnetwork_name,
191-
subnetwork_project=vars.project_id,
192-
nic_type="IRDMA",
193-
queue_count=null,
194-
network_ip=null,
195-
stack_type=null,
196-
access_config=[{nat_ip=null, public_ptr_domain_name=null, network_tier=null}],
197-
ipv6_access_config=[],
198-
alias_ip_range=[]
199-
}]
200-
))
201172
outputs: [instructions]
202173

203174
# Install Kueue and Jobset

modules/network/multivpc/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ limitations under the License.
103103
| <a name="input_allowed_ssh_ip_ranges"></a> [allowed\_ssh\_ip\_ranges](#input\_allowed\_ssh\_ip\_ranges) | A list of CIDR IP ranges from which to allow ssh access | `list(string)` | `[]` | no |
104104
| <a name="input_delete_default_internet_gateway_routes"></a> [delete\_default\_internet\_gateway\_routes](#input\_delete\_default\_internet\_gateway\_routes) | If set, ensure that all routes within the network specified whose names begin with 'default-route' and with a next hop of 'default-internet-gateway' are deleted | `bool` | `false` | no |
105105
| <a name="input_deployment_name"></a> [deployment\_name](#input\_deployment\_name) | The name of the current deployment | `string` | n/a | yes |
106+
| <a name="input_enable_cloud_nat"></a> [enable\_cloud\_nat](#input\_enable\_cloud\_nat) | Enable the creation of Cloud NATs. | `bool` | `true` | no |
107+
| <a name="input_enable_cloud_router"></a> [enable\_cloud\_router](#input\_enable\_cloud\_router) | Enable the creation of a Cloud Router for your VPC. For more information on Cloud Routers see https://cloud.google.com/network-connectivity/docs/router/concepts/overview | `bool` | `true` | no |
106108
| <a name="input_enable_iap_rdp_ingress"></a> [enable\_iap\_rdp\_ingress](#input\_enable\_iap\_rdp\_ingress) | Enable a firewall rule to allow Windows Remote Desktop Protocol access using IAP tunnels | `bool` | `false` | no |
107109
| <a name="input_enable_iap_ssh_ingress"></a> [enable\_iap\_ssh\_ingress](#input\_enable\_iap\_ssh\_ingress) | Enable a firewall rule to allow SSH access using IAP tunnels | `bool` | `true` | no |
108110
| <a name="input_enable_iap_winrm_ingress"></a> [enable\_iap\_winrm\_ingress](#input\_enable\_iap\_winrm\_ingress) | Enable a firewall rule to allow Windows Remote Management (WinRM) access using IAP tunnels | `bool` | `false` | no |
@@ -121,6 +123,7 @@ limitations under the License.
121123
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created | `string` | n/a | yes |
122124
| <a name="input_region"></a> [region](#input\_region) | The default region for Cloud resources | `string` | n/a | yes |
123125
| <a name="input_subnetwork_cidr_suffix"></a> [subnetwork\_cidr\_suffix](#input\_subnetwork\_cidr\_suffix) | The size, in CIDR suffix notation, for each network (e.g. 24 for 172.16.0.0/24); changing this will destroy every network. | `number` | `16` | no |
126+
| <a name="input_subnetwork_private_access"></a> [subnetwork\_private\_access](#input\_subnetwork\_private\_access) | Enable Private Google Access on the subnetworks | `bool` | `true` | no |
124127

125128
## Outputs
126129

modules/network/multivpc/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,7 @@ module "vpcs" {
7575
network_description = var.network_description
7676
network_routing_mode = var.network_routing_mode
7777
network_profile = var.network_profile
78+
enable_cloud_router = var.enable_cloud_router
79+
enable_cloud_nat = var.enable_cloud_nat
80+
subnetwork_private_access = var.subnetwork_private_access
7881
}

modules/network/multivpc/variables.tf

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ variable "network_count" {
4040
type = number
4141
default = 4
4242

43-
validation {
44-
condition = var.network_count > 1
45-
error_message = "The minimum VPCs able to be created by this module is 2. Use the standard Toolkit module at modules/network/vpc for count = 1"
46-
}
4743
validation {
4844
condition = var.network_count <= 8
4945
error_message = "The maximum VPCs able to be created by this module is 8"
@@ -199,3 +195,21 @@ variable "network_profile" {
199195
EOT
200196
default = null
201197
}
198+
199+
variable "enable_cloud_router" {
200+
type = bool
201+
description = "Enable the creation of a Cloud Router for your VPC. For more information on Cloud Routers see https://cloud.google.com/network-connectivity/docs/router/concepts/overview"
202+
default = true
203+
}
204+
205+
variable "enable_cloud_nat" {
206+
type = bool
207+
description = "Enable the creation of Cloud NATs."
208+
default = true
209+
}
210+
211+
variable "subnetwork_private_access" {
212+
type = bool
213+
description = "Enable Private Google Access on the subnetworks"
214+
default = true
215+
}

modules/network/vpc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ limitations under the License.
220220
| <a name="input_secondary_ranges_list"></a> [secondary\_ranges\_list](#input\_secondary\_ranges\_list) | "List of secondary ranges associated with the subnetworks.<br/>Each subnetwork must be specified at most once in this list." | <pre>list(object({<br/> subnetwork_name = string,<br/> ranges = list(object({<br/> range_name = string,<br/> ip_cidr_range = string<br/> }))<br/> }))</pre> | `[]` | no |
221221
| <a name="input_shared_vpc_host"></a> [shared\_vpc\_host](#input\_shared\_vpc\_host) | Makes this project a Shared VPC host if 'true' (default 'false') | `bool` | `false` | no |
222222
| <a name="input_subnetwork_name"></a> [subnetwork\_name](#input\_subnetwork\_name) | The name of the network to be created (if unsupplied, will default to "{deployment\_name}-primary-subnet") | `string` | `null` | no |
223+
| <a name="input_subnetwork_private_access"></a> [subnetwork\_private\_access](#input\_subnetwork\_private\_access) | Enable Private Google Access on the subnetworks | `bool` | `true` | no |
223224
| <a name="input_subnetwork_size"></a> [subnetwork\_size](#input\_subnetwork\_size) | DEPRECATED: please see https://goo.gle/hpc-toolkit-vpc-deprecation for migration instructions | `number` | `null` | no |
224225
| <a name="input_subnetworks"></a> [subnetworks](#input\_subnetworks) | List of subnetworks to create within the VPC. If left empty, it will be<br/>replaced by a single, default subnetwork constructed from other parameters<br/>(e.g. var.region). In all cases, the first subnetwork in the list is identified<br/>by outputs as a "primary" subnetwork.<br/><br/>subnet\_name (string, required, name of subnet)<br/>subnet\_region (string, required, region of subnet)<br/>subnet\_ip (string, mutually exclusive with new\_bits, CIDR-formatted IP range for subnetwork)<br/>new\_bits (number, mutually exclusive with subnet\_ip, CIDR bits used to calculate subnetwork range)<br/>subnet\_private\_access (bool, optional, Enable Private Access on subnetwork)<br/>subnet\_flow\_logs (map(string), optional, Configure Flow Logs see terraform-google-network module)<br/>description (string, optional, Description of Network)<br/>purpose (string, optional, related to Load Balancing)<br/>role (string, optional, related to Load Balancing) | `list(map(string))` | `[]` | no |
225226

modules/network/vpc/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ locals {
4040
subnet_name = local.subnetwork_name
4141
subnet_ip = local.default_primary_subnetwork_cidr_block
4242
subnet_region = var.region
43-
subnet_private_access = true
43+
subnet_private_access = var.subnetwork_private_access
4444
subnet_flow_logs = false
4545
description = "primary subnetwork in ${local.network_name}"
4646
purpose = null

modules/network/vpc/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,9 @@ variable "network_profile" {
311311
EOT
312312
default = null
313313
}
314+
315+
variable "subnetwork_private_access" {
316+
type = bool
317+
description = "Enable Private Google Access on the subnetworks"
318+
default = true
319+
}

tools/cloud-build/daily-tests/builds/gke-h4d.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ tags:
1919
- m.gke-node-pool
2020
- m.service-account
2121
- m.vpc
22+
- m.multivpc
2223
- m.kubectl-apply
2324
- m.filestore
2425
- m.gke-job-template

0 commit comments

Comments
 (0)