component

package
v0.0.0-...-c8bc4d7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCrdGenerateCode  = "11088"
	ErrDefinitionCode   = "11090"
	ErrGetSchemaCode    = "11091"
	ErrUpdateSchemaCode = "11092"
)
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

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

func ErrUpdateSchema(err error, obj string) error

func Generate

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

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

Jump to

Keyboard shortcuts

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