Skip to content

Commit

Permalink
feat: Add cluster_telemetry var to beta submodules (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaibao authored Nov 5, 2020
1 parent 63d7f5e commit e8291f0
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 8 deletions.
11 changes: 11 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,19 @@ resource "google_container_cluster" "primary" {
{% endif %}
min_master_version = var.release_channel != null ? null : local.master_version

{% if beta_cluster %}
dynamic "cluster_telemetry" {
for_each = local.cluster_telemetry_type_is_set ? [1] : []
content {
type = var.cluster_telemetry_type
}
}
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service
{% else %}
logging_service = var.logging_service
monitoring_service = var.monitoring_service
{% endif %}

cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
Expand Down
1 change: 1 addition & 0 deletions autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ locals {
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
Expand Down
8 changes: 8 additions & 0 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ variable "configure_ip_masq" {
default = false
}

{% if beta_cluster %}
variable "cluster_telemetry_type" {
type = string
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
default = null
}

{% endif %}
variable "logging_service" {
type = string
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Then perform the following commands on the root folder:
| 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 |
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
| cluster\_telemetry\_type | Available options include ENABLED, DISABLED, and SYSTEM\_ONLY | `string` | `null` | no |
| config\_connector | (Beta) Whether ConfigConnector is enabled for this cluster. | `bool` | `false` | no |
| 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 |
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
Expand Down
10 changes: 8 additions & 2 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ resource "google_container_cluster" "primary" {
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
monitoring_service = var.monitoring_service
dynamic "cluster_telemetry" {
for_each = local.cluster_telemetry_type_is_set ? [1] : []
content {
type = var.cluster_telemetry_type
}
}
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service

cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ locals {
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ variable "configure_ip_masq" {
default = false
}

variable "cluster_telemetry_type" {
type = string
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
default = null
}

variable "logging_service" {
type = string
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Then perform the following commands on the root folder:
| 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 |
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
| cluster\_telemetry\_type | Available options include ENABLED, DISABLED, and SYSTEM\_ONLY | `string` | `null` | no |
| config\_connector | (Beta) Whether ConfigConnector is enabled for this cluster. | `bool` | `false` | no |
| 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 |
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
Expand Down
10 changes: 8 additions & 2 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ resource "google_container_cluster" "primary" {
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
monitoring_service = var.monitoring_service
dynamic "cluster_telemetry" {
for_each = local.cluster_telemetry_type_is_set ? [1] : []
content {
type = var.cluster_telemetry_type
}
}
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service

cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ locals {
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ variable "configure_ip_masq" {
default = false
}

variable "cluster_telemetry_type" {
type = string
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
default = null
}

variable "logging_service" {
type = string
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/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:
| 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 |
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
| cluster\_telemetry\_type | Available options include ENABLED, DISABLED, and SYSTEM\_ONLY | `string` | `null` | no |
| config\_connector | (Beta) Whether ConfigConnector is enabled for this cluster. | `bool` | `false` | no |
| 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 |
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
Expand Down
10 changes: 8 additions & 2 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ resource "google_container_cluster" "primary" {
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
monitoring_service = var.monitoring_service
dynamic "cluster_telemetry" {
for_each = local.cluster_telemetry_type_is_set ? [1] : []
content {
type = var.cluster_telemetry_type
}
}
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service

cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ locals {
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ variable "configure_ip_masq" {
default = false
}

variable "cluster_telemetry_type" {
type = string
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
default = null
}

variable "logging_service" {
type = string
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Then perform the following commands on the root folder:
| 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 |
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
| cluster\_telemetry\_type | Available options include ENABLED, DISABLED, and SYSTEM\_ONLY | `string` | `null` | no |
| config\_connector | (Beta) Whether ConfigConnector is enabled for this cluster. | `bool` | `false` | no |
| 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 |
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
Expand Down
10 changes: 8 additions & 2 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ resource "google_container_cluster" "primary" {
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
monitoring_service = var.monitoring_service
dynamic "cluster_telemetry" {
for_each = local.cluster_telemetry_type_is_set ? [1] : []
content {
type = var.cluster_telemetry_type
}
}
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service

cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ locals {
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ variable "configure_ip_masq" {
default = false
}

variable "cluster_telemetry_type" {
type = string
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
default = null
}

variable "logging_service" {
type = string
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
Expand Down

0 comments on commit e8291f0

Please sign in to comment.