From d5657633c546cb8d01249882ca457df26146762f Mon Sep 17 00:00:00 2001 From: Laura Seidler Date: Tue, 28 Jun 2022 11:32:57 +0200 Subject: [PATCH] Allow enabling managed Prometheus for safer cluster variants --- autogen/safer-cluster/main.tf.tmpl | 2 ++ autogen/safer-cluster/variables.tf.tmpl | 6 ++++++ modules/safer-cluster-update-variant/README.md | 1 + modules/safer-cluster-update-variant/main.tf | 2 ++ modules/safer-cluster-update-variant/variables.tf | 6 ++++++ modules/safer-cluster/README.md | 1 + modules/safer-cluster/main.tf | 2 ++ modules/safer-cluster/variables.tf | 6 ++++++ 8 files changed, 26 insertions(+) diff --git a/autogen/safer-cluster/main.tf.tmpl b/autogen/safer-cluster/main.tf.tmpl index ac8486a81c..0893b0c0ee 100644 --- a/autogen/safer-cluster/main.tf.tmpl +++ b/autogen/safer-cluster/main.tf.tmpl @@ -100,6 +100,8 @@ module "gke" { logging_service = var.logging_service monitoring_service = var.monitoring_service + monitoring_enable_managed_prometheus = var.monitoring_enable_managed_prometheus + // We never use the default service account for the cluster. The default // project/editor permissions can create problems if nodes were to be ever // compromised. diff --git a/autogen/safer-cluster/variables.tf.tmpl b/autogen/safer-cluster/variables.tf.tmpl index 2a7a84db85..60e20e24b2 100644 --- a/autogen/safer-cluster/variables.tf.tmpl +++ b/autogen/safer-cluster/variables.tf.tmpl @@ -226,6 +226,12 @@ variable "monitoring_service" { default = "monitoring.googleapis.com/kubernetes" } +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 +} + variable "grant_registry_access" { type = bool description = "Grants created cluster-specific service account storage.objectViewer role." diff --git a/modules/safer-cluster-update-variant/README.md b/modules/safer-cluster-update-variant/README.md index 4ae74f0d60..fb247e7dd4 100644 --- a/modules/safer-cluster-update-variant/README.md +++ b/modules/safer-cluster-update-variant/README.md @@ -240,6 +240,7 @@ For simplicity, we suggest using `roles/container.admin` and | maintenance\_start\_time | Time window specified for daily 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 | | master\_ipv4\_cidr\_block | 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 | `string` | n/a | yes | | network | The VPC network to host the cluster in | `string` | n/a | yes | diff --git a/modules/safer-cluster-update-variant/main.tf b/modules/safer-cluster-update-variant/main.tf index c13c9ce14d..856a116f2e 100644 --- a/modules/safer-cluster-update-variant/main.tf +++ b/modules/safer-cluster-update-variant/main.tf @@ -96,6 +96,8 @@ module "gke" { logging_service = var.logging_service monitoring_service = var.monitoring_service + monitoring_enable_managed_prometheus = var.monitoring_enable_managed_prometheus + // We never use the default service account for the cluster. The default // project/editor permissions can create problems if nodes were to be ever // compromised. diff --git a/modules/safer-cluster-update-variant/variables.tf b/modules/safer-cluster-update-variant/variables.tf index 98a113b0a0..49fe3afbde 100644 --- a/modules/safer-cluster-update-variant/variables.tf +++ b/modules/safer-cluster-update-variant/variables.tf @@ -226,6 +226,12 @@ variable "monitoring_service" { default = "monitoring.googleapis.com/kubernetes" } +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 +} + variable "grant_registry_access" { type = bool description = "Grants created cluster-specific service account storage.objectViewer role." diff --git a/modules/safer-cluster/README.md b/modules/safer-cluster/README.md index 4ae74f0d60..fb247e7dd4 100644 --- a/modules/safer-cluster/README.md +++ b/modules/safer-cluster/README.md @@ -240,6 +240,7 @@ For simplicity, we suggest using `roles/container.admin` and | maintenance\_start\_time | Time window specified for daily 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 | | master\_ipv4\_cidr\_block | 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 | `string` | n/a | yes | | network | The VPC network to host the cluster in | `string` | n/a | yes | diff --git a/modules/safer-cluster/main.tf b/modules/safer-cluster/main.tf index 2545daa2e0..960a376ba3 100644 --- a/modules/safer-cluster/main.tf +++ b/modules/safer-cluster/main.tf @@ -96,6 +96,8 @@ module "gke" { logging_service = var.logging_service monitoring_service = var.monitoring_service + monitoring_enable_managed_prometheus = var.monitoring_enable_managed_prometheus + // We never use the default service account for the cluster. The default // project/editor permissions can create problems if nodes were to be ever // compromised. diff --git a/modules/safer-cluster/variables.tf b/modules/safer-cluster/variables.tf index 98a113b0a0..49fe3afbde 100644 --- a/modules/safer-cluster/variables.tf +++ b/modules/safer-cluster/variables.tf @@ -226,6 +226,12 @@ variable "monitoring_service" { default = "monitoring.googleapis.com/kubernetes" } +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 +} + variable "grant_registry_access" { type = bool description = "Grants created cluster-specific service account storage.objectViewer role."