From 53c464c3055854336c42458e8b3faae059bfe60f Mon Sep 17 00:00:00 2001 From: Justin SB Date: Mon, 3 Aug 2020 12:58:47 -0400 Subject: [PATCH] GCE: Fix spurious comparison failures on adddress & InstanceTemplate Spruce up the find logic to avoid detecting changes that aren't there. --- upup/pkg/fi/cloudup/gcetasks/address.go | 10 ++++++++++ upup/pkg/fi/cloudup/gcetasks/instancetemplate.go | 1 + 2 files changed, 11 insertions(+) diff --git a/upup/pkg/fi/cloudup/gcetasks/address.go b/upup/pkg/fi/cloudup/gcetasks/address.go index 69661d38007cc..c2cd0c17a7108 100644 --- a/upup/pkg/fi/cloudup/gcetasks/address.go +++ b/upup/pkg/fi/cloudup/gcetasks/address.go @@ -35,12 +35,22 @@ type Address struct { ForAPIServer bool } +var _ fi.CompareWithID = &ForwardingRule{} + +func (e *Address) CompareWithID() *string { + return e.Name +} + func (e *Address) Find(c *fi.Context) (*Address, error) { actual, err := e.find(c.Cloud.(gce.GCECloud)) if actual != nil && err == nil { if e.IPAddress == nil { e.IPAddress = actual.IPAddress } + + // Ignore system fields + actual.Lifecycle = e.Lifecycle + actual.ForAPIServer = e.ForAPIServer } return actual, err } diff --git a/upup/pkg/fi/cloudup/gcetasks/instancetemplate.go b/upup/pkg/fi/cloudup/gcetasks/instancetemplate.go index eb81a73cd8f5c..6b9e12836985b 100644 --- a/upup/pkg/fi/cloudup/gcetasks/instancetemplate.go +++ b/upup/pkg/fi/cloudup/gcetasks/instancetemplate.go @@ -139,6 +139,7 @@ func (e *InstanceTemplate) Find(c *fi.Context) (*InstanceTemplate, error) { for _, scope := range serviceAccount.Scopes { actual.Scopes = append(actual.Scopes, scopeToShortForm(scope)) } + actual.ServiceAccounts = append(actual.ServiceAccounts, serviceAccount.Email) } // When we deal with additional disks (local disks), we'll need to map them like this...