Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Promote managed_prometheus to GA #1505

Merged
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,15 @@ Then perform the following commands on the root folder:
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | `string` | n/a | yes |
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |
| monitoring\_enable\_managed\_prometheus | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no |
| monitoring\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration. | `list(string)` | `[]` | no |
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | `string` | `"monitoring.googleapis.com/kubernetes"` | no |
| name | The name of the cluster (required) | `string` | n/a | yes |
| network | The VPC network to host the cluster in (required) | `string` | n/a | yes |
Expand Down
30 changes: 12 additions & 18 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,31 @@ resource "google_container_cluster" "primary" {
type = var.cluster_telemetry_type
}
}
{% endif %}
{% if autopilot_cluster != true %}
# only one of logging/monitoring_service or logging/monitoring_config can be specified
logging_service = local.cluster_telemetry_type_is_set || local.logmon_config_is_set ? null : var.logging_service
{% if beta_cluster %}
ericyz marked this conversation as resolved.
Show resolved Hide resolved
logging_service = local.cluster_telemetry_type_is_set || local.logmon_config_is_set ? null : var.logging_service
{% else %}
logging_service = local.logmon_config_is_set ? null : var.logging_service
{% endif %}
dynamic "logging_config" {
for_each = length(var.logging_enabled_components) > 0 ? [1] : []

content {
enable_components = var.logging_enabled_components
}
}
{% if beta_cluster %}
monitoring_service = local.cluster_telemetry_type_is_set || local.logmon_config_is_set ? null : var.monitoring_service
{% else %}
monitoring_service = local.logmon_config_is_set ? null : var.monitoring_service
{% endif %}
dynamic "monitoring_config" {
for_each = length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus ? [1] : []

content {
enable_components = length(var.monitoring_enabled_components) > 0 ? var.monitoring_enabled_components : null
enable_components = length(var.monitoring_enabled_components) > 0 ? var.monitoring_enabled_components : []

dynamic "managed_prometheus" {
for_each = var.monitoring_enable_managed_prometheus ? [1] : []
Expand All @@ -108,22 +118,6 @@ resource "google_container_cluster" "primary" {
}
}
}
{% else %}
logging_service = var.logging_service
monitoring_service = var.monitoring_service
{% if beta_cluster %}
dynamic "monitoring_config" {
for_each = var.monitoring_enable_managed_prometheus ? [1] : []

content {
managed_prometheus {
enabled = var.monitoring_enable_managed_prometheus
}
}
}
{% endif %}
{% endif %}
{% if autopilot_cluster != true %}
cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
dynamic "auto_provisioning_defaults" {
Expand Down
7 changes: 5 additions & 2 deletions autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ locals {
] : []
cluster_cloudrun_enabled = var.cloudrun
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus
{% endif %}

{% if autopilot_cluster != true %}
ericyz marked this conversation as resolved.
Show resolved Hide resolved
logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus
{% endif %}

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]
Expand Down Expand Up @@ -220,10 +223,10 @@ locals {
# BETA features
cluster_istio_enabled = ! local.cluster_output_istio_disabled
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
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
ericyz marked this conversation as resolved.
Show resolved Hide resolved

# /BETA features
{% endif %}
Expand Down
27 changes: 15 additions & 12 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ variable "cluster_telemetry_type" {
description = "Available options include ENABLED, DISABLED, and SYSTEM_ONLY"
default = null
}

{% endif %}

ericyz marked this conversation as resolved.
Show resolved Hide resolved
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 Expand Up @@ -645,33 +645,36 @@ variable "timeouts" {
error_message = "Only create, update, delete timeouts can be specified."
}
}
{% if beta_cluster %}
{% if autopilot_cluster != true %}

variable "enable_kubernetes_alpha" {
{% if autopilot_cluster != true %}
variable "monitoring_enable_managed_prometheus" {
ericyz marked this conversation as resolved.
Show resolved Hide resolved
type = bool
description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days."
description = "Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled."
default = false
}

variable "logging_enabled_components" {
variable "monitoring_enabled_components" {
type = list(string)
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS. Empty list is default GKE configuration."
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration."
default = []
}

variable "monitoring_enabled_components" {
variable "logging_enabled_components" {
type = list(string)
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration."
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS. Empty list is default GKE configuration."
default = []
}
{% endif %}
{% endif %}

variable "monitoring_enable_managed_prometheus" {
{% if beta_cluster %}
{% if autopilot_cluster != true %}

variable "enable_kubernetes_alpha" {
ericyz marked this conversation as resolved.
Show resolved Hide resolved
type = bool
description = "(Beta) Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled."
description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days."
default = false
}
{% endif %}
{% if autopilot_cluster != true %}

variable "istio" {
Expand Down
4 changes: 2 additions & 2 deletions autogen/main/versions.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.45.0, < 5.0"
version = ">= 4.46.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand All @@ -38,7 +38,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 4.45.0, < 5.0"
version = ">= 4.46.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
27 changes: 25 additions & 2 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,31 @@ resource "google_container_cluster" "primary" {

min_master_version = var.release_channel == null || var.release_channel == "UNSPECIFIED" ? local.master_version : null

logging_service = var.logging_service
monitoring_service = var.monitoring_service
# only one of logging/monitoring_service or logging/monitoring_config can be specified
logging_service = local.logmon_config_is_set ? null : var.logging_service
dynamic "logging_config" {
for_each = length(var.logging_enabled_components) > 0 ? [1] : []

content {
enable_components = var.logging_enabled_components
}
}
monitoring_service = local.logmon_config_is_set ? null : var.monitoring_service
dynamic "monitoring_config" {
for_each = length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus ? [1] : []

content {
enable_components = length(var.monitoring_enabled_components) > 0 ? var.monitoring_enabled_components : []

dynamic "managed_prometheus" {
for_each = var.monitoring_enable_managed_prometheus ? [1] : []

content {
enabled = var.monitoring_enable_managed_prometheus
}
}
}
}
cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
dynamic "auto_provisioning_defaults" {
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ locals {
}]
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]

logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]
Expand Down
1 change: 0 additions & 1 deletion modules/beta-autopilot-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Then perform the following commands on the root folder:
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |
| master\_global\_access\_enabled | Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint. | `bool` | `true` | no |
| master\_ipv4\_cidr\_block | (Beta) The IP range in CIDR notation to use for the hosted master network | `string` | `"10.0.0.0/28"` | no |
| monitoring\_enable\_managed\_prometheus | (Beta) Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no |
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | `string` | `"monitoring.googleapis.com/kubernetes"` | no |
| name | The name of the cluster (required) | `string` | n/a | yes |
| network | The VPC network to host the cluster in (required) | `string` | n/a | yes |
Expand Down
11 changes: 0 additions & 11 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@ resource "google_container_cluster" "primary" {

min_master_version = var.release_channel == null || var.release_channel == "UNSPECIFIED" ? local.master_version : null

logging_service = var.logging_service
monitoring_service = var.monitoring_service
dynamic "monitoring_config" {
for_each = var.monitoring_enable_managed_prometheus ? [1] : []

content {
managed_prometheus {
enabled = var.monitoring_enable_managed_prometheus
}
}
}
cluster_autoscaling {
dynamic "auto_provisioning_defaults" {
for_each = var.create_service_account ? [1] : []
Expand Down
3 changes: 2 additions & 1 deletion modules/beta-autopilot-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ locals {
pod_all_ip_ranges = var.add_cluster_firewall_rules ? [local.cluster_alias_ranges_cidr[var.ip_range_pods]] : []



cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]
Expand Down Expand Up @@ -126,10 +127,10 @@ locals {
# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
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
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null

# /BETA features

Expand Down
6 changes: 1 addition & 5 deletions modules/beta-autopilot-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,4 @@ variable "timeouts" {
}
}

variable "monitoring_enable_managed_prometheus" {
type = bool
description = "(Beta) Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled."
default = false
}

2 changes: 1 addition & 1 deletion modules/beta-autopilot-private-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.45.0, < 5.0"
version = ">= 4.46.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
1 change: 0 additions & 1 deletion modules/beta-autopilot-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ Then perform the following commands on the root folder:
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |
| monitoring\_enable\_managed\_prometheus | (Beta) Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no |
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | `string` | `"monitoring.googleapis.com/kubernetes"` | no |
| name | The name of the cluster (required) | `string` | n/a | yes |
| network | The VPC network to host the cluster in (required) | `string` | n/a | yes |
Expand Down
11 changes: 0 additions & 11 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@ resource "google_container_cluster" "primary" {

min_master_version = var.release_channel == null || var.release_channel == "UNSPECIFIED" ? local.master_version : null

logging_service = var.logging_service
monitoring_service = var.monitoring_service
dynamic "monitoring_config" {
for_each = var.monitoring_enable_managed_prometheus ? [1] : []

content {
managed_prometheus {
enabled = var.monitoring_enable_managed_prometheus
}
}
}
cluster_autoscaling {
dynamic "auto_provisioning_defaults" {
for_each = var.create_service_account ? [1] : []
Expand Down
3 changes: 2 additions & 1 deletion modules/beta-autopilot-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ locals {
pod_all_ip_ranges = var.add_cluster_firewall_rules ? [local.cluster_alias_ranges_cidr[var.ip_range_pods]] : []



cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]
Expand Down Expand Up @@ -125,10 +126,10 @@ locals {
# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
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
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null

# /BETA features

Expand Down
6 changes: 1 addition & 5 deletions modules/beta-autopilot-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,4 @@ variable "timeouts" {
}
}

variable "monitoring_enable_managed_prometheus" {
type = bool
description = "(Beta) Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled."
default = false
}

2 changes: 1 addition & 1 deletion modules/beta-autopilot-public-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.45.0, < 5.0"
version = ">= 4.46.0, < 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
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 @@ -226,7 +226,7 @@ Then perform the following commands on the root folder:
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |
| master\_global\_access\_enabled | Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint. | `bool` | `true` | no |
| master\_ipv4\_cidr\_block | (Beta) The IP range in CIDR notation to use for the hosted master network | `string` | `"10.0.0.0/28"` | no |
| monitoring\_enable\_managed\_prometheus | (Beta) Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no |
| monitoring\_enable\_managed\_prometheus | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no |
ericyz marked this conversation as resolved.
Show resolved Hide resolved
| monitoring\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration. | `list(string)` | `[]` | no |
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | `string` | `"monitoring.googleapis.com/kubernetes"` | no |
| name | The name of the cluster (required) | `string` | n/a | yes |
Expand Down
Loading