Skip to content

Commit 9d1274f

Browse files
authored
feat: Add support for setting additional pod_range to beta node pools (#984)
BREAKING CHANGE: Minimum beta provider version increased to v3.79.0.
1 parent b910639 commit 9d1274f

File tree

28 files changed

+63
-15
lines changed

28 files changed

+63
-15
lines changed

autogen/main/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ The node_pools variable takes the following parameters:
199199
{% endif %}
200200
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional |
201201
| name | The name of the node pool | | Required |
202+
{% if beta_cluster %}
203+
| pod_range | The ID of the secondary range for pod IPs. | | Optional |
204+
{% endif %}
202205
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required |
203206
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
204207
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

autogen/main/cluster.tf.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@ resource "google_container_node_pool" "pools" {
472472
}
473473
}
474474

475+
{% if beta_cluster %}
476+
dynamic "network_config" {
477+
for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : []
478+
content {
479+
pod_range = lookup(network_config.value, "pod_range", null)
480+
}
481+
}
482+
{% endif %}
483+
475484
management {
476485
auto_repair = lookup(each.value, "auto_repair", true)
477486
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

autogen/main/versions.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ terraform {
2424
required_providers {
2525
google-beta = {
2626
source = "hashicorp/google-beta"
27-
version = ">= 3.63.0, <4.0.0"
27+
version = ">= 3.79.0, <4.0.0"
2828
}
2929
kubernetes = {
3030
source = "hashicorp/kubernetes"

cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ resource "google_container_node_pool" "pools" {
226226
}
227227
}
228228

229+
229230
management {
230231
auto_repair = lookup(each.value, "auto_repair", true)
231232
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

examples/node_pool/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
region = var.region
2424
}
2525

@@ -77,6 +77,7 @@ module "gke" {
7777
image_type = "COS"
7878
auto_upgrade = true
7979
service_account = var.compute_engine_service_account
80+
pod_range = "test"
8081
},
8182
]
8283

examples/node_pool_update_variant_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
credentials = file(var.credentials_path)
2424
region = var.region
2525
}

examples/node_pool_update_variant_public_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
credentials = file(var.credentials_path)
2424
region = var.region
2525
}

examples/regional_private_node_pool_oauth_scopes/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ provider "google" {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
}
2424

2525
data "google_client_config" "default" {}

examples/safer_cluster/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ provider "google" {
3535
}
3636

3737
provider "google-beta" {
38-
version = "~> 3.63.0"
38+
version = "~> 3.79.0"
3939
}
4040

4141
data "google_client_config" "default" {}

examples/safer_cluster_iap_bastion/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ provider "google" {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
}
2424

2525
data "google_client_config" "default" {}

examples/simple_regional_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
region = var.region
2424
}
2525

examples/simple_regional_private_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ provider "google" {
2424
}
2525

2626
provider "google-beta" {
27-
version = "~> 3.63.0"
27+
version = "~> 3.79.0"
2828
region = var.region
2929
}
3030

examples/simple_zonal_with_asm/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
region = var.region
2424
}
2525

examples/workload_metadata_config/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.63.0"
22+
version = "~> 3.79.0"
2323
region = var.region
2424
}
2525

modules/beta-private-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ The node_pools variable takes the following parameters:
316316
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. | 0 | Optional |
317317
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional |
318318
| name | The name of the node pool | | Required |
319+
| pod_range | The ID of the secondary range for pod IPs. | | Optional |
319320
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required |
320321
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
321322
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ resource "google_container_node_pool" "pools" {
429429
}
430430
}
431431

432+
dynamic "network_config" {
433+
for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : []
434+
content {
435+
pod_range = lookup(network_config.value, "pod_range", null)
436+
}
437+
}
438+
432439
management {
433440
auto_repair = lookup(each.value, "auto_repair", true)
434441
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

modules/beta-private-cluster-update-variant/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google-beta = {
2323
source = "hashicorp/google-beta"
24-
version = ">= 3.63.0, <4.0.0"
24+
version = ">= 3.79.0, <4.0.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ The node_pools variable takes the following parameters:
294294
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. | 0 | Optional |
295295
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional |
296296
| name | The name of the node pool | | Required |
297+
| pod_range | The ID of the secondary range for pod IPs. | | Optional |
297298
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required |
298299
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
299300
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

modules/beta-private-cluster/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,13 @@ resource "google_container_node_pool" "pools" {
345345
}
346346
}
347347

348+
dynamic "network_config" {
349+
for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : []
350+
content {
351+
pod_range = lookup(network_config.value, "pod_range", null)
352+
}
353+
}
354+
348355
management {
349356
auto_repair = lookup(each.value, "auto_repair", true)
350357
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

modules/beta-private-cluster/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google-beta = {
2323
source = "hashicorp/google-beta"
24-
version = ">= 3.63.0, <4.0.0"
24+
version = ">= 3.79.0, <4.0.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

modules/beta-public-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ The node_pools variable takes the following parameters:
303303
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. | 0 | Optional |
304304
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional |
305305
| name | The name of the node pool | | Required |
306+
| pod_range | The ID of the secondary range for pod IPs. | | Optional |
306307
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required |
307308
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
308309
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

modules/beta-public-cluster-update-variant/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,13 @@ resource "google_container_node_pool" "pools" {
410410
}
411411
}
412412

413+
dynamic "network_config" {
414+
for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : []
415+
content {
416+
pod_range = lookup(network_config.value, "pod_range", null)
417+
}
418+
}
419+
413420
management {
414421
auto_repair = lookup(each.value, "auto_repair", true)
415422
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

modules/beta-public-cluster-update-variant/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google-beta = {
2323
source = "hashicorp/google-beta"
24-
version = ">= 3.63.0, <4.0.0"
24+
version = ">= 3.79.0, <4.0.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ The node_pools variable takes the following parameters:
281281
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. | 0 | Optional |
282282
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional |
283283
| name | The name of the node pool | | Required |
284+
| pod_range | The ID of the secondary range for pod IPs. | | Optional |
284285
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required |
285286
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
286287
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

modules/beta-public-cluster/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ resource "google_container_node_pool" "pools" {
326326
}
327327
}
328328

329+
dynamic "network_config" {
330+
for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : []
331+
content {
332+
pod_range = lookup(network_config.value, "pod_range", null)
333+
}
334+
}
335+
329336
management {
330337
auto_repair = lookup(each.value, "auto_repair", true)
331338
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

modules/beta-public-cluster/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google-beta = {
2323
source = "hashicorp/google-beta"
24-
version = ">= 3.63.0, <4.0.0"
24+
version = ">= 3.79.0, <4.0.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

modules/private-cluster-update-variant/cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ resource "google_container_node_pool" "pools" {
323323
}
324324
}
325325

326+
326327
management {
327328
auto_repair = lookup(each.value, "auto_repair", true)
328329
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

modules/private-cluster/cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ resource "google_container_node_pool" "pools" {
239239
}
240240
}
241241

242+
242243
management {
243244
auto_repair = lookup(each.value, "auto_repair", true)
244245
auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade)

0 commit comments

Comments
 (0)