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
Conversation
451d4d6
to
58cded0
Compare
looks like this is addressing #3441, am I wrong? |
Yes. Added to the description. |
58cded0
to
4c9a77a
Compare
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>
96340e1
to
b7c61f4
Compare
b7c61f4
to
cf0bb0e
Compare
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question as above
There was a problem hiding this 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
601e91d
to
018d42e
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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? 🤔
There was a problem hiding this comment.
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 🙂
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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! ✅
420ca7f
to
63b1c99
Compare
…ymous resources Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sttts.
// Note that this 'Composition' will be derived from a | ||
// CompositionRevision if the relevant feature flag is enabled. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
Git didn't detect any merge conflicts, but the resulting code didn't build. Signed-off-by: Nic Cope <nicc@rk0n.org>
Git didn't detect any merge conflicts, but the resulting code didn't build. Signed-off-by: Nic Cope <nicc@rk0n.org>
Git didn't detect any merge conflicts, but the resulting code didn't build. Signed-off-by: Nic Cope <nicc@rk0n.org>
Description of your changes
Set the
Ready
condition message for reasonCreating
to be the first 3 unready resources. They are sorted in the composition and hence give a stable message.Fixes #3441.
I have:
make reviewable
to ensure this PR is ready for review.Addedbackport release-x.y
labels to auto-backport this PR, if necessary.Opened a PR updating the docs, if necessary.