From e5ba3329ebbfd7af7edb23aefeb2de2a6fade23d Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Wed, 21 Oct 2020 00:02:29 -0700 Subject: [PATCH] Remove bare-metal CoreOS Container Linux profiles * Remove Matchbox profiles for CoreOS Container Linux * Simplify the remaining Flatcat Linux profiles --- CHANGES.md | 3 +- .../flatcar-linux/kubernetes/cl/install.yaml | 2 +- bare-metal/flatcar-linux/kubernetes/groups.tf | 4 +- .../flatcar-linux/kubernetes/profiles.tf | 124 ++++++------------ .../flatcar-linux/kubernetes/variables.tf | 6 +- 5 files changed, 45 insertions(+), 94 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0ea275d0..d32f23ee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,10 +12,11 @@ Notable changes between versions. ### Flatcar Linux -* Rename `container-linux` modules to `flatcar-linux` ([#858](https://github.com/poseidon/typhoon/issues/858)) (action required) +* Rename `container-linux` modules to `flatcar-linux` ([#858](https://github.com/poseidon/typhoon/issues/858)) (**action required**) * Change `kubelet.service` container runner from rkt to docker ([#855](https://github.com/poseidon/typhoon/pull/855)) * Change `delete-node.service` to use docker and an inline ExecStart ([#855](https://github.com/poseidon/typhoon/pull/855)) * Fix local node delete oneshot on node shutdown ([#855](https://github.com/poseidon/typhoon/pull/855)) +* Remove CoreOS Container Linux Matchbox profiles ([#859](https://github.com/poseidon/typhoon/pull/858)) ## v1.19.3 diff --git a/bare-metal/flatcar-linux/kubernetes/cl/install.yaml b/bare-metal/flatcar-linux/kubernetes/cl/install.yaml index 6a36f19d..9a16091d 100644 --- a/bare-metal/flatcar-linux/kubernetes/cl/install.yaml +++ b/bare-metal/flatcar-linux/kubernetes/cl/install.yaml @@ -31,7 +31,7 @@ storage: inline: | #!/bin/bash -ex curl --retry 10 "${ignition_endpoint}?{{.request.raw_query}}&os=installed" -o ignition.json - ${os_flavor}-install \ + flatcar-install \ -d ${install_disk} \ -C ${os_channel} \ -V ${os_version} \ diff --git a/bare-metal/flatcar-linux/kubernetes/groups.tf b/bare-metal/flatcar-linux/kubernetes/groups.tf index 42b4d694..f420c988 100644 --- a/bare-metal/flatcar-linux/kubernetes/groups.tf +++ b/bare-metal/flatcar-linux/kubernetes/groups.tf @@ -3,8 +3,8 @@ resource "matchbox_group" "install" { name = format("install-%s", concat(var.controllers.*.name, var.workers.*.name)[count.index]) - # pick one of 4 Matchbox profiles (Container Linux or Flatcar, cached or non-cached) - profile = local.flavor == "flatcar" ? var.cached_install ? matchbox_profile.cached-flatcar-linux-install.*.name[count.index] : matchbox_profile.flatcar-install.*.name[count.index] : var.cached_install ? matchbox_profile.cached-container-linux-install.*.name[count.index] : matchbox_profile.container-linux-install.*.name[count.index] + # pick Matchbox profile (Flatcar upstream or Matchbox image cache) + profile = var.cached_install ? matchbox_profile.cached-flatcar-install.*.name[count.index] : matchbox_profile.flatcar-install.*.name[count.index] selector = { mac = concat(var.controllers.*.mac, var.workers.*.mac)[count.index] diff --git a/bare-metal/flatcar-linux/kubernetes/profiles.tf b/bare-metal/flatcar-linux/kubernetes/profiles.tf index eee77253..b41bf8df 100644 --- a/bare-metal/flatcar-linux/kubernetes/profiles.tf +++ b/bare-metal/flatcar-linux/kubernetes/profiles.tf @@ -1,91 +1,8 @@ locals { - # coreos-stable -> coreos flavor, stable channel - # flatcar-stable -> flatcar flavor, stable channel - flavor = split("-", var.os_channel)[0] + # flatcar-stable -> stable channel channel = split("-", var.os_channel)[1] } -// Container Linux Install profile (from release.core-os.net) -resource "matchbox_profile" "container-linux-install" { - count = length(var.controllers) + length(var.workers) - name = format("%s-container-linux-install-%s", var.cluster_name, concat(var.controllers.*.name, var.workers.*.name)[count.index]) - - kernel = "${var.download_protocol}://${local.channel}.release.core-os.net/amd64-usr/${var.os_version}/coreos_production_pxe.vmlinuz" - - initrd = [ - "${var.download_protocol}://${local.channel}.release.core-os.net/amd64-usr/${var.os_version}/coreos_production_pxe_image.cpio.gz", - ] - - args = flatten([ - "initrd=coreos_production_pxe_image.cpio.gz", - "coreos.config.url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}", - "coreos.first_boot=yes", - "console=tty0", - "console=ttyS0", - var.kernel_args, - ]) - - container_linux_config = data.template_file.container-linux-install-configs.*.rendered[count.index] -} - -data "template_file" "container-linux-install-configs" { - count = length(var.controllers) + length(var.workers) - - template = file("${path.module}/cl/install.yaml") - - vars = { - os_flavor = local.flavor - os_channel = local.channel - os_version = var.os_version - ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint) - install_disk = var.install_disk - ssh_authorized_key = var.ssh_authorized_key - # only cached-container-linux profile adds -b baseurl - baseurl_flag = "" - } -} - -// Container Linux Install profile (from matchbox /assets cache) -// Note: Admin must have downloaded os_version into matchbox assets/coreos. -resource "matchbox_profile" "cached-container-linux-install" { - count = length(var.controllers) + length(var.workers) - name = format("%s-cached-container-linux-install-%s", var.cluster_name, concat(var.controllers.*.name, var.workers.*.name)[count.index]) - - kernel = "/assets/coreos/${var.os_version}/coreos_production_pxe.vmlinuz" - - initrd = [ - "/assets/coreos/${var.os_version}/coreos_production_pxe_image.cpio.gz", - ] - - args = flatten([ - "initrd=coreos_production_pxe_image.cpio.gz", - "coreos.config.url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}", - "coreos.first_boot=yes", - "console=tty0", - "console=ttyS0", - var.kernel_args, - ]) - - container_linux_config = data.template_file.cached-container-linux-install-configs.*.rendered[count.index] -} - -data "template_file" "cached-container-linux-install-configs" { - count = length(var.controllers) + length(var.workers) - - template = file("${path.module}/cl/install.yaml") - - vars = { - os_flavor = local.flavor - os_channel = local.channel - os_version = var.os_version - ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint) - install_disk = var.install_disk - ssh_authorized_key = var.ssh_authorized_key - # profile uses -b baseurl to install from matchbox cache - baseurl_flag = "-b ${var.matchbox_http_endpoint}/assets/${local.flavor}" - } -} - // Flatcar Linux install profile (from release.flatcar-linux.net) resource "matchbox_profile" "flatcar-install" { count = length(var.controllers) + length(var.workers) @@ -106,12 +23,12 @@ resource "matchbox_profile" "flatcar-install" { var.kernel_args, ]) - container_linux_config = data.template_file.container-linux-install-configs.*.rendered[count.index] + container_linux_config = data.template_file.install-configs.*.rendered[count.index] } // Flatcar Linux Install profile (from matchbox /assets cache) // Note: Admin must have downloaded os_version into matchbox assets/flatcar. -resource "matchbox_profile" "cached-flatcar-linux-install" { +resource "matchbox_profile" "cached-flatcar-install" { count = length(var.controllers) + length(var.workers) name = format("%s-cached-flatcar-linux-install-%s", var.cluster_name, concat(var.controllers.*.name, var.workers.*.name)[count.index]) @@ -130,9 +47,42 @@ resource "matchbox_profile" "cached-flatcar-linux-install" { var.kernel_args, ]) - container_linux_config = data.template_file.cached-container-linux-install-configs.*.rendered[count.index] + container_linux_config = data.template_file.cached-install-configs.*.rendered[count.index] } +data "template_file" "install-configs" { + count = length(var.controllers) + length(var.workers) + + template = file("${path.module}/cl/install.yaml") + + vars = { + os_channel = local.channel + os_version = var.os_version + ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint) + install_disk = var.install_disk + ssh_authorized_key = var.ssh_authorized_key + # only cached profile adds -b baseurl + baseurl_flag = "" + } +} + +data "template_file" "cached-install-configs" { + count = length(var.controllers) + length(var.workers) + + template = file("${path.module}/cl/install.yaml") + + vars = { + os_channel = local.channel + os_version = var.os_version + ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint) + install_disk = var.install_disk + ssh_authorized_key = var.ssh_authorized_key + # profile uses -b baseurl to install from matchbox cache + baseurl_flag = "-b ${var.matchbox_http_endpoint}/assets/flatcar" + } +} + + // Kubernetes Controller profiles resource "matchbox_profile" "controllers" { count = length(var.controllers) diff --git a/bare-metal/flatcar-linux/kubernetes/variables.tf b/bare-metal/flatcar-linux/kubernetes/variables.tf index b32fb67b..dc400bd1 100644 --- a/bare-metal/flatcar-linux/kubernetes/variables.tf +++ b/bare-metal/flatcar-linux/kubernetes/variables.tf @@ -17,7 +17,7 @@ variable "os_channel" { variable "os_version" { type = string - description = "Version for a Container Linux derivative to PXE and install (e.g. 2079.5.1)" + description = "Version of Flatcar Linux to PXE and install (e.g. 2079.5.1)" } # machines @@ -122,14 +122,14 @@ variable "download_protocol" { variable "cached_install" { type = bool - description = "Whether Container Linux should PXE boot and install from matchbox /assets cache. Note that the admin must have downloaded the os_version into matchbox assets." + description = "Whether Flatcar Linux should PXE boot and install from matchbox /assets cache. Note that the admin must have downloaded the os_version into matchbox assets." default = false } variable "install_disk" { type = string default = "/dev/sda" - description = "Disk device to which the install profiles should install Container Linux (e.g. /dev/sda)" + description = "Disk device to which the install profiles should install Flatcar Linux (e.g. /dev/sda)" } variable "kernel_args" {