Skip to content

Commit 47b5ff6

Browse files
authored
feat!: promote notification config & dns to ga (terraform-google-modules#1327)
* feat: support notification config &dns in ga * feat: support notification config &dns in ga
1 parent 7940d26 commit 47b5ff6

File tree

29 files changed

+116
-38
lines changed

29 files changed

+116
-38
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Then perform the following commands on the root folder:
146146
| description | The description of the cluster | `string` | `""` | no |
147147
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
148148
| 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 |
149+
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
149150
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
150151
| 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 |
151152
| 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 |
@@ -185,6 +186,7 @@ Then perform the following commands on the root folder:
185186
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` | <pre>{<br> "all": [],<br> "default-node-pool": []<br>}</pre> | no |
186187
| node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` | <pre>{<br> "all": [],<br> "default-node-pool": []<br>}</pre> | no |
187188
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` | <pre>[<br> "10.0.0.0/8",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
189+
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
188190
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
189191
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
190192
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,16 @@ resource "google_container_cluster" "primary" {
211211
disabled = !var.horizontal_pod_autoscaling
212212
}
213213

214+
214215
{% if autopilot_cluster != true %}
215216
network_policy_config {
216217
disabled = !var.network_policy
217218
}
218219

220+
dns_cache_config {
221+
enabled = var.dns_cache
222+
}
223+
219224
gcp_filestore_csi_driver_config {
220225
enabled = var.filestore_csi_driver
221226
}
@@ -235,10 +240,6 @@ resource "google_container_cluster" "primary" {
235240
}
236241
}
237242

238-
dns_cache_config {
239-
enabled = var.dns_cache
240-
}
241-
242243
dynamic "gce_persistent_disk_csi_driver_config" {
243244
for_each = local.cluster_gce_pd_csi_config
244245

@@ -462,14 +463,12 @@ resource "google_container_cluster" "primary" {
462463
}
463464
}
464465

465-
{% if beta_cluster %}
466466
notification_config {
467467
pubsub {
468468
enabled = var.notification_config_topic != "" ? true : false
469469
topic = var.notification_config_topic
470470
}
471471
}
472-
{% endif %}
473472
}
474473
{% if autopilot_cluster != true %}
475474
/******************************************

autogen/main/variables.tf.tmpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,18 +401,16 @@ variable "master_global_access_enabled" {
401401
}
402402
{% endif %}
403403
{% endif %}
404-
{% if beta_cluster %}
405404

406405
variable "dns_cache" {
407406
type = bool
408-
description = "(Beta) The status of the NodeLocal DNSCache addon."
407+
description = "The status of the NodeLocal DNSCache addon."
409408
{% if autopilot_cluster == true %}
410409
default = true
411410
{% else %}
412411
default = false
413412
{% endif %}
414413
}
415-
{% endif %}
416414

417415
variable "authenticator_security_group" {
418416
type = string
@@ -482,13 +480,13 @@ variable "disable_default_snat" {
482480
default = false
483481
}
484482

485-
{% if beta_cluster %}
486483
variable "notification_config_topic" {
487484
type = string
488485
description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}."
489486
default = ""
490487
}
491488

489+
{% if beta_cluster %}
492490
variable "enable_tpu" {
493491
type = bool
494492
description = "Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive!"

cluster.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,15 @@ resource "google_container_cluster" "primary" {
118118
disabled = !var.horizontal_pod_autoscaling
119119
}
120120

121+
121122
network_policy_config {
122123
disabled = !var.network_policy
123124
}
124125

126+
dns_cache_config {
127+
enabled = var.dns_cache
128+
}
129+
125130
gcp_filestore_csi_driver_config {
126131
enabled = var.filestore_csi_driver
127132
}
@@ -278,6 +283,12 @@ resource "google_container_cluster" "primary" {
278283
}
279284
}
280285

286+
notification_config {
287+
pubsub {
288+
enabled = var.notification_config_topic != "" ? true : false
289+
topic = var.notification_config_topic
290+
}
291+
}
281292
}
282293
/******************************************
283294
Create Container Cluster node pools

modules/beta-autopilot-private-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Then perform the following commands on the root folder:
8282
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | `bool` | `false` | no |
8383
| description | The description of the cluster | `string` | `""` | no |
8484
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
85-
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
85+
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
8686
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
8787
| 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 |
8888
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ resource "google_container_cluster" "primary" {
9797
disabled = !var.horizontal_pod_autoscaling
9898
}
9999

100+
100101
}
101102

102103
datapath_provider = var.datapath_provider

modules/beta-autopilot-private-cluster/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ variable "master_global_access_enabled" {
291291

292292
variable "dns_cache" {
293293
type = bool
294-
description = "(Beta) The status of the NodeLocal DNSCache addon."
294+
description = "The status of the NodeLocal DNSCache addon."
295295
default = true
296296
}
297297

modules/beta-autopilot-public-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Then perform the following commands on the root folder:
7575
| datapath\_provider | The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
7676
| description | The description of the cluster | `string` | `""` | no |
7777
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
78-
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
78+
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
7979
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
8080
| 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 |
8181
| 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 |

modules/beta-autopilot-public-cluster/cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ resource "google_container_cluster" "primary" {
9797
disabled = !var.horizontal_pod_autoscaling
9898
}
9999

100+
100101
}
101102

102103
datapath_provider = var.datapath_provider

modules/beta-autopilot-public-cluster/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ variable "skip_provisioners" {
260260

261261
variable "dns_cache" {
262262
type = bool
263-
description = "(Beta) The status of the NodeLocal DNSCache addon."
263+
description = "The status of the NodeLocal DNSCache addon."
264264
default = true
265265
}
266266

0 commit comments

Comments
 (0)