feat: migrate to Crossplane v2 with namespaced composite resources#10
Merged
feat: migrate to Crossplane v2 with namespaced composite resources#10
Conversation
Migrates the tutorial to the Crossplane v2 programming model with namespaced XRs. Claims no longer exist in v2, so claim examples/harness are dropped; XRs are now applied directly to a namespace (default). Changes: - All 8 XRDs: apiextensions.crossplane.io/v1 -> v2, scope: Namespaced, claimNames removed, X-prefix dropped from kind/plural/name - Compositions: update metadata.name + compositeTypeRef.kind; set metadata.namespace = oxr.metadata.namespace on every composed resource (required: namespaced XRs can only compose namespaced resources) - Examples: rename X-prefixed directories, drop claim.yaml/claim.k, each xr.yaml sets kind to the new name and metadata.namespace: default - Dependencies bumped for v2 compatibility: - provider-nop v0.2.1 -> v0.5.0 (adds namespaced NopResource kind) - function-kcl v0.8.0 -> v0.12.1 (built against crossplane-runtime/v2) - function-auto-ready v0.2.1 -> v0.6.3 - crossplane version constraint: >=v1.15.2 -> >=v2.0.0-0 (the -0 suffix matches pre-release tags like UXP v2.2.0-up.N) - Makefile: fix uptest paths for renamed dirs, update CROSSPLANE_NAMESPACE to crossplane-system, promote crossplane beta render -> crossplane render - README.md: rewrite for v2 (namespaced XRs, up CLI preferred, no claims) - Remove test-harness.sh (claim-based) and migration plan file Verified end-to-end on fresh kind cluster with upstream Crossplane v2.2.0: all 8 XRDs established, all 8 example XRs SYNCED + READY, 14 namespaced NopResources in default, CompositeCluster composes 5 nested XRs, clean deletion confirmed.
haarchri
approved these changes
Apr 14, 2026
Member
haarchri
left a comment
There was a problem hiding this comment.
thanks for unblock v2, can we get this converted to a Project in a followup ? And use our normal CI Workflow and RepoSetup too ?
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.
Summary
Migrates
configuration-getting-startedto the Crossplane v2 programming model with namespaced composite resources. Claims are gone in v2, so the tutorial now shows how to apply XRs directly to a namespace (defaultdefault).Context: found while debugging a UXP v2 incompatibility with Mark Anderson-Trocme. The immediate UXP bug (suffix-stripping regression in
v2.2.0-up.1..up.4) is already fixed inv2.2.0-up.5via upbound/crossplane#213, but the repo itself still targeted the v1 model and was overdue for a v2 port.Changes
XRDs (8 files)
apiextensions.crossplane.io/v1→v2spec.scope: NamespacedclaimNames(claims aren't supported in v2)Xprefix frommetadata.name,spec.names.kind,spec.names.pluralxclusters.platform.acme.co/XClusterclusters.platform.acme.co/Clusterxdatabases/XDatabasedatabases/Databasexnetworks/XNetworknetworks/Networkxnodepools/XNodePoolnodepools/NodePoolxserviceaccounts/XServiceAccountserviceaccounts/ServiceAccountxsubnetworks/XSubnetworksubnetworks/Subnetworkxaccountscaffolds/XAccountScaffoldaccountscaffolds/AccountScaffoldxcompositeclusters/XCompositeClustercompositeclusters/CompositeClusterCompositions (8 files)
metadata.name+compositeTypeRef.kindupdated to drop X-prefixAccountScaffold/CompositeCluster, and everyNopResource) now setsmetadata.namespace = oxr.metadata.namespace. Without this, Crossplane rejects the composition withcannot apply cluster scoped composed resource ... for a namespaced composite resource.kindstays atapiextensions.crossplane.io/v1— Crossplane v2 introduced a v2 XRD API but compositions remain v1.Examples (8 folders)
Xprefixclaim.yamlandclaim.kdeleted (claims don't exist in v2)xr.yamlupdated: newkind,metadata.namespace: default, updatedrender.crossplane.io/composition-pathannotationtest-harness.shremoved (it was entirely claim-based;kubectl apply -f examples/<resource>/xr.yamlis the v2 equivalent)crossplane.yamlcrossplane.version:">=v1.15.2"→">=v2.0.0-0". The-0is defensive: it makes the constraint semver-match pre-release tags like UXP'sv2.2.0-up.N, which otherwise fail a plain>=range.provider-nop:v0.2.1→v0.5.0— v0.5.0 introduced the namespacedNopResourcealongside a cluster-scopedClusterNopResource. Required for namespaced XRs.function-kcl:v0.8.0→v0.12.1— built againstcrossplane-runtime/v2, correctly emits namespaced composed resources.function-auto-ready:v0.2.1→v0.6.3Plan file
.agents/plans/CROSSPLANE_V2_MIGRATION.mddocuments the phase-by-phase migration (generated off the plan-v2-migration skill template, adapted for the classiccrossplane.yamlpackage format).Verification
End-to-end on upstream Crossplane v2.2.0 on kind:
crossplane xpkg build, pushed tottl.sh, installed viaConfiguration.ESTABLISHED=True,OFFEREDempty (correct — no claims).Network+Subnetwork+ClusterXRs indefault→ allSYNCED=True, READY=True, each composed a namespacedNopResourceindefault.CompositeClusterXR → composed 5 nested namespaced XRs (Network, Subnetwork, Cluster, NodePool, ServiceAccount), each composed a namespacedNopResource. Final state:Breaking changes
This is a breaking change for any user on
v0.3.0:XCluster→Cluster, etc.)Suggest cutting this as
v1.0.0to signal the break.Draft because
mainsince v0.2.0 (v0.3.0 on the registry predates the switch to function-kcl). Worth deciding whether to cut a fresh v0.4.0 of the v1 artifact from main first, or jump straight to v1.0.0 from this branch..github/workflows/e2e.yamlmay reference removed files/scripts — haven't audited it.Test plan
.agents/plans/CROSSPLANE_V2_MIGRATION.md.github/workflows/e2e.yamlstill works (or update it)