From 902e5a5c104c1bde260d84d3f67e0fd490f2aa6b Mon Sep 17 00:00:00 2001 From: Gerrit91 Date: Thu, 2 May 2024 10:12:08 +0200 Subject: [PATCH] Update firewall when controller version changes. --- controllers/monitor/reconcile.go | 4 ++++ controllers/monitor/reconcile_test.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/controllers/monitor/reconcile.go b/controllers/monitor/reconcile.go index 892e3a7..4bcf1cb 100644 --- a/controllers/monitor/reconcile.go +++ b/controllers/monitor/reconcile.go @@ -128,6 +128,10 @@ func significantFirewallStatusChange(o, n v2.FirewallStatus) bool { return true } + if o.ControllerStatus != nil && n.ControllerStatus != nil && o.ControllerStatus.ActualVersion != n.ControllerStatus.ActualVersion { + return true + } + if !cmp.Equal(o.Conditions, n.Conditions, cmpopts.IgnoreFields(v2.Condition{}, "Message", "LastUpdateTime", "LastTransitionTime")) { return true } diff --git a/controllers/monitor/reconcile_test.go b/controllers/monitor/reconcile_test.go index 5090bc1..76adeb7 100644 --- a/controllers/monitor/reconcile_test.go +++ b/controllers/monitor/reconcile_test.go @@ -60,6 +60,20 @@ func Test_significantFirewallStatusChange(t *testing.T) { }, want: true, }, + { + name: "controller version update", + o: v2.FirewallStatus{ + ControllerStatus: &v2.ControllerConnection{ + ActualVersion: "v1.2.3", + }, + }, + n: v2.FirewallStatus{ + ControllerStatus: &v2.ControllerConnection{ + ActualVersion: "v1.2.4", + }, + }, + want: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {