Skip to content

Commit f76d8e8

Browse files
committed
fix: promoting release_channel, database_encryption, workload_identity_config, and enable_shielded_nodes from beta to GA
1 parent 68e8eec commit f76d8e8

File tree

44 files changed

+561
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+561
-258
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,21 @@ Then perform the following commands on the root folder:
107107
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | map(string) | `<map>` | no |
108108
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
109109
| create\_service\_account | Defines if service account specified to run nodes should be created. | bool | `"true"` | no |
110+
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
110111
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
111112
| description | The description of the cluster | string | `""` | no |
112113
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
113114
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | bool | `"false"` | no |
114115
| enable\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | bool | `"true"` | no |
116+
| enable\_shielded\_nodes | Enable Shielded Nodes features on all nodes in this cluster | bool | `"true"` | no |
115117
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers | list(string) | `<list>` | no |
116118
| firewall\_priority | Priority rule for firewall rules | number | `"1000"` | no |
117119
| gcloud\_skip\_download | Whether to skip downloading gcloud (assumes gcloud is already available outside the module) | bool | `"true"` | no |
118120
| gcloud\_upgrade | Whether to upgrade gcloud at runtime | bool | `"false"` | no |
119121
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
120122
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
121123
| http\_load\_balancing | Enable httpload balancer addon | bool | `"true"` | no |
124+
| identity\_namespace | Workload Identity namespace. (Default value of `enabled` automatically sets project based namespace `[project_id].svc.id.goog`) | string | `"enabled"` | no |
122125
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | number | `"0"` | no |
123126
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | bool | `"false"` | no |
124127
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | string | `"60s"` | no |
@@ -135,6 +138,7 @@ Then perform the following commands on the root folder:
135138
| network\_policy | Enable network policy addon | bool | `"true"` | no |
136139
| network\_policy\_provider | The network policy provider. | string | `"CALICO"` | no |
137140
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no |
141+
| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"GKE_METADATA_SERVER"` | no |
138142
| node\_pools | List of maps containing node pools | list(map(string)) | `<list>` | no |
139143
| node\_pools\_labels | Map of maps containing node labels by node-pool name | map(map(string)) | `<map>` | no |
140144
| node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map(map(string)) | `<map>` | no |
@@ -146,6 +150,7 @@ Then perform the following commands on the root folder:
146150
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | string | `"null"` | no |
147151
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
148152
| registry\_project\_id | Project holding the Google Container Registry. If empty, we use the cluster project. If grant_registry_access is true, storage.objectViewer role is assigned on this project. | string | `""` | no |
153+
| release\_channel | The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | string | `"null"` | no |
149154
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
150155
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | string | `""` | no |
151156
| 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 |
@@ -163,6 +168,7 @@ Then perform the following commands on the root folder:
163168
| endpoint | Cluster endpoint |
164169
| horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled |
165170
| http\_load\_balancing\_enabled | Whether http load balancing enabled |
171+
| identity\_namespace | Workload Identity namespace |
166172
| location | Cluster location (region if regional cluster, zone if zonal cluster) |
167173
| logging\_service | Logging service used |
168174
| master\_authorized\_networks\_config | Networks from which access to master is permitted |
@@ -174,6 +180,7 @@ Then perform the following commands on the root folder:
174180
| node\_pools\_names | List of node pools names |
175181
| node\_pools\_versions | List of node pools versions |
176182
| region | Cluster region |
183+
| release\_channel | The release channel of this cluster |
177184
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
178185
| type | Cluster type (regional / zonal) |
179186
| zones | List of zones in which the cluster resides |

autogen/main/cluster.tf.tmpl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@ resource "google_container_cluster" "primary" {
4545
}
4646
}
4747

48-
{% if beta_cluster %}
4948
dynamic "release_channel" {
5049
for_each = local.release_channel
5150

5251
content {
5352
channel = release_channel.value.channel
5453
}
5554
}
56-
{% endif %}
5755

5856
subnetwork = "projects/${local.network_project_id}/regions/${var.region}/subnetworks/${var.subnetwork}"
5957

@@ -62,11 +60,7 @@ resource "google_container_cluster" "primary" {
6260
disabled = var.disable_default_snat
6361
}
6462
{% endif %}
65-
{% if beta_cluster %}
6663
min_master_version = var.release_channel != null ? null : local.master_version
67-
{% else %}
68-
min_master_version = local.master_version
69-
{% endif %}
7064

7165
logging_service = var.logging_service
7266
monitoring_service = var.monitoring_service
@@ -88,10 +82,10 @@ resource "google_container_cluster" "primary" {
8882

8983
default_max_pods_per_node = var.default_max_pods_per_node
9084

85+
enable_shielded_nodes = var.enable_shielded_nodes
9186
{% if beta_cluster %}
9287
enable_binary_authorization = var.enable_binary_authorization
9388
enable_intranode_visibility = var.enable_intranode_visibility
94-
enable_shielded_nodes = var.enable_shielded_nodes
9589
enable_kubernetes_alpha = var.enable_kubernetes_alpha
9690

9791
vertical_pod_autoscaling {
@@ -224,7 +218,6 @@ resource "google_container_cluster" "primary" {
224218

225219
node_config {
226220
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
227-
{% if beta_cluster %}
228221

229222
dynamic "workload_metadata_config" {
230223
for_each = local.cluster_node_metadata_config
@@ -233,7 +226,6 @@ resource "google_container_cluster" "primary" {
233226
node_metadata = workload_metadata_config.value.node_metadata
234227
}
235228
}
236-
{% endif %}
237229
}
238230
}
239231

@@ -278,7 +270,6 @@ resource "google_container_cluster" "primary" {
278270
{% endif %}
279271

280272
remove_default_node_pool = var.remove_default_node_pool
281-
{% if beta_cluster %}
282273

283274
dynamic "database_encryption" {
284275
for_each = var.database_encryption
@@ -297,6 +288,7 @@ resource "google_container_cluster" "primary" {
297288
}
298289
}
299290

291+
{% if beta_cluster %}
300292
dynamic "authenticator_groups_config" {
301293
for_each = local.cluster_authenticator_security_group
302294
content {
@@ -501,7 +493,6 @@ resource "google_container_node_pool" "pools" {
501493
count = guest_accelerator["count"]
502494
}
503495
]
504-
{% if beta_cluster %}
505496

506497
dynamic "workload_metadata_config" {
507498
for_each = local.cluster_node_metadata_config
@@ -510,7 +501,7 @@ resource "google_container_node_pool" "pools" {
510501
node_metadata = lookup(each.value, "node_metadata", workload_metadata_config.value.node_metadata)
511502
}
512503
}
513-
504+
{% if beta_cluster %}
514505
dynamic "sandbox_config" {
515506
for_each = local.cluster_sandbox_enabled
516507

autogen/main/main.tf.tmpl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ locals {
5050
node_pool_names = [for np in toset(var.node_pools) : np.name]
5151
node_pools = zipmap(local.node_pool_names, tolist(toset(var.node_pools)))
5252

53-
{% if beta_cluster %}
5453
release_channel = var.release_channel != null ? [{ channel : var.release_channel }] : []
54+
{% if beta_cluster %}
5555

5656
autoscalling_resource_limits = var.cluster_autoscaling.enabled ? [{
5757
resource_type = "cpu"
@@ -95,17 +95,16 @@ locals {
9595

9696
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
9797

98-
cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
99-
node_metadata = var.node_metadata
100-
}]
101-
10298
cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
10399
security_group = var.authenticator_security_group
104100
}]
105101

106102
cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []
107103

108104
{% endif %}
105+
cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
106+
node_metadata = var.node_metadata
107+
}]
109108

110109
cluster_output_name = google_container_cluster.primary.name
111110
cluster_output_regional_zones = google_container_cluster.primary.node_locations
@@ -167,6 +166,10 @@ locals {
167166
cluster_network_policy_enabled = ! local.cluster_output_network_policy_enabled
168167
cluster_http_load_balancing_enabled = ! local.cluster_output_http_load_balancing_enabled
169168
cluster_horizontal_pod_autoscaling_enabled = ! local.cluster_output_horizontal_pod_autoscaling_enabled
169+
workload_identity_enabled = ! (var.identity_namespace == null || var.identity_namespace == "null")
170+
cluster_workload_identity_config = ! local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
171+
identity_namespace = "${var.project_id}.svc.id.goog" }] : [{ identity_namespace = var.identity_namespace
172+
}]
170173
{% if beta_cluster %}
171174
# BETA features
172175
cluster_istio_enabled = ! local.cluster_output_istio_disabled
@@ -176,10 +179,6 @@ locals {
176179
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
177180
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
178181

179-
workload_identity_enabled = ! (var.identity_namespace == null || var.identity_namespace == "null")
180-
cluster_workload_identity_config = ! local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
181-
identity_namespace = "${var.project_id}.svc.id.goog" }] : [{ identity_namespace = var.identity_namespace
182-
}]
183182
# /BETA features
184183
{% endif %}
185184

autogen/main/outputs.tf.tmpl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ output "service_account" {
118118
description = "The service account to default running nodes as if not overridden in `node_pools`."
119119
value = local.service_account
120120
}
121+
122+
output "release_channel" {
123+
description = "The release channel of this cluster"
124+
value = var.release_channel
125+
}
126+
127+
output "identity_namespace" {
128+
description = "Workload Identity namespace"
129+
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
130+
depends_on = [
131+
google_container_cluster.primary
132+
]
133+
}
121134
{% if private_cluster %}
122135

123136
output "master_ipv4_cidr_block" {
@@ -161,17 +174,4 @@ output "vertical_pod_autoscaling_enabled" {
161174
description = "Whether veritical pod autoscaling is enabled"
162175
value = local.cluster_vertical_pod_autoscaling_enabled
163176
}
164-
165-
output "release_channel" {
166-
description = "The release channel of this cluster"
167-
value = var.release_channel
168-
}
169-
170-
output "identity_namespace" {
171-
description = "Workload Identity namespace"
172-
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
173-
depends_on = [
174-
google_container_cluster.primary
175-
]
176-
}
177177
{% endif %}

autogen/main/variables.tf.tmpl

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,6 @@ variable "config_connector" {
445445
default = false
446446
}
447447

448-
variable "database_encryption" {
449-
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
450-
type = list(object({ state = string, key_name = string }))
451-
452-
default = [{
453-
state = "DECRYPTED"
454-
key_name = ""
455-
}]
456-
}
457-
458448
variable "cloudrun" {
459449
description = "(Beta) Enable CloudRun addon"
460450
default = false
@@ -471,12 +461,6 @@ variable "enable_pod_security_policy" {
471461
default = false
472462
}
473463

474-
variable "node_metadata" {
475-
description = "Specifies how node metadata is exposed to the workload running on the node"
476-
default = "GKE_METADATA_SERVER"
477-
type = string
478-
}
479-
480464
variable "sandbox_enabled" {
481465
type = bool
482466
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
@@ -495,21 +479,38 @@ variable "enable_vertical_pod_autoscaling" {
495479
default = false
496480
}
497481

498-
variable "identity_namespace" {
499-
description = "Workload Identity namespace. (Default value of `enabled` automatically sets project based namespace `[project_id].svc.id.goog`)"
500-
type = string
501-
default = "enabled"
502-
}
503-
504482
variable "authenticator_security_group" {
505483
type = string
506484
description = "The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected]"
507485
default = null
508486
}
487+
{% endif %}
488+
489+
variable "node_metadata" {
490+
description = "Specifies how node metadata is exposed to the workload running on the node"
491+
default = "GKE_METADATA_SERVER"
492+
type = string
493+
}
494+
495+
variable "database_encryption" {
496+
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
497+
type = list(object({ state = string, key_name = string }))
498+
499+
default = [{
500+
state = "DECRYPTED"
501+
key_name = ""
502+
}]
503+
}
504+
505+
variable "identity_namespace" {
506+
description = "Workload Identity namespace. (Default value of `enabled` automatically sets project based namespace `[project_id].svc.id.goog`)"
507+
type = string
508+
default = "enabled"
509+
}
509510

510511
variable "release_channel" {
511512
type = string
512-
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
513+
description = "The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
513514
default = null
514515
}
515516

@@ -518,8 +519,6 @@ variable "enable_shielded_nodes" {
518519
description = "Enable Shielded Nodes features on all nodes in this cluster"
519520
default = true
520521
}
521-
{% endif %}
522-
523522

524523
variable "add_cluster_firewall_rules" {
525524
type = bool

0 commit comments

Comments
 (0)