See Crossplane contributing doc for guidelines that apply to all Crossplane repositories.
API version of a CRD provides some guarantees about its stability and amount of interventions you can expect during upgrades. Crossplane strictly follows the conventions Kubernetes sets forth here.
The actions needed to be taken depends on whether the upgrade includes a breaking
schema change and from what level it is upgrading from and to, i.e. alpha/beta
etc.
From alpha to beta, breaking changes can be made without early notice. However,
we do include a warning in release notes and provide instructions on how to migrate
from one to the other manually.
Step to upgrade from v1alpha1 to v1beta1:
- Create a new folder called
v1beta1inapis/<group name>and copy the following files from existingv1alpha1folder:register.go: Replace allv1alpha1occurrences withv1beta1.
- Copy the Go type into
v1beta1package.- Add
// +kubebuilder:storageversioncomment to the type comments.
- Add
- Delete all files in
v1alpha1andv1beta1packages starting withzz_and runmake generateso that functions that satisfy certain interfaces are generated for the new types.- If there are functions in those packages assuming the structs implement those interfaces, such as old reference resolvers, you'll need to comment them out for code generation to succeed and bring them back once it's completed.
- Add the new API package to
apis/aws.gotype registration list. - Make sure the controller in
pkg/controller/<group name>/<kind name>/controller.gouses the new struct fromv1beta1package. - Make sure the client functions in
pkg/clients/<group name>/<kind name>.gouses the new struct fromv1beta1package. - The old Go type should not be used in anywhere, like controller, or reference
resolver of another type. Its sole usage should be registration in
apis/aws.go - Deprecate the old type in
v1alpha1package by adding the following comments to both<Kind>and<Kind>Liststructs with a little bit of detail about what they should do:// +kubebuilder:deprecatedversion:warning="Please use v1beta1 version of this resource that has identical schema."// Deprecated: Please use v1beta1 version of this resource.
- Run
make reviewableand see if the corresponding CRD is updated inpackage/crdsfolder. - Update the example in
examples/<group name>/<kind>.yamlto havev1beta1.