From 09eb208b4e9858827b130880ed64d0da295379a8 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Tue, 19 May 2020 21:41:51 -0700 Subject: [PATCH] Fix Fedora CoreOS on GCP proposing controller recreate * With Fedora CoreOS image stream support (#727), the latest resolved image will change over the lifecycle of a cluster. * Fix issue where an image diff proposed replacing a Fedora CoreOS controller on GCP, introduced in #727 (unreleased) * Also ignore image diffs to the GCP managed instance group of workers. This aligns with worker AMI diffs being ignored on AWS and similar on Azure, since workers update themselves. Background: * Controller nodes should strictly not be recreated by Terraform, they are stateful (etcd) and should not be replaced * Across cloud platforms, OS image diffs are ignored since both Flatcar Linux and Fedora CoreOS nodes update themselves. For workers, user-data or disk size diffs (where relevant) are allowed to recreate workers templates/configs since these are considered to be user-initiated declarations that a reprovision should be done --- google-cloud/fedora-coreos/kubernetes/controllers.tf | 5 ++++- google-cloud/fedora-coreos/kubernetes/workers/workers.tf | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/google-cloud/fedora-coreos/kubernetes/controllers.tf b/google-cloud/fedora-coreos/kubernetes/controllers.tf index 81e20ed0..3dc96a3e 100644 --- a/google-cloud/fedora-coreos/kubernetes/controllers.tf +++ b/google-cloud/fedora-coreos/kubernetes/controllers.tf @@ -59,7 +59,10 @@ resource "google_compute_instance" "controllers" { tags = ["${var.cluster_name}-controller"] lifecycle { - ignore_changes = [metadata] + ignore_changes = [ + metadata, + boot_disk[0].initialize_params + ] } } diff --git a/google-cloud/fedora-coreos/kubernetes/workers/workers.tf b/google-cloud/fedora-coreos/kubernetes/workers/workers.tf index c6620afe..78367c67 100644 --- a/google-cloud/fedora-coreos/kubernetes/workers/workers.tf +++ b/google-cloud/fedora-coreos/kubernetes/workers/workers.tf @@ -64,6 +64,9 @@ resource "google_compute_instance_template" "worker" { } lifecycle { + ignore_changes = [ + disk[0].source_image + ] # To update an Instance Template, Terraform should replace the existing resource create_before_destroy = true }