Documentation
¶
Index ¶
- Constants
- func FluxOperatorInstallObjects() ([]client.Object, error)
- type BootstrapGenerator
- func (bg *BootstrapGenerator) GenerateBootstrap(config *stack.BootstrapConfig, rootNode *stack.Node) ([]client.Object, error)
- func (bg *BootstrapGenerator) GenerateFluxInstance(config *stack.BootstrapConfig, rootNode *stack.Node) (*fluxv1.FluxInstance, error)
- func (bg *BootstrapGenerator) SupportedBootstrapModes() []string
- type LayoutIntegrator
- type ResourceGenerator
- func (g *ResourceGenerator) GenerateFromBundle(b *stack.Bundle) ([]client.Object, error)
- func (g *ResourceGenerator) GenerateFromCluster(c *stack.Cluster) ([]client.Object, error)
- func (g *ResourceGenerator) GenerateFromNode(n *stack.Node) ([]client.Object, error)
- func (g *ResourceGenerator) GetName() string
- func (g *ResourceGenerator) GetVersion() string
- type WorkflowEngine
- func (we *WorkflowEngine) CreateLayoutWithResources(c *stack.Cluster, rules stack.LayoutRulesProvider) (stack.ManifestLayoutResult, error)
- func (we *WorkflowEngine) GenerateBootstrap(config *stack.BootstrapConfig, rootNode *stack.Node) ([]client.Object, error)
- func (we *WorkflowEngine) GenerateFromBundle(b *stack.Bundle) ([]client.Object, error)
- func (we *WorkflowEngine) GenerateFromCluster(c *stack.Cluster) ([]client.Object, error)
- func (we *WorkflowEngine) GenerateFromNode(n *stack.Node) ([]client.Object, error)
- func (we *WorkflowEngine) GetBootstrapGenerator() *BootstrapGenerator
- func (we *WorkflowEngine) GetLayoutIntegrator() *LayoutIntegrator
- func (we *WorkflowEngine) GetName() string
- func (we *WorkflowEngine) GetResourceGenerator() *ResourceGenerator
- func (we *WorkflowEngine) GetVersion() string
- func (we *WorkflowEngine) IntegrateWithLayout(ml *layout.ManifestLayout, c *stack.Cluster, rules layout.LayoutRules) error
- func (we *WorkflowEngine) SetKustomizationMode(mode layout.KustomizationMode)
- func (we *WorkflowEngine) SupportedBootstrapModes() []string
Constants ¶
const FluxOperatorVersion = "v0.48.0"
FluxOperatorVersion is the upstream flux-operator release whose install manifest is vendored as fluxOperatorInstallYAML. It is pinned to match the github.com/controlplaneio-fluxcd/flux-operator Go module version in kure's go.mod so that the generated FluxInstance type and the install bundle stay in lockstep.
To refresh this vendoring:
- Bump github.com/controlplaneio-fluxcd/flux-operator in go.mod.
- Download the matching install.yaml from the flux-operator GitHub release page: https://github.com/controlplaneio-fluxcd/flux-operator/releases/download/{version}/install.yaml
- Replace pkg/stack/fluxcd/flux_operator_install.yaml with it.
- Update this constant.
- Run the tests in this package and confirm the resource inventory in TestFluxOperatorInstallObjects still matches.
Variables ¶
This section is empty.
Functions ¶
func FluxOperatorInstallObjects ¶
FluxOperatorInstallObjects returns the parsed Flux Operator install manifest: Namespace, CRDs, RBAC, ServiceAccount, Service, and controller Deployment. The bytes are embedded at build time from flux_operator_install.yaml (version FluxOperatorVersion).
The returned slice is cached on first parse; callers must treat it as read-only. To mutate any object, deep-copy first.
The order of objects matches the order in the upstream install.yaml (Namespace → CRDs → RBAC → ServiceAccount → Deployment → Service), which is also a valid apply order.
Types ¶
type BootstrapGenerator ¶
type BootstrapGenerator struct {
// DefaultNamespace is the namespace where bootstrap resources are created
DefaultNamespace string
// DefaultInterval is the default reconciliation interval
DefaultInterval time.Duration
}
BootstrapGenerator implements the workflow.BootstrapGenerator interface for Flux. It handles the generation of bootstrap resources for setting up Flux.
func NewBootstrapGenerator ¶
func NewBootstrapGenerator() *BootstrapGenerator
NewBootstrapGenerator creates a FluxCD bootstrap generator.
func (*BootstrapGenerator) GenerateBootstrap ¶
func (bg *BootstrapGenerator) GenerateBootstrap(config *stack.BootstrapConfig, rootNode *stack.Node) ([]client.Object, error)
GenerateBootstrap creates bootstrap resources for setting up Flux. When FluxMode is empty, flux-operator is used as the default.
func (*BootstrapGenerator) GenerateFluxInstance ¶
func (bg *BootstrapGenerator) GenerateFluxInstance(config *stack.BootstrapConfig, rootNode *stack.Node) (*fluxv1.FluxInstance, error)
GenerateFluxInstance returns only the FluxInstance CR configured for the given bootstrap settings, without the full Flux Operator install bundle. Returns (nil, nil) when config is nil. Unlike GenerateBootstrap, this method does not check config.Enabled — the caller is responsible for that gate.
func (*BootstrapGenerator) SupportedBootstrapModes ¶
func (bg *BootstrapGenerator) SupportedBootstrapModes() []string
SupportedBootstrapModes returns the bootstrap modes supported by this generator. flux-operator is the primary (recommended) mode; gotk is the legacy mode.
type LayoutIntegrator ¶
type LayoutIntegrator struct {
// ResourceGenerator generates the Flux resources
Generator *ResourceGenerator
}
LayoutIntegrator implements the workflow.LayoutIntegrator interface for Flux. It handles integration of Flux resources with manifest layouts.
Placement (FluxIntegratedPerLayout vs FluxSeparate) is configured via layout.LayoutRules.FluxPlacement on each call. CreateLayoutWithResources normalizes FluxUnset to FluxSeparate before invoking the SourceRef validation gate, WalkCluster, and IntegrateWithLayout, so all three observers agree on the effective placement.
func NewLayoutIntegrator ¶
func NewLayoutIntegrator(generator *ResourceGenerator) *LayoutIntegrator
NewLayoutIntegrator creates a FluxCD layout integrator.
func (*LayoutIntegrator) CreateLayoutWithResources ¶
func (li *LayoutIntegrator) CreateLayoutWithResources(c *stack.Cluster, rules layout.LayoutRules) (*layout.ManifestLayout, error)
CreateLayoutWithResources creates a new layout that includes Flux resources.
rules.FluxPlacement is normalized once at the top of this method (FluxUnset -> FluxSeparate) and the normalized rules are passed to the SourceRef validation gate, WalkCluster, and IntegrateWithLayout. This guarantees a single placement authority per call.
func (*LayoutIntegrator) IntegrateWithLayout ¶
func (li *LayoutIntegrator) IntegrateWithLayout(ml *layout.ManifestLayout, c *stack.Cluster, rules layout.LayoutRules) error
IntegrateWithLayout adds Flux resources to an existing manifest layout.
Placement is driven by rules.FluxPlacement. FluxUnset is treated as FluxSeparate to match DefaultLayoutRules and the walker's normalization in pkg/stack/layout/walker.go:42-44.
If the layout was post-processed by FlattenSingleTier (recorded as flattenInfo on the absorbing layouts), this method consults nodeAliases during integrated placement (see findLayoutNode) and rewrites Flux Kustomization Spec.Path values via layout.ApplyFlattenPathRewrites before returning, regardless of placement mode.
type ResourceGenerator ¶
type ResourceGenerator struct {
// Mode controls how spec.path is generated in Kustomizations
Mode layout.KustomizationMode
// DefaultInterval is the default reconciliation interval for generated resources
DefaultInterval time.Duration
// DefaultNamespace is the default namespace for generated Flux resources
DefaultNamespace string
}
ResourceGenerator implements the workflow.ResourceGenerator interface for Flux. It focuses purely on generating Flux CRDs from stack components.
func NewResourceGenerator ¶
func NewResourceGenerator() *ResourceGenerator
NewResourceGenerator creates a FluxCD resource generator with sensible defaults.
func (*ResourceGenerator) GenerateFromBundle ¶
GenerateFromBundle creates Flux resources (Kustomization, and optionally a Source) for b itself only. Umbrella Children are NOT recursed — callers that need the closure should use GenerateFromNode, which walks the subtree, or iterate b.Children directly.
func (*ResourceGenerator) GenerateFromCluster ¶
GenerateFromCluster creates Flux Kustomizations and Sources from a cluster definition. It runs stack.ValidateCluster first to fail fast on structural errors (umbrella cycles, disjointness violations, etc.).
func (*ResourceGenerator) GenerateFromNode ¶
GenerateFromNode creates Flux resources from a node and its children. When a node's bundle is an umbrella (len(Bundle.Children) > 0), the umbrella closure is walked and flattened into the returned slice so flat-list consumers (e.g. separate Flux placement) see every child Kustomization CR.
func (*ResourceGenerator) GetName ¶
func (g *ResourceGenerator) GetName() string
GetName returns the name of this resource generator.
func (*ResourceGenerator) GetVersion ¶
func (g *ResourceGenerator) GetVersion() string
GetVersion returns the version of this resource generator.
type WorkflowEngine ¶
type WorkflowEngine struct {
// ResourceGen handles core resource generation
ResourceGen *ResourceGenerator
// LayoutInteg handles layout integration
LayoutInteg *LayoutIntegrator
// BootstrapGen handles bootstrap resource generation
BootstrapGen *BootstrapGenerator
}
WorkflowEngine implements the stack.Workflow interface by composing the specialized generator components. This provides a complete FluxCD workflow implementation with clear separation of concerns.
func Engine ¶
func Engine() *WorkflowEngine
Engine returns a WorkflowEngine initialized with defaults. This is the primary entry point for FluxCD workflow functionality.
func EngineWithConfig ¶
func EngineWithConfig(mode layout.KustomizationMode) *WorkflowEngine
EngineWithConfig returns a WorkflowEngine with a specific kustomization mode. Placement is no longer a constructor argument; set it on layout.LayoutRules.FluxPlacement at call time.
func EngineWithMode ¶
func EngineWithMode(mode layout.KustomizationMode) *WorkflowEngine
EngineWithMode returns a WorkflowEngine with a specific kustomization mode.
func NewWorkflowEngine ¶
func NewWorkflowEngine() *WorkflowEngine
NewWorkflowEngine creates a FluxCD workflow engine with default components.
func NewWorkflowEngineWithConfig ¶
func NewWorkflowEngineWithConfig(mode layout.KustomizationMode) *WorkflowEngine
NewWorkflowEngineWithConfig creates a workflow engine with custom configuration.
Placement is no longer a constructor argument; set it on layout.LayoutRules.FluxPlacement at call time. See LayoutIntegrator for the normalization semantics.
func (*WorkflowEngine) CreateLayoutWithResources ¶
func (we *WorkflowEngine) CreateLayoutWithResources(c *stack.Cluster, rules stack.LayoutRulesProvider) (stack.ManifestLayoutResult, error)
CreateLayoutWithResources creates a new layout that includes Flux resources.
func (*WorkflowEngine) GenerateBootstrap ¶
func (we *WorkflowEngine) GenerateBootstrap(config *stack.BootstrapConfig, rootNode *stack.Node) ([]client.Object, error)
GenerateBootstrap creates bootstrap resources for setting up Flux.
func (*WorkflowEngine) GenerateFromBundle ¶
GenerateFromBundle creates Flux resources from a bundle definition.
func (*WorkflowEngine) GenerateFromCluster ¶
GenerateFromCluster creates Flux resources from a cluster definition.
func (*WorkflowEngine) GenerateFromNode ¶
GenerateFromNode creates Flux resources from a node definition.
func (*WorkflowEngine) GetBootstrapGenerator ¶
func (we *WorkflowEngine) GetBootstrapGenerator() *BootstrapGenerator
GetBootstrapGenerator returns the underlying bootstrap generator for advanced configuration.
func (*WorkflowEngine) GetLayoutIntegrator ¶
func (we *WorkflowEngine) GetLayoutIntegrator() *LayoutIntegrator
GetLayoutIntegrator returns the underlying layout integrator for advanced configuration.
func (*WorkflowEngine) GetName ¶
func (we *WorkflowEngine) GetName() string
GetName returns a human-readable name for this workflow engine.
func (*WorkflowEngine) GetResourceGenerator ¶
func (we *WorkflowEngine) GetResourceGenerator() *ResourceGenerator
GetResourceGenerator returns the underlying resource generator for advanced configuration.
func (*WorkflowEngine) GetVersion ¶
func (we *WorkflowEngine) GetVersion() string
GetVersion returns the version of this workflow engine.
func (*WorkflowEngine) IntegrateWithLayout ¶
func (we *WorkflowEngine) IntegrateWithLayout(ml *layout.ManifestLayout, c *stack.Cluster, rules layout.LayoutRules) error
IntegrateWithLayout adds Flux resources to an existing manifest layout.
func (*WorkflowEngine) SetKustomizationMode ¶
func (we *WorkflowEngine) SetKustomizationMode(mode layout.KustomizationMode)
SetKustomizationMode configures how Kustomization paths are generated.
func (*WorkflowEngine) SupportedBootstrapModes ¶
func (we *WorkflowEngine) SupportedBootstrapModes() []string
SupportedBootstrapModes returns the bootstrap modes supported by this engine.