diff --git a/README.md b/README.md index 37ced0191..958c0c744 100644 --- a/README.md +++ b/README.md @@ -46,20 +46,20 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -236,7 +236,7 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional | diff --git a/autogen/main/README.md b/autogen/main/README.md index f8c3a679b..d821827f0 100644 --- a/autogen/main/README.md +++ b/autogen/main/README.md @@ -86,20 +86,23 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + {% if beta_cluster %} + local_ssd_ephemeral_count = 0 + {% endif %} + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -181,7 +184,10 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | +{% if beta_cluster %} +| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional | +{% endif %} | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | {% if beta_cluster %} diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 1a1b7cdd6..69d3c8ad7 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -528,6 +528,15 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + {% if beta_cluster %} + dynamic "ephemeral_storage_config" { + for_each = lookup(each.value, "local_ssd_ephemeral_count",0) > 0 ? [each.value.local_ssd_ephemeral_count] : [] + content { + local_ssd_count = ephemeral_storage_config.value + } + } + {% endif %} + service_account = lookup( each.value, "service_account", diff --git a/cluster.tf b/cluster.tf index 189a8d252..e1891d424 100644 --- a/cluster.tf +++ b/cluster.tf @@ -272,6 +272,7 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + service_account = lookup( each.value, "service_account", diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index 24a54fc62..abe605800 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -77,20 +77,21 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + local_ssd_ephemeral_count = 0 + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -304,7 +305,8 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | +| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional | | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 7b2b5f5f5..31de261c6 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -479,6 +479,13 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + dynamic "ephemeral_storage_config" { + for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : [] + content { + local_ssd_count = ephemeral_storage_config.value + } + } + service_account = lookup( each.value, "service_account", diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index 0b3dcbe12..d967fd526 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -55,20 +55,21 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + local_ssd_ephemeral_count = 0 + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -282,7 +283,8 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | +| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional | | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index 119b2bc8e..b05a12585 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -395,6 +395,13 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + dynamic "ephemeral_storage_config" { + for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : [] + content { + local_ssd_count = ephemeral_storage_config.value + } + } + service_account = lookup( each.value, "service_account", diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index 5345cddf2..8239363a3 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -71,20 +71,21 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + local_ssd_ephemeral_count = 0 + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -291,7 +292,8 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | +| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional | | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 137426e2e..47976d4e4 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -460,6 +460,13 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + dynamic "ephemeral_storage_config" { + for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : [] + content { + local_ssd_count = ephemeral_storage_config.value + } + } + service_account = lookup( each.value, "service_account", diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index 1f6750af0..f9f142209 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -49,20 +49,21 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + local_ssd_ephemeral_count = 0 + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -269,7 +270,8 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | +| local_ssd_ephemeral_count | The amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as an `emptyDir` volume. If unspecified, ephemeral storage is backed by the cluster node boot disk. | 0 | Optional | | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index 783c5ed01..923f48087 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -376,6 +376,13 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + dynamic "ephemeral_storage_config" { + for_each = lookup(each.value, "local_ssd_ephemeral_count", 0) > 0 ? [each.value.local_ssd_ephemeral_count] : [] + content { + local_ssd_count = ephemeral_storage_config.value + } + } + service_account = lookup( each.value, "service_account", diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 367a4e688..79a1560af 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -74,20 +74,20 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -270,7 +270,7 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index a322d1c96..fab61a072 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -369,6 +369,7 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + service_account = lookup( each.value, "service_account", diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 48453017f..3f5b8b8c1 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -52,20 +52,20 @@ module "gke" { node_pools = [ { - name = "default-node-pool" - machine_type = "e2-medium" - node_locations = "us-central1-b,us-central1-c" - min_count = 1 - max_count = 100 - local_ssd_count = 0 - disk_size_gb = 100 - disk_type = "pd-standard" - image_type = "COS" - auto_repair = true - auto_upgrade = true - service_account = "project-service-account@.iam.gserviceaccount.com" - preemptible = false - initial_node_count = 80 + name = "default-node-pool" + machine_type = "e2-medium" + node_locations = "us-central1-b,us-central1-c" + min_count = 1 + max_count = 100 + local_ssd_count = 0 + disk_size_gb = 100 + disk_type = "pd-standard" + image_type = "COS" + auto_repair = true + auto_upgrade = true + service_account = "project-service-account@.iam.gserviceaccount.com" + preemptible = false + initial_node_count = 80 }, ] @@ -248,7 +248,7 @@ The node_pools variable takes the following parameters: | image_type | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | COS | Optional | | initial_node_count | The initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count | " " | Optional | | key | The key required for the taint | | Required | -| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node | 0 | Optional | +| local_ssd_count | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | 0 | Optional | | machine_type | The name of a Google Compute Engine machine type | e2-medium | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index c526f8c99..37bc5c18c 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -285,6 +285,7 @@ resource "google_container_node_pool" "pools" { disk_size_gb = lookup(each.value, "disk_size_gb", 100) disk_type = lookup(each.value, "disk_type", "pd-standard") + service_account = lookup( each.value, "service_account",