Documentation
¶
Index ¶
- Variables
- func IsDataPending(err error) bool
- type Interface
- type Node
- func (n *Node) DeleteTargets() ([]*unstructured.Unstructured, error)
- func (n *Node) GetDesired() ([]*unstructured.Unstructured, error)
- func (n *Node) GetDesiredIdentity() ([]*unstructured.Unstructured, error)
- func (n *Node) IsIgnored() (bool, error)
- func (n *Node) IsReady() (bool, error)
- func (n *Node) SetObserved(observed []*unstructured.Unstructured)
- type Runtime
Constants ¶
This section is empty.
Variables ¶
var ErrDataPending = errors.New("data pending")
ErrDataPending indicates that CEL evaluation failed because required data is not yet available (e.g., a resource's status field hasn't been populated). This is a retryable condition - the controller should requeue and try again.
var ErrDesiredNotResolved = errors.New("desired state not resolved")
ErrDesiredNotResolved indicates that the desired state for a node has not been resolved yet. This typically happens when GetDesired is called on a node that is still in Pending or Error state.
Functions ¶
func IsDataPending ¶ added in v0.8.0
IsDataPending returns true if the error indicates data is pending and evaluation should be retried later.
Types ¶
type Interface ¶
type Interface interface {
// Nodes returns nodes in topological order (instance excluded).
Nodes() []*Node
// Instance returns the instance node.
Instance() *Node
}
Interface defines the minimal runtime operations needed by the controller.
type Node ¶ added in v0.8.0
Node is the mutable runtime handle that wraps an immutable graph.Node. Each reconciliation creates fresh Node instances.
func (*Node) DeleteTargets ¶ added in v0.8.0
func (n *Node) DeleteTargets() ([]*unstructured.Unstructured, error)
DeleteTargets returns the ordered list of objects this node should delete now.
This is intentionally narrow today: it only reasons about identity resolution and currently observed objects, and returns the safe deletion targets. It is the runtime's deletion gate so callers don't re-implement matching logic.
Long-term, this should evolve into an ActionPlan where the runtime tells the caller which resources to create, update, keep intact, or delete, and where propagation/rollout gates are enforced in one place.
func (*Node) GetDesired ¶ added in v0.8.0
func (n *Node) GetDesired() ([]*unstructured.Unstructured, error)
GetDesired computes and returns the desired state(s) for this node. Results are cached - subsequent calls return the cached value. Behavior varies by node type:
- Resource: strict evaluation, fails fast on any error
- Collection: strict evaluation with forEach expansion
- Instance: best-effort partial evaluation
- External: resolves template (for name/namespace CEL), caller reads instead of applies
Note: The caller should call IsIgnored() before GetDesired() for resource nodes.
func (*Node) GetDesiredIdentity ¶ added in v0.8.0
func (n *Node) GetDesiredIdentity() ([]*unstructured.Unstructured, error)
GetDesiredIdentity resolves only identity-related fields (metadata.name & namespace) and skips readiness gating. It is used for deletion/observation when we only need stable identities and want to avoid being blocked by unrelated template fields.
NOTE: This method does not cache its result in n.desired; callers in non-deletion paths should continue using GetDesired().
func (*Node) IsIgnored ¶ added in v0.8.0
IsIgnored reports whether this node should be skipped entirely. It is true when:
- any dependency is ignored (contagious)
- any includeWhen expression evaluates to false
Results are memoized via expression caching - once an includeWhen expression evaluates to false, it stays false for this runtime instance.
func (*Node) IsReady ¶ added in v0.8.0
IsReady evaluates readyWhen expressions using observed state. Ignored nodes are treated as ready for dependency gating purposes.
func (*Node) SetObserved ¶ added in v0.8.0
func (n *Node) SetObserved(observed []*unstructured.Unstructured)
SetObserved stores the observed state(s) from the cluster.
type Runtime ¶ added in v0.8.0
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is the execution context for a single reconciliation. It holds nodes in topological order and provides access to the instance node. Expression deduplication is done during FromGraph construction via a local cache.
func FromGraph ¶ added in v0.8.0
func FromGraph(g *graph.Graph, instance *unstructured.Unstructured) (*Runtime, error)
FromGraph creates a new Runtime from a Graph and instance. This is called at the start of each reconciliation.