From 32a8ae3bd07250144b1836cac35e79d0a6a97f11 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Fri, 20 Oct 2023 16:10:27 +0200 Subject: [PATCH] feat: add advanced datapath observability config option --- README.md | 2 ++ autogen/main/cluster.tf.tmpl | 4 ++++ autogen/main/variables.tf.tmpl | 16 ++++++++++++++++ cluster.tf | 4 ++++ .../README.md | 2 ++ .../cluster.tf | 4 ++++ .../variables.tf | 16 ++++++++++++++++ modules/beta-private-cluster/README.md | 2 ++ modules/beta-private-cluster/cluster.tf | 4 ++++ modules/beta-private-cluster/variables.tf | 16 ++++++++++++++++ .../beta-public-cluster-update-variant/README.md | 2 ++ .../cluster.tf | 4 ++++ .../variables.tf | 16 ++++++++++++++++ modules/beta-public-cluster/README.md | 2 ++ modules/beta-public-cluster/cluster.tf | 4 ++++ modules/beta-public-cluster/variables.tf | 16 ++++++++++++++++ modules/private-cluster-update-variant/README.md | 2 ++ .../private-cluster-update-variant/cluster.tf | 4 ++++ .../private-cluster-update-variant/variables.tf | 16 ++++++++++++++++ modules/private-cluster/README.md | 2 ++ modules/private-cluster/cluster.tf | 4 ++++ modules/private-cluster/variables.tf | 16 ++++++++++++++++ variables.tf | 16 ++++++++++++++++ 23 files changed, 174 insertions(+) diff --git a/README.md b/README.md index fdb677beb9..80a9cd0f50 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,9 @@ Then perform the following commands on the root folder: | 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\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are 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\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | 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 | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 4c96c90062..676111bdd2 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -123,6 +123,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/autogen/main/variables.tf.tmpl b/autogen/main/variables.tf.tmpl index 1848cf0afe..19abce6fd7 100644 --- a/autogen/main/variables.tf.tmpl +++ b/autogen/main/variables.tf.tmpl @@ -721,6 +721,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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." diff --git a/cluster.tf b/cluster.tf index 7c8b05cdaa..4beb11883c 100644 --- a/cluster.tf +++ b/cluster.tf @@ -88,6 +88,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index 9784d38d29..73d577d270 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -238,7 +238,9 @@ Then perform the following commands on the root folder: | 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 | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no | +| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are 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\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | 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 | diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index fdbecb2ac2..8316700f40 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -100,6 +100,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/modules/beta-private-cluster-update-variant/variables.tf b/modules/beta-private-cluster-update-variant/variables.tf index 6a444b2f53..2b784d90f7 100644 --- a/modules/beta-private-cluster-update-variant/variables.tf +++ b/modules/beta-private-cluster-update-variant/variables.tf @@ -681,6 +681,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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." diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index 9563237347..384a062d2b 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -216,7 +216,9 @@ Then perform the following commands on the root folder: | 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 | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no | +| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are 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\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | 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 | diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index 520b0529a8..98bf93b98d 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -100,6 +100,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/modules/beta-private-cluster/variables.tf b/modules/beta-private-cluster/variables.tf index 6a444b2f53..2b784d90f7 100644 --- a/modules/beta-private-cluster/variables.tf +++ b/modules/beta-private-cluster/variables.tf @@ -681,6 +681,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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." diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index 3b515c1f2d..8076d4d72e 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -227,7 +227,9 @@ Then perform the following commands on the root folder: | 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\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are 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\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | 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 | diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 63af038480..ac905cbf03 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -100,6 +100,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/modules/beta-public-cluster-update-variant/variables.tf b/modules/beta-public-cluster-update-variant/variables.tf index 46572f3c17..ce5f6b92d1 100644 --- a/modules/beta-public-cluster-update-variant/variables.tf +++ b/modules/beta-public-cluster-update-variant/variables.tf @@ -651,6 +651,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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." diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index 4d606346bd..06a256d799 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -205,7 +205,9 @@ Then perform the following commands on the root folder: | 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\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are 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\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | 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 | diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index a8db1c6e13..bb226b5a9a 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -100,6 +100,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/modules/beta-public-cluster/variables.tf b/modules/beta-public-cluster/variables.tf index 46572f3c17..ce5f6b92d1 100644 --- a/modules/beta-public-cluster/variables.tf +++ b/modules/beta-public-cluster/variables.tf @@ -651,6 +651,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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." diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 097fb66526..e23cb29263 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -220,7 +220,9 @@ Then perform the following commands on the root folder: | 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 | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no | +| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are 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\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | 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 | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 191c99ec50..18c5268489 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -88,6 +88,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/modules/private-cluster-update-variant/variables.tf b/modules/private-cluster-update-variant/variables.tf index f06b1e9d95..95f07a8199 100644 --- a/modules/private-cluster-update-variant/variables.tf +++ b/modules/private-cluster-update-variant/variables.tf @@ -645,6 +645,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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." diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 3ebfe4acf7..ad0804ddd5 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -198,7 +198,9 @@ Then perform the following commands on the root folder: | 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 | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no | +| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are 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\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | 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 | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index c2fa9906dc..3ea93b4fca 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -88,6 +88,10 @@ resource "google_container_cluster" "primary" { managed_prometheus { enabled = var.monitoring_enable_managed_prometheus } + advanced_datapath_observability_config { + enable_metrics = var.monitoring_enable_observability_metrics + relay_mode = var.monitoring_observability_metrics_relay_mode + } } } cluster_autoscaling { diff --git a/modules/private-cluster/variables.tf b/modules/private-cluster/variables.tf index f06b1e9d95..95f07a8199 100644 --- a/modules/private-cluster/variables.tf +++ b/modules/private-cluster/variables.tf @@ -645,6 +645,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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." diff --git a/variables.tf b/variables.tf index e5757a9b07..80e1289cfd 100644 --- a/variables.tf +++ b/variables.tf @@ -615,6 +615,22 @@ variable "monitoring_enable_managed_prometheus" { default = false } +variable "monitoring_enable_observability_metrics" { + type = bool + description = "Whether or not the advanced datapath metrics are enabled." + default = false +} + +variable "monitoring_observability_metrics_relay_mode" { + type = string + description = "Mode used to make advanced datapath metrics relay available." + default = null + validation { + condition = var.monitoring_observability_metrics_relay_mode == null ? true : contains(["DISABLED", "INTERNAL_VPC_LB", "EXTERNAL_LB"], var.monitoring_observability_metrics_relay_mode) + error_message = "The advanced datapath metrics relay value must be one of DISABLED, INTERNAL_VPC_LB, EXTERNAL_LB." + } +} + variable "monitoring_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."