diff --git a/bare-metal/container-linux/kubernetes/cl/controller.yaml.tmpl b/bare-metal/container-linux/kubernetes/cl/controller.yaml.tmpl index fa26afe88..5a930927a 100644 --- a/bare-metal/container-linux/kubernetes/cl/controller.yaml.tmpl +++ b/bare-metal/container-linux/kubernetes/cl/controller.yaml.tmpl @@ -81,7 +81,7 @@ systemd: ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/cache/kubelet-pod.uuid - ExecStart=/usr/lib/coreos/kubelet-wrapper \ + ExecStart=/usr/lib/${os_flavor}/kubelet-wrapper \ --anonymous-auth=false \ --authentication-token-webhook \ --authorization-mode=Webhook \ diff --git a/bare-metal/container-linux/kubernetes/cl/worker.yaml.tmpl b/bare-metal/container-linux/kubernetes/cl/worker.yaml.tmpl index c3c4b95cd..3c05facc3 100644 --- a/bare-metal/container-linux/kubernetes/cl/worker.yaml.tmpl +++ b/bare-metal/container-linux/kubernetes/cl/worker.yaml.tmpl @@ -54,7 +54,7 @@ systemd: ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/cache/kubelet-pod.uuid - ExecStart=/usr/lib/coreos/kubelet-wrapper \ + ExecStart=/usr/lib/${os_flavor}/kubelet-wrapper \ --anonymous-auth=false \ --authentication-token-webhook \ --authorization-mode=Webhook \ diff --git a/bare-metal/container-linux/kubernetes/groups.tf b/bare-metal/container-linux/kubernetes/groups.tf index 5d587f236..6a467af37 100644 --- a/bare-metal/container-linux/kubernetes/groups.tf +++ b/bare-metal/container-linux/kubernetes/groups.tf @@ -3,7 +3,7 @@ resource "matchbox_group" "install" { name = "${format("install-%s", element(concat(var.controller_names, var.worker_names), count.index))}" - profile = "${local.flavor == "flatcar" ? element(matchbox_profile.flatcar-install.*.name, count.index) : var.cached_install == "true" ? element(matchbox_profile.cached-container-linux-install.*.name, count.index) : element(matchbox_profile.container-linux-install.*.name, count.index)}" + profile = "${local.flavor == "flatcar" ? var.cached_install == "true" ? element(matchbox_profile.cached-flatcar-linux-install.*.name, count.index) : element(matchbox_profile.flatcar-install.*.name, count.index) : var.cached_install == "true" ? element(matchbox_profile.cached-container-linux-install.*.name, count.index) : element(matchbox_profile.container-linux-install.*.name, count.index)}" selector { mac = "${element(concat(var.controller_macs, var.worker_macs), count.index)}" diff --git a/bare-metal/container-linux/kubernetes/profiles.tf b/bare-metal/container-linux/kubernetes/profiles.tf index 51e5977c5..6383b9baf 100644 --- a/bare-metal/container-linux/kubernetes/profiles.tf +++ b/bare-metal/container-linux/kubernetes/profiles.tf @@ -87,7 +87,7 @@ data "template_file" "cached-container-linux-install-configs" { ssh_authorized_key = "${var.ssh_authorized_key}" # profile uses -b baseurl to install from matchbox cache - baseurl_flag = "-b ${var.matchbox_http_endpoint}/assets/coreos" + baseurl_flag = "-b ${var.matchbox_http_endpoint}/assets/${local.flavor}" } } @@ -114,6 +114,30 @@ resource "matchbox_profile" "flatcar-install" { container_linux_config = "${element(data.template_file.container-linux-install-configs.*.rendered, count.index)}" } +// Flatcar Linux Install profile (from matchbox /assets cache) +// Note: Admin must have downloaded os_version into matchbox assets. +resource "matchbox_profile" "cached-flatcar-linux-install" { + count = "${length(var.controller_names) + length(var.worker_names)}" + name = "${format("%s-cached-flatcar-linux-install-%s", var.cluster_name, element(concat(var.controller_names, var.worker_names), count.index))}" + + kernel = "/assets/flatcar/${var.os_version}/flatcar_production_pxe.vmlinuz" + + initrd = [ + "/assets/flatcar/${var.os_version}/flatcar_production_pxe_image.cpio.gz", + ] + + args = [ + "initrd=flatcar_production_pxe_image.cpio.gz", + "flatcar.config.url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}", + "flatcar.first_boot=yes", + "console=tty0", + "console=ttyS0", + "${var.kernel_args}", + ] + + container_linux_config = "${element(data.template_file.cached-container-linux-install-configs.*.rendered, count.index)}" +} + // Kubernetes Controller profiles resource "matchbox_profile" "controllers" { count = "${length(var.controller_names)}" @@ -136,6 +160,7 @@ data "template_file" "controller-configs" { template = "${file("${path.module}/cl/controller.yaml.tmpl")}" vars { + os_flavor = "${local.flavor}" domain_name = "${element(var.controller_domains, count.index)}" etcd_name = "${element(var.controller_names, count.index)}" etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", var.controller_names, var.controller_domains))}" @@ -167,6 +192,7 @@ data "template_file" "worker-configs" { template = "${file("${path.module}/cl/worker.yaml.tmpl")}" vars { + os_flavor = "${local.flavor}" domain_name = "${element(var.worker_domains, count.index)}" k8s_dns_service_ip = "${module.bootkube.kube_dns_service_ip}" cluster_domain_suffix = "${var.cluster_domain_suffix}"