Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/graph/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,11 @@ func getSchemaWithoutStatus(crd *extv1.CustomResourceDefinition) (*spec.Schema,
crdCopy := crd.DeepCopy()

// TODO(a-hilaly) expand this function when we start support CRD upgrades.
if len(crdCopy.Spec.Versions) != 1 || crdCopy.Spec.Versions[0].Schema == nil {
panic("Expected CRD to have exactly one version with schema defined")
if len(crdCopy.Spec.Versions) != 1 {
return nil, fmt.Errorf("expected CRD to have exactly one version, got %d versions: multi-version CRDs not yet supported", len(crdCopy.Spec.Versions))
}
if crdCopy.Spec.Versions[0].Schema == nil {
return nil, fmt.Errorf("expected CRD version to have schema defined, but schema is nil")
}

openAPISchema := crdCopy.Spec.Versions[0].Schema.OpenAPIV3Schema
Expand Down