Skip to content

Commit

Permalink
feat: added container filtering for cloud monitoring agents using new…
Browse files Browse the repository at this point in the history
… variable `cloud_monitoring_container_filter` (#204)
  • Loading branch information
Aashiq-J authored Nov 5, 2024
1 parent b4b6491 commit 9f559cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion solutions/agents/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data "ibm_container_cluster_config" "cluster_config" {

module "observability_agents" {
source = "terraform-ibm-modules/observability-agents/ibm"
version = "2.0.1"
version = "2.1.0"
cluster_id = var.cluster_id
cluster_resource_group_id = var.cluster_resource_group_id
cluster_config_endpoint_type = var.cluster_config_endpoint_type
Expand All @@ -23,6 +23,7 @@ module "observability_agents" {
cloud_monitoring_access_key = var.cloud_monitoring_access_key
cloud_monitoring_secret_name = var.prefix != null ? "${var.prefix}-${var.cloud_monitoring_secret_name}" : var.cloud_monitoring_secret_name
cloud_monitoring_metrics_filter = var.cloud_monitoring_metrics_filter
cloud_monitoring_container_filter = var.cloud_monitoring_container_filter
cloud_monitoring_agent_tags = var.cloud_monitoring_agent_tags
cloud_monitoring_instance_region = var.cloud_monitoring_instance_region
cloud_monitoring_agent_tolerations = var.cloud_monitoring_agent_tolerations
Expand Down
14 changes: 10 additions & 4 deletions solutions/agents/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,16 @@ variable "cloud_monitoring_metrics_filter" {
}))
description = "To filter on custom metrics, specify the IBM Cloud Monitoring metrics to include or exclude. [Learn more](https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_inc_exc_metrics)"
default = [] # [{ type = "exclude", name = "metricA.*" }, { type = "include", name = "metricB.*" }]
validation {
condition = length(var.cloud_monitoring_metrics_filter) == 0 || can(regex("^(include|exclude)$", var.cloud_monitoring_metrics_filter[0].type))
error_message = "The specified `type` for the `cloud_monitoring_metrics_filter` is not valid. Specify either `include` or `exclude`. If the value for `type` is not specified, no metrics are included or excluded."
}
}

variable "cloud_monitoring_container_filter" {
type = list(object({
type = string
parameter = string
name = string
}))
description = "To filter custom containers, specify which containers to include or exclude from metrics collection for the cloud monitoring agent. See https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_filter_data."
default = [] # [{ type = "exclude", parameter = "kubernetes.namespace.name", name = "kube-system" }]
}

variable "cloud_monitoring_agent_tags" {
Expand Down

0 comments on commit 9f559cf

Please sign in to comment.