Documentation
¶
Overview ¶
Package model defines the core data types shared across the engine and providers: the declarative Object, references between objects, and observed Status.
Index ¶
Constants ¶
const ( PhaseReady = "Ready" PhaseReconciling = "Reconciling" PhaseBlocked = "Blocked" PhaseError = "Error" PhaseDeleted = "Deleted" PhaseUnknown = "Unknown" )
Phase constants describe the high-level lifecycle state of an object.
Variables ¶
This section is empty.
Functions ¶
func HashSpec ¶
HashSpec returns a stable sha256 of a spec map. Marshalling via encoding/json with sorted map keys gives a deterministic representation.
func ShortHash ¶
ShortHash returns the first 8 hex chars of HashSpec, suitable for content-addressed resource names (e.g. immutable Swarm secrets/configs).
func ShortSummary ¶
ShortSummary returns a compact human summary considering phase, drift and sync.
Types ¶
type Condition ¶
type Condition struct {
Type string `json:"type"`
Status string `json:"status"` // True|False|Unknown
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
}
Condition is a single status condition, keyed by Type and updated in place.
type DriftStatus ¶
type DriftStatus struct {
Drifted bool `json:"drifted"`
Details map[string]any `json:"details,omitempty"`
}
DriftStatus tracks observed-vs-desired divergence.
type Metadata ¶
type Metadata struct {
Name string `json:"name" yaml:"name"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}
Metadata holds the manifest metadata block.
type Object ¶
type Object struct {
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Kind string `json:"kind" yaml:"kind"`
Name string `json:"-" yaml:"-"`
Namespace string `json:"-" yaml:"-"`
Labels map[string]string `json:"-" yaml:"-"`
Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`
Target string `json:"target,omitempty" yaml:"target,omitempty"`
DependsOn []Ref `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"`
Spec map[string]any `json:"spec,omitempty" yaml:"spec,omitempty"`
Source string `json:"-" yaml:"-"`
// Metadata is the raw metadata block; Name/Namespace/Labels are hoisted from it.
Metadata Metadata `json:"metadata" yaml:"metadata"`
}
Object is a single declarative resource parsed from a manifest. The Spec is left unstructured; each provider decodes it into a typed spec.
func ParseYAML ¶
ParseYAML parses a (possibly multi-document) YAML stream into Objects. Documents with no Kind are skipped (e.g. empty docs from "---" separators).
type Ref ¶
type Ref struct {
Kind string `json:"kind" yaml:"kind"`
Name string `json:"name" yaml:"name"`
Optional bool `json:"optional,omitempty" yaml:"optional,omitempty"`
}
Ref identifies another object by kind and name.
type Status ¶
type Status struct {
ObservedGeneration int64 `json:"observedGeneration"`
LastReconciled time.Time `json:"lastReconciled,omitempty"`
LastChange time.Time `json:"lastChange,omitempty"`
Phase string `json:"phase,omitempty"`
Summary string `json:"summary,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
Sync SyncStatus `json:"sync"`
Drift DriftStatus `json:"drift"`
Extra map[string]any `json:"extra,omitempty"`
}
Status is the operator-observed state of an object, persisted for the API/CLI.
func (*Status) SetCondition ¶
SetCondition inserts or updates a condition keyed by Type. LastTransitionTime is only refreshed when the Status value actually changes, matching Kubernetes semantics and keeping the slice bounded.
type SyncStatus ¶
type SyncStatus struct {
DesiredHash string `json:"desiredHash,omitempty"`
LastAppliedHash string `json:"lastAppliedHash,omitempty"`
OutOfSync bool `json:"outOfSync"`
}
SyncStatus tracks desired-vs-applied hashes.