Skip to content

Commit dafb16b

Browse files
committed
feat: add auto_monitoring_config in GKE managed_prometheus
1 parent 79b3cb3 commit dafb16b

File tree

31 files changed

+220
-1
lines changed

31 files changed

+220
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ Then perform the following commands on the root folder:
219219
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
220220
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
221221
| 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 |
222+
| monitoring\_auto\_monitoring\_config\_scope | Whether or not to enable GKE Auto-Monitoring. Supported values include: ALL, NONE | `string` | `"NONE"` | no |
222223
| monitoring\_enable\_managed\_prometheus | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `null` | no |
223224
| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are enabled. | `bool` | `false` | no |
224225
| monitoring\_enable\_observability\_relay | Whether or not the advanced datapath relay is enabled. | `bool` | `false` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ resource "google_container_cluster" "primary" {
125125
{% if autopilot_cluster != true %}
126126
managed_prometheus {
127127
enabled = var.monitoring_enable_managed_prometheus == null ? false : var.monitoring_enable_managed_prometheus
128+
dynamic "auto_monitoring_config" {
129+
for_each = var.monitoring_enable_managed_prometheus == true && var.monitoring_auto_monitoring_config_scope != null ? [1] : []
130+
content {
131+
scope = var.monitoring_auto_monitoring_config_scope
132+
}
133+
}
128134
}
129135
advanced_datapath_observability_config {
130136
enable_metrics = var.monitoring_enable_observability_metrics

autogen/main/variables.tf.tmpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,23 @@ variable "monitoring_enable_managed_prometheus" {
986986
default = null
987987
}
988988

989+
variable "monitoring_auto_monitoring_config_scope" {
990+
default = "NONE"
991+
description = "Whether or not to enable GKE Auto-Monitoring. Supported values include: ALL, NONE"
992+
type = string
993+
994+
validation {
995+
condition = contains(
996+
[
997+
"ALL",
998+
"NONE",
999+
],
1000+
var.monitoring_auto_monitoring_config_scope
1001+
)
1002+
error_message = "'monitoring_auto_monitoring_config_scope' value is invalid"
1003+
}
1004+
}
1005+
9891006
variable "monitoring_enable_observability_metrics" {
9901007
type = bool
9911008
description = "Whether or not the advanced datapath metrics are enabled."

cluster.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ resource "google_container_cluster" "primary" {
102102
enable_components = var.monitoring_enabled_components
103103
managed_prometheus {
104104
enabled = var.monitoring_enable_managed_prometheus == null ? false : var.monitoring_enable_managed_prometheus
105+
dynamic "auto_monitoring_config" {
106+
for_each = var.monitoring_enable_managed_prometheus == true && var.monitoring_auto_monitoring_config_scope != null ? [1] : []
107+
content {
108+
scope = var.monitoring_auto_monitoring_config_scope
109+
}
110+
}
105111
}
106112
advanced_datapath_observability_config {
107113
enable_metrics = var.monitoring_enable_observability_metrics

metadata.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ spec:
701701
- name: monitoring_enable_managed_prometheus
702702
description: Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled.
703703
varType: bool
704+
- name: monitoring_auto_monitoring_config_scope
705+
description: "Whether or not to enable GKE Auto-Monitoring. Supported values include: ALL, NONE"
706+
varType: string
707+
defaultValue: NONE
704708
- name: monitoring_enable_observability_metrics
705709
description: Whether or not the advanced datapath metrics are enabled.
706710
varType: bool

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ Then perform the following commands on the root folder:
263263
| 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 |
264264
| 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 |
265265
| master\_ipv4\_cidr\_block | (Optional) The IP range in CIDR notation to use for the hosted master network. | `string` | `null` | no |
266+
| monitoring\_auto\_monitoring\_config\_scope | Whether or not to enable GKE Auto-Monitoring. Supported values include: ALL, NONE | `string` | `"NONE"` | no |
266267
| monitoring\_enable\_managed\_prometheus | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `null` | no |
267268
| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are enabled. | `bool` | `false` | no |
268269
| monitoring\_enable\_observability\_relay | Whether or not the advanced datapath relay is enabled. | `bool` | `false` | no |

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ resource "google_container_cluster" "primary" {
108108
enable_components = var.monitoring_enabled_components
109109
managed_prometheus {
110110
enabled = var.monitoring_enable_managed_prometheus == null ? false : var.monitoring_enable_managed_prometheus
111+
dynamic "auto_monitoring_config" {
112+
for_each = var.monitoring_enable_managed_prometheus == true && var.monitoring_auto_monitoring_config_scope != null ? [1] : []
113+
content {
114+
scope = var.monitoring_auto_monitoring_config_scope
115+
}
116+
}
111117
}
112118
advanced_datapath_observability_config {
113119
enable_metrics = var.monitoring_enable_observability_metrics

modules/beta-private-cluster-update-variant/metadata.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,10 @@ spec:
694694
- name: monitoring_enable_managed_prometheus
695695
description: Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled.
696696
varType: bool
697+
- name: monitoring_auto_monitoring_config_scope
698+
description: "Whether or not to enable GKE Auto-Monitoring. Supported values include: ALL, NONE"
699+
varType: string
700+
defaultValue: NONE
697701
- name: monitoring_enable_observability_metrics
698702
description: Whether or not the advanced datapath metrics are enabled.
699703
varType: bool

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,23 @@ variable "monitoring_enable_managed_prometheus" {
930930
default = null
931931
}
932932

933+
variable "monitoring_auto_monitoring_config_scope" {
934+
default = "NONE"
935+
description = "Whether or not to enable GKE Auto-Monitoring. Supported values include: ALL, NONE"
936+
type = string
937+
938+
validation {
939+
condition = contains(
940+
[
941+
"ALL",
942+
"NONE",
943+
],
944+
var.monitoring_auto_monitoring_config_scope
945+
)
946+
error_message = "'monitoring_auto_monitoring_config_scope' value is invalid"
947+
}
948+
}
949+
933950
variable "monitoring_enable_observability_metrics" {
934951
type = bool
935952
description = "Whether or not the advanced datapath metrics are enabled."

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ Then perform the following commands on the root folder:
241241
| 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 |
242242
| 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 |
243243
| master\_ipv4\_cidr\_block | (Optional) The IP range in CIDR notation to use for the hosted master network. | `string` | `null` | no |
244+
| monitoring\_auto\_monitoring\_config\_scope | Whether or not to enable GKE Auto-Monitoring. Supported values include: ALL, NONE | `string` | `"NONE"` | no |
244245
| monitoring\_enable\_managed\_prometheus | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `null` | no |
245246
| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are enabled. | `bool` | `false` | no |
246247
| monitoring\_enable\_observability\_relay | Whether or not the advanced datapath relay is enabled. | `bool` | `false` | no |

0 commit comments

Comments
 (0)