Skip to content

Commit

Permalink
feat: Add secondary_boot_disks to node_pool configuration. (#1946)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorik committed May 17, 2024
1 parent 3d5cc9f commit 11bae67
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
1 change: 1 addition & 0 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
9 changes: 9 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
18 changes: 18 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -798,6 +807,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
18 changes: 18 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -990,6 +999,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
18 changes: 18 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -914,6 +923,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
18 changes: 18 additions & 0 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -971,6 +980,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
18 changes: 18 additions & 0 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -895,6 +904,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
18 changes: 18 additions & 0 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -893,6 +902,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ The node_pools variable takes the following parameters:
| value | The value for the taint | | Required |
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |

## windows_node_pools variable
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.
Expand Down
18 changes: 18 additions & 0 deletions modules/private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,15 @@ resource "google_container_node_pool" "pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down Expand Up @@ -817,6 +826,15 @@ resource "google_container_node_pool" "windows_pools" {
}
}

# Supports a single secondary boot disk because `map(any)` must have the same values type.
dynamic "secondary_boot_disks" {
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
content {
disk_image = secondary_boot_disks.value
mode = "CONTAINER_IMAGE_CACHE"
}
}

service_account = lookup(
each.value,
"service_account",
Expand Down

0 comments on commit 11bae67

Please sign in to comment.