Documentation
¶
Overview ¶
Package v1alpha1 contains types for the v1alpha1 API group +groupName=blueprints.windsorcli.dev
Package v1alpha1 contains types for the v1alpha1 API group +groupName=blueprints.windsorcli.dev
Package v1alpha1 contains types for the v1alpha1 API group +groupName=blueprints.windsorcli.dev
Index ¶
- Constants
- func CrdKustomizationName(source string) string
- func DeepMergeMaps(base, overlay map[string]any) map[string]any
- func HasRemoteTemplateSource(sources []Source) bool
- func IsCrdLayerName(name string) bool
- func IsLocalTemplateSource(source Source) bool
- func ToMapStringAny(v any) map[string]any
- func ToSliceAny(v any) []any
- type Blueprint
- func (b *Blueprint) AllKustomizations() []Kustomization
- func (b *Blueprint) BackendComponentID() string
- func (b *Blueprint) BackendComponents() []*TerraformComponent
- func (b *Blueprint) DeepCopy() *Blueprint
- func (b *Blueprint) IsBackendComponent(id string) bool
- func (b *Blueprint) RemoveFluxSystem(removal FluxSystem) error
- func (b *Blueprint) RemoveKustomization(removal Kustomization) error
- func (b *Blueprint) RemoveTerraformComponent(removal TerraformComponent) error
- func (b *Blueprint) ReplaceKustomization(kustomization Kustomization) error
- func (b *Blueprint) ReplaceTerraformComponent(component TerraformComponent) error
- func (b *Blueprint) StrategicMerge(overlays ...*Blueprint) error
- func (b *Blueprint) UpsertFluxSystem(sys FluxSystem) error
- type BlueprintPatch
- type BoolExpression
- func (b *BoolExpression) DeepCopy() *BoolExpression
- func (b *BoolExpression) IsEnabled() bool
- func (b *BoolExpression) IsInstalled() bool
- func (b *BoolExpression) MarshalYAML() (any, error)
- func (b *BoolExpression) ToBool() *bool
- func (b *BoolExpression) UnmarshalYAML(unmarshal func(any) error) error
- type ConditionalKustomization
- type ConditionalTerraformComponent
- type ConfigBlock
- type Decryption
- type DecryptionSecretRef
- type DurationString
- type Facet
- type FluxSystem
- type FluxVariant
- type HealthCheckExpr
- type HealthCheckRef
- type IntExpression
- type Kustomization
- type Message
- type Metadata
- type PostBuild
- type Reference
- type Repository
- type RequirementBlock
- type SecretEntry
- type Source
- type SubstituteReference
- type TerraformComponent
- type TestCase
- type TestFile
Constants ¶
const CrdLayerName = "crds"
CrdLayerName is the base name of the synthesized kustomizations that install the vendored CRD layer. One CRD kustomization is materialized per source that carries CRDs: the layer for the default/project source takes this name verbatim, and a layer for a named source takes "crds-<source>" (see CrdKustomizationName). The stack depends on these layers by name, and ToFluxKustomization keys its PostBuild skip on them (see IsCrdLayerName) — so the "crds" name and the "crds-" namespace are reserved: the composer rejects user-authored kustomizations that claim them.
Variables ¶
This section is empty.
Functions ¶
func CrdKustomizationName ¶ added in v0.9.0
CrdKustomizationName returns the name of the kustomization the provisioner synthesizes for a CRD source: "crds" for the default/project source (empty name) and "crds-<source>" for a named source. The barrier makes every root kustomization depend on this name so the stack waits on the CRDs.
func DeepMergeMaps ¶ added in v0.9.0
DeepMergeMaps returns a new map from a deep merge of base and overlay maps. Overlay values take precedence; nested maps merge recursively. Non-map overlay values replace base values. Empty overlay values—including empty string "", empty slice, and empty map—never overwrite an existing non-empty base value, so populated Inputs (or other merged maps) are preserved when overlay has empty values. Map-like overlay values are normalized to map[string]any. Package-level so callers without a Blueprint can merge scope maps (e.g. context over facet scope) without losing nested facet-derived keys.
func HasRemoteTemplateSource ¶ added in v0.9.0
HasRemoteTemplateSource returns true when sources include a template source with a non-empty URL.
func IsCrdLayerName ¶ added in v0.9.0
IsCrdLayerName reports whether name belongs to the synthesized CRD layer namespace: the base "crds" name or any per-source "crds-<source>" name.
func IsLocalTemplateSource ¶ added in v0.9.0
IsLocalTemplateSource returns true when the source is the template source with no URL (local context template).
func ToMapStringAny ¶ added in v0.9.0
ToMapStringAny converts a map-like value to map[string]any recursively (e.g. map[interface{}]interface{} from YAML or expr). Returns nil if v is not a map. Ensures blueprint Inputs are always map[string]any so YAML marshaling produces nested YAML rather than Go's %v string format.
func ToSliceAny ¶ added in v0.9.0
ToSliceAny converts a slice-like value to []any recursively (e.g. []interface{} from YAML or expr). Returns nil if v is not a slice.
Types ¶
type Blueprint ¶
type Blueprint struct {
// Kind is the blueprint type, following Kubernetes conventions.
Kind string `yaml:"kind"`
// ApiVersion is the API schema version of the blueprint.
ApiVersion string `yaml:"apiVersion"`
// Metadata includes the blueprint's name and description.
Metadata Metadata `yaml:"metadata"`
// Backend names the terraform component that terminates the backend's component chain.
Backend string `yaml:"backend,omitempty"`
// Repository details the source repository of the blueprint.
Repository Repository `yaml:"repository,omitempty"`
// Sources are external resources referenced by the blueprint.
Sources []Source `yaml:"sources,omitempty"`
// TerraformComponents are Terraform modules in the blueprint.
TerraformComponents []TerraformComponent `yaml:"terraform,omitempty"`
// Crds lists the vendored CRD references, such as "cert-manager-1.16.2", from the default source.
Crds []string `yaml:"crds,omitempty"`
// Kustomizations are plain Flux Kustomization configs (the kustomize: passthrough).
Kustomizations []Kustomization `yaml:"kustomize,omitempty"`
// FluxSystems are the flux: entries, each compiled to install and resources Kustomizations.
FluxSystems []FluxSystem `yaml:"flux,omitempty"`
// Substitutions are key/value pairs, evaluated with facet scope, that go into values-common.
Substitutions map[string]string `yaml:"substitutions,omitempty"`
// ConfigMaps are standalone ConfigMaps that every kustomization uses for PostBuild substitution.
ConfigMaps map[string]map[string]string `yaml:"configMaps,omitempty"`
// Messages are post-run notes from active facets, which GenerateResolved evaluates against composed scope.
Messages []Message `yaml:"messages,omitempty"`
// Config maps each facet config block name to its evaluated value.
Config map[string]any `yaml:"config,omitempty"`
// Exports lists the config block names that facets of other blueprints may read but not write.
Exports []string `yaml:"exports,omitempty"`
}
Blueprint is a configuration blueprint for initializing a project. Crds install from the default source into the "crds" kustomization ahead of the stack. CRDs of an OCI source belong to that Source instead. Substitutions may use expressions such as "${dns.domain}" and go into values-common for every kustomization. TestRunner sets Config so a test case can assert on it. Production composition and windsor show leave Config unset.
func (*Blueprint) AllKustomizations ¶ added in v0.9.0
func (b *Blueprint) AllKustomizations() []Kustomization
AllKustomizations returns a flat list of every compiled Kustomization — plain kustomize: entries first, then the install and resources tiers compiled from each FluxSystem. Expressions on stored FluxSystems are already evaluated; this method only performs name/path/dependency assembly.
func (*Blueprint) BackendComponentID ¶ added in v0.9.0
BackendComponentID returns Blueprint.Backend, or "" when no backend is declared.
func (*Blueprint) BackendComponents ¶ added in v0.9.1
func (b *Blueprint) BackendComponents() []*TerraformComponent
BackendComponents returns the named backend component plus every component declared before it in TerraformComponents, in declaration order. Returns nil when Backend is unset or names a component not present (validation catches the latter at load).
func (*Blueprint) IsBackendComponent ¶ added in v0.9.1
IsBackendComponent reports whether the component ID appears in BackendComponents.
func (*Blueprint) RemoveFluxSystem ¶ added in v0.9.0
func (b *Blueprint) RemoveFluxSystem(removal FluxSystem) error
RemoveFluxSystem removes the fields named in removal from the FluxSystem with the same Name. It subtracts dependsOn entries and the install fields named in removal.Install. It drops each resources variant whose Name appears in removal.Resources. An empty Name matches the unnamed variant. Name stays unchanged, and the call does nothing when no system matches.
func (*Blueprint) RemoveKustomization ¶ added in v0.9.0
func (b *Blueprint) RemoveKustomization(removal Kustomization) error
RemoveKustomization removes specified non-index fields from an existing Kustomization. It finds a kustomization matching the same Name, then removes patches, components, dependencies, cleanup items, and substitutions that are specified in the removal kustomization. The index field (Name) is not affected. If no matching kustomization exists, no action is taken.
func (*Blueprint) RemoveTerraformComponent ¶ added in v0.9.0
func (b *Blueprint) RemoveTerraformComponent(removal TerraformComponent) error
RemoveTerraformComponent removes specified non-index fields from an existing TerraformComponent. Components are matched by component ID (name if provided, otherwise Path). It removes inputs, dependencies, and other fields that are specified in the removal component. Index fields (Name, Path, Source) are not affected. If no matching component exists, no action is taken.
func (*Blueprint) ReplaceKustomization ¶ added in v0.8.0
func (b *Blueprint) ReplaceKustomization(kustomization Kustomization) error
ReplaceKustomization replaces an existing Kustomization with the provided kustomization. If a kustomization with the same Name exists, it is completely replaced. Otherwise, the kustomization is appended. Returns an error if a dependency cycle is detected during sorting.
func (*Blueprint) ReplaceTerraformComponent ¶ added in v0.8.0
func (b *Blueprint) ReplaceTerraformComponent(component TerraformComponent) error
ReplaceTerraformComponent replaces an existing TerraformComponent with the provided component. Components are matched by component ID (name if provided, otherwise Path). If a matching component exists, it is completely replaced. Otherwise, the component is appended. Returns an error if a dependency cycle is detected during sorting or if component IDs are not unique.
func (*Blueprint) StrategicMerge ¶ added in v0.8.0
StrategicMerge performs a strategic merge of the provided overlay Blueprints into the receiver Blueprint. This method appends to array fields, deep merges map fields, and updates scalar fields if present in the overlays. It is designed for feature composition, enabling the combination of multiple features into a single blueprint. Messages accumulate in order, and an identical (when, text) message appears only once.
func (*Blueprint) UpsertFluxSystem ¶ added in v0.9.0
func (b *Blueprint) UpsertFluxSystem(sys FluxSystem) error
UpsertFluxSystem merges sys into the FluxSystem with the same Name, or appends sys when none exists. On a match, DependsOn is the union of both lists, and Secrets merge per data key. Install and Resources deep-merge through MergeFluxInstall and MergeFluxVariants. StrategicMerge uses this to combine FluxSystems from different sources without losing either side.
type BlueprintPatch ¶ added in v0.8.0
type BlueprintPatch struct {
// Path to the patch file, relative to the directory of the file that declares the patch.
Path string `yaml:"path,omitempty"`
// Patch content as YAML string (Flux format).
Patch string `yaml:"patch,omitempty"`
// Target selector for the patch (Flux format).
Target *kustomize.Selector `yaml:"target,omitempty"`
}
BlueprintPatch represents a patch in the blueprint format. This is converted to kustomize.Patch during processing. Supports both blueprint format (Path) and Flux format (Patch + Target). The blueprint loader reads the file at Path into Patch.
type BoolExpression ¶ added in v0.9.0
BoolExpression represents a boolean value that can be unmarshaled from a boolean or a string expression. String expressions are preserved for later evaluation during facet processing.
func (*BoolExpression) DeepCopy ¶ added in v0.9.0
func (b *BoolExpression) DeepCopy() *BoolExpression
DeepCopy creates a deep copy of the BoolExpression.
func (*BoolExpression) IsEnabled ¶ added in v0.9.0
func (b *BoolExpression) IsEnabled() bool
IsEnabled returns true if the BoolExpression is nil (default) or if its value is true. Returns false only if the value is explicitly set to false. This is used for fields like Enabled that default to true.
func (*BoolExpression) IsInstalled ¶ added in v0.9.0
func (b *BoolExpression) IsInstalled() bool
IsInstalled returns true only if the BoolExpression is explicitly set to true. Returns false if nil (default), if it's an expression, or if explicitly false. This is used for fields like Install that default to false.
func (*BoolExpression) MarshalYAML ¶ added in v0.9.0
func (b *BoolExpression) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaler to write boolean as a bool or expression string.
func (*BoolExpression) ToBool ¶ added in v0.9.0
func (b *BoolExpression) ToBool() *bool
ToBool returns the boolean value, or nil if it's an expression.
func (*BoolExpression) UnmarshalYAML ¶ added in v0.9.0
func (b *BoolExpression) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements yaml.Unmarshaler to read boolean from a bool or string expression.
type ConditionalKustomization ¶ added in v0.8.0
type ConditionalKustomization struct {
Kustomization `yaml:",inline"`
// When is an expression that gates the kustomization. Empty means it applies while the facet is active.
When string `yaml:"when,omitempty"`
// Strategy is "merge" (default), "replace", or "remove".
Strategy string `yaml:"strategy,omitempty"`
// Ordinal overrides the facet ordinal for this kustomization's merge precedence.
Ordinal *int `yaml:"ordinal,omitempty"`
// Requires lists requirement blocks scoped to this kustomization.
Requires []RequirementBlock `yaml:"requires,omitempty"`
}
ConditionalKustomization extends Kustomization with conditional logic support. Strategy "merge" (the default) merges into the kustomization with the same Name, and "replace" replaces it. "remove" removes the values the entry sets from that kustomization, after all merges and replaces, and never changes Name. A higher ordinal is processed later and wins on conflict. Requires entries apply under facet.When && kustomization.When && block.When.
func (*ConditionalKustomization) DeepCopy ¶ added in v0.8.0
func (c *ConditionalKustomization) DeepCopy() *ConditionalKustomization
DeepCopy creates a deep copy of the ConditionalKustomization object.
type ConditionalTerraformComponent ¶ added in v0.8.0
type ConditionalTerraformComponent struct {
TerraformComponent `yaml:",inline"`
// When is an expression that gates the component. Empty means it applies while the facet is active.
When string `yaml:"when,omitempty"`
// Strategy is "merge" (default), "replace", or "remove".
Strategy string `yaml:"strategy,omitempty"`
// Ordinal overrides the facet ordinal for this component's merge precedence.
Ordinal *int `yaml:"ordinal,omitempty"`
// Requires lists requirement blocks scoped to this terraform component.
Requires []RequirementBlock `yaml:"requires,omitempty"`
}
ConditionalTerraformComponent extends TerraformComponent with conditional logic support. Strategy "merge" (the default) merges into the component with the same Path and Source, and "replace" replaces it. "remove" removes the values the entry sets from that component, after all merges and replaces, and never changes Path or Source. A higher ordinal is processed later and wins on conflict. Requires entries apply under facet.When && component.When && block.When.
func (*ConditionalTerraformComponent) DeepCopy ¶ added in v0.8.0
func (c *ConditionalTerraformComponent) DeepCopy() *ConditionalTerraformComponent
DeepCopy creates a deep copy of the ConditionalTerraformComponent object.
type ConfigBlock ¶ added in v0.9.0
type ConfigBlock struct {
// Name identifies the block at scope root.
Name string `yaml:"name"`
// When is an expression that gates the block. Empty means the block applies while the facet is active.
When string `yaml:"when,omitempty"`
// Strategy is "merge" (default), "replace", or "remove".
Strategy string `yaml:"strategy,omitempty"`
// Ordinal overrides the facet ordinal for this block's merge precedence.
Ordinal *int `yaml:"ordinal,omitempty"`
// Requires lists requirement blocks scoped to this config block.
Requires []RequirementBlock `yaml:"requires,omitempty"`
// Body holds the content as {"value": <content>} for merge and evaluation, and is not marshaled.
Body map[string]any `yaml:"-"`
}
ConfigBlock represents a named, optionally conditional configuration block in a facet. Only name, when, value, strategy, and ordinal are allowed; value is required and may be a scalar, list, or map. The block is exposed at scope root: expressions use <name> for scalar/list values, or <name>.<key> when value is a map. References from terraform.inputs and kustomize.substitutions use the block name (e.g. talos, platform). Strategy "merge" (the default) deep-merges blocks of the same name, "replace" replaces the existing block, and "remove" removes the block from scope. A higher ordinal wins on conflict. Requires entries apply under the AND of facet.When, block.When, and the entry's own When.
func (*ConfigBlock) DeepCopy ¶ added in v0.9.0
func (c *ConfigBlock) DeepCopy() *ConfigBlock
DeepCopy creates a deep copy of the ConfigBlock object.
func (*ConfigBlock) MarshalYAML ¶ added in v0.9.0
func (c *ConfigBlock) MarshalYAML() (any, error)
MarshalYAML implements custom marshaling. Only name, when, value, strategy, and ordinal are written.
func (*ConfigBlock) UnmarshalYAML ¶ added in v0.9.0
func (c *ConfigBlock) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements custom unmarshaling. Only name, when, value, strategy, and ordinal are read; value is required. Body is set to {"value": raw["value"]} for merge and evaluation. The YAML decoder gives a positive integer as uint64, so the ordinal accepts it. An ordinal that is not an integer returns an error.
type Decryption ¶ added in v0.9.0
type Decryption struct {
// Provider is the decryption backend, e.g. "sops".
Provider string `yaml:"provider,omitempty"`
// SecretRef names the in-cluster Secret holding the decryption key.
SecretRef *DecryptionSecretRef `yaml:"secretRef,omitempty"`
}
Decryption configures in-cluster decryption of a Kustomization's manifests, mapping to Flux's spec.decryption. When set, kustomize-controller decrypts encrypted files in the source with the referenced key Secret during reconciliation; leaving it nil keeps Flux's default of no decryption.
func (*Decryption) DeepCopy ¶ added in v0.9.0
func (d *Decryption) DeepCopy() *Decryption
DeepCopy returns a deep copy of the Decryption, sharing no pointer with the original.
type DecryptionSecretRef ¶ added in v0.9.0
type DecryptionSecretRef struct {
// Name is the Secret's name.
Name string `yaml:"name,omitempty"`
}
DecryptionSecretRef names the Secret that holds the decryption key material, resolved in the Kustomization's own namespace.
type DurationString ¶ added in v0.9.0
DurationString represents a duration that marshals/unmarshals as a string (e.g., "5m"). It can be converted to metav1.Duration for use with Kubernetes APIs.
func FromMetaV1Duration ¶ added in v0.9.0
func FromMetaV1Duration(d *metav1.Duration) *DurationString
FromMetaV1Duration creates a DurationString from *metav1.Duration.
func (*DurationString) MarshalYAML ¶ added in v0.9.0
func (d *DurationString) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaler to write duration as a string.
func (*DurationString) ToMetaV1Duration ¶ added in v0.9.0
func (d *DurationString) ToMetaV1Duration() *metav1.Duration
ToMetaV1Duration converts DurationString to *metav1.Duration.
func (*DurationString) UnmarshalYAML ¶ added in v0.9.0
func (d *DurationString) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements yaml.Unmarshaler to read duration from a string or object.
type Facet ¶ added in v0.9.0
type Facet struct {
// Kind is the facet type, following Kubernetes conventions.
Kind string `yaml:"kind"`
// ApiVersion is the API schema version of the facet.
ApiVersion string `yaml:"apiVersion"`
// Metadata includes the facet's name and description.
Metadata Metadata `yaml:"metadata"`
// Path is the facet's file path, used to resolve relative paths in file() and yaml().
Path string `yaml:"-"`
// Source names the blueprint source this facet came from during composition, and is not marshaled.
Source string `yaml:"-"`
// Ordinal sets the merge precedence of this facet. A higher ordinal wins.
Ordinal *int `yaml:"ordinal,omitempty"`
// When is an expression that determines if this facet applies.
When string `yaml:"when,omitempty"`
// Backend contributes Blueprint.Backend; the composer merges by ordinal precedence.
Backend string `yaml:"backend,omitempty"`
// Config is a list of named configuration blocks exposed at scope root, such as talos.controlplanes.
Config []ConfigBlock `yaml:"config,omitempty"`
// Requires lists requirement blocks that must hold while the facet is active.
Requires []RequirementBlock `yaml:"requires,omitempty"`
// TerraformComponents are Terraform modules in the facet.
TerraformComponents []ConditionalTerraformComponent `yaml:"terraform,omitempty"`
// Kustomizations are kustomization configs in the facet.
Kustomizations []ConditionalKustomization `yaml:"kustomize,omitempty"`
// FluxSystems are the flux: entries of this facet, each compiled to install and resources Kustomizations.
FluxSystems []FluxSystem `yaml:"flux,omitempty"`
// Crds lists vendored CRD references, such as "cert-manager-1.16.2", that this facet's kustomizations depend on.
Crds []string `yaml:"crds,omitempty"`
// Substitutions are key/value pairs, evaluated with facet scope, that go into values-common.
Substitutions map[string]string `yaml:"substitutions,omitempty"`
// Messages are operator-facing notes that render at the end of a bootstrap or apply run.
Messages []Message `yaml:"messages,omitempty"`
}
Facet represents a conditional blueprint fragment that can be merged into a base blueprint. Facets enable modular composition of blueprints based on user configuration values. Facets inherit Repository and Sources from the base blueprint they are merged into. When uses expr-lang/expr syntax, for example "platform == 'aws'". A nil Ordinal comes from the file basename: config-* 100, platform-base or provider-base 199, platform-* or provider-* 200, option-* or options-* 300, and addon-* or addons-* 400. Unmet Requires blocks from every active facet are reported in one error. Messages render after a successful run, interpolated against composed scope.
type FluxSystem ¶ added in v0.9.0
type FluxSystem struct {
// Name identifies the system; tiers compile to "<name>-install" / "<name>-resources[-<variant>]".
Name string `yaml:"name"`
// Path is the base; tiers reconcile from "<path>/install" and "<path>/resources". Defaults to Name.
Path string `yaml:"path,omitempty"`
// Source is the blueprint source that provides the tier bases.
Source string `yaml:"source,omitempty"`
// Enabled includes or excludes the whole system. Defaults to true.
Enabled *BoolExpression `yaml:"enabled,omitempty"`
// Destroy governs whether the system's kustomizations are removed on teardown. Defaults to true.
Destroy *BoolExpression `yaml:"destroy,omitempty"`
// When gates the system; combined (AND) with each resources variant's own condition.
When string `yaml:"when,omitempty"`
// DependsOn are cross-layer edges to other systems.
DependsOn []string `yaml:"dependsOn,omitempty"`
// Strategy governs how a system with this Name merges across facets (merge | replace | remove).
Strategy string `yaml:"strategy,omitempty"`
// Ordinal overrides the facet's ordinal for this system's merge precedence.
Ordinal *int `yaml:"ordinal,omitempty"`
// GlobalDependency makes the system a precondition, such as admission policies, for the rest of the stack.
GlobalDependency bool `yaml:"globalDependency,omitempty"`
// Install is the controller tier that compiles to "<name>-install". The composer sets its Name, Path, and DependsOn.
Install *Kustomization `yaml:"install,omitempty"`
// Resources are the custom-resource tier variants, all sharing "<path>/resources".
Resources []FluxVariant `yaml:"resources,omitempty"`
// Secrets declares Kubernetes Secrets for this system, keyed by Secret name.
Secrets map[string]SecretEntry `yaml:"secrets,omitempty"`
}
FluxSystem is a system entry under a blueprint or facet's `flux:` list — a functional layer that compiles to an install Kustomization plus zero or more resources-variant Kustomizations. The descriptor carries identity, lifecycle, and merge fields; the Install/Resources tiers reuse the Kustomization type and carry the Flux operational properties per tier. It holds no operational properties itself — those belong on the tiers that produce Kustomization objects. DependsOn attaches to the install tier when present, else to each resources variant, and never names the implicit install edge. GlobalDependency makes every kustomization and system outside this system's dependency closure depend on its terminal tier. Secrets back real Secrets with values from schema properties marked sensitive, which never render in plaintext.
func (*FluxSystem) DeepCopy ¶ added in v0.9.0
func (s *FluxSystem) DeepCopy() *FluxSystem
DeepCopy returns a deep copy of the FluxSystem, including its Install tier and Resources variants (each deep-copied via Kustomization.DeepCopy/FluxVariant.DeepCopy).
func (FluxSystem) EffectivePath ¶ added in v0.9.1
func (sys FluxSystem) EffectivePath() string
EffectivePath returns the system's Path. If Path is empty, it returns the Name. This is the single source for the default that compileFluxSystemTiers applies to each tier. Use this method, not the Path field, to read a system's path outside tier compilation. A test assertion against a FluxSystem before tier compilation is one example.
func (FluxSystem) InstallTierName ¶ added in v0.10.0
func (sys FluxSystem) InstallTierName() string
InstallTierName returns the compiled Kustomization name of the system's install tier.
func (FluxSystem) ResourcesTierName ¶ added in v0.10.0
func (sys FluxSystem) ResourcesTierName(variantName string) string
ResourcesTierName returns the compiled Kustomization name of a resources variant. An empty variantName selects the unnamed variant.
func (FluxSystem) TierNames ¶ added in v0.9.0
func (sys FluxSystem) TierNames() []string
TierNames returns the compiled Kustomization names this system produces (its install tier, if any, followed by each resources variant), in compiled order.
type FluxVariant ¶ added in v0.9.0
type FluxVariant struct {
Kustomization `yaml:",inline"`
// When gates this variant; combined (AND) with the system's own condition.
When string `yaml:"when,omitempty"`
}
FluxVariant is one resources-tier Kustomization of a system. It reuses Kustomization for its components, substitutions, and operational properties; the authored `name` becomes the variant suffix ("<system>-resources-<name>") and `dependsOn` is appended to the implicit install edge.
func MergeFluxVariants ¶ added in v0.9.0
func MergeFluxVariants(existing, overlay []FluxVariant) []FluxVariant
MergeFluxVariants combines two resources-variant lists keyed by variant name. A variant from overlay deep-merges into the same-named variant in existing via MergeKustomizationFields (see MergeFluxInstall for why by-name Blueprint.Kustomizations matching isn't used instead), and the two When conditions combine with AND. A variant with a new name is appended in order. This keeps a cross-facet or cross-source merge from emitting two Kustomizations with the same "<system>-resources[-<name>]" identity.
func (*FluxVariant) DeepCopy ¶ added in v0.9.0
func (v *FluxVariant) DeepCopy() *FluxVariant
DeepCopy returns a deep copy of the FluxVariant, including its embedded Kustomization.
type HealthCheckExpr ¶ added in v0.9.1
type HealthCheckExpr struct {
// APIVersion of the custom resource under evaluation.
APIVersion string `yaml:"apiVersion,omitempty"`
// Kind of the custom resource under evaluation.
Kind string `yaml:"kind,omitempty"`
// Current is the CEL expression matching the resource's desired state.
Current string `yaml:"current,omitempty"`
// InProgress is the CEL expression matching a resource still converging.
InProgress string `yaml:"inProgress,omitempty"`
// Failed is the CEL expression matching a resource that failed to converge.
Failed string `yaml:"failed,omitempty"`
}
HealthCheckExpr evaluates the health of a custom resource with CEL, mapping to an entry in Flux's spec.healthCheckExprs. It gates a waiting Kustomization on resources kstatus reports Current immediately — those exposing no status.observedGeneration and no Reconciling/Stalled condition.
type HealthCheckRef ¶ added in v0.9.1
type HealthCheckRef struct {
// APIVersion of the resource to wait on.
APIVersion string `yaml:"apiVersion,omitempty"`
// Kind of the resource to wait on.
Kind string `yaml:"kind,omitempty"`
// Name of the resource to wait on.
Name string `yaml:"name,omitempty"`
// Namespace of the resource to wait on. Defaults to the Kustomization's own namespace.
Namespace string `yaml:"namespace,omitempty"`
}
HealthCheckRef names an external resource a Kustomization waits on before Ready, mirroring Flux's spec.healthChecks. Setting any entry forces Wait to false and disables HealthCheckExprs, since Flux only evaluates those when Wait is true.
type IntExpression ¶ added in v0.9.0
IntExpression represents an integer value that can be unmarshaled from an integer or a string expression. String expressions are preserved for later evaluation during facet processing.
func (*IntExpression) DeepCopy ¶ added in v0.9.0
func (i *IntExpression) DeepCopy() *IntExpression
DeepCopy creates a deep copy of the IntExpression.
func (*IntExpression) MarshalYAML ¶ added in v0.9.0
func (i *IntExpression) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaler to write integer as an int or expression string.
func (*IntExpression) ToInt ¶ added in v0.9.0
func (i *IntExpression) ToInt() *int
ToInt returns the integer value, or nil if it's an expression.
func (*IntExpression) UnmarshalYAML ¶ added in v0.9.0
func (i *IntExpression) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements yaml.Unmarshaler to read integer from an int or string expression.
type Kustomization ¶
type Kustomization struct {
// Name of the kustomization, omitted when empty so an unnamed resources variant emits no name.
Name string `yaml:"name,omitempty"`
// Path of the kustomization. Defaults to Name.
Path string `yaml:"path,omitempty"`
// Source of the kustomization.
Source string `yaml:"source,omitempty"`
// Namespace overrides the namespace of the Flux Kustomization object itself.
Namespace string `yaml:"namespace,omitempty"`
// TargetNamespace sets spec.targetNamespace, so Flux overrides the namespace of every reconciled resource.
TargetNamespace string `yaml:"targetNamespace,omitempty"`
// DependsOn lists dependencies of this kustomization.
DependsOn []string `yaml:"dependsOn,omitempty"`
// Interval for applying the kustomization.
Interval *DurationString `yaml:"interval,omitempty"`
// RetryInterval before retrying a failed kustomization.
RetryInterval *DurationString `yaml:"retryInterval,omitempty"`
// Timeout for the kustomization to complete.
Timeout *DurationString `yaml:"timeout,omitempty"`
// DeleteTimeout bounds how long destroy waits for this kustomization to delete, such as a managed database.
DeleteTimeout *DurationString `yaml:"deleteTimeout,omitempty"`
// Patches to apply to the kustomization.
Patches []BlueprintPatch `yaml:"patches,omitempty"`
// Wait for the kustomization to be fully applied.
Wait *bool `yaml:"wait,omitempty"`
// Force apply the kustomization.
Force *bool `yaml:"force,omitempty"`
// Prune enables garbage collection of resources that are no longer present in the source.
Prune *bool `yaml:"prune,omitempty"`
// HealthCheckExprs are CEL health checks for custom resources kstatus cannot evaluate.
HealthCheckExprs []HealthCheckExpr `yaml:"healthCheckExprs,omitempty"`
// HealthChecks are external resources to wait on before Ready. See HealthCheckRef.
HealthChecks []HealthCheckRef `yaml:"healthChecks,omitempty"`
// Components to include in the kustomization.
Components []string `yaml:"components,omitempty"`
// Destroy determines if the kustomization is destroyed during down operations.
Destroy *BoolExpression `yaml:"destroy,omitempty"`
// DestroyOnly skips the kustomization during apply and up, and runs it only during destroy.
DestroyOnly *bool `yaml:"destroyOnly,omitempty"`
// Enabled determines if the kustomization is included in the final blueprint.
Enabled *BoolExpression `yaml:"enabled,omitempty"`
// Substitutions are string values for Flux postBuild substitution.
Substitutions map[string]string `yaml:"substitutions,omitempty"`
// Substitute is the preferred spelling of Substitutions, matching Flux's postBuild.substitute.
Substitute map[string]string `yaml:"substitute,omitempty"`
// Secrets maps Secret names to entries on a compiled tier, and is never marshaled.
Secrets map[string]SecretEntry `yaml:"-"`
// Decryption maps to Flux's spec.decryption. Nil leaves decryption unset.
Decryption *Decryption `yaml:"decryption,omitempty"`
}
Kustomization represents a kustomization configuration. An unset Namespace uses the gitops namespace. DependsOn always resolves in the gitops namespace, so cross-namespace dependencies are not supported. Timeout governs install and reconcile waits, and seeds the destroy wait when DeleteTimeout is unset. Destroy and Enabled default to true. A DestroyOnly kustomization runs only during destroy, before the regular kustomizations. Substitute and Substitutions merge during composition and go into ConfigMaps, not the context blueprint.yaml.
func MergeFluxInstall ¶ added in v0.9.0
func MergeFluxInstall(existing, overlay *Kustomization) *Kustomization
MergeFluxInstall deep-merges overlay's Install tier into existing's via MergeKustomizationFields (Components/DependsOn accumulate, other fields are overridden by overlay when set) rather than via by-name Blueprint.Kustomizations matching, since Install carries no Name until tier compilation and that by-name path is a no-op on an unnamed Kustomization. Either side being nil just takes the other, matching how a facet or source with no Install opinion shouldn't erase one contributed elsewhere.
func MergeKustomizationFields ¶ added in v0.9.0
func MergeKustomizationFields(base, overlay Kustomization) Kustomization
MergeKustomizationFields deep-merges overlay onto base and returns the result. Neither input changes. Components and DependsOn accumulate without duplicates, and Components are sorted. Patches accumulate. Substitutions copy in. For every other field, a value that overlay sets replaces the base value. HealthCheckExprs and HealthChecks accumulate. An overlay HealthCheckExpr replaces a base entry with the same APIVersion and Kind, and an overlay HealthCheck replaces one with the same APIVersion, Kind, and Name. Namespace is not part of the match, because it defaults to the kustomization's namespace.
func (*Kustomization) DeepCopy ¶ added in v0.6.0
func (k *Kustomization) DeepCopy() *Kustomization
DeepCopy creates a deep copy of the Kustomization object.
func (*Kustomization) FluxPath ¶ added in v0.10.0
func (k *Kustomization) FluxPath() string
FluxPath returns the slash-separated path of k under the kustomize/ directory. A Path-less k uses k.Name.
func (*Kustomization) ToFluxKustomization ¶ added in v0.8.0
func (k *Kustomization) ToFluxKustomization(namespace string, defaultSourceName string, sources []Source, mode constants.GitopsMode, configMaps ...map[string]map[string]string) kustomizev1.Kustomization
ToFluxKustomization converts a blueprint Kustomization to a Flux Kustomization in namespace. k.Namespace overrides namespace for the object, and DependsOn always resolves in namespace. A Path-less k uses k.Name as its path, and an unset Interval follows the source (see constants.FluxKustomizationInterval). The mode argument does not change the result. The first configMaps entry adds blueprint-level ConfigMaps to postBuild.substituteFrom. CRD layers get no PostBuild, because envsubst fails on the ${...} text in vendored CRDs.
type Message ¶ added in v0.9.0
type Message struct {
// When is an optional expression gating whether this message renders. Empty means always.
When string `yaml:"when,omitempty"`
// Text is the message body, which may reference config values and run outputs.
Text string `yaml:"text"`
}
Message is an operator-facing note a facet emits at the end of a run. When gates whether it renders; Text is the message body, evaluated against composed scope so it can interpolate run values.
type Metadata ¶
type Metadata struct {
// Name is the blueprint's unique identifier.
Name string `yaml:"name"`
// Description is a brief overview of the blueprint.
Description string `yaml:"description,omitempty"`
}
Metadata describes a blueprint.
type PostBuild ¶ added in v0.4.0
type PostBuild struct {
// Substitute is a map of resources to substitute from.
Substitute map[string]string `yaml:"substitute,omitempty"`
// SubstituteFrom is a list of resources to substitute from.
SubstituteFrom []SubstituteReference `yaml:"substituteFrom,omitempty"`
}
PostBuild is a post-build step to run after the kustomization is applied.
type Reference ¶
type Reference struct {
// Branch to use.
Branch string `yaml:"branch,omitempty"`
// Tag to use.
Tag string `yaml:"tag,omitempty"`
// SemVer to use.
SemVer string `yaml:"semver,omitempty"`
// Name of the reference.
Name string `yaml:"name,omitempty"`
// Commit hash to use.
Commit string `yaml:"commit,omitempty"`
}
Reference details a specific version or state of a repository or source.
type Repository ¶
type Repository struct {
// Url is the repository location.
Url string `yaml:"url,omitempty"`
// Ref details the branch, tag, or commit to use.
Ref Reference `yaml:"ref,omitempty"`
// SecretName is the secret for repository access.
SecretName *string `yaml:"secretName,omitempty"`
}
Repository contains source code repository info.
type RequirementBlock ¶ added in v0.9.0
type RequirementBlock struct {
// When is an expression gating this block. Empty means always required while the parent facet is active.
When string `yaml:"when,omitempty"`
// Paths are dotted scope keys whose values must be present and non-empty.
Paths []string `yaml:"paths,omitempty"`
// Message is author-supplied context for the aggregated error. A block without Paths requires it.
Message string `yaml:"message,omitempty"`
}
RequirementBlock declares a rule that the parent facet's inputs must meet. A block with Paths requires each path to resolve to a present, non-empty value. A block without Paths rejects a combination of values: it fails whenever its When is true, and the error shows its Message. When gates the block; if empty, the block applies whenever the parent facet is active.
func (*RequirementBlock) DeepCopy ¶ added in v0.9.0
func (r *RequirementBlock) DeepCopy() *RequirementBlock
DeepCopy creates a deep copy of the RequirementBlock object.
func (*RequirementBlock) UnmarshalYAML ¶ added in v0.9.0
func (r *RequirementBlock) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML rejects a block that has neither when nor paths, because it checks nothing. It also rejects a block without paths that has no message, because its error would have no text.
type SecretEntry ¶ added in v0.9.0
type SecretEntry struct {
// Namespaces are the namespaces to place this Secret into.
Namespaces []string `yaml:"namespaces,omitempty"`
// Data maps each Secret data key to a reference to a schema property.
Data map[string]string `yaml:"data,omitempty"`
// Type is the Kubernetes Secret type, such as "kubernetes.io/tls" for a Gateway listener.
Type string `yaml:"type,omitempty"`
}
SecretEntry is one `secrets:` entry on a flux system tier: the data that backs a Kubernetes Secret plus the namespaces it is placed into. Empty Namespaces places the Secret in the single namespace the owning kustomization creates. A named namespace must be one that kustomization created, so one entry can fan out to several namespaces of a system such as pki. Data values reference schema properties, resolve at placement, and never render in plaintext. An empty Type comes from the data keys: a ".dockerconfigjson" key, or "docker-username" plus "docker-password" (and an optional "docker-server", default "ghcr.io"), makes a kubernetes.io/dockerconfigjson Secret. Any other data makes an Opaque Secret.
func (SecretEntry) DeepCopy ¶ added in v0.9.0
func (s SecretEntry) DeepCopy() SecretEntry
DeepCopy returns a deep copy of the SecretEntry, sharing no slice or map with the original.
type Source ¶
type Source struct {
// Name identifies the source.
Name string `yaml:"name"`
// Url is the source location.
Url string `yaml:"url,omitempty"`
// PathPrefix is a prefix to the source path.
PathPrefix string `yaml:"pathPrefix,omitempty"`
// Ref details the branch, tag, or commit to use.
Ref Reference `yaml:"ref,omitempty"`
// SecretName is the secret for source access.
SecretName string `yaml:"secretName,omitempty"`
// Install merges the source's components into the final blueprint.
Install *BoolExpression `yaml:"install,omitempty"`
// Crds lists the CRD references this source vendors at <source>/kustomize/crds/<ref>.
Crds []string `yaml:"crds,omitempty"`
}
Source is an external resource referenced by a blueprint. Install defaults to false. Facets can set Install with an expression, such as "${some.condition ?? true}". The composer fills Crds from the source's facets. When Install is true, the provisioner installs them in a background "crds-<name>" kustomization ahead of the stack.
type SubstituteReference ¶ added in v0.4.0
type SubstituteReference struct {
// Kind of the resource to substitute from.
Kind string `yaml:"kind"`
// Name of the resource to substitute from.
Name string `yaml:"name"`
// Optional indicates if the resource is optional.
Optional bool `yaml:"optional,omitempty"`
}
SubstituteReference is a reference to a resource to substitute from.
type TerraformComponent ¶
type TerraformComponent struct {
// Name of the terraform component, which is its ID when set.
Name string `yaml:"name,omitempty"`
// Source of the Terraform module.
Source string `yaml:"source,omitempty"`
// Path of the Terraform module.
Path string `yaml:"path"`
// FullPath is the complete path, not serialized to YAML.
FullPath string `yaml:"-"`
// DependsOn lists dependencies of this terraform component.
DependsOn []string `yaml:"dependsOn,omitempty"`
// Inputs are configuration values for the module.
Inputs map[string]any `yaml:"inputs,omitempty"`
// Destroy determines if the component is destroyed during down operations.
Destroy *BoolExpression `yaml:"destroy,omitempty"`
// Parallelism limits the number of concurrent operations as Terraform walks the graph.
Parallelism *IntExpression `yaml:"parallelism,omitempty"`
// Enabled determines if the component is included in the final blueprint.
Enabled *BoolExpression `yaml:"enabled,omitempty"`
// InputOrigins maps each input key to the facet file that defined it, to resolve relative paths.
InputOrigins map[string]string `yaml:"-"`
}
TerraformComponent defines a Terraform module in a blueprint. Name, when set, is the component ID instead of Path. An Inputs value with ${} syntax, such as "${cluster.name}", is an expression, and any other value is a literal. Inputs go into tfvars files and not into the context blueprint.yaml. Destroy and Enabled default to true. Parallelism maps to the terraform -parallelism flag. Facets can set Destroy, Enabled, and Parallelism with expressions, such as "${cluster.destroy ?? true}".
func (*TerraformComponent) DeepCopy ¶ added in v0.8.0
func (t *TerraformComponent) DeepCopy() *TerraformComponent
DeepCopy creates a deep copy of the TerraformComponent object.
func (*TerraformComponent) GetID ¶ added in v0.9.0
func (t *TerraformComponent) GetID() string
GetID returns the unique identifier for this terraform component. If Name is provided, it returns Name; otherwise, it returns Path.
type TestCase ¶ added in v0.9.0
type TestCase struct {
// Name is the unique identifier for this test case.
Name string `yaml:"name"`
// Values are configuration values that override the existing configuration before composition.
Values map[string]any `yaml:"values,omitempty"`
// Env provides the only environment variables that env() expressions see during composition.
Env map[string]string `yaml:"env,omitempty"`
// TerraformOutputs maps component IDs to mock outputs for terraform_output() expressions.
TerraformOutputs map[string]map[string]any `yaml:"terraformOutputs,omitempty"`
// Expect defines components that must be present in the composed blueprint.
Expect *Blueprint `yaml:"expect,omitempty"`
// Exclude defines components that must not be present in the composed blueprint.
Exclude *Blueprint `yaml:"exclude,omitempty"`
// ExpectError makes the case pass only when composition fails.
ExpectError bool `yaml:"expectError,omitempty"`
// ApplySchemaDefaults composes this case with schema default: values materialized, as production does.
ApplySchemaDefaults bool `yaml:"applySchemaDefaults,omitempty"`
}
TestCase represents a single test case with input values and expected output. Each test case applies the specified values to configuration and validates the resulting composed blueprint against expectations. Expect and Exclude match partially: only the fields they set are checked, and Kind, ApiVersion, and Metadata are ignored. env() sees only Env, never the host environment. Composition skips schema defaults unless ApplySchemaDefaults is set.
type TestFile ¶ added in v0.9.0
type TestFile struct {
// Cases is a list of test cases to execute.
Cases []TestCase `yaml:"cases"`
}
TestFile represents a test file containing multiple test cases for blueprint composition validation. Test files are stored in contexts/_template/tests/*.test.yaml and define input values along with expected and excluded blueprint components.