From 92b9101cc556660c9eda8249ba5813bb82faa653 Mon Sep 17 00:00:00 2001 From: Gerrit91 Date: Wed, 8 May 2024 15:47:00 +0200 Subject: [PATCH] Do not react on maintenance annotation. --- controllers/deployment/controller.go | 1 + integration/suite_test.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/controllers/deployment/controller.go b/controllers/deployment/controller.go index a604540..6366b87 100644 --- a/controllers/deployment/controller.go +++ b/controllers/deployment/controller.go @@ -36,6 +36,7 @@ func SetupWithManager(log logr.Logger, recorder record.EventRecorder, mgr ctrl.M &v2.FirewallDeployment{}, builder.WithPredicates( predicate.And( + predicate.Not(v2.AnnotationAddedPredicate(v2.MaintenanceAnnotation)), predicate.Not(v2.AnnotationRemovedPredicate(v2.MaintenanceAnnotation)), predicate.Or( predicate.GenerationChangedPredicate{}, // prevents reconcile on status sub resource update diff --git a/integration/suite_test.go b/integration/suite_test.go index 89389c0..608e49f 100644 --- a/integration/suite_test.go +++ b/integration/suite_test.go @@ -16,6 +16,7 @@ import ( "github.com/metal-stack/firewall-controller-manager/controllers/firewall" "github.com/metal-stack/firewall-controller-manager/controllers/monitor" "github.com/metal-stack/firewall-controller-manager/controllers/set" + "github.com/metal-stack/firewall-controller-manager/controllers/update" metalclient "github.com/metal-stack/metal-go/test/client" "github.com/metal-stack/metal-lib/pkg/tag" . "github.com/onsi/ginkgo/v2" @@ -158,6 +159,14 @@ var _ = BeforeSuite(func() { ) Expect(err).ToNot(HaveOccurred()) + err = update.SetupWithManager( + ctrl.Log.WithName("controllers").WithName("update"), + mgr.GetEventRecorderFor("update-controller"), + mgr, + cc, + ) + Expect(err).ToNot(HaveOccurred()) + err = deployment.SetupWebhookWithManager(ctrl.Log.WithName("defaulting-webhook"), mgr, cc) Expect(err).ToNot(HaveOccurred()) err = set.SetupWebhookWithManager(ctrl.Log.WithName("defaulting-webhook"), mgr, cc)