Documentation
¶
Index ¶
- Variables
- func CompileCuexTemplate(ctx context.Context, cueTemplate string) (cue.Value, error)
- func CompileOpenPolicyTemplate(ctx context.Context, scope v1beta1.PolicyScope, cueTemplate string) (cue.Value, error)
- func CompilePolicyTemplate(ctx context.Context, scope v1beta1.PolicyScope, cueTemplate string) (cue.Value, error)
- func IsAddonDefinition(obj client.Object) bool
- func ValidateCompiledCuexTemplate(val cue.Value) error
- func ValidateCueTemplate(cueTemplate string) error
- func ValidateCuexTemplate(ctx context.Context, cueTemplate string) error
- func ValidateDefinitionRevision(ctx context.Context, cli client.Client, def runtime.Object, ...) error
- func ValidateMultipleDefVersionsNotPresent(version, revisionName, objectType string) error
- func ValidateOutputResourcesExist(cueTemplate string, mapper meta.RESTMapper, obj client.Object) error
- func ValidateSemanticVersion(version string) error
- type ResourceInfo
Constants ¶
This section is empty.
Variables ¶
var ContextRegex = `^.+:\sreference\s\"context\"\snot\sfound$`
ContextRegex to match '**: reference "context" not found'
Functions ¶
func CompileCuexTemplate ¶ added in v1.11.1
CompileCuexTemplate compiles cueTemplate exactly as ValidateCuexTemplate does, against the workload compiler with provider functions left unresolved, and returns the value instead of a verdict. A caller that runs more than one check against a template compiles it once here, then hands the value to ValidateCompiledCuexTemplate and to its own checks.
func CompileOpenPolicyTemplate ¶ added in v1.11.1
func CompileOpenPolicyTemplate(ctx context.Context, scope v1beta1.PolicyScope, cueTemplate string) (cue.Value, error)
CompileOpenPolicyTemplate is CompilePolicyTemplate with the fields a render supplies, context and parameter, opened. A template that reads context does not compile on its own, so this is what its parameter declaration is read from.
func CompilePolicyTemplate ¶ added in v1.11.1
func CompilePolicyTemplate(ctx context.Context, scope v1beta1.PolicyScope, cueTemplate string) (cue.Value, error)
CompilePolicyTemplate compiles a PolicyDefinition template the way CompileCuexTemplate compiles a component's, with provider functions left unresolved, but against the compiler that renders a policy of the given scope. It returns the value instead of a verdict: a caller that runs more than one check against a template compiles it once here, then hands the value to ValidateCompiledCuexTemplate and to its own checks.
func IsAddonDefinition ¶ added in v1.10.4
IsAddonDefinition checks if the object is part of an addon installation This is a generic solution that works for ALL addons by checking owner references
func ValidateCompiledCuexTemplate ¶ added in v1.11.1
ValidateCompiledCuexTemplate is ValidateCuexTemplate for a value already produced by CompileCuexTemplate or CompilePolicyTemplate.
func ValidateCueTemplate ¶ added in v1.9.7
ValidateCueTemplate validate cueTemplate
func ValidateCuexTemplate ¶ added in v1.10.4
ValidateCuexTemplate validate cueTemplate with CueX for types utilising it. Uses WorkloadCompiler so that templates referencing internal provider packages (e.g. "vela/helm") parse during admission validation.
The compile runs under helm.WithDryRun so that any provider package that honors the dry-run signal short-circuits to a side-effect-free path. Without this, a ComponentDefinition whose CUE supplies fully concrete arguments to helm.#Render could trigger a real chart fetch and helm install during admission.
func ValidateDefinitionRevision ¶
func ValidateDefinitionRevision(ctx context.Context, cli client.Client, def runtime.Object, defRevNamespacedName types.NamespacedName) error
ValidateDefinitionRevision validate whether definition will modify the immutable object definitionRevision
func ValidateMultipleDefVersionsNotPresent ¶ added in v1.10.0
ValidateMultipleDefVersionsNotPresent validates that both Name Annotation Revision and Spec.Version are not present
func ValidateOutputResourcesExist ¶ added in v1.10.4
func ValidateOutputResourcesExist(cueTemplate string, mapper meta.RESTMapper, obj client.Object) error
ValidateOutputResourcesExist validates that resources referenced in output/outputs fields exist on the cluster
func ValidateSemanticVersion ¶ added in v1.10.0
ValidateSemanticVersion validates if a Definition's version includes all of major,minor & patch version values.
Types ¶
type ResourceInfo ¶ added in v1.10.4
type ResourceInfo struct {
APIVersion string
Kind string
Name string // optional, for better error messages
}
func ExtractResourceInfo ¶ added in v1.10.4
func ExtractResourceInfo(cueTemplate string) ([]ResourceInfo, error)
ExtractResourceInfo extracts apiVersion and kind from CUE template without evaluation