Skip to content

Commit 5515edb

Browse files
committed
feat: Add OS and Kubelet disk type options.
OS Disk type can be either Managed or Temporary. Kubelet Disk type can be either OS or Ephemeral. The default behaviour for the option, and when not set, is to use Managed and OS for the OS and Kubelet respectively. When set to Temporary and Ephemeral the local temporary storage will be used if available on the node. Signed-off-by: Carus Kyle <[email protected]>
1 parent 7ce32d8 commit 5515edb

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

main.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
#
99
provider "azurerm" {
1010

11-
subscription_id = var.subscription_id
12-
client_id = var.client_id
13-
client_secret = var.client_secret
14-
tenant_id = var.tenant_id
15-
partner_id = var.partner_id
16-
use_msi = var.use_msi
11+
subscription_id = var.subscription_id
12+
client_id = var.client_id
13+
client_secret = var.client_secret
14+
tenant_id = var.tenant_id
15+
partner_id = var.partner_id
16+
use_msi = var.use_msi
1717

1818
features {}
1919
}
@@ -197,8 +197,8 @@ module "node_pools" {
197197
machine_type = each.value.machine_type
198198
fips_enabled = var.fips_enabled
199199
os_disk_size = each.value.os_disk_size
200-
# TODO: enable with azurerm v2.37.0
201-
# os_disk_type = each.value.os_disk_type
200+
os_disk_type = each.value.os_disk_type
201+
kubelet_disk_type = each.value.kubelet_disk_type
202202
enable_auto_scaling = each.value.min_nodes == each.value.max_nodes ? false : true
203203
node_count = each.value.min_nodes
204204
min_nodes = each.value.min_nodes == each.value.max_nodes ? null : each.value.min_nodes
@@ -271,11 +271,11 @@ module "message_broker" {
271271
}
272272

273273
data "external" "git_hash" {
274-
program = ["files/tools/iac_git_info.sh"]
274+
program = ["${path.module}/files/tools/iac_git_info.sh"]
275275
}
276276

277277
data "external" "iac_tooling_version" {
278-
program = ["files/tools/iac_tooling_version.sh"]
278+
program = ["${path.module}/files/tools/iac_tooling_version.sh"]
279279
}
280280

281281
resource "kubernetes_config_map" "sas_iac_buildinfo" {

modules/aks_node_pool/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ resource "azurerm_kubernetes_cluster_node_pool" "autoscale_node_pool" {
1414
proximity_placement_group_id = var.proximity_placement_group_id == "" ? null : var.proximity_placement_group_id
1515
vm_size = var.machine_type
1616
os_disk_size_gb = var.os_disk_size
17-
# TODO: enable after azurerm v2.37.0
18-
# os_disk_type = var.os_disk_type
19-
os_type = var.os_type
20-
enable_auto_scaling = var.enable_auto_scaling
17+
os_disk_type = var.os_disk_type
18+
kubelet_disk_type = var.kubelet_disk_type
19+
os_type = var.os_type == null ? null : var.os_type
20+
enable_auto_scaling = var.enable_auto_scaling
2121
# Still in preview, revisit if needed later - https://docs.microsoft.com/en-us/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools-preview
2222
# enable_node_public_ip = var.enable_node_public_ip
2323
node_count = var.node_count
@@ -46,7 +46,8 @@ resource "azurerm_kubernetes_cluster_node_pool" "static_node_pool" {
4646
vm_size = var.machine_type
4747
os_disk_size_gb = var.os_disk_size
4848
# TODO: enable after azurerm v2.37.0
49-
# os_disk_type = var.os_disk_type
49+
os_disk_type = var.os_disk_type
50+
kubelet_disk_type = var.kubelet_disk_type
5051
os_type = var.os_type
5152
enable_auto_scaling = var.enable_auto_scaling
5253
node_count = var.node_count

modules/aks_node_pool/variables.tf

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ variable "os_disk_size" {
4646
default = 100
4747
}
4848

49-
# TODO: enable after azurerm v2.37.0
50-
# variable "os_disk_type" {
51-
# description = "The type of disk which should be used for the Operating System. Possible values are Ephemeral and Managed. Defaults to Managed. Changing this forces a new resource to be created"
52-
# type = string
53-
# default = "Managed"
54-
# }
49+
variable "os_disk_type" {
50+
description = "(Optional) The type of disk which should be used for the Operating System. Possible values are Ephemeral and Managed. Changing this forces a new resource to be created"
51+
type = string
52+
default = null
53+
}
54+
55+
variable "kubelet_disk_type" {
56+
description = "(Optional) The type of disk which should be used for the Kubelet. Possible values are OS (Where the OS Disk Type is then used) and Temporary. Defaults to Managed. Changing this forces a new resource to be created"
57+
type = string
58+
default = null
59+
}
5560

5661
variable "os_type" {
5762
description = "The Operating System which should be used for this Node Pool. Changing this forces a new resource to be created. Possible values are Linux and Windows. Defaults to Linux"

variables.tf

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,15 @@ variable "node_pools_proximity_placement" {
542542
variable "node_pools" {
543543
description = "Node pool definitions"
544544
type = map(object({
545-
machine_type = string
546-
os_disk_size = number
547-
min_nodes = string
548-
max_nodes = string
549-
max_pods = string
550-
node_taints = list(string)
551-
node_labels = map(string)
545+
machine_type = string
546+
os_disk_size = number
547+
kubelet_disk_type = optional(string)
548+
os_disk_type = optional(string)
549+
min_nodes = string
550+
max_nodes = string
551+
max_pods = string
552+
node_taints = list(string)
553+
node_labels = map(string)
552554
}))
553555

554556
default = {

0 commit comments

Comments
 (0)