Skip to content

Commit 9b06e47

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

File tree

44 files changed

+510
-243
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

+510
-243
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: 2 additions & 4 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

@@ -88,10 +86,10 @@ resource "google_container_cluster" "primary" {
8886

8987
default_max_pods_per_node = var.default_max_pods_per_node
9088

89+
enable_shielded_nodes = var.enable_shielded_nodes
9190
{% if beta_cluster %}
9291
enable_binary_authorization = var.enable_binary_authorization
9392
enable_intranode_visibility = var.enable_intranode_visibility
94-
enable_shielded_nodes = var.enable_shielded_nodes
9593
enable_kubernetes_alpha = var.enable_kubernetes_alpha
9694

9795
vertical_pod_autoscaling {
@@ -278,7 +276,6 @@ resource "google_container_cluster" "primary" {
278276
{% endif %}
279277

280278
remove_default_node_pool = var.remove_default_node_pool
281-
{% if beta_cluster %}
282279

283280
dynamic "database_encryption" {
284281
for_each = var.database_encryption
@@ -297,6 +294,7 @@ resource "google_container_cluster" "primary" {
297294
}
298295
}
299296

297+
{% if beta_cluster %}
300298
dynamic "authenticator_groups_config" {
301299
for_each = local.cluster_authenticator_security_group
302300
content {

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

cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
dynamic "release_channel" {
45+
for_each = local.release_channel
46+
47+
content {
48+
channel = release_channel.value.channel
49+
}
50+
}
4451

4552
subnetwork = "projects/${local.network_project_id}/regions/${var.region}/subnetworks/${var.subnetwork}"
4653

@@ -52,6 +59,7 @@ resource "google_container_cluster" "primary" {
5259

5360
default_max_pods_per_node = var.default_max_pods_per_node
5461

62+
enable_shielded_nodes = var.enable_shielded_nodes
5563
dynamic "master_authorized_networks_config" {
5664
for_each = local.master_authorized_networks_config
5765
content {
@@ -136,6 +144,24 @@ resource "google_container_cluster" "primary" {
136144

137145

138146
remove_default_node_pool = var.remove_default_node_pool
147+
148+
dynamic "database_encryption" {
149+
for_each = var.database_encryption
150+
151+
content {
152+
key_name = database_encryption.value.key_name
153+
state = database_encryption.value.state
154+
}
155+
}
156+
157+
dynamic "workload_identity_config" {
158+
for_each = local.cluster_workload_identity_config
159+
160+
content {
161+
identity_namespace = workload_identity_config.value.identity_namespace
162+
}
163+
}
164+
139165
}
140166

141167
/******************************************

examples/private_zonal_with_networking/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ data "google_compute_subnetwork" "subnetwork" {
5151
}
5252

5353
module "gke" {
54-
source = "../../modules/beta-private-cluster/"
54+
source = "../../modules/private-cluster/"
5555
project_id = var.project_id
5656
name = var.cluster_name
5757
regional = false

examples/simple_zonal_with_asm/main.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,24 @@ provider "google-beta" {
2323
region = var.region
2424
}
2525

26+
provider "google" {
27+
version = "~> 3.42.0"
28+
region = var.region
29+
}
30+
2631
data "google_project" "project" {
2732
project_id = var.project_id
2833
}
2934

3035
module "gke" {
31-
source = "../../modules/beta-public-cluster/"
36+
source = "../../"
3237
project_id = var.project_id
3338
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
3439
regional = false
3540
region = var.region
3641
zones = var.zones
3742
release_channel = "REGULAR"
43+
kubernetes_version = "1.17.9"
3844
network = var.network
3945
subnetwork = var.subnetwork
4046
ip_range_pods = var.ip_range_pods

examples/workload_identity/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ provider "kubernetes" {
3232
}
3333

3434
module "gke" {
35-
source = "../../modules/beta-public-cluster/"
35+
source = "../../"
3636
project_id = var.project_id
3737
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
3838
region = var.region

examples/workload_metadata_config/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ data "google_compute_subnetwork" "subnetwork" {
3030
}
3131

3232
module "gke" {
33-
source = "../../modules/beta-private-cluster/"
33+
source = "../../modules/private-cluster/"
3434
project_id = var.project_id
3535
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
3636
regional = false

0 commit comments

Comments
 (0)