Add Flatcar Linux ARM64 support on Azure

* Kinvolk now publishes Flatcar Linux images for ARM64
* For now, amd64 image must specify a plan while arm64 images
must NOT specify a plan due to how Kinvolk publishes.

Rel: https://github.com/flatcar/Flatcar/issues/872
This commit is contained in:
Dalton Hubble
2022-10-13 20:49:01 -07:00
parent b68f8bb2a9
commit f04e1d25a8
9 changed files with 83 additions and 17 deletions

View File

@ -100,6 +100,17 @@ variable "node_taints" {
default = []
}
variable "arch" {
type = string
description = "Container architecture (amd64 or arm64)"
default = "amd64"
validation {
condition = var.arch == "amd64" || var.arch == "arm64"
error_message = "The arch must be amd64 or arm64."
}
}
# unofficial, undocumented, unsupported
variable "cluster_domain_suffix" {

View File

@ -1,6 +1,8 @@
locals {
# flatcar-stable -> Flatcar Linux Stable
channel = split("-", var.os_image)[1]
channel = split("-", var.os_image)[1]
offer_suffix = var.arch == "arm64" ? "corevm" : "free"
urn = var.arch == "arm64" ? local.channel : "${local.channel}-gen2"
}
# Workers scale set
@ -25,15 +27,18 @@ resource "azurerm_linux_virtual_machine_scale_set" "workers" {
# Flatcar Container Linux
source_image_reference {
publisher = "kinvolk"
offer = "flatcar-container-linux-free"
sku = "${local.channel}-gen2"
offer = "flatcar-container-linux-${local.offer_suffix}"
sku = local.urn
version = "latest"
}
plan {
publisher = "kinvolk"
product = "flatcar-container-linux-free"
name = "${local.channel}-gen2"
dynamic "plan" {
for_each = var.arch == "arm64" ? [] : [1]
content {
publisher = "kinvolk"
product = "flatcar-container-linux-${local.offer_suffix}"
name = local.urn
}
}
# Azure requires setting admin_ssh_key, though Ignition custom_data handles it too