Skip to content

Commit

Permalink
WIP: xrd/claim: event triggered composite update event
Browse files Browse the repository at this point in the history
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
  • Loading branch information
sttts committed Jul 11, 2023
1 parent bb58425 commit fd64e44
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/controller/apiextensions/claim/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, cm), errUpdateClaimStatus)
}

oldRV := cp.GetResourceVersion()
if err := r.client.Apply(ctx, cp); err != nil {
log.Debug(errApplyComposite, "error", err)
err = errors.Wrap(err, errApplyComposite)
Expand All @@ -528,8 +529,12 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, cm), errUpdateClaimStatus)
}

log.Debug("Successfully applied composite resource")
record.Event(cm, event.Normal(reasonCompositeConfigure, "Successfully applied composite resource"))
if oldRV != cp.GetResourceVersion() {
log.Debug("Successfully applied composite resource")
record.Event(cm, event.Normal(reasonCompositeConfigure, "Successfully applied composite resource"))
} else {
log.Debug("Skipped no-op composite resource apply")
}

if err := r.claim.Configure(ctx, cm, cp); err != nil {
log.Debug(errConfigureClaim, "error", err)
Expand Down

0 comments on commit fd64e44

Please sign in to comment.