From 0cdc40b0099f872e507a07b16bb655c4e5dcba41 Mon Sep 17 00:00:00 2001 From: Ritika Patil Date: Thu, 25 Jan 2024 15:18:02 -0600 Subject: [PATCH 1/3] feat: (IAC-1336) Add support for specifying K8s support plan --- docs/CONFIG-VARS.md | 3 ++- main.tf | 1 + modules/azure_aks/main.tf | 1 + modules/azure_aks/variables.tf | 12 +++++++++--- variables.tf | 17 ++++++++++++++--- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/CONFIG-VARS.md b/docs/CONFIG-VARS.md index 38cc73f9..bb0ba0a1 100644 --- a/docs/CONFIG-VARS.md +++ b/docs/CONFIG-VARS.md @@ -194,7 +194,8 @@ Ubuntu 20.04 LTS is the operating system used on the Jump/NFS servers. Ubuntu cr | ssh_public_key | File name of public ssh key for jump and nfs VM | string | "~/.ssh/id_rsa.pub" | Required with `create_jump_vm=true` or `storage_type=standard` | | cluster_api_mode | Public or private IP for the cluster api | string | "public" | Valid Values: "public", "private" | | aks_cluster_private_dns_zone_id | Specifies private DNS zone resource ID for AKS private cluster to use | string | "" | For `cluster_api_mode=private` if `aks_cluster_private_dns_zone_id` is not specified then the value `System` is used else it is set to null. For details see [Configure a private DNS zone](https://learn.microsoft.com/en-us/azure/aks/private-clusters?tabs=azure-portal#configure-a-private-dns-zone) | -| aks_cluster_sku_tier | Optimizes api server for cost vs availability | string | "Free" | Valid Values: "Free", "Standard" | +| aks_cluster_sku_tier | The SKU Tier that should be used for this Kubernetes Cluster. Optimizes api server for cost vs availability | string | "Free" | Valid Values: "Free", "Standard" and "Premium" | +| aks_support_plan | Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are `KubernetesOfficial` and `AKSLongTermSupport`. | string | "KubernetesOfficial" | To enable long term K8s support is a combination of setting `aks_cluster_sku_tier` to `Premium` tier and explicitly selecting the `aks_support_plan` as `AKSLongTermSupport`. For details see [Long term Support](https://learn.microsoft.com/en-us/azure/aks/long-term-support) and for which K8s version has long term support see [AKS Kubernetes release calendar](https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-kubernetes-release-calendar).| ## Node Pools diff --git a/main.tf b/main.tf index af51e083..476625a1 100644 --- a/main.tf +++ b/main.tf @@ -134,6 +134,7 @@ module "aks" { aks_cluster_dns_prefix = "${var.prefix}-aks" aks_cluster_sku_tier = var.aks_cluster_sku_tier aks_cluster_location = var.location + aks_support_plan = var.aks_support_plan fips_enabled = var.fips_enabled aks_cluster_node_auto_scaling = var.default_nodepool_min_nodes == var.default_nodepool_max_nodes ? false : true aks_cluster_node_count = var.default_nodepool_min_nodes diff --git a/modules/azure_aks/main.tf b/modules/azure_aks/main.tf index 522039e7..0662d57d 100644 --- a/modules/azure_aks/main.tf +++ b/modules/azure_aks/main.tf @@ -10,6 +10,7 @@ resource "azurerm_kubernetes_cluster" "aks" { dns_prefix_private_cluster = var.aks_private_cluster && var.aks_cluster_private_dns_zone_id != "" ? var.aks_cluster_dns_prefix : null sku_tier = var.aks_cluster_sku_tier + support_plan = var.aks_support_plan role_based_access_control_enabled = true http_application_routing_enabled = false diff --git a/modules/azure_aks/variables.tf b/modules/azure_aks/variables.tf index 05307a49..69a20dc7 100644 --- a/modules/azure_aks/variables.tf +++ b/modules/azure_aks/variables.tf @@ -23,16 +23,22 @@ variable "aks_cluster_location" { } variable "aks_cluster_sku_tier" { - description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are Free and Standard (which includes the Uptime SLA). Defaults to Free" + description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are Free, Standard (which includes the Uptime SLA) and Premium. Defaults to Free" type = string default = "Free" validation { - condition = contains(["Free", "Standard"], var.aks_cluster_sku_tier) - error_message = "ERROR: Valid types are \"Free\" and \"Standard\"!" + condition = contains(["Free", "Standard", "Premium"], var.aks_cluster_sku_tier) + error_message = "ERROR: Valid types are \"Free\", \"Standard\" and \"Premium\"!" } } +variable "aks_support_plan" { + description = "Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are 'KubernetesOfficial' and 'AKSLongTermSupport'. Defaults to 'KubernetesOfficial'." + type = string + default = "KubernetesOfficial" +} + variable "fips_enabled" { description = "Should the nodes in this Node Pool have Federal Information Processing Standard enabled? Changing this forces a new resource to be created." type = bool diff --git a/variables.tf b/variables.tf index fb0ca297..f75fcab8 100644 --- a/variables.tf +++ b/variables.tf @@ -59,13 +59,24 @@ variable "location" { } variable "aks_cluster_sku_tier" { - description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are Free and Standard (which includes the Uptime SLA). Defaults to Free" + description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are Free, Standard (which includes the Uptime SLA) and Premium. Defaults to Free" type = string default = "Free" validation { - condition = contains(["Free", "Standard"], var.aks_cluster_sku_tier) - error_message = "ERROR: Valid types are \"Free\" and \"Standard\"!" + condition = contains(["Free", "Standard", "Premium"], var.aks_cluster_sku_tier) + error_message = "ERROR: Valid types are \"Free\", \"Standard\" and \"Premium\"!" + } +} + +variable "aks_support_plan" { + description = "Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are 'KubernetesOfficial' and 'AKSLongTermSupport'. Defaults to 'KubernetesOfficial'." + type = string + default = "KubernetesOfficial" + + validation { + condition = contains(["KubernetesOfficial", "AKSLongTermSupport"], var.aks_support_plan) + error_message = "ERROR: Valid types are \"KubernetesOfficial\" and \"AKSLongTermSupport\"!" } } From 2d3a2996aeffe89f96ddec194ef287b7e93e8894 Mon Sep 17 00:00:00 2001 From: Ritika Patil Date: Fri, 26 Jan 2024 15:33:14 -0600 Subject: [PATCH 2/3] feat: (IAC-1336) Update variable name --- docs/CONFIG-VARS.md | 2 +- main.tf | 2 +- modules/azure_aks/main.tf | 2 +- modules/azure_aks/variables.tf | 2 +- variables.tf | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/CONFIG-VARS.md b/docs/CONFIG-VARS.md index bb0ba0a1..cbdc8bad 100644 --- a/docs/CONFIG-VARS.md +++ b/docs/CONFIG-VARS.md @@ -195,7 +195,7 @@ Ubuntu 20.04 LTS is the operating system used on the Jump/NFS servers. Ubuntu cr | cluster_api_mode | Public or private IP for the cluster api | string | "public" | Valid Values: "public", "private" | | aks_cluster_private_dns_zone_id | Specifies private DNS zone resource ID for AKS private cluster to use | string | "" | For `cluster_api_mode=private` if `aks_cluster_private_dns_zone_id` is not specified then the value `System` is used else it is set to null. For details see [Configure a private DNS zone](https://learn.microsoft.com/en-us/azure/aks/private-clusters?tabs=azure-portal#configure-a-private-dns-zone) | | aks_cluster_sku_tier | The SKU Tier that should be used for this Kubernetes Cluster. Optimizes api server for cost vs availability | string | "Free" | Valid Values: "Free", "Standard" and "Premium" | -| aks_support_plan | Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are `KubernetesOfficial` and `AKSLongTermSupport`. | string | "KubernetesOfficial" | To enable long term K8s support is a combination of setting `aks_cluster_sku_tier` to `Premium` tier and explicitly selecting the `aks_support_plan` as `AKSLongTermSupport`. For details see [Long term Support](https://learn.microsoft.com/en-us/azure/aks/long-term-support) and for which K8s version has long term support see [AKS Kubernetes release calendar](https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-kubernetes-release-calendar).| +| cluster_support_tier | Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are `KubernetesOfficial` and `AKSLongTermSupport`. | string | "KubernetesOfficial" | To enable long term K8s support is a combination of setting `aks_cluster_sku_tier` to `Premium` tier and explicitly selecting the `cluster_support_tier` as `AKSLongTermSupport`. For details see [Long term Support](https://learn.microsoft.com/en-us/azure/aks/long-term-support) and for which K8s version has long term support see [AKS Kubernetes release calendar](https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-kubernetes-release-calendar).| ## Node Pools diff --git a/main.tf b/main.tf index 476625a1..3fcc5166 100644 --- a/main.tf +++ b/main.tf @@ -134,7 +134,7 @@ module "aks" { aks_cluster_dns_prefix = "${var.prefix}-aks" aks_cluster_sku_tier = var.aks_cluster_sku_tier aks_cluster_location = var.location - aks_support_plan = var.aks_support_plan + cluster_support_tier = var.cluster_support_tier fips_enabled = var.fips_enabled aks_cluster_node_auto_scaling = var.default_nodepool_min_nodes == var.default_nodepool_max_nodes ? false : true aks_cluster_node_count = var.default_nodepool_min_nodes diff --git a/modules/azure_aks/main.tf b/modules/azure_aks/main.tf index 0662d57d..6efb6954 100644 --- a/modules/azure_aks/main.tf +++ b/modules/azure_aks/main.tf @@ -10,7 +10,7 @@ resource "azurerm_kubernetes_cluster" "aks" { dns_prefix_private_cluster = var.aks_private_cluster && var.aks_cluster_private_dns_zone_id != "" ? var.aks_cluster_dns_prefix : null sku_tier = var.aks_cluster_sku_tier - support_plan = var.aks_support_plan + support_plan = var.cluster_support_tier role_based_access_control_enabled = true http_application_routing_enabled = false diff --git a/modules/azure_aks/variables.tf b/modules/azure_aks/variables.tf index 69a20dc7..4d8f0944 100644 --- a/modules/azure_aks/variables.tf +++ b/modules/azure_aks/variables.tf @@ -33,7 +33,7 @@ variable "aks_cluster_sku_tier" { } } -variable "aks_support_plan" { +variable "cluster_support_tier" { description = "Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are 'KubernetesOfficial' and 'AKSLongTermSupport'. Defaults to 'KubernetesOfficial'." type = string default = "KubernetesOfficial" diff --git a/variables.tf b/variables.tf index f75fcab8..9a179c08 100644 --- a/variables.tf +++ b/variables.tf @@ -69,13 +69,13 @@ variable "aks_cluster_sku_tier" { } } -variable "aks_support_plan" { +variable "cluster_support_tier" { description = "Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are 'KubernetesOfficial' and 'AKSLongTermSupport'. Defaults to 'KubernetesOfficial'." type = string default = "KubernetesOfficial" validation { - condition = contains(["KubernetesOfficial", "AKSLongTermSupport"], var.aks_support_plan) + condition = contains(["KubernetesOfficial", "AKSLongTermSupport"], var.cluster_support_tier) error_message = "ERROR: Valid types are \"KubernetesOfficial\" and \"AKSLongTermSupport\"!" } } From 12dd18c7a4d13428a30693dacc8df97a989be13f Mon Sep 17 00:00:00 2001 From: Ritika Patil Date: Mon, 29 Jan 2024 14:03:01 -0600 Subject: [PATCH 3/3] feat: (IAC-1336) Updated doc --- docs/CONFIG-VARS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONFIG-VARS.md b/docs/CONFIG-VARS.md index cbdc8bad..83324f62 100644 --- a/docs/CONFIG-VARS.md +++ b/docs/CONFIG-VARS.md @@ -195,7 +195,7 @@ Ubuntu 20.04 LTS is the operating system used on the Jump/NFS servers. Ubuntu cr | cluster_api_mode | Public or private IP for the cluster api | string | "public" | Valid Values: "public", "private" | | aks_cluster_private_dns_zone_id | Specifies private DNS zone resource ID for AKS private cluster to use | string | "" | For `cluster_api_mode=private` if `aks_cluster_private_dns_zone_id` is not specified then the value `System` is used else it is set to null. For details see [Configure a private DNS zone](https://learn.microsoft.com/en-us/azure/aks/private-clusters?tabs=azure-portal#configure-a-private-dns-zone) | | aks_cluster_sku_tier | The SKU Tier that should be used for this Kubernetes Cluster. Optimizes api server for cost vs availability | string | "Free" | Valid Values: "Free", "Standard" and "Premium" | -| cluster_support_tier | Specifies the support plan which should be used for this Kubernetes Cluster. Possible values are `KubernetesOfficial` and `AKSLongTermSupport`. | string | "KubernetesOfficial" | To enable long term K8s support is a combination of setting `aks_cluster_sku_tier` to `Premium` tier and explicitly selecting the `cluster_support_tier` as `AKSLongTermSupport`. For details see [Long term Support](https://learn.microsoft.com/en-us/azure/aks/long-term-support) and for which K8s version has long term support see [AKS Kubernetes release calendar](https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-kubernetes-release-calendar).| +| cluster_support_tier | Specifies the support plan which should be used for this Kubernetes Cluster. | string | "KubernetesOfficial" | Possible values are `KubernetesOfficial` and `AKSLongTermSupport`. To enable long term K8s support is a combination of setting `aks_cluster_sku_tier` to `Premium` tier and explicitly selecting the `cluster_support_tier` as `AKSLongTermSupport`. For details see [Long term Support](https://learn.microsoft.com/en-us/azure/aks/long-term-support) and for which K8s version has long term support see [AKS Kubernetes release calendar](https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-kubernetes-release-calendar).| ## Node Pools