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

feat: Add OS and Kubelet disk type options. #385

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#
provider "azurerm" {

subscription_id = var.subscription_id
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
partner_id = var.partner_id
use_msi = var.use_msi
subscription_id = var.subscription_id
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
partner_id = var.partner_id
use_msi = var.use_msi

features {}
}
Expand Down Expand Up @@ -200,8 +200,8 @@ module "node_pools" {
machine_type = each.value.machine_type
fips_enabled = var.fips_enabled
os_disk_size = each.value.os_disk_size
# TODO: enable with azurerm v2.37.0
# os_disk_type = each.value.os_disk_type
os_disk_type = each.value.os_disk_type
kubelet_disk_type = each.value.kubelet_disk_type
enable_auto_scaling = each.value.min_nodes == each.value.max_nodes ? false : true
node_count = each.value.min_nodes
min_nodes = each.value.min_nodes == each.value.max_nodes ? null : each.value.min_nodes
Expand Down Expand Up @@ -274,11 +274,11 @@ module "message_broker" {
}

data "external" "git_hash" {
program = ["files/tools/iac_git_info.sh"]
program = ["${path.module}/files/tools/iac_git_info.sh"]
}

data "external" "iac_tooling_version" {
program = ["files/tools/iac_tooling_version.sh"]
program = ["${path.module}/files/tools/iac_tooling_version.sh"]
}

resource "kubernetes_config_map" "sas_iac_buildinfo" {
Expand Down
11 changes: 6 additions & 5 deletions modules/aks_node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ resource "azurerm_kubernetes_cluster_node_pool" "autoscale_node_pool" {
proximity_placement_group_id = var.proximity_placement_group_id == "" ? null : var.proximity_placement_group_id
vm_size = var.machine_type
os_disk_size_gb = var.os_disk_size
# TODO: enable after azurerm v2.37.0
# os_disk_type = var.os_disk_type
os_type = var.os_type
enable_auto_scaling = var.enable_auto_scaling
os_disk_type = var.os_disk_type
kubelet_disk_type = var.kubelet_disk_type
os_type = var.os_type == null ? null : var.os_type
enable_auto_scaling = var.enable_auto_scaling
# 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
# enable_node_public_ip = var.enable_node_public_ip
node_count = var.node_count
Expand Down Expand Up @@ -46,7 +46,8 @@ resource "azurerm_kubernetes_cluster_node_pool" "static_node_pool" {
vm_size = var.machine_type
os_disk_size_gb = var.os_disk_size
# TODO: enable after azurerm v2.37.0
# os_disk_type = var.os_disk_type
os_disk_type = var.os_disk_type
kubelet_disk_type = var.kubelet_disk_type
os_type = var.os_type
enable_auto_scaling = var.enable_auto_scaling
node_count = var.node_count
Expand Down
17 changes: 11 additions & 6 deletions modules/aks_node_pool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ variable "os_disk_size" {
default = 100
}

# TODO: enable after azurerm v2.37.0
# variable "os_disk_type" {
# 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"
# type = string
# default = "Managed"
# }
variable "os_disk_type" {
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"
type = string
default = null
}

variable "kubelet_disk_type" {
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"
type = string
default = null
}

variable "os_type" {
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"
Expand Down
16 changes: 9 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,15 @@ variable "node_pools_proximity_placement" {
variable "node_pools" {
description = "Node pool definitions"
type = map(object({
machine_type = string
os_disk_size = number
min_nodes = string
max_nodes = string
max_pods = string
node_taints = list(string)
node_labels = map(string)
machine_type = string
os_disk_size = number
kubelet_disk_type = optional(string)
os_disk_type = optional(string)
min_nodes = string
max_nodes = string
max_pods = string
node_taints = list(string)
node_labels = map(string)
}))

default = {
Expand Down
Loading