Require XR's spec field
Signed-off-by: Simon Rüegg <simon@rueggs.ch>
This commit is contained in:
parent
c1dec96dfb
commit
084ebffa4e
|
@ -76,10 +76,7 @@ func ForCompositeResource(xrd *v1beta1.CompositeResourceDefinition) (*extv1.Cust
|
|||
Storage: vr.Referenceable,
|
||||
AdditionalPrinterColumns: append(vr.AdditionalPrinterColumns, CompositeResourcePrinterColumns()...),
|
||||
Schema: &extv1.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &extv1.JSONSchemaProps{
|
||||
Type: "object",
|
||||
Properties: BaseProps(),
|
||||
},
|
||||
OpenAPIV3Schema: BaseProps(),
|
||||
},
|
||||
Subresources: &extv1.CustomResourceSubresources{
|
||||
Status: &extv1.CustomResourceSubresourceStatus{},
|
||||
|
@ -136,10 +133,7 @@ func ForCompositeResourceClaim(xrd *v1beta1.CompositeResourceDefinition) (*extv1
|
|||
Storage: vr.Referenceable,
|
||||
AdditionalPrinterColumns: append(vr.AdditionalPrinterColumns, CompositeResourceClaimPrinterColumns()...),
|
||||
Schema: &extv1.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &extv1.JSONSchemaProps{
|
||||
Type: "object",
|
||||
Properties: BaseProps(),
|
||||
},
|
||||
OpenAPIV3Schema: BaseProps(),
|
||||
},
|
||||
Subresources: &extv1.CustomResourceSubresources{
|
||||
Status: &extv1.CustomResourceSubresourceStatus{},
|
||||
|
|
|
@ -153,7 +153,8 @@ func TestForCompositeResource(t *testing.T) {
|
|||
},
|
||||
Schema: &extv1.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &extv1.JSONSchemaProps{
|
||||
Type: "object",
|
||||
Type: "object",
|
||||
Required: []string{"spec"},
|
||||
Properties: map[string]extv1.JSONSchemaProps{
|
||||
"apiVersion": {
|
||||
Type: "string",
|
||||
|
@ -477,7 +478,8 @@ func TestForCompositeResourceClaim(t *testing.T) {
|
|||
},
|
||||
Schema: &extv1.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &extv1.JSONSchemaProps{
|
||||
Type: "object",
|
||||
Type: "object",
|
||||
Required: []string{"spec"},
|
||||
Properties: map[string]extv1.JSONSchemaProps{
|
||||
"apiVersion": {
|
||||
Type: "string",
|
||||
|
|
|
@ -33,26 +33,30 @@ var FilterClaimSpecProps = []string{"resourceRef", "writeConnectionSecretToRef"}
|
|||
|
||||
// BaseProps is a partial OpenAPIV3Schema for the spec fields that Crossplane
|
||||
// expects to be present for all CRDs that it creates.
|
||||
func BaseProps() map[string]extv1.JSONSchemaProps {
|
||||
return map[string]extv1.JSONSchemaProps{
|
||||
"apiVersion": {
|
||||
Type: "string",
|
||||
},
|
||||
"kind": {
|
||||
Type: "string",
|
||||
},
|
||||
"metadata": {
|
||||
// NOTE(muvaf): api-server takes care of validating
|
||||
// metadata.
|
||||
Type: "object",
|
||||
},
|
||||
"spec": {
|
||||
Type: "object",
|
||||
Properties: map[string]extv1.JSONSchemaProps{},
|
||||
},
|
||||
"status": {
|
||||
Type: "object",
|
||||
Properties: map[string]extv1.JSONSchemaProps{},
|
||||
func BaseProps() *extv1.JSONSchemaProps {
|
||||
return &extv1.JSONSchemaProps{
|
||||
Type: "object",
|
||||
Required: []string{"spec"},
|
||||
Properties: map[string]extv1.JSONSchemaProps{
|
||||
"apiVersion": {
|
||||
Type: "string",
|
||||
},
|
||||
"kind": {
|
||||
Type: "string",
|
||||
},
|
||||
"metadata": {
|
||||
// NOTE(muvaf): api-server takes care of validating
|
||||
// metadata.
|
||||
Type: "object",
|
||||
},
|
||||
"spec": {
|
||||
Type: "object",
|
||||
Properties: map[string]extv1.JSONSchemaProps{},
|
||||
},
|
||||
"status": {
|
||||
Type: "object",
|
||||
Properties: map[string]extv1.JSONSchemaProps{},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue