component

package
v0.7.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

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 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

func ErrCrdGenerate(err error) error

No reference usage found. Also check in adapters before deleting

func ErrGetDefinition

func ErrGetDefinition(err error) error

No reference usage found. Also check in adapters before deleting

func ErrGetSchema

func ErrGetSchema(err error) error

func ErrUpdateSchema added in v0.6.47

func ErrUpdateSchema(err error, obj string) error

func FilterCRDs added in v0.7.12

func FilterCRDs(manifests [][]byte) ([]string, []error)

func Generate

func Generate(crd string) (v1beta1.ComponentDefinition, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL