Skip to content

Conversation

@jbw976
Copy link
Member

@jbw976 jbw976 commented Mar 29, 2025

Description of your changes

This PR adds the v2alpha1 version for apiextensions to a few places, so they understand what a v2 XRD (i.e. CompositeResourceDefinition.apiextensions.crossplane.io/v2alpha1) is:

  • the apiextensions module setup
  • the xpkg linter
  • the xpkg parser

This fixes the following scenarios, enabling you to use v2 XRDs in them:

  • crossplane xpkg build a configuration package that has a v2 XRD in it
  • crossplane xpkg install a configuration package that has a v2 XRD in it

I have tested this with the following commands and the content in this gist: https://gist.github.com/jbw976/c51c8262c4bdd93f6a358f7cadee9a5c

# build a crank binary from local changes in this PR
go install ./cmd/crank

# build and push the xpkg, note this now passes the parser and linter checks
crank xpkg build --package-file=test-package.xpkg
crank xpkg push --package-files=test-package.xpkg ghcr.io/jbw976/v2-xrd:v0.0.1

# run a hack cluster with the local changes in this PR
earthly +hack --SIMULATE_CROSSPLANE_VERSION=v2.0.0-rc.0

# install the xpkg into the hack cluster
crank xpkg install configuration ghcr.io/jbw976/v2-xrd:v0.0.1

With the fixes in this PR, the configuration packages becomes healthy and installed ✅

Fixes #6364

I have:

Need help with this checklist? See the cheat sheet.

@jbw976 jbw976 requested review from a team, negz and turkenh as code owners March 29, 2025 02:32
@jbw976 jbw976 requested review from phisco and removed request for a team March 29, 2025 02:32
v1.AddToScheme,
v1beta1.AddToScheme,
v1alpha1.AddToScheme,
v2alpha1.AddToScheme,
Copy link
Member Author

Choose a reason for hiding this comment

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

@negz is it clear to you how basic reconciliation of XRDs was working without this? 🤔

Copy link
Member

@negz negz Mar 29, 2025

Choose a reason for hiding this comment

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

Yeah - the XRD controller still watches and reconciles v1 XRDs. So until now there wasn't actually any Crossplane controller code that cared about v2alpha1. Only the API server knew about that version (and whenever you create a v2alpha1 XRD it's implicitly also served as a v1 XRD).

I imagine once we release v2.0 proper I'll switch the code to use the new v2 type. I didn't yet mostly because it felt strange to update the code to use the new type while it's marked alpha.

@jbw976 jbw976 merged commit 815fa2b into crossplane:v2 Mar 29, 2025
16 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants