Skip to content

Commit 11bae67

Browse files
authored
feat: Add secondary_boot_disks to node_pool configuration. (#1946)
1 parent 3d5cc9f commit 11bae67

File tree

16 files changed

+143
-0
lines changed

16 files changed

+143
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ The node_pools variable takes the following parameters:
325325
| value | The value for the taint | | Required |
326326
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
327327
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
328+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
328329

329330
## windows_node_pools variable
330331
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

autogen/main/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ The node_pools variable takes the following parameters:
250250
| value | The value for the taint | | Required |
251251
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
252252
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
253+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
253254

254255
## windows_node_pools variable
255256
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

autogen/main/cluster.tf.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,15 @@ resource "google_container_node_pool" "windows_pools" {
864864
}
865865
}
866866

867+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
868+
dynamic "secondary_boot_disks" {
869+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
870+
content {
871+
disk_image = secondary_boot_disks.value
872+
mode = "CONTAINER_IMAGE_CACHE"
873+
}
874+
}
875+
867876
service_account = lookup(
868877
each.value,
869878
"service_account",

cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,15 @@ resource "google_container_node_pool" "pools" {
582582
}
583583
}
584584

585+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
586+
dynamic "secondary_boot_disks" {
587+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
588+
content {
589+
disk_image = secondary_boot_disks.value
590+
mode = "CONTAINER_IMAGE_CACHE"
591+
}
592+
}
593+
585594
service_account = lookup(
586595
each.value,
587596
"service_account",
@@ -798,6 +807,15 @@ resource "google_container_node_pool" "windows_pools" {
798807
}
799808
}
800809

810+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
811+
dynamic "secondary_boot_disks" {
812+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
813+
content {
814+
disk_image = secondary_boot_disks.value
815+
mode = "CONTAINER_IMAGE_CACHE"
816+
}
817+
}
818+
801819
service_account = lookup(
802820
each.value,
803821
"service_account",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ The node_pools variable takes the following parameters:
391391
| value | The value for the taint | | Required |
392392
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
393393
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
394+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
394395

395396
## windows_node_pools variable
396397
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,15 @@ resource "google_container_node_pool" "pools" {
748748
}
749749
}
750750

751+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
752+
dynamic "secondary_boot_disks" {
753+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
754+
content {
755+
disk_image = secondary_boot_disks.value
756+
mode = "CONTAINER_IMAGE_CACHE"
757+
}
758+
}
759+
751760
service_account = lookup(
752761
each.value,
753762
"service_account",
@@ -990,6 +999,15 @@ resource "google_container_node_pool" "windows_pools" {
990999
}
9911000
}
9921001

1002+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
1003+
dynamic "secondary_boot_disks" {
1004+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
1005+
content {
1006+
disk_image = secondary_boot_disks.value
1007+
mode = "CONTAINER_IMAGE_CACHE"
1008+
}
1009+
}
1010+
9931011
service_account = lookup(
9941012
each.value,
9951013
"service_account",

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ The node_pools variable takes the following parameters:
369369
| value | The value for the taint | | Required |
370370
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
371371
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
372+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
372373

373374
## windows_node_pools variable
374375
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

modules/beta-private-cluster/cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,15 @@ resource "google_container_node_pool" "pools" {
673673
}
674674
}
675675

676+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
677+
dynamic "secondary_boot_disks" {
678+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
679+
content {
680+
disk_image = secondary_boot_disks.value
681+
mode = "CONTAINER_IMAGE_CACHE"
682+
}
683+
}
684+
676685
service_account = lookup(
677686
each.value,
678687
"service_account",
@@ -914,6 +923,15 @@ resource "google_container_node_pool" "windows_pools" {
914923
}
915924
}
916925

926+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
927+
dynamic "secondary_boot_disks" {
928+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
929+
content {
930+
disk_image = secondary_boot_disks.value
931+
mode = "CONTAINER_IMAGE_CACHE"
932+
}
933+
}
934+
917935
service_account = lookup(
918936
each.value,
919937
"service_account",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ The node_pools variable takes the following parameters:
379379
| value | The value for the taint | | Required |
380380
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
381381
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
382+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
382383

383384
## windows_node_pools variable
384385
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,15 @@ resource "google_container_node_pool" "pools" {
729729
}
730730
}
731731

