x-generation icon indicating copy to clipboard operation
x-generation copied to clipboard

Feature/expose versions properties

Open jehadnasser opened this issue 1 year ago • 0 comments

Description of your changes

What happened?

The generated XRD always ends up having referenceable: false:

versions:
  - name: v1alpha1
    referenceable: false

which leads to a CRD with storage: false:

versions:
  - additionalPrinterColumns:
    # ...
    name: v1alpha1
    schema:
    # ...
    served: true
    storage: false

which causing the following error during the applying of the CRD:

cannot establish control of object: admission webhook "compositeresourcedefinitions.apiextensions.crossplane.io" denied the request: invalid CRD generated for CompositeResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "compositedbclusters.rds.aws.xxx.cloud" is invalid: [spec.versions: Invalid value: []apiextensions.CustomResourceDefinitionVersion{apiextensions.CustomResourceDefinitionVersion{Name:"v1alpha1", Served:true, Storage:false, Deprecated:false, DeprecationWarning:(*string)(nil), Schema:(*apiextensions.CustomResourceValidation)(nil), Subresources:(*apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil)}}: must have exactly one version marked as storage version, status.storedVersions: Invalid value: []string(nil): must have at least one stored version]

How I solved the issue locally?

  • I passed the versions details in the generate.yaml file:
versions:
  - name: v1alpha1
    served: true
    referenceable: true
  • then I used the passed values in the generator Fixes #

I have:

  • [ ] Read and followed Crossplane's contribution process.
  • [ ] Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

jehadnasser avatar Jul 18 '24 08:07 jehadnasser