From 5ab322ec90d10eeefd1b84a7f3d10dbd0f447de5 Mon Sep 17 00:00:00 2001 From: Kishore Kudipudi Date: Fri, 12 Nov 2021 10:08:00 -0800 Subject: [PATCH] =?UTF-8?q?feat:=20Added=20support=20for=20specifying=20mi?= =?UTF-8?q?n=5Fcpu=5Fplatform=20in=20node=20config=20-=20=E2=80=A6=20(#105?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Added support for specifying min_cpu_platform in node config - fix terraform-google-modules#985 * README: Added description for min_cpu_platform in node config Co-authored-by: Bharath KKB --- README.md | 1 + autogen/main/README.md | 1 + autogen/main/cluster.tf.tmpl | 15 +++++++++------ cluster.tf | 10 ++++++---- .../beta-private-cluster-update-variant/README.md | 1 + .../cluster.tf | 11 +++++++---- modules/beta-private-cluster/README.md | 1 + modules/beta-private-cluster/cluster.tf | 10 ++++++---- .../beta-public-cluster-update-variant/README.md | 1 + .../beta-public-cluster-update-variant/cluster.tf | 11 +++++++---- modules/beta-public-cluster/README.md | 1 + modules/beta-public-cluster/cluster.tf | 10 ++++++---- modules/private-cluster-update-variant/README.md | 1 + modules/private-cluster-update-variant/cluster.tf | 11 +++++++---- modules/private-cluster/README.md | 1 + modules/private-cluster/cluster.tf | 10 ++++++---- 16 files changed, 62 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 239e55ab32..f453556c70 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,7 @@ The node_pools variable takes the following parameters: | 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 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | 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 | | name | The name of the node pool | | Required | diff --git a/autogen/main/README.md b/autogen/main/README.md index 45115b7dd8..14acb6f3ba 100644 --- a/autogen/main/README.md +++ b/autogen/main/README.md @@ -194,6 +194,7 @@ The node_pools variable takes the following parameters: | 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | {% if beta_cluster %} | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index f6d96e4a0c..0375299d67 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -261,11 +261,12 @@ resource "google_container_cluster" "primary" { node_config { {% if beta_cluster %} - image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") {% else %} - image_type = lookup(var.node_pools[0], "image_type", "COS") + image_type = lookup(var.node_pools[0], "image_type", "COS") {% endif %} - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -385,6 +386,7 @@ locals { "accelerator_type", "local_ssd_count", "machine_type", + "min_cpu_platform", "preemptible", "service_account", ] @@ -528,11 +530,12 @@ resource "google_container_node_pool" "pools" { node_config { {% if beta_cluster %} - image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") {% else %} - image_type = lookup(each.value, "image_type", "COS") + image_type = lookup(each.value, "image_type", "COS") {% endif %} - machine_type = lookup(each.value, "machine_type", "e2-medium") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/cluster.tf b/cluster.tf index ccf8b2c8bd..05d6ac3f21 100644 --- a/cluster.tf +++ b/cluster.tf @@ -138,8 +138,9 @@ resource "google_container_cluster" "primary" { initial_node_count = var.initial_node_count node_config { - image_type = lookup(var.node_pools[0], "image_type", "COS") - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + image_type = lookup(var.node_pools[0], "image_type", "COS") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -252,8 +253,9 @@ resource "google_container_node_pool" "pools" { node_config { - image_type = lookup(each.value, "image_type", "COS") - machine_type = lookup(each.value, "machine_type", "e2-medium") + image_type = lookup(each.value, "image_type", "COS") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index 45ccdf7b50..6a25c04832 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -314,6 +314,7 @@ The node_pools variable takes the following parameters: | 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | 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 | | max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. | 1 | Optional | diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 443cc6b306..4c6004e33f 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -231,8 +231,9 @@ resource "google_container_cluster" "primary" { initial_node_count = var.initial_node_count node_config { - image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -343,6 +344,7 @@ locals { "accelerator_type", "local_ssd_count", "machine_type", + "min_cpu_platform", "preemptible", "service_account", ] @@ -472,8 +474,9 @@ resource "google_container_node_pool" "pools" { } node_config { - image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(each.value, "machine_type", "e2-medium") + image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index 2fae4ffde9..531eb8a409 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -292,6 +292,7 @@ The node_pools variable takes the following parameters: | 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | 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 | | max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. | 1 | Optional | diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index 0b7491dd09..1412626ab8 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -231,8 +231,9 @@ resource "google_container_cluster" "primary" { initial_node_count = var.initial_node_count node_config { - image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -388,8 +389,9 @@ resource "google_container_node_pool" "pools" { } node_config { - image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(each.value, "machine_type", "e2-medium") + image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index 16d5860abf..9e70d20fe4 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -301,6 +301,7 @@ The node_pools variable takes the following parameters: | 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | 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 | | max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. | 1 | Optional | diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 682b961292..8e81246548 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -231,8 +231,9 @@ resource "google_container_cluster" "primary" { initial_node_count = var.initial_node_count node_config { - image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -324,6 +325,7 @@ locals { "accelerator_type", "local_ssd_count", "machine_type", + "min_cpu_platform", "preemptible", "service_account", ] @@ -453,8 +455,9 @@ resource "google_container_node_pool" "pools" { } node_config { - image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(each.value, "machine_type", "e2-medium") + image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index 3e351b50d4..0c1306a58c 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -279,6 +279,7 @@ The node_pools variable takes the following parameters: | 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | 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 | | max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. | 1 | Optional | diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index 94d0e4a092..f06a15d34b 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -231,8 +231,9 @@ resource "google_container_cluster" "primary" { initial_node_count = var.initial_node_count node_config { - image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + image_type = lookup(var.node_pools[0], "image_type", lookup(var.node_pools[0], "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -369,8 +370,9 @@ resource "google_container_node_pool" "pools" { } node_config { - image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") - machine_type = lookup(each.value, "machine_type", "e2-medium") + image_type = lookup(each.value, "image_type", lookup(each.value, "sandbox_enabled", var.sandbox_enabled) ? "COS_CONTAINERD" : "COS") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index d99cda8154..80f4ad9882 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -275,6 +275,7 @@ The node_pools variable takes the following parameters: | 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 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | 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 | | name | The name of the node pool | | Required | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index b9b5dd8648..735fc07d3a 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -138,8 +138,9 @@ resource "google_container_cluster" "primary" { initial_node_count = var.initial_node_count node_config { - image_type = lookup(var.node_pools[0], "image_type", "COS") - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + image_type = lookup(var.node_pools[0], "image_type", "COS") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -230,6 +231,7 @@ locals { "accelerator_type", "local_ssd_count", "machine_type", + "min_cpu_platform", "preemptible", "service_account", ] @@ -349,8 +351,9 @@ resource "google_container_node_pool" "pools" { node_config { - image_type = lookup(each.value, "image_type", "COS") - machine_type = lookup(each.value, "machine_type", "e2-medium") + image_type = lookup(each.value, "image_type", "COS") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 1365b72a26..4ac06b8753 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -253,6 +253,7 @@ The node_pools variable takes the following parameters: | 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 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 | +| min_cpu_platform | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | " " | 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 | | name | The name of the node pool | | Required | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index 182f86bca3..d04e8fde0a 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -138,8 +138,9 @@ resource "google_container_cluster" "primary" { initial_node_count = var.initial_node_count node_config { - image_type = lookup(var.node_pools[0], "image_type", "COS") - machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + image_type = lookup(var.node_pools[0], "image_type", "COS") + machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") service_account = lookup(var.node_pools[0], "service_account", local.service_account) @@ -265,8 +266,9 @@ resource "google_container_node_pool" "pools" { node_config { - image_type = lookup(each.value, "image_type", "COS") - machine_type = lookup(each.value, "machine_type", "e2-medium") + image_type = lookup(each.value, "image_type", "COS") + machine_type = lookup(each.value, "machine_type", "e2-medium") + min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "") labels = merge( lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},