Crossplane: Validate CompositeResourceDefinition schemas

Created on 21 Sep 2020  路  3Comments  路  Source: crossplane/crossplane

What happened?

My CompositeResourceDefinition is still being created, although the composite CRD has never been created successfully generated by the operator

How can we reproduce it?

I have invalid openAPIV3Schema which contain default value that is not supposed to be there (default value is forbidden)

image

What environment did it happen in?

Crossplane version: v0.13.0-rc.114.g20493ac

Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit
:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-
05-21T14:50:54Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.9-eks-4c6976
", GitCommit:"4c6976793196d70bc5cd29d56ce5440c9473648e", GitTreeState:"clean", Buil
dDate:"2020-07-17T18:46:04Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/
amd64"}

bug enhancement

All 3 comments

@kelvinwijaya thanks for opening this! Could you add a little more context around what is happening here? Are you saying that you:

  1. Created a CompositeResourceDefinition (XRD) with an invalid schema
  2. A CRD was not created in reponse

If so, this seems to be working as intended. The validation would not occur until the controller attempted to create the CRD because the OpenAPIV3Schema is just a runtime.RawExtension. However, it would be a nice feature in the future for us to have an admission webhook (or something of similar nature) that would reject XRDs with invalid schemas.

Hi @hasheddan ,

Yes I have unintentionally created CompositeResourceDefinition (XRD) with an invalid schema, when this happened , I am expecting some error might be shown in the CompositeResourceDefinition > status > conditions.

As i have no clue about why the CRD has not been created until i go into the events logs to check
Not a very big deal just that as you mention it is good to have the validation check.

Thanks,
Kelvin

This is definitely something we want to do. It's similar to https://github.com/crossplane/crossplane/issues/1476, which is about validating kind: Composition rather than kind: CompositeResourceDefinition. I'm going to convert this issue to a feature request, because we don't have an issue tracking that. :)

Was this page helpful?
0 / 5 - 0 ratings