From 3f2978821bc24dbb4246be60342f377e0073944a Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Fri, 20 Apr 2018 17:44:24 -0700 Subject: [PATCH] Add atomic_assets_endpoint var for fedora-atomic bare-metal --- .../kubernetes/kickstart/fedora-atomic.ks.tmpl | 2 +- bare-metal/fedora-atomic/kubernetes/profiles.tf | 12 +++++++++--- bare-metal/fedora-atomic/kubernetes/variables.tf | 12 ++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/bare-metal/fedora-atomic/kubernetes/kickstart/fedora-atomic.ks.tmpl b/bare-metal/fedora-atomic/kubernetes/kickstart/fedora-atomic.ks.tmpl index c3fb9acb..cff58895 100644 --- a/bare-metal/fedora-atomic/kubernetes/kickstart/fedora-atomic.ks.tmpl +++ b/bare-metal/fedora-atomic/kubernetes/kickstart/fedora-atomic.ks.tmpl @@ -17,7 +17,7 @@ network --bootproto=dhcp --device=link --activate --onboot=on bootloader --timeout=1 --append="ds=nocloud\;seedfrom=/var/cloud-init/" services --enabled=cloud-init,cloud-init-local,cloud-config,cloud-final -ostreesetup --osname="fedora-atomic" --remote="fedora-atomic-27" --url="${matchbox_http_endpoint}/assets/fedora/27/repo" --ref=fedora/27/x86_64/atomic-host --nogpg +ostreesetup --osname="fedora-atomic" --remote="fedora-atomic-27" --url="${atomic_assets_endpoint}/repo" --ref=fedora/27/x86_64/atomic-host --nogpg reboot diff --git a/bare-metal/fedora-atomic/kubernetes/profiles.tf b/bare-metal/fedora-atomic/kubernetes/profiles.tf index 252b8f45..4eb761c2 100644 --- a/bare-metal/fedora-atomic/kubernetes/profiles.tf +++ b/bare-metal/fedora-atomic/kubernetes/profiles.tf @@ -1,3 +1,8 @@ +locals { + default_assets_endpoint = "${var.matchbox_http_endpoint}/assets/fedora/27" + atomic_assets_endpoint = "${var.atomic_assets_endpoint != "" ? var.atomic_assets_endpoint : local.default_assets_endpoint}" +} + // Cached Fedora Install profile (from matchbox /assets cache) // Note: Admin must have downloaded Fedora kernel, initrd, and repo into // matchbox assets. @@ -5,15 +10,15 @@ resource "matchbox_profile" "cached-fedora-install" { count = "${length(var.controller_names) + length(var.worker_names)}" name = "${format("%s-cached-fedora-install-%s", var.cluster_name, element(concat(var.controller_names, var.worker_names), count.index))}" - kernel = "/assets/fedora/27/vmlinuz" + kernel = "${local.atomic_assets_endpoint}/images/pxeboot/vmlinuz" initrd = [ - "/assets/fedora/27/initrd.img", + "${local.atomic_assets_endpoint}/images/pxeboot/initrd.img", ] args = [ "initrd=initrd.img", - "inst.repo=${var.matchbox_http_endpoint}/assets/fedora/27/Server/x86_64/os/", + "inst.repo=${local.atomic_assets_endpoint}", "inst.ks=${var.matchbox_http_endpoint}/generic?mac=${element(concat(var.controller_macs, var.worker_macs), count.index)}", "inst.text", "${var.kernel_args}", @@ -30,6 +35,7 @@ data "template_file" "install-kickstarts" { vars { matchbox_http_endpoint = "${var.matchbox_http_endpoint}" + atomic_assets_endpoint = "${local.atomic_assets_endpoint}" mac = "${element(concat(var.controller_macs, var.worker_macs), count.index)}" } } diff --git a/bare-metal/fedora-atomic/kubernetes/variables.tf b/bare-metal/fedora-atomic/kubernetes/variables.tf index f2406c7f..73071000 100644 --- a/bare-metal/fedora-atomic/kubernetes/variables.tf +++ b/bare-metal/fedora-atomic/kubernetes/variables.tf @@ -10,6 +10,16 @@ variable "matchbox_http_endpoint" { description = "Matchbox HTTP read-only endpoint (e.g. http://matchbox.example.com:8080)" } +variable "atomic_assets_endpoint" { + type = "string" + default = "" + description = <