Restore Azure auto-scale settings for VMSS node pools

* Using spot instances, when an instance is deleted it actually
lowers the desired number of nodes in the VMSS so the node is
not replaced
* Restore the auto-scale setting needed to maintain a consistent
desired number of workers while spot instances come and go. This
was mistakely removed in refactoring
This commit is contained in:
Dalton Hubble
2025-01-19 20:31:42 -08:00
parent 27cff3fd4f
commit 19a7868b2d
3 changed files with 39 additions and 0 deletions

View File

@@ -4,6 +4,10 @@ Notable changes between versions.
## Latest
### Azure
* Restore VMSS auto-scale setting to maintain node pools sizes during spot terminations ([#1567](https://github.com/poseidon/typhoon/pull/1567))
# v1.32.0
* Kubernetes [v1.32.0](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.32.md#v1320)

View File

@@ -91,3 +91,20 @@ data "ct_config" "worker" {
snippets = var.snippets
}
# Scale up or down to maintain desired number, tolerating deallocations.
resource "azurerm_monitor_autoscale_setting" "workers" {
name = "${var.name}-maintain-desired"
resource_group_name = var.resource_group_name
location = var.location
# autoscale
enabled = true
target_resource_id = azurerm_orchestrated_virtual_machine_scale_set.workers.id
profile {
name = "default"
capacity {
minimum = var.worker_count
default = var.worker_count
maximum = var.worker_count
}
}
}

View File

@@ -111,3 +111,21 @@ data "ct_config" "worker" {
strict = true
snippets = var.snippets
}
# Scale up or down to maintain desired number, tolerating deallocations.
resource "azurerm_monitor_autoscale_setting" "workers" {
name = "${var.name}-maintain-desired"
resource_group_name = var.resource_group_name
location = var.location
# autoscale
enabled = true
target_resource_id = azurerm_orchestrated_virtual_machine_scale_set.workers.id
profile {
name = "default"
capacity {
minimum = var.worker_count
default = var.worker_count
maximum = var.worker_count
}
}
}