definition

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OutputFieldName is the name of the struct contains the CR data
	OutputFieldName = velaprocess.OutputFieldName
	// OutputsFieldName is the name of the struct contains the map[string]CR data
	OutputsFieldName = velaprocess.OutputsFieldName
	// PatchFieldName is the name of the struct contains the patch of CR data
	PatchFieldName = "patch"
	// PatchOutputsFieldName is the name of the struct contains the patch of outputs CR data
	PatchOutputsFieldName = "patchOutputs"
	// ErrsFieldName check if errors contained in the cue
	ErrsFieldName = "errs"
	// TemplateContextPrefix is the base prefix for storing templates in context
	TemplateContextPrefix = "template-context-"
)
View Source
const (
	// AuxiliaryWorkload defines the extra workload obj from a workloadDefinition,
	// e.g. a workload composed by deployment and service, the service will be marked as AuxiliaryWorkload
	AuxiliaryWorkload = "AuxiliaryWorkload"
)

Variables

View Source
var CUERenderDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
	Name:    "kubevela_cue_render_duration_seconds",
	Help:    "End-to-end duration of CUE definition rendering (compat rewrite + compile + validate), by definition kind and status.",
	Buckets: []float64{0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0},
}, []string{"definition_kind", "status"})

CUERenderDuration measures the end-to-end duration of a definition Complete call, covering CUE version compatibility rewriting, compilation, and validation. Labels:

  • definition_kind: definition type, e.g. "Component", "Trait"
  • status: "ok" on success, "error" on failure

Buckets are tuned for the expected millisecond range of CUE compilation and validation. Use histogram_quantile() in PromQL to compute aggregated latency percentiles across replicas.

Functions

func FormatCUEError added in v1.11.0

func FormatCUEError(err error, messagePrefix string, entityType, entityName string, val ...*cue.Value) error

FormatCUEError formats CUE errors in a user-friendly grouped format

func GetBaseContextLabels added in v1.6.0

func GetBaseContextLabels(ctx process.Context) map[string]string

GetBaseContextLabels get base context labels

func GetCommonLabels

func GetCommonLabels(contextLabels map[string]string) map[string]string

GetCommonLabels will convert context based labels to OAM standard labels

func GetTraitTemplateKey added in v1.11.0

func GetTraitTemplateKey(name string) string

GetTraitTemplateKey returns the context key for storing trait templates

func GetWorkloadTemplateKey added in v1.11.0

func GetWorkloadTemplateKey(name string) string

GetWorkloadTemplateKey returns the context key for storing workload templates

Types

type AbstractEngine

type AbstractEngine interface {
	Complete(ctx process.Context, abstractTemplate string, params interface{}) error
	Status(templateContext map[string]interface{}, request *health.StatusRequest) (*health.StatusResult, error)
	GetTemplateContext(ctx process.Context, cli client.Client, accessor util.NamespaceAccessor) (map[string]interface{}, error)
}

AbstractEngine defines Definition's Render interface

func NewTraitAbstractEngine

func NewTraitAbstractEngine(name string) AbstractEngine

NewTraitAbstractEngine create Trait Definition AbstractEngine

func NewWorkloadAbstractEngine

func NewWorkloadAbstractEngine(name string) AbstractEngine

NewWorkloadAbstractEngine create Workload Definition AbstractEngine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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