Skip to content

Commit 9278265

Browse files
authored
feat: Added monitoring_enabled_components and logging_enabled_components variables to beta clusters (#1028)
1 parent 41a0c83 commit 9278265

File tree

29 files changed

+173
-25
lines changed

29 files changed

+173
-25
lines changed

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ SHELL := /usr/bin/env bash
2121
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.0
2222
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2323
REGISTRY_URL := gcr.io/cloud-foundation-cicd
24+
DOCKER_BIN ?= docker
2425

2526
# Enter docker container for local development
2627
.PHONY: docker_run
2728
docker_run:
28-
docker run --rm -it \
29+
$(DOCKER_BIN) run --rm -it \
2930
-e SERVICE_ACCOUNT_JSON \
3031
-v "$(CURDIR)":/workspace \
3132
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
@@ -34,7 +35,7 @@ docker_run:
3435
# Execute prepare tests within the docker container
3536
.PHONY: docker_test_prepare
3637
docker_test_prepare:
37-
docker run --rm -it \
38+
$(DOCKER_BIN) run --rm -it \
3839
-e SERVICE_ACCOUNT_JSON \
3940
-e TF_VAR_org_id \
4041
-e TF_VAR_folder_id \
@@ -46,7 +47,7 @@ docker_test_prepare:
4647
# Clean up test environment within the docker container
4748
.PHONY: docker_test_cleanup
4849
docker_test_cleanup:
49-
docker run --rm -it \
50+
$(DOCKER_BIN) run --rm -it \
5051
-e SERVICE_ACCOUNT_JSON \
5152
-e TF_VAR_org_id \
5253
-e TF_VAR_folder_id \
@@ -58,7 +59,7 @@ docker_test_cleanup:
5859
# Execute integration tests within the docker container
5960
.PHONY: docker_test_integration
6061
docker_test_integration:
61-
docker run --rm -it \
62+
$(DOCKER_BIN) run --rm -it \
6263
-e SERVICE_ACCOUNT_JSON \
6364
-v "$(CURDIR)":/workspace \
6465
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
@@ -67,7 +68,7 @@ docker_test_integration:
6768
# Execute lint tests within the docker container
6869
.PHONY: docker_test_lint
6970
docker_test_lint:
70-
docker run --rm -it \
71+
$(DOCKER_BIN) run --rm -it \
7172
-e ENABLE_PARALLEL=1 \
7273
-v "$(CURDIR)":/workspace \
7374
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
@@ -76,15 +77,15 @@ docker_test_lint:
7677
# Generate documentation
7778
.PHONY: docker_generate_docs
7879
docker_generate_docs:
79-
docker run --rm -it \
80+
$(DOCKER_BIN) run --rm -it \
8081
-v "$(CURDIR)":/workspace \
8182
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
8283
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs'
8384

8485
# Generate files from autogen
8586
.PHONY: docker_generate_modules
8687
docker_generate_modules:
87-
docker run --rm -it \
88+
$(DOCKER_BIN) run --rm -it \
8889
-v "$(CURDIR)":/workspace \
8990
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
9091
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_modules'

autogen/main/cluster.tf.tmpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,22 @@ resource "google_container_cluster" "primary" {
7878
}
7979
}
8080
logging_service = local.cluster_telemetry_type_is_set ? null : var.logging_service
81+
dynamic "logging_config" {
82+
for_each = length(var.logging_enabled_components) > 0 ? [1] : []
83+
84+
content {
85+
enable_components = var.logging_enabled_components
86+
}
87+
}
88+
8189
monitoring_service = local.cluster_telemetry_type_is_set ? null : var.monitoring_service
90+
dynamic "monitoring_config" {
91+
for_each = length(var.monitoring_enabled_components) > 0 ? [1] : []
92+
93+
content {
94+
enable_components = var.monitoring_enabled_components
95+
}
96+
}
8297
{% else %}
8398
logging_service = var.logging_service
8499
monitoring_service = var.monitoring_service

autogen/main/variables.tf.tmpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,28 @@ variable "logging_service" {
349349
default = "logging.googleapis.com/kubernetes"
350350
}
351351

352+
{% if beta_cluster %}
353+
variable "logging_enabled_components" {
354+
type = list(string)
355+
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS. Empty list is default GKE configuration."
356+
default = []
357+
}
358+
359+
{% endif %}
352360
variable "monitoring_service" {
353361
type = string
354362
description = "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"
355363
default = "monitoring.googleapis.com/kubernetes"
356364
}
357365

366+
{% if beta_cluster %}
367+
variable "monitoring_enabled_components" {
368+
type = list(string)
369+
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration."
370+
default = []
371+
}
372+
373+
{% endif %}
358374
variable "create_service_account" {
359375
type = bool
360376
description = "Defines if service account specified to run nodes should be created."

autogen/main/versions.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ terraform {
2424
required_providers {
2525
google-beta = {
2626
source = "hashicorp/google-beta"
27-
version = ">= 3.79.0, <4.0.0"
27+
version = ">= 3.87.0, <4.0.0"
2828
}
2929
kubernetes = {
3030
source = "hashicorp/kubernetes"

examples/node_pool_update_variant_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.79.0"
22+
version = "~> 3.87.0"
2323
credentials = file(var.credentials_path)
2424
region = var.region
2525
}

examples/node_pool_update_variant_public_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.79.0"
22+
version = "~> 3.87.0"
2323
credentials = file(var.credentials_path)
2424
region = var.region
2525
}

examples/regional_private_node_pool_oauth_scopes/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ provider "google" {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.79.0"
22+
version = "~> 3.87.0"
2323
}
2424

2525
data "google_client_config" "default" {}

examples/safer_cluster/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ provider "google" {
3535
}
3636

3737
provider "google-beta" {
38-
version = "~> 3.79.0"
38+
version = "~> 3.87.0"
3939
}
4040

4141
data "google_client_config" "default" {}

examples/safer_cluster_iap_bastion/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ provider "google" {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.79.0"
22+
version = "~> 3.87.0"
2323
}
2424

2525
data "google_client_config" "default" {}

examples/simple_regional_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 3.79.0"
22+
version = "~> 3.87.0"
2323
region = var.region
2424
}
2525

0 commit comments

Comments
 (0)