Create separate bare-metal container-linux-install profiles

* Create separate container-linux-install profiles (and
cached-container-linux-install) for each node in a cluster
* Fix contention bug on bare-metal during `terraform apply`.
With only a global install profile, terraform would create
(or retain) the profile for each cluster and try to delete
it for each cluster being deleted. As a result, in some cases
apply had to be run multiple times before terraform's repr
of constraints was satisfied (profile deleted and recreated)
* Allow Container Linux install properties to vary between
clusters, such as using a different Container Linux channel
or version for different clusters
This commit is contained in:
Dalton Hubble 2018-01-14 12:36:40 -08:00
parent bbe295a3f1
commit 38fa7dff1a
3 changed files with 21 additions and 7 deletions

View File

@ -12,6 +12,12 @@ Notable changes between versions.
* Update kube-dns from v1.14.7 to v1.14.8 * Update kube-dns from v1.14.7 to v1.14.8
* Use separate service account for kube-dns * Use separate service account for kube-dns
#### Bare-Metal
* Use per-node Container Linux install profiles ([#97](https://github.com/poseidon/typhoon/pull/97))
* Allow Container Linux channel/version to be chosen per-cluster
* Fix issue where cluster deletion could require `terraform apply` multiple times
## v1.9.1 ## v1.9.1
* Kubernetes [v1.9.1](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.9.md#v191) * Kubernetes [v1.9.1](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.9.md#v191)

View File

@ -3,7 +3,7 @@ resource "matchbox_group" "container-linux-install" {
count = "${length(var.controller_names) + length(var.worker_names)}" count = "${length(var.controller_names) + length(var.worker_names)}"
name = "${format("container-linux-install-%s", element(concat(var.controller_names, var.worker_names), count.index))}" name = "${format("container-linux-install-%s", element(concat(var.controller_names, var.worker_names), count.index))}"
profile = "${var.cached_install == "true" ? matchbox_profile.cached-container-linux-install.name : matchbox_profile.container-linux-install.name}" profile = "${var.cached_install == "true" ? element(matchbox_profile.cached-container-linux-install.*.name, count.index) : element(matchbox_profile.container-linux-install.*.name, count.index)}"
selector { selector {
mac = "${element(concat(var.controller_macs, var.worker_macs), count.index)}" mac = "${element(concat(var.controller_macs, var.worker_macs), count.index)}"

View File

@ -1,6 +1,8 @@
// Container Linux Install profile (from release.core-os.net) // Container Linux Install profile (from release.core-os.net)
resource "matchbox_profile" "container-linux-install" { resource "matchbox_profile" "container-linux-install" {
name = "container-linux-install" count = "${length(var.controller_names) + length(var.worker_names)}"
name = "${format("%s-container-linux-install-%s", var.cluster_name, element(concat(var.controller_names, var.worker_names), count.index))}"
kernel = "http://${var.container_linux_channel}.release.core-os.net/amd64-usr/${var.container_linux_version}/coreos_production_pxe.vmlinuz" kernel = "http://${var.container_linux_channel}.release.core-os.net/amd64-usr/${var.container_linux_version}/coreos_production_pxe.vmlinuz"
initrd = [ initrd = [
@ -16,10 +18,12 @@ resource "matchbox_profile" "container-linux-install" {
"${var.kernel_args}", "${var.kernel_args}",
] ]
container_linux_config = "${data.template_file.container-linux-install-config.rendered}" container_linux_config = "${element(data.template_file.container-linux-install-configs.*.rendered, count.index)}"
} }
data "template_file" "container-linux-install-config" { data "template_file" "container-linux-install-configs" {
count = "${length(var.controller_names) + length(var.worker_names)}"
template = "${file("${path.module}/cl/container-linux-install.yaml.tmpl")}" template = "${file("${path.module}/cl/container-linux-install.yaml.tmpl")}"
vars { vars {
@ -37,7 +41,9 @@ data "template_file" "container-linux-install-config" {
// Container Linux Install profile (from matchbox /assets cache) // Container Linux Install profile (from matchbox /assets cache)
// Note: Admin must have downloaded container_linux_version into matchbox assets. // Note: Admin must have downloaded container_linux_version into matchbox assets.
resource "matchbox_profile" "cached-container-linux-install" { resource "matchbox_profile" "cached-container-linux-install" {
name = "cached-container-linux-install" count = "${length(var.controller_names) + length(var.worker_names)}"
name = "${format("%s-cached-container-linux-install-%s", var.cluster_name, element(concat(var.controller_names, var.worker_names), count.index))}"
kernel = "/assets/coreos/${var.container_linux_version}/coreos_production_pxe.vmlinuz" kernel = "/assets/coreos/${var.container_linux_version}/coreos_production_pxe.vmlinuz"
initrd = [ initrd = [
@ -53,10 +59,12 @@ resource "matchbox_profile" "cached-container-linux-install" {
"${var.kernel_args}", "${var.kernel_args}",
] ]
container_linux_config = "${data.template_file.cached-container-linux-install-config.rendered}" container_linux_config = "${element(data.template_file.cached-container-linux-install-configs.*.rendered, count.index)}"
} }
data "template_file" "cached-container-linux-install-config" { data "template_file" "cached-container-linux-install-configs" {
count = "${length(var.controller_names) + length(var.worker_names)}"
template = "${file("${path.module}/cl/container-linux-install.yaml.tmpl")}" template = "${file("${path.module}/cl/container-linux-install.yaml.tmpl")}"
vars { vars {