From d42f47c49ebddfb8c558a91d5dc4ba9227c0ffe4 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Mon, 17 Dec 2018 14:13:50 -0800 Subject: [PATCH] Update terraform-provider-ct plugin from v0.2.1 to v0.3.0 * Provide migration instructions for upgrading terraform-provider-ct in-place for v1.12.2+ clusters * Require switching from ~/.terraformrc to the Terraform third-party plugins directory ~/.terraform.d/plugins/ * Require Container Linux 1688.5.3 or newer --- CHANGES.md | 6 ++- docs/cl/aws.md | 10 ++--- docs/cl/azure.md | 10 ++--- docs/cl/bare-metal.md | 8 ++-- docs/cl/digital-ocean.md | 10 ++--- docs/cl/google-cloud.md | 8 ++-- docs/topics/maintenance.md | 77 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 105 insertions(+), 24 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 000f024ad..1b029a997 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,9 +5,13 @@ Notable changes between versions. ## Latest * Kubernetes [v1.13.1](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.13.md#v1131) -* Update Calico from v3.3.2 to [v3.4.0](https://docs.projectcalico.org/v3.4/releases/) +* Update Calico from v3.3.2 to [v3.4.0](https://docs.projectcalico.org/v3.4/releases/) ([#362](https://github.com/poseidon/typhoon/pull/362)) * Install CNI plugins with an init container rather than a sidecar * Improve the `calico-node` ClusterRole +* Recommend updating `terraform-provider-ct` plugin from v0.2.1 to v0.3.0 ([#363](https://github.com/poseidon/typhoon/pull/363)) + * [Migration](https://typhoon.psdn.io/topics/maintenance/#upgrade-terraform-provider-ct) instructions for upgrading `terraform-provider-ct` in-place for v1.12.2+ clusters (**action required**) + * [Require](https://typhoon.psdn.io/topics/maintenance/#terraform-plugins-directory) switching from `~/.terraformrc` to the Terraform [third-party plugins](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins) directory `~/.terraform.d/plugins/` + * Require Container Linux 1688.5.3 or newer #### Google Cloud diff --git a/docs/cl/aws.md b/docs/cl/aws.md index 5536f03b5..b0cfc92e4 100644 --- a/docs/cl/aws.md +++ b/docs/cl/aws.md @@ -18,15 +18,15 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.11.x on your sys ```sh $ terraform version -Terraform v0.11.7 +Terraform v0.11.11 ``` Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name. ```sh -wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.2.1/terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -tar xzf terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -mv terraform-provider-ct-v0.2.1-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.2.1 +wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.3.0/terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +tar xzf terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +mv terraform-provider-ct-v0.3.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.0 ``` Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`). @@ -57,7 +57,7 @@ provider "aws" { } provider "ct" { - version = "0.2.1" + version = "0.3.0" } provider "local" { diff --git a/docs/cl/azure.md b/docs/cl/azure.md index f2a384d40..bfc875547 100644 --- a/docs/cl/azure.md +++ b/docs/cl/azure.md @@ -21,15 +21,15 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.11.x on your sys ```sh $ terraform version -Terraform v0.11.7 +Terraform v0.11.11 ``` Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name. ```sh -wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.2.1/terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -tar xzf terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -mv terraform-provider-ct-v0.2.1-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.2.1 +wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.3.0/terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +tar xzf terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +mv terraform-provider-ct-v0.3.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.0 ``` Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`). @@ -55,7 +55,7 @@ provider "azurerm" { } provider "ct" { - version = "0.2.1" + version = "0.3.0" } provider "local" { diff --git a/docs/cl/bare-metal.md b/docs/cl/bare-metal.md index f629e82a0..4fd894515 100644 --- a/docs/cl/bare-metal.md +++ b/docs/cl/bare-metal.md @@ -124,9 +124,9 @@ mv terraform-provider-matchbox-v0.2.2-linux-amd64/terraform-provider-matchbox ~/ Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name. ```sh -wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.2.1/terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -tar xzf terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -mv terraform-provider-ct-v0.2.1-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.2.1 +wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.3.0/terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +tar xzf terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +mv terraform-provider-ct-v0.3.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.0 ``` Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`). @@ -149,7 +149,7 @@ provider "matchbox" { } provider "ct" { - version = "0.2.1" + version = "0.3.0" } provider "local" { diff --git a/docs/cl/digital-ocean.md b/docs/cl/digital-ocean.md index a62537dba..c25118405 100644 --- a/docs/cl/digital-ocean.md +++ b/docs/cl/digital-ocean.md @@ -18,15 +18,15 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.11.x on your sys ```sh $ terraform version -Terraform v0.11.7 +Terraform v0.11.11 ``` Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name. ```sh -wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.2.1/terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -tar xzf terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -mv terraform-provider-ct-v0.2.1-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.2.1 +wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.3.0/terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +tar xzf terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +mv terraform-provider-ct-v0.3.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.0 ``` Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`). @@ -56,7 +56,7 @@ provider "digitalocean" { } provider "ct" { - version = "0.2.1" + version = "0.3.0" } provider "local" { diff --git a/docs/cl/google-cloud.md b/docs/cl/google-cloud.md index ee063008e..4762e0262 100644 --- a/docs/cl/google-cloud.md +++ b/docs/cl/google-cloud.md @@ -24,9 +24,9 @@ Terraform v0.11.7 Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name. ```sh -wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.2.1/terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -tar xzf terraform-provider-ct-v0.2.1-linux-amd64.tar.gz -mv terraform-provider-ct-v0.2.1-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.2.1 +wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.3.0/terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +tar xzf terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +mv terraform-provider-ct-v0.3.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.0 ``` Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`). @@ -58,7 +58,7 @@ provider "google" { } provider "ct" { - version = "0.2.1" + version = "0.3.0" } provider "local" { diff --git a/docs/topics/maintenance.md b/docs/topics/maintenance.md index b6c7712d5..ee9b030b5 100644 --- a/docs/topics/maintenance.md +++ b/docs/topics/maintenance.md @@ -193,3 +193,80 @@ $ terraform init $ terraform plan ``` +### Upgrade terraform-provider-ct + +The [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin parses, validates, and converts Container Linux Configs into Ignition user-data for provisioning instances. Previously, updating the plugin re-provisioned controller nodes and was destructive to clusters. With Typhoon v1.12.2+, the plugin can be updated in-place and on apply, only workers will be replaced. + +First, [migrate](#terraform-plugins-directory) to the Terraform 3rd-party plugin directory to allow 3rd-party plugins to be defined and versioned independently (rather than globally). + +Add the [terraform-provider-ct](https://github.com/coreos/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name. + +```sh +wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.3.0/terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +tar xzf terraform-provider-ct-v0.3.0-linux-amd64.tar.gz +mv terraform-provider-ct-v0.3.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.0 +``` + +Binary names are versioned. This enables the ability to upgrade different plugins and have clusters pin different versions. + +``` +$ tree ~/.terraform.d/ +/home/user/.terraform.d/ +└── plugins + ├── terraform-provider-ct_v0.2.1 + ├── terraform-provider-ct_v0.3.0 + └── terraform-provider-matchbox_v0.2.2 +``` + + +Update the version of the `ct` plugin in each Terraform working directory. Typhoon clusters managed in the working directory **must** be v1.12.2 or higher. + +``` +# providers.tf +provider "ct" { + version = "0.3.0" +} +``` + +Run init and plan to check that no diff is proposed for the controller nodes (a diff would destroy cluster state). + +``` +terraform init +terraform plan +``` + +Apply the change. Worker nodes' user-data will be changed and workers will be replaced. Rollout happens slightly differently on each platform: + + +#### AWS + +AWS creates a new worker ASG, then removes the old ASG. New workers join the cluster and old workers disappear. `terraform apply` will hang during this process. + +#### Azure + +Azure edits the worker scale set in-place instantly. Manually terminate workers to create replacement workers using the new user-data. + +#### Bare-Metal + +No action is needed. Bare-Metal machines do not re-PXE unless explicitly made to do so. + +#### DigitalOcean + +DigitalOcean destroys existing worker nodes and DNS records, then creates new workers and DNS records. DigitalOcean lacks a "managed group" notion. For worker droplets to join the cluster, you **must** taint the secret copying step to indicate it must be repeated to add the kubeconfig to new workers. + +``` +# old workers destroyed, new workers created +terraform apply + +# add kubeconfig to new workers +terraform state list | grep null_resource +terraform taint -module digital-ocean-nemo null_resource.copy-worker-secrets.N +terraform apply +``` + +Expect downtime. + +#### Google Cloud + +Google Cloud creates a new worker template and edits the worker instance group instantly. Manually terminate workers and replacement workers will use the user-data. +