Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(message): fix event message to print composition revision #4714

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

haarchri
Copy link
Contributor

@haarchri haarchri commented Oct 2, 2023

Description of your changes

before this PR:
Selected composition revision: %!s(MISSING)

after this PR:
Selected composition revision: xclusters.aws.caas.upbound.io-5ebaa5e

Fixes #4708

I have:

  • Read and followed Crossplane's contribution process.
  • Added or updated unit and E2E tests for my change.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, if necessary.
  • Opened a PR updating the docs, if necessary.

@haarchri haarchri requested review from turkenh and a team as code owners October 2, 2023 21:41
@haarchri haarchri requested a review from lsviben October 2, 2023 21:41
Copy link
Member

@negz negz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Perhaps we should have an event.Normalf for this, as a future improvement. event.Normal takes KV pairs as variadic args and includes them with its events, but those aren't super easy to find (I think you have do kubectl describe events to see them.

@@ -538,7 +538,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, xr), errUpdateStatus)
}
if rev := xr.GetCompositionRevisionReference(); rev != nil && (origRev == nil || *rev != *origRev) {
r.record.Event(xr, event.Normal(reasonResolve, "Selected composition revision: %s", rev.Name))
r.record.Event(xr, event.Normal(reasonResolve, fmt.Sprintf("Selected composition revision: %s", rev.Name)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normal takes key/value pairs from the 3rd argument on, so the other option here is to make it

Suggested change
r.record.Event(xr, event.Normal(reasonResolve, fmt.Sprintf("Selected composition revision: %s", rev.Name)))
r.record.Event(xr, event.Normal(reasonResolve, "Selected composition revision", "name", rev.Name)))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking better at it, we don't use annotations much, just in a few places, these are not shown when viewing events, I'd say we can continue using fmt.Sprintf, wdyt? CC @negz @sttts

Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
@phisco phisco merged commit d33805b into crossplane:master Oct 3, 2023
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selected composition revision: %!s(MISSING)
3 participants