From 60e93606820017e52817b87f658371778a3cc147 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 10 Jul 2022 23:29:20 +0300 Subject: [PATCH 1/2] promote fields to ga --- README.md | 4 ++++ autogen/main/README.md | 4 ---- autogen/main/cluster.tf.tmpl | 4 ---- cluster.tf | 10 ++++++++++ modules/private-cluster-update-variant/README.md | 4 ++++ modules/private-cluster-update-variant/cluster.tf | 10 ++++++++++ modules/private-cluster/README.md | 4 ++++ modules/private-cluster/cluster.tf | 10 ++++++++++ 8 files changed, 42 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 522564c06e..98bee34caa 100644 --- a/README.md +++ b/README.md @@ -251,8 +251,12 @@ The node_pools variable takes the following parameters: | 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 | +| 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 | | 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 | +| pod_range | The ID of the secondary range for pod IPs. | | Optional | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/autogen/main/README.md b/autogen/main/README.md index 6fde2af604..150c673c58 100644 --- a/autogen/main/README.md +++ b/autogen/main/README.md @@ -211,16 +211,12 @@ The node_pools variable takes the following parameters: | 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 | | 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 | | 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 | -{% endif %} | 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 | -{% if beta_cluster %} | pod_range | The ID of the secondary range for pod IPs. | | Optional | -{% endif %} | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index c08a6570ee..88768bb6ee 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -588,26 +588,22 @@ resource "google_container_node_pool" "pools" { } } - {% if beta_cluster %} dynamic "network_config" { for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] content { pod_range = lookup(network_config.value, "pod_range", null) } } - {% endif %} management { auto_repair = lookup(each.value, "auto_repair", true) auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } - {% if beta_cluster %} upgrade_settings { max_surge = lookup(each.value, "max_surge", 1) max_unavailable = lookup(each.value, "max_unavailable", 0) } - {% endif %} node_config { image_type = lookup(each.value, "image_type", "COS_CONTAINERD") diff --git a/cluster.tf b/cluster.tf index 6de632f8a9..ff3d221872 100644 --- a/cluster.tf +++ b/cluster.tf @@ -297,12 +297,22 @@ resource "google_container_node_pool" "pools" { } } + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + } + } management { auto_repair = lookup(each.value, "auto_repair", true) auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + upgrade_settings { + max_surge = lookup(each.value, "max_surge", 1) + max_unavailable = lookup(each.value, "max_unavailable", 0) + } node_config { image_type = lookup(each.value, "image_type", "COS_CONTAINERD") diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index cdc59dbd55..0b87a0ba1f 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -285,8 +285,12 @@ The node_pools variable takes the following parameters: | 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 | +| 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 | | 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 | +| pod_range | The ID of the secondary range for pod IPs. | | Optional | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index d8ecd2eb5f..7f96b50181 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -401,12 +401,22 @@ resource "google_container_node_pool" "pools" { } } + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + } + } management { auto_repair = lookup(each.value, "auto_repair", true) auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + upgrade_settings { + max_surge = lookup(each.value, "max_surge", 1) + max_unavailable = lookup(each.value, "max_unavailable", 0) + } node_config { image_type = lookup(each.value, "image_type", "COS_CONTAINERD") diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index e7251e2710..a3c3bb9d3c 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -263,8 +263,12 @@ The node_pools variable takes the following parameters: | 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 | +| 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 | | 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 | +| pod_range | The ID of the secondary range for pod IPs. | | Optional | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index aaedfaf344..00064de9b1 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -310,12 +310,22 @@ resource "google_container_node_pool" "pools" { } } + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + } + } management { auto_repair = lookup(each.value, "auto_repair", true) auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + upgrade_settings { + max_surge = lookup(each.value, "max_surge", 1) + max_unavailable = lookup(each.value, "max_unavailable", 0) + } node_config { image_type = lookup(each.value, "image_type", "COS_CONTAINERD") From c5a2fc1667b0b2f0817de66cef18b6f8e33c7d00 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Mon, 11 Jul 2022 16:22:33 +0300 Subject: [PATCH 2/2] revert network_config --- README.md | 1 - autogen/main/README.md | 2 ++ autogen/main/cluster.tf.tmpl | 2 ++ cluster.tf | 6 ------ modules/private-cluster-update-variant/README.md | 1 - modules/private-cluster-update-variant/cluster.tf | 6 ------ modules/private-cluster/README.md | 1 - modules/private-cluster/cluster.tf | 6 ------ 8 files changed, 4 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 98bee34caa..d5ebebeaf5 100644 --- a/README.md +++ b/README.md @@ -256,7 +256,6 @@ The node_pools variable takes the following parameters: | 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 | | 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 | -| pod_range | The ID of the secondary range for pod IPs. | | Optional | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/autogen/main/README.md b/autogen/main/README.md index 150c673c58..e2e2eb48c1 100644 --- a/autogen/main/README.md +++ b/autogen/main/README.md @@ -216,7 +216,9 @@ The node_pools variable takes the following parameters: | 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 | | 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 | +{% if beta_cluster %} | pod_range | The ID of the secondary range for pod IPs. | | Optional | +{% endif %} | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 88768bb6ee..b369bfd78d 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -588,12 +588,14 @@ resource "google_container_node_pool" "pools" { } } + {% if beta_cluster %} dynamic "network_config" { for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] content { pod_range = lookup(network_config.value, "pod_range", null) } } + {% endif %} management { auto_repair = lookup(each.value, "auto_repair", true) diff --git a/cluster.tf b/cluster.tf index ff3d221872..9ba51ad550 100644 --- a/cluster.tf +++ b/cluster.tf @@ -297,12 +297,6 @@ resource "google_container_node_pool" "pools" { } } - dynamic "network_config" { - for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] - content { - pod_range = lookup(network_config.value, "pod_range", null) - } - } management { auto_repair = lookup(each.value, "auto_repair", true) diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 0b87a0ba1f..7f5c136d56 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -290,7 +290,6 @@ The node_pools variable takes the following parameters: | 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 | | 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 | -| pod_range | The ID of the secondary range for pod IPs. | | Optional | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 7f96b50181..7ebd2b7de9 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -401,12 +401,6 @@ resource "google_container_node_pool" "pools" { } } - dynamic "network_config" { - for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] - content { - pod_range = lookup(network_config.value, "pod_range", null) - } - } management { auto_repair = lookup(each.value, "auto_repair", true) diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index a3c3bb9d3c..f6b4617170 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -268,7 +268,6 @@ The node_pools variable takes the following parameters: | 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 | | 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 | -| pod_range | The ID of the secondary range for pod IPs. | | Optional | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | | 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 | | node_metadata | Options to expose the node metadata to the workload running on the node | | Optional | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index 00064de9b1..da5463d2a8 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -310,12 +310,6 @@ resource "google_container_node_pool" "pools" { } } - dynamic "network_config" { - for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] - content { - pod_range = lookup(network_config.value, "pod_range", null) - } - } management { auto_repair = lookup(each.value, "auto_repair", true)