Skip to content

Commit 5791ac1

Browse files
authored
feat: [safer-cluster] Replace "kubernetes_version" with "release_channel" (terraform-google-modules#487)
BREAKING CHANGE: For the safer cluster module, you must now specify `release_channel` instead of `kubernetes_version`.
1 parent a5ace36 commit 5791ac1

File tree

28 files changed

+34
-103
lines changed

28 files changed

+34
-103
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ Then perform the following commands on the root folder:
133133
| node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map(map(string)) | `<map>` | no |
134134
| node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | map(list(string)) | `<map>` | no |
135135
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | map(list(string)) | `<map>` | no |
136-
| node\_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `""` | no |
137136
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list(string) | `<list>` | no |
138137
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
139138
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | string | `"null"` | no |

autogen/main/main.tf.tmpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ locals {
4444
// Kubernetes version
4545
master_version_regional = var.kubernetes_version != "latest" ? var.kubernetes_version : data.google_container_engine_versions.region.latest_master_version
4646
master_version_zonal = var.kubernetes_version != "latest" ? var.kubernetes_version : data.google_container_engine_versions.zone.latest_master_version
47-
node_version_regional = var.node_version != "" && var.regional ? var.node_version : local.master_version_regional
48-
node_version_zonal = var.node_version != "" && ! var.regional ? var.node_version : local.master_version_zonal
4947
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
50-
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
5148

5249
// Build a map of maps of node pools from a list of objects
5350
node_pool_names = [for np in toset(var.node_pools) : np.name]

autogen/main/variables.tf.tmpl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ variable "kubernetes_version" {
7272
default = "latest"
7373
}
7474

75-
variable "node_version" {
76-
type = string
77-
description = "The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation."
78-
default = ""
79-
}
80-
8175
variable "master_authorized_networks" {
8276
type = list(object({ cidr_block = string, display_name = string }))
8377
description = "List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists)."
@@ -448,7 +442,7 @@ variable "node_metadata" {
448442

449443
variable "sandbox_enabled" {
450444
type = bool
451-
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it)."
445+
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
452446
default = false
453447
}
454448

autogen/safer-cluster/main.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ module "gke" {
3434

3535
// We need to enforce a minimum Kubernetes Version to ensure
3636
// that the necessary security features are enabled.
37-
kubernetes_version = "latest"
37+
kubernetes_version = var.kubernetes_version
3838

3939
// Nodes are created with a default version. The nodepool enables
4040
// auto_upgrade so that the node versions can be kept up to date with
4141
// the master upgrades.
4242
//
4343
// https://cloud.google.com/kubernetes-engine/versioning-and-upgrades
44-
node_version = ""
44+
release_channel = var.release_channel
4545

4646
master_authorized_networks = var.master_authorized_networks
4747

autogen/safer-cluster/variables.tf.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ variable "subnetwork" {
6868
variable "kubernetes_version" {
6969
type = string
7070
description = "The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. The module enforces certain minimum versions to ensure that specific features are available. "
71-
default = "latest"
71+
default = null
7272
}
7373

74-
variable "node_version" {
74+
variable "release_channel" {
7575
type = string
76-
description = "The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation."
77-
default = ""
76+
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `REGULAR`."
77+
default = "REGULAR"
7878
}
7979

8080
variable "master_authorized_networks" {
@@ -270,7 +270,7 @@ variable "resource_usage_export_dataset_id" {
270270

271271
variable "sandbox_enabled" {
272272
type = bool
273-
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it)."
273+
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
274274
default = false
275275
}
276276

main.tf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ locals {
4040
// Kubernetes version
4141
master_version_regional = var.kubernetes_version != "latest" ? var.kubernetes_version : data.google_container_engine_versions.region.latest_master_version
4242
master_version_zonal = var.kubernetes_version != "latest" ? var.kubernetes_version : data.google_container_engine_versions.zone.latest_master_version
43-
node_version_regional = var.node_version != "" && var.regional ? var.node_version : local.master_version_regional
44-
node_version_zonal = var.node_version != "" && ! var.regional ? var.node_version : local.master_version_zonal
4543
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
46-
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
4744

4845
// Build a map of maps of node pools from a list of objects
4946
node_pool_names = [for np in toset(var.node_pools) : np.name]

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ Then perform the following commands on the root folder:
210210
| node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | map(list(string)) | `<map>` | no |
211211
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | map(list(string)) | `<map>` | no |
212212
| node\_pools\_taints | Map of lists containing node taints by node-pool name | object | `<map>` | no |
213-
| node\_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `""` | no |
214213
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list(string) | `<list>` | no |
215214
| pod\_security\_policy\_config | enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. | object | `<list>` | no |
216215
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
@@ -220,7 +219,7 @@ Then perform the following commands on the root folder:
220219
| release\_channel | (Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | string | `"null"` | no |
221220
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
222221
| resource\_usage\_export\_dataset\_id | The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | string | `""` | no |
223-
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it). | bool | `"false"` | no |
222+
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | bool | `"false"` | no |
224223
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created. | string | `""` | no |
225224
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | bool | `"false"` | no |
226225
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | map(list(string)) | `<map>` | no |

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ locals {
4040
// Kubernetes version
4141
master_version_regional = var.kubernetes_version != "latest" ? var.kubernetes_version : data.google_container_engine_versions.region.latest_master_version
4242
master_version_zonal = var.kubernetes_version != "latest" ? var.kubernetes_version : data.google_container_engine_versions.zone.latest_master_version
43-
node_version_regional = var.node_version != "" && var.regional ? var.node_version : local.master_version_regional
44-
node_version_zonal = var.node_version != "" && ! var.regional ? var.node_version : local.master_version_zonal
4543
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
46-
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
4744

4845
// Build a map of maps of node pools from a list of objects
4946
node_pool_names = [for np in toset(var.node_pools) : np.name]

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ variable "kubernetes_version" {
7272
default = "latest"
7373
}
7474

75-
variable "node_version" {
76-
type = string
77-
description = "The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation."
78-
default = ""
79-
}
80-
8175
variable "master_authorized_networks" {
8276
type = list(object({ cidr_block = string, display_name = string }))
8377
description = "List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists)."
@@ -441,7 +435,7 @@ variable "node_metadata" {
441435

442436
variable "sandbox_enabled" {
443437
type = bool
444-
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it)."
438+
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
445439
default = false
446440
}
447441

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ Then perform the following commands on the root folder:
188188
| node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | map(list(string)) | `<map>` | no |
189189
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | map(list(string)) | `<map>` | no |
190190
| node\_pools\_taints | Map of lists containing node taints by node-pool name | object | `<map>` | no |
191-
| node\_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `""` | no |
192191
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list(string) | `<list>` | no |
193192
| pod\_security\_policy\_config | enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. | object | `<list>` | no |
194193
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
@@ -198,7 +197,7 @@ Then perform the following commands on the root folder:
198197
| release\_channel | (Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | string | `"null"` | no |
199198
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
200199
| resource\_usage\_export\_dataset\_id | The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | string | `""` | no |
201-
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it). | bool | `"false"` | no |
200+
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | bool | `"false"` | no |
202201
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created. | string | `""` | no |
203202
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | bool | `"false"` | no |
204203
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | map(list(string)) | `<map>` | no |

0 commit comments

Comments
 (0)