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

apiextensions/composite: list unready resources in condition message #4565

Merged
merged 7 commits into from Sep 12, 2023

Conversation

sttts
Copy link
Contributor

@sttts sttts commented Sep 4, 2023

Description of your changes

Set the Ready condition message for reason Creating to be the first 3 unready resources. They are sorted in the composition and hence give a stable message.

Bildschirmfoto 2023-09-04 um 18 49 12

Fixes #3441.

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.

@sttts sttts requested review from turkenh and a team as code owners September 4, 2023 15:46
@sttts sttts requested a review from pedjak September 4, 2023 15:46
@phisco
Copy link
Contributor

phisco commented Sep 6, 2023

looks like this is addressing #3441, am I wrong?

@sttts
Copy link
Contributor Author

sttts commented Sep 6, 2023

looks like this is addressing #3441, am I wrong?

Yes. Added to the description.

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
@sttts sttts force-pushed the sttts-compositor-messages branch 2 times, most recently from 96340e1 to b7c61f4 Compare September 8, 2023 08:18
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
@sttts sttts requested a review from a team as a code owner September 8, 2023 12:39
log.Debug("Composite resource is not yet ready")
record.Event(cm, event.Normal(reasonBind, "Composite resource is not yet ready"))
if cpReady := cp.GetCondition(xpv1.TypeReady); !resource.IsConditionTrue(cpReady) {
log.Debug("Composite resource is not yet ready", "reason", cpReady.Reason, "message", cpReady.Message)
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be helpful to add to the log the composite name as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be. Not caring about the debug logs though. They are useless anyway. If we cared, we would think about info level ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that the claim should be part of the log. The claim includes the composition reference.

if cpReady := cp.GetCondition(xpv1.TypeReady); !resource.IsConditionTrue(cpReady) {
log.Debug("Composite resource is not yet ready", "reason", cpReady.Reason, "message", cpReady.Message)
if msg := cpReady.Message; msg != "" {
record.Event(cm, event.Normal(reasonBind, fmt.Sprintf("%s: %s", Waiting().Message, msg)))
Copy link
Contributor

Choose a reason for hiding this comment

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

same question as above

Copy link
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

LGTM, - I would add also composite name to the log/events, but not blocking on it

Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

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

Your continued efforts to improve the dev experience are really appreciated @sttts!! Just one question about how we handle resources that potentially don't have a name 🤔

xr.SetConditions(xpv1.Creating())
names := make([]string, len(unready))
for i, cd := range unready {
names[i] = cd.ResourceName
Copy link
Member

Choose a reason for hiding this comment

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

is ResourceName guaranteed to be a non empty string? https://github.com/crossplane/crossplane/blob/master/internal/controller/apiextensions/composite/reconciler.go#L628-L633 is making think that it doesn't have that guarantee - would we want to do something different with the name here, e.g. fall back to its index number? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we should print the group kind and name. I was there before actually, then thought that the names are what ppl refer to. Now you are (rightfully) saying they are optional 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, kind and name are not guaranteed either. Especially, with the Kubernetes provider these are all objects. The index exists in p&f, not in functions afaik. Looks like we need some heuristic decided by the compositor. What matters here is that we find something pragmatic rather than perfect. Would rather do something imperfect than postponing this topic another 2 years. So +1 putting there the best we have to identify the object. This might also encourage ppl to put proper resource names there to avoid "resource 7" like messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Double checked: I think we are good. For p&f, anonymous resources get %d as name. I have made that a little prettier via resource %d now. In functions, anonymous resources are not allowed:

The PTFComposer does not support anonymous templates

@jbw976 ptal

Copy link
Member

Choose a reason for hiding this comment

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

sounds good @sttts, thanks for looking deeper into that! ✅

…ymous resources

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
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 @sttts.

Comment on lines 534 to 535
// Note that this 'Composition' will be derived from a
// CompositionRevision if the relevant feature flag is enabled.
Copy link
Member

Choose a reason for hiding this comment

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

This comment is stale - revisions are GA and can't be disabled. Not related to this PR but it would be nice to update if doing so is easy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
@phisco phisco merged commit d7542dd into crossplane:master Sep 12, 2023
16 checks passed
negz added a commit to negz/crossplane that referenced this pull request Sep 13, 2023
Git didn't detect any merge conflicts, but the resulting code didn't
build.

Signed-off-by: Nic Cope <nicc@rk0n.org>
negz added a commit to negz/crossplane that referenced this pull request Sep 13, 2023
Git didn't detect any merge conflicts, but the resulting code didn't
build.

Signed-off-by: Nic Cope <nicc@rk0n.org>
negz added a commit to negz/crossplane that referenced this pull request Sep 13, 2023
Git didn't detect any merge conflicts, but the resulting code didn't
build.

Signed-off-by: Nic Cope <nicc@rk0n.org>
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.

Report which resources are blocking the transition to Ready state
6 participants