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(resource string) (component.ComponentDefinition, error)
- func GenerateFromOpenAPI(resource string, pkg models.Package) ([]component.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",
}
View Source
var ErrNoSchemasFound = errors.New(ErrGetSchemaCode, errors.Alert, []string{"Could not get schema for the given openapi spec"}, []string{"The OpenAPI spec doesn't include \"components.schemas\" path"}, []string{"The spec doesn't have include any schema"}, []string{"Verify the spec has valid schema."})
View Source
var OpenAPISpecPathConfig = CuePathConfig{
NamePath: `x-kubernetes-group-version-kind"[0].kind`,
IdentifierPath: "spec.names.kind",
VersionPath: `"x-kubernetes-group-version-kind"[0].version`,
GroupPath: `"x-kubernetes-group-version-kind"[0].group`,
ScopePath: "spec.scope",
SpecPath: "spec.versions[0].schema.openAPIV3Schema",
PropertiesPath: "properties",
}
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 GenerateFromOpenAPI ¶ added in v0.7.79
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.