Skip to content

Commit e8291f0

Browse files
feat: Add cluster_telemetry var to beta submodules (#728)
1 parent 63d7f5e commit e8291f0

File tree

19 files changed

+84
-8
lines changed

19 files changed

+84
-8
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,19 @@ resource "google_container_cluster" "primary" {
6262
{% endif %}
6363
min_master_version = var.release_channel != null ? null : local.master_version
6464

65+
{% if beta_cluster %}
66+
dynamic "cluster_telemetry" {
67+
for_each = local.cluster_telemetry_type_is_set ? [1] : []
68+
content {
69+
type = var.cluster_telemetry_type
70+
}
71+
}
72+
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
73+
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service
74+
{% else %}
6575
logging_service = var.logging_service
6676
monitoring_service = var.monitoring_service
77+
{% endif %}
6778

6879
cluster_autoscaling {
6980
enabled = var.cluster_autoscaling.enabled

autogen/main/main.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ locals {
172172
cluster_istio_enabled = ! local.cluster_output_istio_disabled
173173
cluster_cloudrun_enabled = var.cloudrun
174174
cluster_dns_cache_enabled = var.dns_cache
175+
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
175176
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
176177
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
177178
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled

autogen/main/variables.tf.tmpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,14 @@ variable "configure_ip_masq" {
301301
default = false
302302
}
303303

304+
{% if beta_cluster %}
305+
variable "cluster_telemetry_type" {
306+
type = string
307+
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
308+
default = null
309+
}
310+
311+
{% endif %}
304312
variable "logging_service" {
305313
type = string
306314
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"

modules/beta-private-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ Then perform the following commands on the root folder:
152152
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
153153
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
154154
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
155+
| cluster\_telemetry\_type | Available options include ENABLED, DISABLED, and SYSTEM\_ONLY | `string` | `null` | no |
155156
| config\_connector | (Beta) Whether ConfigConnector is enabled for this cluster. | `bool` | `false` | no |
156157
| 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. | `bool` | `false` | no |
157158
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ resource "google_container_cluster" "primary" {
5656
}
5757
min_master_version = var.release_channel != null ? null : local.master_version
5858

59-
logging_service = var.logging_service
60-
monitoring_service = var.monitoring_service
59+
dynamic "cluster_telemetry" {
60+
for_each = local.cluster_telemetry_type_is_set ? [1] : []
61+
content {
62+
type = var.cluster_telemetry_type
63+
}
64+
}
65+
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
66+
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service
6167

6268
cluster_autoscaling {
6369
enabled = var.cluster_autoscaling.enabled

modules/beta-private-cluster-update-variant/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ locals {
154154
cluster_istio_enabled = ! local.cluster_output_istio_disabled
155155
cluster_cloudrun_enabled = var.cloudrun
156156
cluster_dns_cache_enabled = var.dns_cache
157+
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
157158
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
158159
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
159160
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled

modules/beta-private-cluster-update-variant/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ variable "configure_ip_masq" {
293293
default = false
294294
}
295295

296+
variable "cluster_telemetry_type" {
297+
type = string
298+
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
299+
default = null
300+
}
301+
296302
variable "logging_service" {
297303
type = string
298304
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Then perform the following commands on the root folder:
130130
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
131131
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
132132
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
133+
| cluster\_telemetry\_type | Available options include ENABLED, DISABLED, and SYSTEM\_ONLY | `string` | `null` | no |
133134
| config\_connector | (Beta) Whether ConfigConnector is enabled for this cluster. | `bool` | `false` | no |
134135
| 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. | `bool` | `false` | no |
135136
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |

modules/beta-private-cluster/cluster.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ resource "google_container_cluster" "primary" {
5656
}
5757
min_master_version = var.release_channel != null ? null : local.master_version
5858

59-
logging_service = var.logging_service
60-
monitoring_service = var.monitoring_service
59+
dynamic "cluster_telemetry" {
60+
for_each = local.cluster_telemetry_type_is_set ? [1] : []
61+
content {
62+
type = var.cluster_telemetry_type
63+
}
64+
}
65+
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
66+
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service
6167

6268
cluster_autoscaling {
6369
enabled = var.cluster_autoscaling.enabled

modules/beta-private-cluster/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ locals {
154154
cluster_istio_enabled = ! local.cluster_output_istio_disabled
155155
cluster_cloudrun_enabled = var.cloudrun
156156
cluster_dns_cache_enabled = var.dns_cache
157+
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
157158
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
158159
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
159160
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled

0 commit comments

Comments
 (0)