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

Add crossplaneResourceTree to get a list of all descendantes of a given XRM Resource. #105

Merged
merged 4 commits into from Sep 28, 2022

Conversation

thephred
Copy link
Member

Description of your changes

Add xrmResourceTree to get a list of all descendantes of a given XRM Resource.

Resovles #95

I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

Ran make and make reviewable

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.

Couldn't you (almost?) write a GraphQL query to get this information with what we have in the schema today using inline fragments? I'm guessing the only blocker is that GraphQL doesn't currently support recursive queries.

schema/queries.gql Outdated Show resolved Hide resolved
schema/queries.gql Outdated Show resolved Hide resolved
Co-authored-by: Nic Cope <nicc@rk0n.org>
@thephred
Copy link
Member Author

Couldn't you (almost?) write a GraphQL query to get this information with what we have in the schema today using inline fragments? I'm guessing the only blocker is that GraphQL doesn't currently support recursive queries.

You are spot on. We want to be able to get this list and we run into depth limitations and verbose queries. Also it might be reasonable to page the results eventually and this wouldn't make sense in the recursive case.

@thephred thephred requested a review from negz September 26, 2022 23:06
@thephred thephred changed the title Add xrmResourceTree to get a list of all descendantes of a given XRM Resource. Add crossplaneResourceTree to get a list of all descendantes of a given XRM Resource. Sep 26, 2022
for composing all `KubernetesResources`
(Will be squashed)
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.

One schema question, but the resolver implementation LGTM.

Comment on lines +165 to +169
crossplaneResourceTree(
"The `ID` of an `CrossplaneResource`"
id: ID!
): CrossplaneResourceTreeConnection!
}
Copy link
Member

Choose a reason for hiding this comment

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

I imagine this could also be a field on claims, XRs, etc like children or exploded rather than a distinct query. Would that offer a better or worse UX?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would work but it could result in asking for a tree for every object in an array or even worse asking for a tree for every element in a tree. By putting it at a top level we encourage it to be used more conservatively.

@thephred thephred merged commit 739f951 into upbound:main Sep 28, 2022
@thephred thephred deleted the resource-tree branch September 28, 2022 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants