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 FilterCRDs(manifests [][]byte) ([]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 = "meshkit-11155" ErrDefinitionCode = "meshkit-11156" ErrGetSchemaCode = "meshkit-11157" ErrUpdateSchemaCode = "meshkit-11158" )
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 ¶ added in v0.6.49
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 ¶ added in v0.6.47
func FilterCRDs ¶ added in v0.7.12
func UpdateProperties ¶ added in v0.6.47
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.