Skip to content

Commit 3e57e64

Browse files
authored
Merge pull request #238 from paulpalamarchuk/add_check_for_beta_feature_fields
Added support for resource usage export config
2 parents dbda452 + ff4ba33 commit 3e57e64

File tree

9 files changed

+49
-0
lines changed

9 files changed

+49
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Extending the adopted spec, each change should have a link to its corresponding
99
## [Unreleased]
1010
### Added
1111

12+
* Added support for resource usage export config [#238]
1213
* Added `sandbox_enabled` variable to use GKE Sandbox [#241]
1314
* Added `grant_registry_access` variable to grant Container Registry access to created SA [#236]
1415
* Support for Intranode Visbiility (IV) and Veritical Pod Autoscaling (VPA) beta features [#216]
@@ -172,6 +173,7 @@ Extending the adopted spec, each change should have a link to its corresponding
172173
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
173174
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0
174175

176+
[#238]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/238
175177
[#241]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/241
176178
[#250]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/250
177179
[#236]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/236

autogen/cluster.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ resource "google_container_cluster" "primary" {
6767
}
6868
}
6969

70+
dynamic "resource_usage_export_config" {
71+
for_each = var.resource_usage_export_dataset_id != "" ? [var.resource_usage_export_dataset_id] : []
72+
content {
73+
enable_network_egress_metering = true
74+
bigquery_destination {
75+
dataset_id = resource_usage_export_config.value
76+
}
77+
}
78+
}
7079
{% endif %}
7180
dynamic "master_authorized_networks_config" {
7281
for_each = var.master_authorized_networks_config

autogen/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ variable "pod_security_policy_config" {
366366
}]
367367
}
368368

369+
variable "resource_usage_export_dataset_id" {
370+
type = string
371+
description = "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."
372+
default = ""
373+
}
374+
369375
variable "node_metadata" {
370376
description = "Specifies how node metadata is exposed to the workload running on the node"
371377
default = "UNSPECIFIED"

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
191191
| region | The region to host the cluster in (required) | string | n/a | yes |
192192
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
193193
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
194+
| 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 |
194195
| 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 |
195196
| 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 |
196197
| 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/cluster.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ resource "google_container_cluster" "primary" {
6262
}
6363
}
6464

65+
dynamic "resource_usage_export_config" {
66+
for_each = var.resource_usage_export_dataset_id != "" ? [var.resource_usage_export_dataset_id] : []
67+
content {
68+
enable_network_egress_metering = true
69+
bigquery_destination {
70+
dataset_id = resource_usage_export_config.value
71+
}
72+
}
73+
}
6574
dynamic "master_authorized_networks_config" {
6675
for_each = var.master_authorized_networks_config
6776
content {

modules/beta-private-cluster/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,12 @@ variable "pod_security_policy_config" {
363363
}]
364364
}
365365

366+
variable "resource_usage_export_dataset_id" {
367+
type = string
368+
description = "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."
369+
default = ""
370+
}
371+
366372
variable "node_metadata" {
367373
description = "Specifies how node metadata is exposed to the workload running on the node"
368374
default = "UNSPECIFIED"

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
182182
| region | The region to host the cluster in (required) | string | n/a | yes |
183183
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
184184
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
185+
| 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 |
185186
| 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 |
186187
| 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 |
187188
| 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-public-cluster/cluster.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ resource "google_container_cluster" "primary" {
6262
}
6363
}
6464

65+
dynamic "resource_usage_export_config" {
66+
for_each = var.resource_usage_export_dataset_id != "" ? [var.resource_usage_export_dataset_id] : []
67+
content {
68+
enable_network_egress_metering = true
69+
bigquery_destination {
70+
dataset_id = resource_usage_export_config.value
71+
}
72+
}
73+
}
6574
dynamic "master_authorized_networks_config" {
6675
for_each = var.master_authorized_networks_config
6776
content {

modules/beta-public-cluster/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ variable "pod_security_policy_config" {
339339
}]
340340
}
341341

342+
variable "resource_usage_export_dataset_id" {
343+
type = string
344+
description = "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."
345+
default = ""
346+
}
347+
342348
variable "node_metadata" {
343349
description = "Specifies how node metadata is exposed to the workload running on the node"
344350
default = "UNSPECIFIED"

0 commit comments

Comments
 (0)