Skip to content

Commit 8b6a803

Browse files
authored
feat: add support for additional_pod_ranges_config (#2435)
Signed-off-by: drfaust92 <[email protected]>
1 parent 75d5547 commit 8b6a803

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+202
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ Then perform the following commands on the root folder:
144144
| add\_master\_webhook\_firewall\_rules | Create master\_webhook firewall rules for ports defined in `firewall_inbound_ports` | `bool` | `false` | no |
145145
| add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no |
146146
| additional\_ip\_range\_pods | List of _names_ of the additional secondary subnet ip ranges to use for pods | `list(string)` | `[]` | no |
147+
| additional\_pod\_ranges\_config | the configuration for individual additional subnetworks attached to the cluster | `list(object({ subnetwork = string, pod_ipv4_range_names = list(string) }))` | `[]` | no |
147148
| additive\_vpc\_scope\_dns\_domain | This will enable Cloud DNS additive VPC scope. Must provide a domain name that is unique within the VPC. For this to work cluster\_dns = `CLOUD_DNS` and cluster\_dns\_scope = `CLUSTER_SCOPE` must both be set as well. | `string` | `""` | no |
148149
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected] | `string` | `null` | no |
149150
| boot\_disk\_kms\_key | The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool, if not overridden in `node_pools`. This should be of the form projects/[KEY\_PROJECT\_ID]/locations/[LOCATION]/keyRings/[RING\_NAME]/cryptoKeys/[KEY\_NAME]. For more information about protecting resources with Cloud KMS Keys please see: https://cloud.google.com/compute/docs/disks/customer-managed-encryption | `string` | `null` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,13 @@ resource "google_container_cluster" "primary" {
541541
pod_range_names = var.additional_ip_range_pods
542542
}
543543
}
544+
dynamic "additional_pod_ranges_config" {
545+
for_each = var.additional_pod_ranges_config
546+
content {
547+
subnetwork = var.additional_pod_ranges_config.subnetwork
548+
pod_ipv4_range_names = var.additional_pod_ranges_config.pod_ipv4_range_names
549+
}
550+
}
544551
stack_type = var.stack_type
545552
}
546553

autogen/main/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ variable "additional_ip_range_pods" {
174174
default = []
175175
}
176176

177+
variable "additional_pod_ranges_config" {
178+
type = list(object({ subnetwork = string, pod_ipv4_range_names = list(string) }))
179+
description = "the configuration for individual additional subnetworks attached to the cluster"
180+
default = []
181+
}
182+
177183
variable "ip_range_services" {
178184
type = string
179185
description = "The _name_ of the secondary subnet range to use for services. If not provided, the default `34.118.224.0/20` range will be used."

cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,13 @@ resource "google_container_cluster" "primary" {
411411
pod_range_names = var.additional_ip_range_pods
412412
}
413413
}
414+
dynamic "additional_pod_ranges_config" {
415+
for_each = var.additional_pod_ranges_config
416+
content {
417+
subnetwork = var.additional_pod_ranges_config.subnetwork
418+
pod_ipv4_range_names = var.additional_pod_ranges_config.pod_ipv4_range_names
419+
}
420+
}
414421
stack_type = var.stack_type
415422
}
416423

metadata.display.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ spec:
3939
additional_ip_range_pods:
4040
name: additional_ip_range_pods
4141
title: Additional Ip Range Pods
42+
additional_pod_ranges_config:
43+
name: additional_pod_ranges_config
44+
title: Additional Pod Ranges Config
4245
additive_vpc_scope_dns_domain:
4346
name: additive_vpc_scope_dns_domain
4447
title: Additive Vpc Scope Dns Domain

metadata.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ spec:
259259
description: List of _names_ of the additional secondary subnet ip ranges to use for pods
260260
varType: list(string)
261261
defaultValue: []
262+
- name: additional_pod_ranges_config
263+
description: the configuration for individual additional subnetworks attached to the cluster
264+
varType: list(object({ subnetwork = string, pod_ipv4_range_names = list(string) }))
265+
defaultValue: []
262266
- name: ip_range_services
263267
description: The _name_ of the secondary subnet range to use for services. If not provided, the default `34.118.224.0/20` range will be used.
264268
varType: string

modules/beta-autopilot-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Then perform the following commands on the root folder:
7777
| add\_master\_webhook\_firewall\_rules | Create master\_webhook firewall rules for ports defined in `firewall_inbound_ports` | `bool` | `false` | no |
7878
| add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no |
7979
| additional\_ip\_range\_pods | List of _names_ of the additional secondary subnet ip ranges to use for pods | `list(string)` | `[]` | no |
80+
| additional\_pod\_ranges\_config | the configuration for individual additional subnetworks attached to the cluster | `list(object({ subnetwork = string, pod_ipv4_range_names = list(string) }))` | `[]` | no |
8081
| allow\_net\_admin | (Optional) Enable NET\_ADMIN for the cluster. | `bool` | `null` | no |
8182
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected] | `string` | `null` | no |
8283
| boot\_disk\_kms\_key | The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool, if not overridden in `node_pools`. This should be of the form projects/[KEY\_PROJECT\_ID]/locations/[LOCATION]/keyRings/[RING\_NAME]/cryptoKeys/[KEY\_NAME]. For more information about protecting resources with Cloud KMS Keys please see: https://cloud.google.com/compute/docs/disks/customer-managed-encryption | `string` | `null` | no |

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,13 @@ resource "google_container_cluster" "primary" {
312312
pod_range_names = var.additional_ip_range_pods
313313
}
314314
}
315+
dynamic "additional_pod_ranges_config" {
316+
for_each = var.additional_pod_ranges_config
317+
content {
318+
subnetwork = var.additional_pod_ranges_config.subnetwork
319+
pod_ipv4_range_names = var.additional_pod_ranges_config.pod_ipv4_range_names
320+
}
321+
}
315322
stack_type = var.stack_type
316323
}
317324

modules/beta-autopilot-private-cluster/metadata.display.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ spec:
4040
additional_ip_range_pods:
4141
name: additional_ip_range_pods
4242
title: Additional Ip Range Pods
43+
additional_pod_ranges_config:
44+
name: additional_pod_ranges_config
45+
title: Additional Pod Ranges Config
4346
allow_net_admin:
4447
name: allow_net_admin
4548
title: Allow Net Admin

modules/beta-autopilot-private-cluster/metadata.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ spec:
218218
description: List of _names_ of the additional secondary subnet ip ranges to use for pods
219219
varType: list(string)
220220
defaultValue: []
221+
- name: additional_pod_ranges_config
222+
description: the configuration for individual additional subnetworks attached to the cluster
223+
varType: list(object({ subnetwork = string, pod_ipv4_range_names = list(string) }))
224+
defaultValue: []
221225
- name: ip_range_services
222226
description: The _name_ of the secondary subnet range to use for services. If not provided, the default `34.118.224.0/20` range will be used.
223227
varType: string

0 commit comments

Comments
 (0)