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

add azurelinux as an option for the os type #123

Merged
merged 1 commit into from
Oct 7, 2024
Merged
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
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,11 @@ map(object({
orchestrator\_version = (Required) The version of Kubernetes which should be used for this Node Pool. Changing this forces a new resource to be created.
max\_count = (Optional) The maximum number of nodes which should exist within this Node Pool. Valid values are between `0` and `1000` and must be greater than or equal to `min_count`.
min\_count = (Optional) The minimum number of nodes which should exist within this Node Pool. Valid values are between `0` and `1000` and must be less than or equal to `max_count`.
os\_sku = (Optional) Specifies the OS SKU used by the agent pool. Possible values include: `Ubuntu`, `CBLMariner`, `Mariner`, `Windows2019`, `Windows2022`. If not specified, the default is `Ubuntu` if OSType=Linux or `Windows2019` if OSType=Windows. And the default Windows OSSKU will be changed to `Windows2022` after Windows2019 is deprecated. Changing this forces a new resource to be created.
os\_sku = (Optional) Specifies the OS SKU used by the agent pool. Possible values include: `Ubuntu`or `AzureLinux`. If not specified, the default is `AzureLinux`. Changing this forces a new resource to be created.
mode = (Optional) Should this Node Pool be used for System or User resources? Possible values are `System` and `User`. Defaults to `User`.
os\_disk\_size\_gb = (Optional) The Agent Operating System disk size in GB. Changing this forces a new resource to be created.
tags = (Optional) A mapping of tags to assign to the resource. At this time there's a bug in the AKS API where Tags for a Node Pool are not stored in the correct case - you [may wish to use Terraform's `ignore_changes` functionality to ignore changes to the casing](https://www.terraform.io/language/meta-arguments/lifecycle#ignore_changess) until this is fixed in the AKS API.
labels = (Optional) A map of Kubernetes labels which should be applied to nodes in this Node Pool.
zones = (Optional) Specifies a list of Availability Zones in which this Kubernetes Cluster Node Pool should be located. Changing this forces a new Kubernetes Cluster Node Pool to be created.
labels = (Optional) A map of Kubernetes labels which should be applied to nodes in this Node Pool.
}))

