Compose a namespaced Request for a namespaced composite - #16
Merged
Conversation
The Request's API group was hard-coded to http.crossplane.io/v1alpha2, which is cluster scoped. Crossplane refuses to apply a cluster scoped composed resource for a namespaced composite, failing the entire reconcile: cannot compose resources: cannot apply cluster scoped composed resource "..." (a Request named ) for a namespaced composite resource So any consumer whose XRD is scope: Namespaced cannot use this function at all. netclab-xp is moving its whole surface to Namespaced and hit exactly this. Pick the group from the composite's own namespace, which the function already reads: namespaced composites get http.m.crossplane.io/v1alpha2, cluster scoped ones keep http.crossplane.io/v1alpha2 unchanged. Nothing else moves -- Crossplane places a composed namespaced resource in the composite's namespace by itself, and provider-http defaults providerConfigRef to the ProviderConfig named "default" there, so neither needs spelling out. Verified with crossplane render against the running function, both ways: the existing cluster scoped example still renders http.crossplane.io, the same XR with a namespace renders http.m.crossplane.io. The existing unit test covers the cluster scoped case (its fixture has no namespace); the new one covers the namespaced case. Note that the namespaced Request needs provider-http >=v1.0.14, which is the first release serving http.m.crossplane.io. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The composed
Request's API group was hard-coded tohttp.crossplane.io/v1alpha2,which is cluster scoped. Crossplane refuses to apply a cluster scoped composed
resource for a namespaced composite, and fails the whole reconcile:
So this function cannot be used at all by a consumer whose XRD is
scope: Namespaced.netclab-xpis moving its entire surface to Namespaced andhit exactly this — its
EosCommandlayer is blocked until this ships.The change
Pick the group from the composite's own namespace, which the function already
reads a line above:
http.m.crossplane.io/v1alpha2http.crossplane.io/v1alpha2, unchangedNothing else moves. Crossplane places a composed namespaced resource in the
composite's namespace by itself, and provider-http defaults
providerConfigRefto the ProviderConfig named
defaultin that namespace — both confirmed on alive cluster, so neither has to be spelled out here.
Verification
crossplane renderagainst the running function, both ways, using the existingexample/manifests:example/xr1.yaml(no namespace)http.crossplane.io/v1alpha2namespace: labhttp.m.crossplane.io/v1alpha2Unit tests: the existing one already covers the cluster scoped case, because its
fixture composite carries no namespace — it is the backward-compatibility guard.
The new one covers the namespaced case and asserts every composed resource, not
just the first.
Notes for the release
function/__version__.pyis bumped to0.0.22, sinceci-with-bnp.yamlfails the release when the tag and that file disagree.
Requestrequires provider-http >=v1.0.14, the first releaseserving
http.m.crossplane.io. Consumers staying cluster scoped areunaffected.
🤖 Generated with Claude Code