Skip to content

Commit 66382e3

Browse files
feat: add support to set the maximum number of pods that can be unavailable during a DaemonSet rolling update using new input max_unavailable. Accepts absolute number or percentage (e.g., '1' or '10%'). (#158)
1 parent 38c0187 commit 66382e3

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ No modules.
140140
| <a name="input_logs_agent_system_logs"></a> [logs\_agent\_system\_logs](#input\_logs\_agent\_system\_logs) | The list of additional log sources. By default, the Logs agent collects logs from a single source at `/var/log/containers/*.log`. | `list(string)` | `[]` | no |
141141
| <a name="input_logs_agent_tolerations"></a> [logs\_agent\_tolerations](#input\_logs\_agent\_tolerations) | List of tolerations to apply to Logs agent. The default value means a pod will run on every node. | <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 |
142142
| <a name="input_logs_agent_trusted_profile_id"></a> [logs\_agent\_trusted\_profile\_id](#input\_logs\_agent\_trusted\_profile\_id) | The IBM Cloud trusted profile ID. Used only when `logs_agent_iam_mode` is set to `TrustedProfile`. The trusted profile must have an IBM Cloud Logs `Sender` role. | `string` | `null` | no |
143+
| <a name="input_max_unavailable"></a> [max\_unavailable](#input\_max\_unavailable) | The maximum number of pods that can be unavailable during a DaemonSet rolling update. Accepts absolute number or percentage (e.g., '1' or '10%'). | `string` | `"1"` | no |
143144
| <a name="input_wait_till"></a> [wait\_till](#input\_wait\_till) | To avoid long wait times when you run your Terraform code, you can specify the stage when you want Terraform to mark the cluster resource creation as completed. Depending on what stage you choose, the cluster creation might not be fully completed and continues to run in the background. However, your Terraform code can continue to run without waiting for the cluster to be fully created. Supported args are `MasterNodeReady`, `OneWorkerNodeReady`, `IngressReady` and `Normal` | `string` | `"Normal"` | no |
144145
| <a name="input_wait_till_timeout"></a> [wait\_till\_timeout](#input\_wait\_till\_timeout) | Timeout for wait\_till in minutes. | `number` | `90` | no |
145146

ibm_catalog.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@
231231
{
232232
"key": "enable_annotations"
233233
},
234+
{
235+
"key": "max_unavailable"
236+
},
234237
{
235238
"key": "log_filters"
236239
},

main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ resource "helm_release" "logs_agent" {
129129
name = "includeAnnotations"
130130
value = var.enable_annotations
131131
}
132+
set {
133+
name = "updateStrategy.maxUnavailable"
134+
value = var.max_unavailable
135+
}
132136

133137
# dummy value hack to force update https://github.com/hashicorp/terraform-provider-helm/issues/515#issuecomment-813088122
134138
values = [

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ module "logs_agent" {
4747
enable_multiline = var.enable_multiline
4848
enable_annotations = var.enable_annotations
4949
log_filters = var.log_filters
50+
max_unavailable = var.max_unavailable
5051
}

solutions/fully-configurable/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ variable "enable_multiline" {
255255
default = false
256256
}
257257

258+
variable "max_unavailable" {
259+
type = string
260+
description = "The maximum number of pods that can be unavailable during a DaemonSet rolling update. Accepts absolute number or percentage (e.g., '1' or '10%')."
261+
default = "1"
262+
nullable = false
263+
}
264+
258265
variable "provider_visibility" {
259266
description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)."
260267
type = string

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,18 @@ variable "enable_annotations" {
255255
description = "Set to true to include pod annotations in log records. Default annotations such as pod IP address and container ID, along with any custom annotations on the pod, will be included. This can help filter logs based on pod annotations in Cloud Logs."
256256
type = bool
257257
default = false
258+
259+
}
260+
261+
variable "max_unavailable" {
262+
type = string
263+
description = "The maximum number of pods that can be unavailable during a DaemonSet rolling update. Accepts absolute number or percentage (e.g., '1' or '10%')."
264+
default = "1"
265+
nullable = false
266+
validation {
267+
condition = can(regex("^\\d+%?$", var.max_unavailable))
268+
error_message = "max_unavailable must be a positive integer (e.g., '1') or a percentage (e.g., '10%')"
269+
}
258270
}
259271

260272

0 commit comments

Comments
 (0)