Skip to content

Commit

Permalink
feat: (IAC-1336) Add support for specifying K8s support plan (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
riragh authored Jan 29, 2024
1 parent 87a00f5 commit b3586f2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/CONFIG-VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" |
| 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

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Expand Down
1 change: 1 addition & 0 deletions modules/azure_aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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.cluster_support_tier
role_based_access_control_enabled = true
http_application_routing_enabled = false

Expand Down
12 changes: 9 additions & 3 deletions modules/azure_aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 "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"
}

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
Expand Down
17 changes: 14 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 "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.cluster_support_tier)
error_message = "ERROR: Valid types are \"KubernetesOfficial\" and \"AKSLongTermSupport\"!"
}
}

Expand Down

0 comments on commit b3586f2

Please sign in to comment.