Skip to content

Commit e0a2e1d

Browse files
Jordan-Williams2Jordan-Williams2
authored andcommitted
feat: expose Sysdig agent mode as configurable input variable
Add agent_mode variable to allow users to configure the operational mode of the Sysdig agent. This addresses GitHub issue #263 where users need to set the agent to 'troubleshooting' mode to access additional metrics. The agent_mode variable accepts: - 'monitor': Standard monitoring mode - 'monitor_light': Lightweight monitoring mode - 'troubleshooting': Enhanced mode with additional metrics like HTTP request metrics (sysdig_container_net_http_url_request_count, sysdig_container_net_http_url_request_time, sysdig_container_net_http_url_error_count) - null: Use the agent's default mode (default value) Changes: - Add agent_mode string variable with validation in variables.tf - Configure feature mode in agent.sysdig.settings in main.tf - Add agent_mode to fully-configurable solution - Update ibm_catalog.json with new variable entry - Auto-generate documentation via pre-commit hooks Fixes issue #263
1 parent f669c3a commit e0a2e1d

File tree

6 files changed

+29
-0
lines changed

6 files changed

+29
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ No modules.
114114
| <a name="input_agent_image_tag_digest"></a> [agent\_image\_tag\_digest](#input\_agent\_image\_tag\_digest) | The image tag or digest of agent image to use. If using digest, it must be in the format of `X.Y.Z@sha256:xxxxx`. | `string` | `"14.2.5@sha256:64b9d77bbd1bb22f97a74198144dcfea62bb5cee7629091252694e9040058035"` | no |
115115
| <a name="input_agent_limits_cpu"></a> [agent\_limits\_cpu](#input\_agent\_limits\_cpu) | Specify CPU resource limits for the agent. For more info, see https://cloud.ibm.com/docs/monitoring?topic=monitoring-resource_requirements | `string` | `"1"` | no |
116116
| <a name="input_agent_limits_memory"></a> [agent\_limits\_memory](#input\_agent\_limits\_memory) | Specify memory resource limits for the agent. For more info, see https://cloud.ibm.com/docs/monitoring?topic=monitoring-resource_requirements | `string` | `"1024Mi"` | no |
117+
| <a name="input_agent_mode"></a> [agent\_mode](#input\_agent\_mode) | The operational mode for the Sysdig agent. Valid values are 'monitor', 'monitor\_light', 'troubleshooting', or null. The 'troubleshooting' mode enables additional metrics that are useful for debugging, such as HTTP request metrics (sysdig\_container\_net\_http\_url\_request\_count, sysdig\_container\_net\_http\_url\_request\_time, sysdig\_container\_net\_http\_url\_error\_count). Set to null to use the agent's default mode. | `string` | `null` | no |
117118
| <a name="input_agent_requests_cpu"></a> [agent\_requests\_cpu](#input\_agent\_requests\_cpu) | Specify CPU resource requests for the agent. For more info, see https://cloud.ibm.com/docs/monitoring?topic=monitoring-resource_requirements | `string` | `"1"` | no |
118119
| <a name="input_agent_requests_memory"></a> [agent\_requests\_memory](#input\_agent\_requests\_memory) | Specify memory resource requests for the agent. For more info, see https://cloud.ibm.com/docs/monitoring?topic=monitoring-resource_requirements | `string` | `"1024Mi"` | no |
119120
| <a name="input_agent_tags"></a> [agent\_tags](#input\_agent\_tags) | Map of tags to associate to the agent. For example, {"environment": "production"}. NOTE: Use the `add_cluster_name` boolean variable to add the cluster name as a tag. | `map(string)` | `{}` | no |

ibm_catalog.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@
348348
"key": "enable_kspm_analyzer",
349349
"required": true
350350
},
351+
{
352+
"key": "agent_mode"
353+
},
351354
{
352355
"key": "use_private_endpoint"
353356
},

main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ resource "helm_release" "cloud_monitoring_agent" {
210210
"enabled": ${var.enable_host_scanner}
211211
"kspm_analyzer":
212212
"enabled": ${var.enable_kspm_analyzer}
213+
%{if var.agent_mode != null~}
214+
"feature":
215+
"mode": ${var.agent_mode}
216+
%{endif~}
213217
"sysdig_api_endpoint": ${local.api_host}
214218
"blacklisted_ports":
215219
%{for port in var.blacklisted_ports~}

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ module "monitoring_agent" {
6565
deployment_tag = var.deployment_tag
6666
enable_host_scanner = var.enable_host_scanner
6767
enable_kspm_analyzer = var.enable_kspm_analyzer
68+
agent_mode = var.agent_mode
6869
cluster_shield_deploy = var.cluster_shield_deploy
6970
cluster_shield_image_tag_digest = var.cluster_shield_image_tag_digest
7071
cluster_shield_image_repository = var.cluster_shield_image_repository

solutions/fully-configurable/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,16 @@ variable "enable_kspm_analyzer" {
352352
default = true
353353
}
354354

355+
variable "agent_mode" {
356+
type = string
357+
description = "The operational mode for the Sysdig agent. Valid values are 'monitor', 'monitor_light', 'troubleshooting', or null. The 'troubleshooting' mode enables additional metrics that are useful for debugging, such as HTTP request metrics (sysdig_container_net_http_url_request_count, sysdig_container_net_http_url_request_time, sysdig_container_net_http_url_error_count). Set to null to use the agent's default mode."
358+
default = null
359+
validation {
360+
condition = var.agent_mode == null ? true : contains(["monitor", "monitor_light", "troubleshooting"], var.agent_mode)
361+
error_message = "agent_mode must be one of 'monitor', 'monitor_light', 'troubleshooting', or null."
362+
}
363+
}
364+
355365
variable "cluster_shield_deploy" {
356366
type = bool
357367
description = "Deploy the Cluster Shield component to provide runtime detection and policy enforcement for Kubernetes workloads. If enabled, a Kubernetes Deployment will be deployed to your cluster using helm."

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,16 @@ variable "enable_kspm_analyzer" {
357357
default = true
358358
}
359359

360+
variable "agent_mode" {
361+
type = string
362+
description = "The operational mode for the Sysdig agent. Valid values are 'monitor', 'monitor_light', 'troubleshooting', or null. The 'troubleshooting' mode enables additional metrics that are useful for debugging, such as HTTP request metrics (sysdig_container_net_http_url_request_count, sysdig_container_net_http_url_request_time, sysdig_container_net_http_url_error_count). Set to null to use the agent's default mode."
363+
default = null
364+
validation {
365+
condition = var.agent_mode == null ? true : contains(["monitor", "monitor_light", "troubleshooting"], var.agent_mode)
366+
error_message = "agent_mode must be one of 'monitor', 'monitor_light', 'troubleshooting', or null."
367+
}
368+
}
369+
360370
variable "cluster_shield_deploy" {
361371
type = bool
362372
description = "Deploy the Cluster Shield component to provide runtime detection and policy enforcement for Kubernetes workloads. If enabled, a Kubernetes Deployment will be deployed to your cluster using helm."

0 commit comments

Comments
 (0)