feat: enable namespaced reference resolution#843
Merged
jbw976 merged 1 commit intocrossplane:mainfrom Jun 9, 2025
Merged
Conversation
phisco
approved these changes
Jun 6, 2025
negz
approved these changes
Jun 7, 2025
|
|
||
| // The reference was not set, but a selector was. Select a reference. | ||
| if err := r.client.List(ctx, req.To.List, client.MatchingLabels(req.Selector.MatchLabels)); err != nil { | ||
| if err := r.client.List(ctx, req.To.List, client.MatchingLabels(req.Selector.MatchLabels), client.InNamespace(req.Namespace)); err != nil { |
Member
There was a problem hiding this comment.
Might be worth adding a note that InNamespace is a no-op if the namespace is empty. I always find that ambiguous when reading it.
Member
Author
There was a problem hiding this comment.
good call, just pushed an update to include a comment on this behavior!
5 tasks
Signed-off-by: Jared Watts <jbw976@gmail.com>
This was referenced Jun 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
This PR updates the Resolve methods to take into a namespace when resolving references. This is needed for v2 compatible providers that have namespaced managed resources.
I considered updating
ResolutionRequest.Referenceitself to become a reference type that includes a namespace field, but I decided against that for the following reasons:This PR is against
mainsince Crossplane core development has moved onto v2 now.Part of crossplane/crossplane#6381
Related PR: crossplane/crossplane-tools#110
These changes have been tested as demonstrated in this demo repo: https://github.com/jbw976/demo-upjet-namespaced-refs
I have:
earthly +reviewableto ensure this PR is ready for review.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.