Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteFields(m map[string]interface{})
- func ErrCrdGenerate(err error) error
- func ErrGetDefinition(err error) error
- func ErrGetSchema(err error) error
- func ErrUpdateSchema(err error, obj string) error
- func Generate(crd string) (v1alpha1.ComponentDefinition, error)
- func UpdateProperties(fieldVal cue.Value, cuePath cue.Path, group string) (map[string]interface{}, error)
- type CuePathConfig
Constants ¶
View Source
const ( ErrCrdGenerateCode = "11088" ErrDefinitionCode = "11090" ErrGetSchemaCode = "11091" ErrUpdateSchemaCode = "11092" )
View Source
const ComponentMetaNameKey = "name"
Variables ¶
View Source
var Configs = []CuePathConfig{DefaultPathConfig, DefaultPathConfig2}
View Source
var DefaultPathConfig = CuePathConfig{
NamePath: "spec.names.kind",
IdentifierPath: "spec.names.kind",
VersionPath: "spec.versions[0].name",
GroupPath: "spec.group",
ScopePath: "spec.scope",
SpecPath: "spec.versions[0].schema.openAPIV3Schema",
PropertiesPath: "properties",
}
View Source
var DefaultPathConfig2 = CuePathConfig{
NamePath: "spec.names.kind",
IdentifierPath: "spec.names.kind",
VersionPath: "spec.versions[0].name",
GroupPath: "spec.group",
ScopePath: "spec.scope",
SpecPath: "spec.validation.openAPIV3Schema",
}
Functions ¶
func DeleteFields ¶
func DeleteFields(m map[string]interface{})
function to remove fields that are not required or prefilled
func ErrCrdGenerate ¶
No reference usage found. Also check in adapters before deleting
func ErrGetDefinition ¶
No reference usage found. Also check in adapters before deleting
func ErrGetSchema ¶
func ErrUpdateSchema ¶
func UpdateProperties ¶
func UpdateProperties(fieldVal cue.Value, cuePath cue.Path, group string) (map[string]interface{}, error)
Find and modify specific schema properties. 1. Identify interesting properties by walking entire schema. 2. Store path to interesting properties. Finish walk. 3. Iterate all paths and modify properties. 5. If error occurs, return nil and skip modifications.
Types ¶
type CuePathConfig ¶
type CuePathConfig struct { NamePath string GroupPath string VersionPath string SpecPath string ScopePath string PropertiesPath string // identifiers are the values that uniquely identify a CRD (in most of the cases, it is the 'Name' field) IdentifierPath string }
all paths should be a valid CUE expression
Click to show internal directories.
Click to hide internal directories.