Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldDescriptor ¶
type FieldDescriptor struct {
// Path is the JSONPath-like location of the field in the resource.
// Example: spec.template.spec.containers[0].env[0].value
Path string
// Expression is the CEL expression for this field.
//
// Lifecycle:
// - Parser creates with Expression.Original set (References, Program nil)
// - Builder populates Expression.References during dependency extraction
// - Builder populates Expression.Program during compilation
//
// String templates like "prefix-${a}-${b}" are compiled into a single CEL
// concatenation expression at parse time.
Expression *krocel.Expression
}
FieldDescriptor represents a field in a resource template that contains CEL expressions. It is created by the parser and enriched by the builder:
- Parser: sets Path and creates Expression objects with only Original populated (References and Program are nil)
- Builder: inspects expressions to populate References, validates types by deriving expected type from schema, then compiles Program
type ResourceField ¶
type ResourceField struct {
FieldDescriptor
// Kind determines what this variable references (static, dynamic, iteration).
// Set by builder based on expression references.
Kind ResourceVariableKind
}
ResourceField represents a variable in a resource template. Variables are fields that contain CEL expressions rather than constant values. For example:
spec:
replicas: ${schema.spec.replicas + 5}
The Kind field determines what the expression references:
- Static: only references schema or nothing (no resource dependencies)
- Dynamic: references other resources in the RGD (e.g., ${vpc.status.id})
- Iteration: references forEach iterators (e.g., ${region} in a collection)
type ResourceVariableKind ¶
type ResourceVariableKind string
ResourceVariableKind represents the kind of resource variable.
const ( // ResourceVariableKindStatic represents a static variable. Static variables // are resolved at the beginning of the execution and their value is constant. // Static variables are easy to find, they always start with 'spec'. Referring // to the instance spec. // // For example: // spec: // replicas: ${schema.spec.replicas + 5} ResourceVariableKindStatic ResourceVariableKind = "static" // ResourceVariableKindDynamic represents a dynamic variable. Dynamic variables // are resolved at runtime and their value can change during the execution. Dynamic // cannot start with 'spec' and they must refer to another resource in the // ResourceGraphDefinition. // // For example: // spec: // vpcID: ${vpc.status.vpcID} ResourceVariableKindDynamic ResourceVariableKind = "dynamic" // ResourceVariableKindReadyWhen represents readyWhen variables. ReadyWhen variables // are resolved at runtime. The difference between them, and the dynamic variables // is that dynamic variable resolutions wait for other resources to provide a value // while ReadyWhen variables are created and wait for certain conditions before // moving forward to the next resource to create // // For example: // name: cluster // readyWhen: // - ${cluster.status.status == "Active"} ResourceVariableKindReadyWhen ResourceVariableKind = "readyWhen" // ResourceVariableKindIncludeWhen represents an includeWhen variable. // IncludeWhen variables are resolved at the beginning of the execution and // their value is constant. They decide whether we are going to create // a resource or not // // For example: // name: deployment // includeWhen: // - ${schema.spec.replicas > 1} ResourceVariableKindIncludeWhen ResourceVariableKind = "includeWhen" // ResourceVariableKindIteration represents an iteration variable. Iteration // variables are expressions inside a collection resource (one with forEach) // that reference iterator variables. They are evaluated during collection // expansion, once per iteration, with the iterator bindings in scope. // // For example, with forEach: [{region: "${schema.spec.regions}"}]: // metadata: // name: ${schema.spec.name}-${region} <- "region" is an iterator variable // // Expressions not referencing iterator variables remain static or dynamic. ResourceVariableKindIteration ResourceVariableKind = "iteration" )
func (ResourceVariableKind) IsDynamic ¶
func (r ResourceVariableKind) IsDynamic() bool
IsDynamic returns true if the ResourceVariableKind is dynamic
func (ResourceVariableKind) IsIncludeWhen ¶
func (r ResourceVariableKind) IsIncludeWhen() bool
IsIncludeWhen returns true if the ResourceVariableKind is includeWhen
func (ResourceVariableKind) IsIteration ¶
func (r ResourceVariableKind) IsIteration() bool
IsIteration returns true if the ResourceVariableKind is iteration
func (ResourceVariableKind) IsStatic ¶
func (r ResourceVariableKind) IsStatic() bool
IsStatic returns true if the ResourceVariableKind is static
func (ResourceVariableKind) String ¶
func (r ResourceVariableKind) String() string
String returns the string representation of a ResourceVariableKind.