732+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
733+
dynamic "secondary_boot_disks" {
734+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
735+
content {
736+
disk_image = secondary_boot_disks.value
737+
mode = "CONTAINER_IMAGE_CACHE"
738+
}
739+
}
740+
732741
service_account = lookup(
733742
each.value,
734743
"service_account",
@@ -971,6 +980,15 @@ resource "google_container_node_pool" "windows_pools" {
971980
}
972981
}
973982

983+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
984+
dynamic "secondary_boot_disks" {
985+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
986+
content {
987+
disk_image = secondary_boot_disks.value
988+
mode = "CONTAINER_IMAGE_CACHE"
989+
}
990+
}
991+
974992
service_account = lookup(
975993
each.value,
976994
"service_account",

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ The node_pools variable takes the following parameters:
357357
| value | The value for the taint | | Required |
358358
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
359359
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
360+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
360361

361362
## windows_node_pools variable
362363
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

modules/beta-public-cluster/cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,15 @@ resource "google_container_node_pool" "pools" {
654654
}
655655
}
656656

657+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
658+
dynamic "secondary_boot_disks" {
659+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
660+
content {
661+
disk_image = secondary_boot_disks.value
662+
mode = "CONTAINER_IMAGE_CACHE"
663+
}
664+
}
665+
657666
service_account = lookup(
658667
each.value,
659668
"service_account",
@@ -895,6 +904,15 @@ resource "google_container_node_pool" "windows_pools" {
895904
}
896905
}
897906

907+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
908+
dynamic "secondary_boot_disks" {
909+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
910+
content {
911+
disk_image = secondary_boot_disks.value
912+
mode = "CONTAINER_IMAGE_CACHE"
913+
}
914+
}
915+
898916
service_account = lookup(
899917
each.value,
900918
"service_account",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ The node_pools variable takes the following parameters:
360360
| value | The value for the taint | | Required |
361361
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
362362
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
363+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
363364

364365
## windows_node_pools variable
365366
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,15 @@ resource "google_container_node_pool" "pools" {
676676
}
677677
}
678678

679+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
680+
dynamic "secondary_boot_disks" {
681+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
682+
content {
683+
disk_image = secondary_boot_disks.value
684+
mode = "CONTAINER_IMAGE_CACHE"
685+
}
686+
}
687+
679688
service_account = lookup(
680689
each.value,
681690
"service_account",
@@ -893,6 +902,15 @@ resource "google_container_node_pool" "windows_pools" {
893902
}
894903
}
895904

905+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
906+
dynamic "secondary_boot_disks" {
907+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
908+
content {
909+
disk_image = secondary_boot_disks.value
910+
mode = "CONTAINER_IMAGE_CACHE"
911+
}
912+
}
913+
896914
service_account = lookup(
897915
each.value,
898916
"service_account",

modules/private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ The node_pools variable takes the following parameters:
338338
| value | The value for the taint | | Required |
339339
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
340340
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
341+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
341342

342343
## windows_node_pools variable
343344
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

modules/private-cluster/cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,15 @@ resource "google_container_node_pool" "pools" {
601601
}
602602
}
603603

604+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
605+
dynamic "secondary_boot_disks" {
606+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
607+
content {
608+
disk_image = secondary_boot_disks.value
609+
mode = "CONTAINER_IMAGE_CACHE"
610+
}
611+
}
612+
604613
service_account = lookup(
605614
each.value,
606615
"service_account",
@@ -817,6 +826,15 @@ resource "google_container_node_pool" "windows_pools" {
817826
}
818827
}
819828

829+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
830+
dynamic "secondary_boot_disks" {
831+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
832+
content {
833+
disk_image = secondary_boot_disks.value
834+
mode = "CONTAINER_IMAGE_CACHE"
835+
}
836+
}
837+
820838
service_account = lookup(
821839
each.value,
822840
"service_account",

0 commit comments

Comments
 (0)