cuestomize

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cuestomize provides the Cuestomize functionality.

Index

Constants

View Source
const (
	// ValidatorAnnotationKey is the annotation key that marks a CUE function as a validator.
	ValidatorAnnotationKey = "config.cuestomize.io/validator"
	// ValidatorAnnotationValue is the value of the annotation that marks a CUE function as a validator.
	ValidatorAnnotationValue = "true"
)
View Source
const (
	// InputFillPath is the CUE path in which the input resources will be injected into the CUE model.
	InputFillPath = "input"
	// IncludesFillPath is the CUE path in which the includes will be injected into the CUE model.
	IncludesFillPath = "includes"

	// OutputsPath is the CUE path in which the function expects the output resources (as a list) to be placed.
	OutputsPath = "outputs"
)
View Source
const (
	// APIVersionFillPath is the CUE path in which the API version of the KRMInput will be filled.
	APIVersionFillPath = "apiVersion"
	// KindFillPath is the CUE path in which the kind of the KRMInput will be filled.
	KindFillPath = "kind"
	// MetadataFillPath is the CUE path in which the metadata of the KRMInput will be filled.
	MetadataFillPath = "metadata"
)

Variables

This section is empty.

Functions

func BuildCUEModelSchema

func BuildCUEModelSchema(ctx context.Context, cueCtx *cue.Context, instances []*build.Instance) (*cue.Value, error)

BuildCUEModelSchema builds a CUE model from the provided instances and returns the unified schema.

func CheckInstances

func CheckInstances(ctx context.Context, instances []*build.Instance) error

CheckInstances checks if any of the instances have an error and returns an error if so.

func Cuestomize

func Cuestomize(ctx context.Context, items []*kyaml.RNode, config *api.KRMInput, resourcesPath string) ([]*kyaml.RNode, error)

Cuestomize generates (or validates) resources from the provided CUE configuration and input resources.

func FillMetadata

func FillMetadata(ctx context.Context, schema cue.Value, config *api.KRMInput) (cue.Value, error)

FillMetadata fills the CUE schema with the API version, kind, and metadata from the KRMInput configuration.

func LoadCUEModel

func LoadCUEModel(ctx context.Context, path string) ([]*build.Instance, error)

LoadCUEModel loads a CUE model from the specified path and returns the instances.

func ProcessOutputs

func ProcessOutputs(ctx context.Context, unified cue.Value, items []*kyaml.RNode) ([]*kyaml.RNode, error)

ProcessOutputs processes the outputs from the CUE model and appends them to the output slice.

func ShouldActAsValidator

func ShouldActAsValidator(config *api.KRMInput) bool

ShouldActAsValidator checks if the KRMInput configuration has the validator annotation set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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