Skip to content

Commit 627a936

Browse files
authored
Merge pull request #463 from sassoftware/pr-pskd-1488
Merge pull request #390 from simon-z22:simon_modifications
2 parents 21269bf + fa334f4 commit 627a936

File tree

7 files changed

+53
-6
lines changed

7 files changed

+53
-6
lines changed

docs/CONFIG-VARS.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,23 @@ Ubuntu 20.04 LTS is the operating system used on the Jump/NFS servers. Ubuntu cr
197197
| :--- | ---: | ---: | ---: | ---: |
198198
| partner_id | A GUID that is registered with Microsoft to facilitate partner resource usage attribution | string | "5d27f3ae-e49c-4dea-9aa3-b44e4750cd8c" | Defaults to SAS partner GUID. When you deploy this Terraform configuration, Microsoft can identify the installation of SAS software with the deployed Azure resources. Microsoft can then correlate the resources that are used to support the software. Microsoft collects this information to provide the best experiences with their products and to operate their business. The data is collected and governed by Microsoft's privacy policies, located at https://www.microsoft.com/trustcenter. |
199199
| create_static_kubeconfig | Allows the user to create a provider / service account-based kubeconfig file | bool | true | A value of `false` will default to using the cloud provider's mechanism for generating the kubeconfig file. A value of `true` will create a static kubeconfig that uses a `Service Account` and `Cluster Role Binding` to provide credentials. |
200-
| kubernetes_version | The AKS cluster Kubernetes version | string | "1.30" |Use of specific versions is still supported. If you need exact kubernetes version please use format `x.y.z`, where `x` is the major version, `y` is the minor version, and `z` is the patch version |
200+
| kubernetes_version | The AKS cluster Kubernetes version | string | "1.30" | Use of specific versions is still supported. If you need exact kubernetes version please use format `x.y.z`, where `x` is the major version, `y` is the minor version, and `z` is the patch version |
201201
| create_jump_vm | Create bastion host | bool | true | |
202202
| create_jump_public_ip | Add public IP address to the jump VM | bool | true | |
203203
| enable_jump_public_static_ip | Enables `Static` allocation method for the public IP address of Jump Server. Setting false will enable `Dynamic` allocation method. | bool | true | Only used with `create_jump_public_ip=true` |
204204
| jump_vm_admin | Operating system Admin User for the jump VM | string | "jumpuser" | |
205-
| jump_vm_machine_type | SKU to use for the jump VM | string | "Standard_B2s" | To check for valid types for your subscription, run: `az vm list-skus --resource-type virtualMachines --subscription $subscription --location $location -o table`|
205+
| jump_vm_machine_type | SKU to use for the jump VM | string | "Standard_B2s" | To check for valid types for your subscription, run: `az vm list-skus --resource-type virtualMachines --subscription $subscription --location $location -o table` |
206206
| jump_rwx_filestore_path | File store mount point on jump server | string | "/viya-share" | This location cannot include `/mnt` as its root location. This disk is ephemeral on Ubuntu, which is the operating system being used for the jump/NFS servers. |
207207
| tags | Map of common tags to be placed on all Azure resources created by this script | map | { project_name = "sasviya4", environment = "dev" } | |
208-
| aks_identity | Use UserAssignedIdentity or Service Principal as [AKS identity](https://docs.microsoft.com/en-us/azure/aks/concepts-identity) | string | "uai" | A value of `uai` wil create a Managed Identity based on the permissions of the authenticated user or use [`AKS_UAI_NAME`](#use-existing), if set. A value of `sp` will use values from [`CLIENT_ID`/`CLIENT_SECRET`](#azure-authentication), if set. |
208+
| aks_identity | Use UserAssignedIdentity or Service Principal as [AKS identity](https://docs.microsoft.com/en-us/azure/aks/concepts-identity) | string | "uai" | A value of `uai` wil create a Managed Identity based on the permissions of the authenticated user or use [`AKS_UAI_NAME`](#use-existing), if set. A value of `sp` will use values from [`CLIENT_ID`/`CLIENT_SECRET`](#azure-authentication), if set. |
209209
| 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` |
210210
| cluster_api_mode | Public or private IP for the cluster api | string | "public" | Valid Values: "public", "private" |
211211
| 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) |
212+
| 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" |
213+
| 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). |
214+
| aks_cluster_run_command_enabled | Enable or disable the AKS Run Command feature | bool | false | The AKS Run Command feature in AKS allows you to remotely execute commands within a running container of your AKS cluster directly from the Azure CLI or Azure portal. To enable the Run Command feature for an AKS cluster where Run Command is disabled, navigate to the Run Command tab for your AKS Cluster in the Azure Portal and select the Enable button. |
215+
| aks_azure_policy_enabled | Enable or disable the Azure Policy Add-on or extension | bool | false | Azure Policy makes it possible to manage and report on the compliance state of your Kubernetes cluster components from one place. By using Azure Policy's Add-on or Extension, governing your cluster components is enhanced with Azure Policy features, like the ability to use selectors and overrides for safe policy rollout and rollback. |
216+
| node_resource_group_name | Specifies the resource group name for the cluster resources | string | `MC_${local.aks_rg.name}_${var.prefix}-aks_${var.location}` | |
212217
| 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" |
213218
| 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).|
214219
| aks_cluster_run_command_enabled | Enable or disable the AKS Run Command feature | bool | false | The AKS Run Command feature in AKS allows you to remotely execute commands within a running container of your AKS cluster directly from the Azure CLI or Azure portal. To enable the Run Command feature for an AKS cluster where Run Command is disabled, navigate to the Run Command tab for your AKS Cluster in the Azure Portal and select the Enable button. |
@@ -230,17 +235,18 @@ Ubuntu 20.04 LTS is the operating system used on the Jump/NFS servers. Ubuntu cr
230235

231236
### Additional Node Pools
232237

233-
Additional node pools can be created separate from the default node pool. This is done with the `node_pools` variable, which is a map of objects. Irrespective of the default values, the following variables are required for each node pool:
238+
Additional node pools can be created separate from the default node pool. This is done with the `node_pools` variable, which is a map of objects. Irrespective of the default values, the following variables are required for each node pool unless marked optional:
234239

235240
| Name | Description | Type | Notes |
236241
| :--- | ---: | ---: | ---: |
237242
| machine_type | Type of the node pool VMs | string | |
238243
| os_disk_size | Disk size for node pool VMs in GB | number | |
239244
| min_nodes | Minimum number of nodes for the node pool | number | Value must be between 0 and 100. Setting min and max node counts to the same value disables autoscaling |
240245
| max_nodes | Maximum number of nodes for the node pool | number | Value must be between 0 and 100. Setting min and max node counts to the same value disables autoscaling |
241-
| max_pods | Maximum number of pods per node | number | Default is 110
246+
| max_pods | Maximum number of pods per node | number | Default is 110 |
242247
| node_taints | Taints for the node pool VMs | list of strings | |
243248
| node_labels | Labels to add to the node pool VMs | map | |
249+
| vm_max_map_count (Optional) | Linux kernel parameter that defines the maximum number of memory map areas that a process can have | map | Value is set as follows: "linux_os_config" = {"sysctl_config" = {"vm_max_map_count" = 262144}} |
244250

245251
The default values for the `node_pools` variable are as follows:
246252

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ module "aks" {
135135
aks_cluster_dns_prefix = "${var.prefix}-aks"
136136
aks_cluster_sku_tier = var.aks_cluster_sku_tier
137137
aks_cluster_location = var.location
138+
node_resource_group_name = var.node_resource_group_name != "" ? var.node_resource_group_name : "MC_${local.aks_rg.name}_${var.prefix}-aks_${var.location}"
138139
cluster_support_tier = var.cluster_support_tier
139140
fips_enabled = var.fips_enabled
140141
aks_cluster_node_auto_scaling = var.default_nodepool_min_nodes == var.default_nodepool_max_nodes ? false : true
@@ -213,6 +214,7 @@ module "node_pools" {
213214
orchestrator_version = var.kubernetes_version
214215
host_encryption_enabled = var.aks_cluster_enable_host_encryption
215216
tags = var.tags
217+
linux_os_config = each.value.linux_os_config
216218
}
217219

218220
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server

modules/aks_node_pool/main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ resource "azurerm_kubernetes_cluster_node_pool" "autoscale_node_pool" {
2929
lifecycle {
3030
ignore_changes = [node_count]
3131
}
32+
33+
linux_os_config {
34+
sysctl_config {
35+
vm_max_map_count = try(var.linux_os_config.sysctl_config.vm_max_map_count,null)
36+
}
37+
}
3238
}
3339

3440
resource "azurerm_kubernetes_cluster_node_pool" "static_node_pool" {
@@ -52,4 +58,10 @@ resource "azurerm_kubernetes_cluster_node_pool" "static_node_pool" {
5258
node_taints = var.node_taints
5359
orchestrator_version = var.orchestrator_version
5460
tags = var.tags
61+
62+
linux_os_config {
63+
sysctl_config {
64+
vm_max_map_count = try(var.linux_os_config.sysctl_config.vm_max_map_count,null)
65+
}
66+
}
5567
}

modules/aks_node_pool/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,13 @@ variable "proximity_placement_group_id" {
115115
type = string
116116
default = ""
117117
}
118+
119+
variable "linux_os_config"{
120+
description = "Specifications of linux os config. Changing this forces a new resource to be created."
121+
type = object({
122+
sysctl_config = optional(object({
123+
vm_max_map_count = optional(number)
124+
}))
125+
})
126+
default = {}
127+
}

modules/azure_aks/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ resource "azurerm_kubernetes_cluster" "aks" {
66
name = var.aks_cluster_name
77
location = var.aks_cluster_location
88
resource_group_name = var.aks_cluster_rg
9+
node_resource_group = var.node_resource_group_name
910
dns_prefix = var.aks_private_cluster == false || var.aks_cluster_private_dns_zone_id == "" ? var.aks_cluster_dns_prefix : null
1011
dns_prefix_private_cluster = var.aks_private_cluster && var.aks_cluster_private_dns_zone_id != "" ? var.aks_cluster_dns_prefix : null
1112

@@ -139,7 +140,7 @@ data "azurerm_public_ip" "cluster_public_ip" {
139140

140141
# effective_outbound_ips is a set of strings, that needs to be converted to a list type
141142
name = split("/", tolist(azurerm_kubernetes_cluster.aks.network_profile[0].load_balancer_profile[0].effective_outbound_ips)[0])[8]
142-
resource_group_name = "MC_${var.aks_cluster_rg}_${var.aks_cluster_name}_${var.aks_cluster_location}"
143+
resource_group_name = var.node_resource_group_name
143144

144145
depends_on = [azurerm_kubernetes_cluster.aks]
145146
}

modules/azure_aks/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,8 @@ variable "aks_cluster_run_command_enabled" {
265265
type = bool
266266
default = false
267267
}
268+
269+
variable "node_resource_group_name" {
270+
type = string
271+
default = ""
272+
}

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,11 @@ variable "node_pools" {
562562
max_pods = string
563563
node_taints = list(string)
564564
node_labels = map(string)
565+
linux_os_config = optional(object({
566+
sysctl_config = optional(object({
567+
vm_max_map_count = optional(number)
568+
}))
569+
}))
565570
}))
566571

567572
default = {
@@ -814,3 +819,9 @@ variable "aks_cluster_run_command_enabled" {
814819
type = bool
815820
default = false
816821
}
822+
823+
variable "node_resource_group_name" {
824+
description = "Resource group name for the AKS cluster resources."
825+
type = string
826+
default = ""
827+
}

0 commit comments

Comments
 (0)