Skip to content

Commit

Permalink
Merge pull request #41 from inteon/fix_predicate
Browse files Browse the repository at this point in the history
Also reconcile when the linked issuer receives an update
  • Loading branch information
jetstack-bot authored Aug 16, 2023
2 parents f53614a + f0e3ccf commit 6c17513
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions controllers/predicates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6c17513

Please sign in to comment.