From f0e3ccfadaa0b6fed9da7e8e9cb8d0508ca036e3 Mon Sep 17 00:00:00 2001 From: Tim Ramlot <42113979+inteon@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:38:51 +0200 Subject: [PATCH] also reconcile when the linked issuer receives an update Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> --- controllers/predicates.go | 3 ++- controllers/predicates_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/controllers/predicates.go b/controllers/predicates.go index 414a94f..4812b77 100644 --- a/controllers/predicates.go +++ b/controllers/predicates.go @@ -121,6 +121,7 @@ func (CertificateSigningRequestPredicate) Update(e event.UpdateEvent) bool { // In these cases we want to trigger: // - the Ready condition was added/ removed // - the Ready condition's Status property changed +// - the Ready condition's observed generation changed type LinkedIssuerPredicate struct { predicate.Funcs } @@ -156,7 +157,7 @@ func (LinkedIssuerPredicate) Update(e event.UpdateEvent) bool { return readyOld != nil || readyNew != nil } - return readyNew.Status != readyOld.Status + return readyNew.Status != readyOld.Status || readyNew.ObservedGeneration != readyOld.ObservedGeneration } // Predicate for Issuer events that should trigger the Issuer reconciler diff --git a/controllers/predicates_test.go b/controllers/predicates_test.go index 2678b44..812b5f1 100644 --- a/controllers/predicates_test.go +++ b/controllers/predicates_test.go @@ -506,6 +506,31 @@ func TestLinkedIssuerPredicate(t *testing.T) { ), }, }, + { + name: "ready-condition-identical-new-observed-generation", + shouldReconcile: true, + event: event.UpdateEvent{ + ObjectOld: testutil.SimpleIssuerFrom(issuer1, + testutil.SetSimpleIssuerStatusCondition( + fakeClock, + cmapi.IssuerConditionReady, + cmmeta.ConditionFalse, + "reason1", + "message1", + ), + ), + ObjectNew: testutil.SimpleIssuerFrom(issuer1, + testutil.SetSimpleIssuerGeneration(2), + testutil.SetSimpleIssuerStatusCondition( + fakeClock, + cmapi.IssuerConditionReady, + cmmeta.ConditionFalse, + "reason2", + "message2", + ), + ), + }, + }, { name: "ready-condition-changed", shouldReconcile: true,