Skip to content

Commit

Permalink
feat!: promote notification config & dns to ga (#1327)
Browse files Browse the repository at this point in the history
* feat: support notification config &dns in ga

* feat: support notification config &dns in ga
  • Loading branch information
ericyz committed Aug 9, 2022
1 parent 7940d26 commit 47b5ff6
Show file tree
Hide file tree
Showing 29 changed files with 116 additions and 38 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Then perform the following commands on the root folder:
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| 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 |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| 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 |
| 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 |
Expand Down Expand Up @@ -185,6 +186,7 @@ Then perform the following commands on the root folder:
| 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 |
| 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 |
| 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 |
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
Expand Down
11 changes: 5 additions & 6 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,16 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


{% if autopilot_cluster != true %}
network_policy_config {
disabled = !var.network_policy
}

dns_cache_config {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}
Expand All @@ -235,10 +240,6 @@ resource "google_container_cluster" "primary" {
}
}

dns_cache_config {
enabled = var.dns_cache
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down Expand Up @@ -462,14 +463,12 @@ resource "google_container_cluster" "primary" {
}
}

{% if beta_cluster %}
notification_config {
pubsub {
enabled = var.notification_config_topic != "" ? true : false
topic = var.notification_config_topic
}
}
{% endif %}
}
{% if autopilot_cluster != true %}
/******************************************
Expand Down
6 changes: 2 additions & 4 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,16 @@ variable "master_global_access_enabled" {
}
{% endif %}
{% endif %}
{% if beta_cluster %}

variable "dns_cache" {
type = bool
description = "(Beta) The status of the NodeLocal DNSCache addon."
description = "The status of the NodeLocal DNSCache addon."
{% if autopilot_cluster == true %}
default = true
{% else %}
default = false
{% endif %}
}
{% endif %}

variable "authenticator_security_group" {
type = string
Expand Down Expand Up @@ -482,13 +480,13 @@ variable "disable_default_snat" {
default = false
}

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

{% if beta_cluster %}
variable "enable_tpu" {
type = bool
description = "Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive!"
Expand Down
11 changes: 11 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,15 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


network_policy_config {
disabled = !var.network_policy
}

dns_cache_config {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}
Expand Down Expand Up @@ -278,6 +283,12 @@ resource "google_container_cluster" "primary" {
}
}

notification_config {
pubsub {
enabled = var.notification_config_topic != "" ? true : false
topic = var.notification_config_topic
}
}
}
/******************************************
Create Container Cluster node pools
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Then perform the following commands on the root folder:
| 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 |
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| 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 |
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


}

datapath_provider = var.datapath_provider
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ variable "master_global_access_enabled" {

variable "dns_cache" {
type = bool
description = "(Beta) The status of the NodeLocal DNSCache addon."
description = "The status of the NodeLocal DNSCache addon."
default = true
}

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Then perform the following commands on the root folder:
| 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 |
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `true` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| 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 |
| 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 |
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


}

datapath_provider = var.datapath_provider
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ variable "skip_provisioners" {

variable "dns_cache" {
type = bool
description = "(Beta) The status of the NodeLocal DNSCache addon."
description = "The status of the NodeLocal DNSCache addon."
default = true
}

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Then perform the following commands on the root folder:
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| 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 |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| enable\_identity\_service | Enable the Identity Service component, which allows customers to use external identity providers with the K8S API. | `bool` | `false` | no |
Expand Down
9 changes: 5 additions & 4 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


network_policy_config {
disabled = !var.network_policy
}

dns_cache_config {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}
Expand All @@ -195,10 +200,6 @@ resource "google_container_cluster" "primary" {
}
}

dns_cache_config {
enabled = var.dns_cache
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ variable "master_global_access_enabled" {

variable "dns_cache" {
type = bool
description = "(Beta) The status of the NodeLocal DNSCache addon."
description = "The status of the NodeLocal DNSCache addon."
default = false
}

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Then perform the following commands on the root folder:
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| 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 |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| enable\_identity\_service | Enable the Identity Service component, which allows customers to use external identity providers with the K8S API. | `bool` | `false` | no |
Expand Down
9 changes: 5 additions & 4 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


network_policy_config {
disabled = !var.network_policy
}

dns_cache_config {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}
Expand All @@ -195,10 +200,6 @@ resource "google_container_cluster" "primary" {
}
}

dns_cache_config {
enabled = var.dns_cache
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ variable "master_global_access_enabled" {

variable "dns_cache" {
type = bool
description = "(Beta) The status of the NodeLocal DNSCache addon."
description = "The status of the NodeLocal DNSCache addon."
default = false
}

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Then perform the following commands on the root folder:
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| 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 |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| enable\_identity\_service | Enable the Identity Service component, which allows customers to use external identity providers with the K8S API. | `bool` | `false` | no |
Expand Down
9 changes: 5 additions & 4 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


network_policy_config {
disabled = !var.network_policy
}

dns_cache_config {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}
Expand All @@ -195,10 +200,6 @@ resource "google_container_cluster" "primary" {
}
}

dns_cache_config {
enabled = var.dns_cache
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ variable "skip_provisioners" {

variable "dns_cache" {
type = bool
description = "(Beta) The status of the NodeLocal DNSCache addon."
description = "The status of the NodeLocal DNSCache addon."
default = false
}

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Then perform the following commands on the root folder:
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| 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 |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| enable\_identity\_service | Enable the Identity Service component, which allows customers to use external identity providers with the K8S API. | `bool` | `false` | no |
Expand Down
9 changes: 5 additions & 4 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


network_policy_config {
disabled = !var.network_policy
}

dns_cache_config {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}
Expand All @@ -195,10 +200,6 @@ resource "google_container_cluster" "primary" {
}
}

dns_cache_config {
enabled = var.dns_cache
}

dynamic "gce_persistent_disk_csi_driver_config" {
for_each = local.cluster_gce_pd_csi_config

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ variable "skip_provisioners" {

variable "dns_cache" {
type = bool
description = "(Beta) The status of the NodeLocal DNSCache addon."
description = "The status of the NodeLocal DNSCache addon."
default = false
}

Expand Down
2 changes: 2 additions & 0 deletions modules/private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ Then perform the following commands on the root folder:
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| 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 |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| 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 |
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
Expand Down Expand Up @@ -217,6 +218,7 @@ Then perform the following commands on the root folder:
| 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 |
| 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 |
| 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 |
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
Expand Down
11 changes: 11 additions & 0 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,15 @@ resource "google_container_cluster" "primary" {
disabled = !var.horizontal_pod_autoscaling
}


network_policy_config {
disabled = !var.network_policy
}

dns_cache_config {
enabled = var.dns_cache
}

gcp_filestore_csi_driver_config {
enabled = var.filestore_csi_driver
}
Expand Down Expand Up @@ -291,6 +296,12 @@ resource "google_container_cluster" "primary" {
}
}

notification_config {
pubsub {
enabled = var.notification_config_topic != "" ? true : false
topic = var.notification_config_topic
}
}
}
/******************************************
Create Container Cluster node pools
Expand Down
Loading

0 comments on commit 47b5ff6

Please sign in to comment.