Skip to content

Commit 923b656

Browse files
authored
fix: fix bug that would occur on rollout status script when using different value for agent name (#274)
1 parent ed52f44 commit 923b656

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ No modules.
132132
|------|-------------|------|---------|:--------:|
133133
| <a name="input_cloud_monitoring_access_key"></a> [cloud\_monitoring\_access\_key](#input\_cloud\_monitoring\_access\_key) | Access key used by the IBM Cloud Monitoring agent to communicate with the instance | `string` | `null` | no |
134134
| <a name="input_cloud_monitoring_add_cluster_name"></a> [cloud\_monitoring\_add\_cluster\_name](#input\_cloud\_monitoring\_add\_cluster\_name) | If true, configure the cloud monitoring agent to attach a tag containing the cluster name to all metric data. | `bool` | `true` | no |
135-
| <a name="input_cloud_monitoring_agent_name"></a> [cloud\_monitoring\_agent\_name](#input\_cloud\_monitoring\_agent\_name) | Cloud Monitoring agent helm release name. | `string` | `"sysdig-agent"` | no |
135+
| <a name="input_cloud_monitoring_agent_name"></a> [cloud\_monitoring\_agent\_name](#input\_cloud\_monitoring\_agent\_name) | Cloud Monitoring agent name. Used for naming all kubernetes and helm resources on the cluster. | `string` | `"sysdig-agent"` | no |
136136
| <a name="input_cloud_monitoring_agent_namespace"></a> [cloud\_monitoring\_agent\_namespace](#input\_cloud\_monitoring\_agent\_namespace) | Namespace where to deploy the Cloud Monitoring agent. Default value is 'ibm-observe' | `string` | `"ibm-observe"` | no |
137137
| <a name="input_cloud_monitoring_agent_tags"></a> [cloud\_monitoring\_agent\_tags](#input\_cloud\_monitoring\_agent\_tags) | List of tags to associate to all matrics that the agent collects. NOTE: Use the 'cloud\_monitoring\_add\_cluster\_name' variable to add the cluster name as a tag. | `list(string)` | `[]` | no |
138138
| <a name="input_cloud_monitoring_agent_tolerations"></a> [cloud\_monitoring\_agent\_tolerations](#input\_cloud\_monitoring\_agent\_tolerations) | List of tolerations to apply to Cloud Monitoring agent. | <pre>list(object({<br> key = optional(string)<br> operator = optional(string)<br> value = optional(string)<br> effect = optional(string)<br> tolerationSeconds = optional(number)<br> }))</pre> | <pre>[<br> {<br> "operator": "Exists"<br> },<br> {<br> "effect": "NoSchedule",<br> "key": "node-role.kubernetes.io/master",<br> "operator": "Exists"<br> }<br>]</pre> | no |
@@ -148,7 +148,7 @@ No modules.
148148
| <a name="input_log_analysis_add_cluster_name"></a> [log\_analysis\_add\_cluster\_name](#input\_log\_analysis\_add\_cluster\_name) | If true, configure the log analysis agent to attach a tag containing the cluster name to all log messages. | `bool` | `true` | no |
149149
| <a name="input_log_analysis_agent_custom_line_exclusion"></a> [log\_analysis\_agent\_custom\_line\_exclusion](#input\_log\_analysis\_agent\_custom\_line\_exclusion) | Log Analysis agent custom configuration for line exclusion setting LOGDNA\_K8S\_METADATA\_LINE\_EXCLUSION. See https://github.com/logdna/logdna-agent-v2/blob/master/docs/KUBERNETES.md#configuration-for-kubernetes-metadata-filtering for more info. | `string` | `null` | no |
150150
| <a name="input_log_analysis_agent_custom_line_inclusion"></a> [log\_analysis\_agent\_custom\_line\_inclusion](#input\_log\_analysis\_agent\_custom\_line\_inclusion) | Log Analysis agent custom configuration for line inclusion setting LOGDNA\_K8S\_METADATA\_LINE\_INCLUSION. See https://github.com/logdna/logdna-agent-v2/blob/master/docs/KUBERNETES.md#configuration-for-kubernetes-metadata-filtering for more info. | `string` | `null` | no |
151-
| <a name="input_log_analysis_agent_name"></a> [log\_analysis\_agent\_name](#input\_log\_analysis\_agent\_name) | Log Analysis agent helm release name. | `string` | `"logdna-agent"` | no |
151+
| <a name="input_log_analysis_agent_name"></a> [log\_analysis\_agent\_name](#input\_log\_analysis\_agent\_name) | Log Analysis agent name. Used for naming all kubernetes and helm resources on the cluster. | `string` | `"logdna-agent"` | no |
152152
| <a name="input_log_analysis_agent_namespace"></a> [log\_analysis\_agent\_namespace](#input\_log\_analysis\_agent\_namespace) | Namespace where to deploy the Log Analysis agent. Default value is 'ibm-observe' | `string` | `"ibm-observe"` | no |
153153
| <a name="input_log_analysis_agent_tags"></a> [log\_analysis\_agent\_tags](#input\_log\_analysis\_agent\_tags) | List of tags to associate to all log records that the agent collects so that you can identify the agent's data quicker in the logging UI. NOTE: Use the 'log\_analysis\_add\_cluster\_name' variable to add the cluster name as a tag. | `list(string)` | `[]` | no |
154154
| <a name="input_log_analysis_agent_tolerations"></a> [log\_analysis\_agent\_tolerations](#input\_log\_analysis\_agent\_tolerations) | List of tolerations to apply to Log Analysis agent. | <pre>list(object({<br> key = optional(string)<br> operator = optional(string)<br> value = optional(string)<br> effect = optional(string)<br> tolerationSeconds = optional(number)<br> }))</pre> | <pre>[<br> {<br> "operator": "Exists"<br> }<br>]</pre> | no |

main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ locals {
2424
log_analysis_agent_tags = var.log_analysis_add_cluster_name ? concat([local.cluster_name], var.log_analysis_agent_tags) : var.log_analysis_agent_tags
2525
log_analysis_host = var.log_analysis_endpoint_type == "private" ? "logs.private.${var.log_analysis_instance_region}.logging.cloud.ibm.com" : "logs.${var.log_analysis_instance_region}.logging.cloud.ibm.com"
2626
# The directory in which the logdna agent will store its state database.
27-
# Note that the agent must have write access to the directory and be a persistent volume.
27+
# Note that the agent must have write access to the directory (handlded by the initContainer) and be a persistent volume.
2828
log_analysis_agent_db_path = "/var/lib/logdna"
2929
cloud_monitoring_chart_location = "${path.module}/chart/sysdig-agent"
3030
cloud_monitoring_agent_registry = "icr.io/ext/sysdig/agent"
@@ -55,6 +55,11 @@ resource "helm_release" "log_analysis_agent" {
5555
recreate_pods = true
5656
force_update = true
5757

58+
set {
59+
name = "metadata.name"
60+
type = "string"
61+
value = var.log_analysis_agent_name
62+
}
5863
set {
5964
name = "image.version"
6065
type = "string"
@@ -139,6 +144,11 @@ resource "helm_release" "cloud_monitoring_agent" {
139144
force_update = true
140145
reset_values = true
141146

147+
set {
148+
name = "metadata.name"
149+
type = "string"
150+
value = var.cloud_monitoring_agent_name
151+
}
142152
set {
143153
name = "image.version"
144154
type = "string"

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ variable "log_analysis_agent_custom_line_exclusion" {
9797
}
9898

9999
variable "log_analysis_agent_name" {
100-
description = "Log Analysis agent helm release name."
100+
description = "Log Analysis agent name. Used for naming all kubernetes and helm resources on the cluster."
101101
type = string
102102
default = "logdna-agent"
103103
nullable = false
@@ -199,7 +199,7 @@ variable "cloud_monitoring_add_cluster_name" {
199199
}
200200

201201
variable "cloud_monitoring_agent_name" {
202-
description = "Cloud Monitoring agent helm release name."
202+
description = "Cloud Monitoring agent name. Used for naming all kubernetes and helm resources on the cluster."
203203
type = string
204204
default = "sysdig-agent"
205205
}

0 commit comments

Comments
 (0)