Example input:
Expand Down Expand Up @@ -264,12 +263,11 @@ map(object({
# do not add nodecount because we enforce the use of auto-scaling
max_count = optional(number)
min_count = optional(number)
os_sku = optional(string)
os_sku = optional(string, "AzureLinux")
mode = optional(string)
os_disk_size_gb = optional(number, null)
tags = optional(map(string), {})
labels = optional(map(string), {})
zones = optional(set(string))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've removed this, based on your comment

}))
```

Expand All @@ -283,6 +281,14 @@ Type: `string`

Default: `null`

### <a name="input_os_sku"></a> [os\_sku](#input\_os\_sku)

Description: (Optional) Specifies the OS SKU used by the agent pool. Possible values include: `Ubuntu` or `AzureLinux`. If not specified, the default is `AzureLinux`.Changing this forces a new resource to be created.

Type: `string`

Default: `"AzureLinux"`

### <a name="input_rbac_aad_admin_group_object_ids"></a> [rbac\_aad\_admin\_group\_object\_ids](#input\_rbac\_aad\_admin\_group\_object\_ids)

Description: Object ID of groups with admin access.
Expand Down
4 changes: 2 additions & 2 deletions examples/without_availability_zone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module "test" {
orchestrator_version = "1.28"
max_count = 110
min_count = 2
os_sku = "Ubuntu"
os_sku = "AzureLinux"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for testing

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean "for testing" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer need this, i added this to test out a user providing Azure linux when we had set ubuntu to default initially

mode = "User"
},
ingress = {
Expand All @@ -84,7 +84,7 @@ module "test" {
orchestrator_version = "1.28"
max_count = 4
min_count = 2
os_sku = "Ubuntu"
os_sku = "AzureLinux"
mode = "User"
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/without_availability_zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module "test" {
orchestrator_version = "1.28"
max_count = 110
min_count = 2
os_sku = "Ubuntu"
os_sku = "AzureLinux"
mode = "User"
},
ingress = {
Expand All @@ -78,7 +78,7 @@ module "test" {
orchestrator_version = "1.28"
max_count = 4
min_count = 2
os_sku = "Ubuntu"
os_sku = "AzureLinux"
mode = "User"
}
}
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ resource "azurerm_kubernetes_cluster" "this" {
min_count = 3
node_labels = var.node_labels
orchestrator_version = var.orchestrator_version
os_sku = "Ubuntu"
os_sku = var.os_sku
tags = merge(var.tags, var.agents_tags)
vnet_subnet_id = var.network.node_subnet_id
zones = try([for zone in local.regions_by_name_or_display_name[var.location].zones : zone], null)
Expand Down
22 changes: 18 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,11 @@ variable "node_pools" {
# do not add nodecount because we enforce the use of auto-scaling
max_count = optional(number)
min_count = optional(number)
os_sku = optional(string)
os_sku = optional(string, "AzureLinux")
mode = optional(string)
os_disk_size_gb = optional(number, null)
tags = optional(map(string), {})
labels = optional(map(string), {})
zones = optional(set(string))
}))
default = {}
zioproto marked this conversation as resolved.
Show resolved Hide resolved
description = <<-EOT
Expand All @@ -144,12 +143,11 @@ map(object({
orchestrator_version = (Required) The version of Kubernetes which should be used for this Node Pool. Changing this forces a new resource to be created.
max_count = (Optional) The maximum number of nodes which should exist within this Node Pool. Valid values are between `0` and `1000` and must be greater than or equal to `min_count`.
min_count = (Optional) The minimum number of nodes which should exist within this Node Pool. Valid values are between `0` and `1000` and must be less than or equal to `max_count`.
os_sku = (Optional) Specifies the OS SKU used by the agent pool. Possible values include: `Ubuntu`, `CBLMariner`, `Mariner`, `Windows2019`, `Windows2022`. If not specified, the default is `Ubuntu` if OSType=Linux or `Windows2019` if OSType=Windows. And the default Windows OSSKU will be changed to `Windows2022` after Windows2019 is deprecated. Changing this forces a new resource to be created.
os_sku = (Optional) Specifies the OS SKU used by the agent pool. Possible values include: `Ubuntu`or `AzureLinux`. If not specified, the default is `AzureLinux`. Changing this forces a new resource to be created.
mode = (Optional) Should this Node Pool be used for System or User resources? Possible values are `System` and `User`. Defaults to `User`.
os_disk_size_gb = (Optional) The Agent Operating System disk size in GB. Changing this forces a new resource to be created.
tags = (Optional) A mapping of tags to assign to the resource. At this time there's a bug in the AKS API where Tags for a Node Pool are not stored in the correct case - you [may wish to use Terraform's `ignore_changes` functionality to ignore changes to the casing](https://www.terraform.io/language/meta-arguments/lifecycle#ignore_changess) until this is fixed in the AKS API.
labels = (Optional) A map of Kubernetes labels which should be applied to nodes in this Node Pool.
zones = (Optional) Specifies a list of Availability Zones in which this Kubernetes Cluster Node Pool should be located. Changing this forces a new Kubernetes Cluster Node Pool to be created.
}))

Example input:
Expand Down Expand Up @@ -177,6 +175,11 @@ Example input:
```
EOT
nullable = false

validation {
condition = alltrue([for pool in var.node_pools : contains(["Ubuntu", "AzureLinux"], pool.os_sku)])
error_message = "os_sku must be either Ubuntu or AzureLinux"
}
}

variable "orchestrator_version" {
Expand All @@ -185,6 +188,17 @@ variable "orchestrator_version" {
description = "Specify which Kubernetes release to use. Specify only minor version, such as '1.28'."
}

variable "os_sku" {
type = string
default = "AzureLinux"
description = "(Optional) Specifies the OS SKU used by the agent pool. Possible values include: `Ubuntu` or `AzureLinux`. If not specified, the default is `AzureLinux`.Changing this forces a new resource to be created."

validation {
condition = can(regex("^(Ubuntu|AzureLinux)$", var.os_sku))
error_message = "os_sku must be either Ubuntu or AzureLinux"
}
}

variable "rbac_aad_admin_group_object_ids" {
type = list(string)
default = null
Expand Down