Skip to content

Commit e550780

Browse files
feat: Add support to make nodeSelector configurable in agent's daemonset (#248)
1 parent 911db79 commit e550780

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ No modules.
148148
| <a name="input_metrics_filter"></a> [metrics\_filter](#input\_metrics\_filter) | To filter custom metrics you can specify which metrics to include and exclude. For more info, see https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_inc_exc_metrics | <pre>list(object({<br/> include = optional(string)<br/> exclude = optional(string)<br/> }))</pre> | `[]` | no |
149149
| <a name="input_name"></a> [name](#input\_name) | The name to give the agent helm release. | `string` | `"sysdig-agent"` | no |
150150
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace to deploy the agent to. | `string` | `"ibm-observe"` | no |
151+
| <a name="input_node_selector"></a> [node\_selector](#input\_node\_selector) | Map of node selector labels for the DaemonSet pods. Defaults to empty map. | `map(string)` | `{}` | no |
151152
| <a name="input_priority_class_name"></a> [priority\_class\_name](#input\_priority\_class\_name) | The priority class name for the PriorityClasses assigned to the monitoring agent daemonset. If no value is passed, priority class is not used. | `string` | `null` | no |
152153
| <a name="input_priority_class_value"></a> [priority\_class\_value](#input\_priority\_class\_value) | The numerical priority assigned to PriorityClass, which determines the importance of monitoring agent daemonset pod within the cluster for both scheduling and eviction decisions. The value only applies if a value was passed for `priority_class_name` | `number` | `10` | no |
153154
| <a name="input_prometheus_config"></a> [prometheus\_config](#input\_prometheus\_config) | Prometheus configuration for the agent. If you want to enable Prometheus configuration provide the prometheus.yaml file content in `hcl` format. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-types.md#prometheus_config). | `map(any)` | `{}` | no |

ibm_catalog.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,11 @@
460460
{
461461
"key": "priority_class_value"
462462
},
463+
{
464+
"key": "node_selector",
465+
"type": "object",
466+
"default_value": {}
467+
},
463468
{
464469
"key": "tolerations",
465470
"type": "array",

main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ data "ibm_container_cluster_config" "cluster_config" {
2929

3030
locals {
3131
cluster_name = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].resource_name : data.ibm_container_cluster.cluster[0].resource_name # Not publicly documented in provider. See https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4485
32-
use_container_filter = length(var.container_filter) < 0 || var.container_filter == null ? false : true
32+
use_container_filter = var.container_filter != null && length(var.container_filter) > 0 ? true : false
3333
# construct ingestion and api endpoints based on inputs
3434
monitoring_api_endpoint = "${var.instance_region}.monitoring.cloud.ibm.com"
3535
scc_wp_api_endpoint = "${var.instance_region}.security-compliance-secure.cloud.ibm.com"
@@ -265,6 +265,9 @@ resource "helm_release" "cloud_monitoring_agent" {
265265
%{if var.max_surge != null}
266266
"maxSurge": ${var.max_surge}
267267
%{endif}
268+
%{~if length(var.node_selector) > 0}
269+
"nodeSelector": ${jsonencode(var.node_selector)}
270+
%{~endif}
268271
EOT
269272
]
270273

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ module "monitoring_agent" {
7777
max_surge = var.max_surge
7878
priority_class_name = var.priority_class_name
7979
priority_class_value = var.priority_class_value
80+
node_selector = var.node_selector
8081
}

solutions/fully-configurable/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ variable "priority_class_value" {
296296
default = 10
297297
}
298298

299+
variable "node_selector" {
300+
type = map(string)
301+
nullable = false
302+
description = "Map of node selector labels for the DaemonSet pods. Defaults to empty map."
303+
default = {}
304+
}
305+
299306
##############################################################################
300307
# Metrics related variables
301308
##############################################################################

variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ variable "priority_class_value" {
283283
default = 10
284284
}
285285

286+
variable "node_selector" {
287+
type = map(string)
288+
nullable = false
289+
description = "Map of node selector labels for the DaemonSet pods. Defaults to empty map."
290+
default = {}
291+
}
292+
286293
##############################################################################
287294
# Metrics related variables
288295
##############################################################################

0 commit comments

Comments
 (0)