Skip to content

Commit

Permalink
add node taints (#132)
Browse files Browse the repository at this point in the history
* add node taints

* fix node taints
  • Loading branch information
nellyk authored Oct 30, 2024
1 parent 207ab0d commit 599d6e3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ map(object({
mode = (Optional) Should this Node Pool be used for System or User resources? Possible values are `System` and `User`. Defaults to `User`.
os\_disk\_size\_gb = (Optional) The Agent Operating System disk size in GB. Changing this forces a new resource to be created.
tags = (Optional) A mapping of tags to assign to the resource. At this time there's a bug in the AKS API where Tags for a Node Pool are not stored in the correct case - you [may wish to use Terraform's `ignore_changes` functionality to ignore changes to the casing](https://www.terraform.io/language/meta-arguments/lifecycle#ignore_changess) until this is fixed in the AKS API.
labels = (Optional) A map of Kubernetes labels which should be applied to nodes in this Node Pool.
labels = (Optional) A map of Kubernetes labels which should be applied to nodes in this Node Pool.
node\_taints = (Optional) A list of the taints added to new nodes during node pool create and scale.
}))

Example input:
Expand Down Expand Up @@ -268,11 +269,20 @@ map(object({
os_disk_size_gb = optional(number, null)
tags = optional(map(string), {})
labels = optional(map(string), {})
node_taints = optional(list(string), null)
}))
```

Default: `{}`

### <a name="input_node_taints"></a> [node\_taints](#input\_node\_taints)

Description: (Optional) A list of the taints added to new nodes during node pool create and scale. Changing this forces a new resource to be created.

Type: `list(string)`

Default: `null`

### <a name="input_orchestrator_version"></a> [orchestrator\_version](#input\_orchestrator\_version)

Description: Specify which Kubernetes release to use. Specify only minor version, such as '1.28'.
Expand Down
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ locals {
max_count = pool.max_count
min_count = pool.min_count
labels = pool.labels
node_taints = pool.node_taints
os_sku = pool.os_sku
mode = pool.mode
os_disk_size_gb = pool.os_disk_size_gb
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ resource "azurerm_kubernetes_cluster" "this" {
max_pods = 110
min_count = 3
node_labels = var.node_labels
node_taints = var.node_taints
orchestrator_version = var.orchestrator_version
os_sku = var.os_sku
tags = merge(var.tags, var.agents_tags)
Expand Down Expand Up @@ -258,6 +259,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "this" {
max_count = each.value.max_count
min_count = each.value.min_count
node_labels = each.value.labels
node_taints = each.value.node_taints
orchestrator_version = each.value.orchestrator_version
os_disk_size_gb = each.value.os_disk_size_gb
os_sku = each.value.os_sku
Expand Down
8 changes: 8 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ variable "node_pools" {
os_disk_size_gb = optional(number, null)
tags = optional(map(string), {})
labels = optional(map(string), {})
node_taints = optional(list(string), null)
}))
default = {}
description = <<-EOT
Expand All @@ -148,6 +149,7 @@ map(object({
os_disk_size_gb = (Optional) The Agent Operating System disk size in GB. Changing this forces a new resource to be created.
tags = (Optional) A mapping of tags to assign to the resource. At this time there's a bug in the AKS API where Tags for a Node Pool are not stored in the correct case - you [may wish to use Terraform's `ignore_changes` functionality to ignore changes to the casing](https://www.terraform.io/language/meta-arguments/lifecycle#ignore_changess) until this is fixed in the AKS API.
labels = (Optional) A map of Kubernetes labels which should be applied to nodes in this Node Pool.
node_taints = (Optional) A list of the taints added to new nodes during node pool create and scale.
}))
Example input:
Expand Down Expand Up @@ -182,6 +184,12 @@ EOT
}
}

variable "node_taints" {
type = list(string)
default = null
description = "(Optional) A list of the taints added to new nodes during node pool create and scale. Changing this forces a new resource to be created."
}

variable "orchestrator_version" {
type = string
default = null
Expand Down

0 comments on commit 599d6e3

Please sign in to comment.