Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for drain_timeout_in_minutes #561

Closed
1 task done
morbendor opened this issue Jun 10, 2024 · 1 comment
Closed
1 task done

Add Support for drain_timeout_in_minutes #561

morbendor opened this issue Jun 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@morbendor
Copy link

morbendor commented Jun 10, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.3.5

Module Version

9.0.0

AzureRM Provider Version

3.107.0

Affected Resource(s)/Data Source(s)

azurerm_kubernetes_cluster

Terraform Configuration Files

module "aks" {
  source                    = "Azure/aks/azurerm"
  version                   = "9.0.0"
  prefix                    = join("-", compact([var.client_name, var.location_short, var.environment]))
  cluster_name              = data.azurecaf_name.aks.result
  resource_group_name       = var.resource_group_name
  kubernetes_version        = var.kubernetes_version
  automatic_channel_upgrade = "patch"
  agents_count              = null
  agents_max_count          = var.agents_max_count
  agents_max_pods           = 55
  agents_min_count          = var.agents_min_count
  agents_pool_name          = data.azurecaf_name.nodepool.result
  agents_type               = "VirtualMachineScaleSets"
  azure_policy_enabled      = true
  identity_type             = "SystemAssigned"
  enable_auto_scaling       = true
  enable_host_encryption    = false
  green_field_application_gateway_for_ingress = {
    subnet_id = var.appgw_subnet_id
  }
  local_account_disabled             = var.local_account_disabled
  oidc_issuer_enabled                = true
  workload_identity_enabled          = true
  log_analytics_workspace_enabled    = var.log_analytics_workspace_enabled
  log_analytics_workspace            = local.log_analytics_workspace
  os_disk_size_gb                    = var.os_disk_size_gb
  private_cluster_enabled            = var.private_cluster_enabled
  rbac_aad                           = var.aad_rbac_enabled
  rbac_aad_managed                   = local.rbac_aad_managed
  role_based_access_control_enabled  = true
  rbac_aad_admin_group_object_ids    = local.rbac_aad_admin_group
  key_vault_secrets_provider_enabled = true
  secret_rotation_enabled            = true
  secret_rotation_interval           = "2m"
  sku_tier                           = var.sku_tier
  vnet_subnet_id                     = var.aks_subnet_id
  attached_acr_id_map                = var.attached_acr_id_map
  agents_tags                        = merge(local.default_tags, var.extra_tags)
  tags                               = merge(local.default_tags, var.extra_tags)
  agents_pool_max_surge              = "10%"

}

tfvars variables values

kubernetes_version          = "1.28" # minor version is not required here
azure_aks_managed_disk_size = "128Gi"
k8s_node_pools = [
  {
    name = "application"
    node_labels = {
      purpose = "application"
    }
    vm_size              = "Standard_D4s_v3"
    orchestrator_version = "1.28"
    availability_zones   = ["1", "2", "3"]
    node_count           = null
    enable_auto_scaling  = true
    min_count            = 1
    max_count            = 2
    max_pods             = 50
    max_surge            = "80%"
    mode                 = "User"
    priority             = "Regular"
  },
  {
    name = "airflowdags"
    node_labels = {
      purpose = "airflow-dags"
    }
    vm_size              = "Standard_B8as_v2"
    orchestrator_version = "1.28"
    availability_zones   = ["1", "2", "3"]
    node_count           = null
    enable_auto_scaling  = true
    min_count            = 0
    max_count            = 2
    max_pods             = 50
    max_surge            = "80%"
    mode                 = "User"
    priority             = "Regular"
  }
]

Debug Output/Panic Output

Terraform will perform the following actions:

  # module.kubernetes.module.aks.azurerm_kubernetes_cluster.main must be replaced
      ~ default_node_pool {

          ~ upgrade_settings {
              - drain_timeout_in_minutes      = 30 -> null # forces replacement
              - node_soak_duration_in_minutes = 0 -> null
                # (1 unchanged attribute hidden)
            }
        }

Plan: 4 to add, 0 to change, 4 to destroy.

Expected Behaviour

The Azure AKS module should allow for the drain_timeout_in_minutes attribute to be configured in the Terraform code, allowing users to specify a custom value or use the default Azure value of 30 minutes for AKS cluster upgrades.

Actual Behaviour

Currently, the Azure AKS module does not provide a way to configure the drain_timeout_in_minutes attribute, which is now required by the Azure API when upgrading AKS clusters. This causes Terraform to fail when attempting to apply changes , as the drain_timeout_in_minutes attribute is missing.

Steps to Reproduce

Use the latest version of the azurerm provider (3.107.0).
Use the Azure AKS module (version 9.0.0).
Attempt to upgrade an AKS cluster using Terraform without specifying the drain_timeout_in_minutes attribute.

Important Factoids

No response

References

No response

@zioproto
Copy link
Collaborator

Implementing this in PR #564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants