Documentation
¶
Index ¶
- Constants
- Variables
- type BackendMove
- type BootstrapConfirmFn
- type BootstrapSummary
- type BootstrapTerraformEntry
- type ComponentFailure
- type ComponentMove
- type DestroyPlanSummary
- type DestroyResult
- type NodeHealthCheckOptions
- type PartialRun
- type PlanSummary
- type Provisioner
- func (i *Provisioner) Apply(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) error
- func (i *Provisioner) ApplyKustomize(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) error
- func (i *Provisioner) ApplyKustomizeAll(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) BeginVersionTransition(blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) Bootstrap(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) (bool, error)
- func (i *Provisioner) CheckComponentDestroyable(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) CheckNodeHealth(ctx context.Context, options NodeHealthCheckOptions, outputFunc func(string)) error
- func (i *Provisioner) CheckVersionGate(blueprint *blueprintv1alpha1.Blueprint) (VersionGate, error)
- func (i *Provisioner) ClearPartialRun() error
- func (i *Provisioner) Close()
- func (i *Provisioner) Destroy(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) (bool, error)
- func (i *Provisioner) DestroyAll(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) (DestroyResult, error)
- func (i *Provisioner) DestroyAllTerraform(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) (DestroyResult, error)
- func (i *Provisioner) DestroyKustomize(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) error
- func (i *Provisioner) Down(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) GetVersionMarker() (kubernetes.VersionMarker, bool, error)
- func (i *Provisioner) HasLocalStateWithResources(componentID string) (bool, error)
- func (i *Provisioner) HasRemoteState(blueprint *blueprintv1alpha1.Blueprint, componentID string) (bool, error)
- func (i *Provisioner) InitComponent(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) Install(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, prune bool) error
- func (i *Provisioner) ListLocalStateComponentIDs() ([]string, error)
- func (i *Provisioner) MigrateComponentState(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) MigrateState(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) ([]string, error)
- func (i *Provisioner) Notify(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) OnTerraformApply(fn func(ctx context.Context, id string) (bool, error))
- func (i *Provisioner) OnTerraformPostApply(fn func(ctx context.Context, id string) error)
- func (i *Provisioner) PendingBackendMove(blueprint *blueprintv1alpha1.Blueprint) (*BackendMove, error)
- func (i *Provisioner) PivotToLocalIfClusterGone() (bool, error)
- func (i *Provisioner) PlaceSecrets(ctx context.Context, resolved ResolvedSecrets, ...) error
- func (i *Provisioner) Plan(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) PlanAll(blueprint *blueprintv1alpha1.Blueprint) (*PlanSummary, error)
- func (i *Provisioner) PlanDestroyAll(blueprint *blueprintv1alpha1.Blueprint) (*DestroyPlanSummary, error)
- func (i *Provisioner) PlanDestroyKustomizeComponentSummary(blueprint *blueprintv1alpha1.Blueprint, name string) (fluxinfra.KustomizePlan, error)
- func (i *Provisioner) PlanDestroyKustomizeSummary(blueprint *blueprintv1alpha1.Blueprint) (*DestroyPlanSummary, error)
- func (i *Provisioner) PlanDestroyTerraformComponentSummary(blueprint *blueprintv1alpha1.Blueprint, componentID string) (terraforminfra.TerraformComponentPlan, error)
- func (i *Provisioner) PlanDestroyTerraformSummary(blueprint *blueprintv1alpha1.Blueprint) (*DestroyPlanSummary, error)
- func (i *Provisioner) PlanKustomization(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) PlanKustomizeAll(blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) PlanKustomizeAllJSON(blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) PlanKustomizeComponentSummary(blueprint *blueprintv1alpha1.Blueprint, name string) (fluxinfra.KustomizePlan, error)
- func (i *Provisioner) PlanKustomizeJSON(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) PlanKustomizeSummary(blueprint *blueprintv1alpha1.Blueprint) (*PlanSummary, error)
- func (i *Provisioner) PlanRun(bp *blueprintv1alpha1.Blueprint, command, to string, continuing bool) (*RunPlan, error)
- func (i *Provisioner) PlanTerraformAll(blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) PlanTerraformAllJSON(blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) PlanTerraformAllResourceChangesJSON(blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) PlanTerraformComponentSummary(blueprint *blueprintv1alpha1.Blueprint, componentID string) (terraforminfra.TerraformComponentPlan, error)
- func (i *Provisioner) PlanTerraformJSON(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) PlanTerraformResourceChangesJSON(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
- func (i *Provisioner) PlanTerraformSummary(blueprint *blueprintv1alpha1.Blueprint) (*PlanSummary, error)
- func (i *Provisioner) PrepareLocalTeardown(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) (bool, error)
- func (i *Provisioner) PrunableKustomizations(blueprint *blueprintv1alpha1.Blueprint) ([]string, error)
- func (i *Provisioner) Prune(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) RecordPartialRun(bp *blueprintv1alpha1.Blueprint, plan *RunPlan) error
- func (i *Provisioner) RemoveLocalState(componentID string) error
- func (i *Provisioner) ResolveSecrets(blueprint *blueprintv1alpha1.Blueprint) (ResolvedSecrets, error)
- func (i *Provisioner) Teardown(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) (DestroyResult, error)
- func (i *Provisioner) TeardownComponent(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) (bool, error)
- func (i *Provisioner) Uninstall(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) Up(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, ...) (bool, error)
- func (i *Provisioner) UpgradeNode(ctx context.Context, node string, image string, offlineTimeout time.Duration, ...) error
- func (i *Provisioner) UpgradeNodes(ctx context.Context, nodes []string, image string, powercycle bool) error
- func (i *Provisioner) ValidateBackendComponents(blueprint *blueprintv1alpha1.Blueprint) error
- func (i *Provisioner) WriteVersionMarker(blueprint *blueprintv1alpha1.Blueprint) error
- type ResolvedSecret
- type ResolvedSecrets
- type RunPlan
- func (p *RunPlan) Finished() []string
- func (p *RunPlan) InstallBlueprint(bp *blueprintv1alpha1.Blueprint) *blueprintv1alpha1.Blueprint
- func (p *RunPlan) StopLabel() string
- func (p *RunPlan) Stops() bool
- func (p *RunPlan) TerraformBlueprint(bp *blueprintv1alpha1.Blueprint) *blueprintv1alpha1.Blueprint
- type Shims
- type VersionGate
Constants ¶
const KustomizeFailureID = "kustomize"
KustomizeFailureID is the sentinel ID for a kustomize Uninstall failure under continue-on-error mode. The kustomize layer reports one aggregate failure, not one per Kustomization.
Variables ¶
var ErrInvalidRunTarget = errors.New("invalid run target")
ErrInvalidRunTarget marks a --to or --continue request that the blueprint or the saved record cannot satisfy.
var ErrKustomizationFailed = kubernetes.ErrKustomizationFailed
ErrKustomizationFailed marks an Install or ApplyKustomize error from a kustomization that will not become Ready without a change. An error that matches it also matches ErrKustomizationsNotReady.
var ErrKustomizationsNotReady = errors.New("kustomizations not ready")
ErrKustomizationsNotReady marks an Install or ApplyKustomize error from a kustomization that did not become Ready.
Functions ¶
This section is empty.
Types ¶
type BackendMove ¶ added in v0.10.0
type BackendMove struct {
To string
Components []ComponentMove
}
BackendMove describes a pending change of the terraform backend type. To is the configured backend type. Components lists the components with a pending move, in blueprint order.
func (*BackendMove) Sources ¶ added in v0.10.0
func (m *BackendMove) Sources() []string
Sources returns each backend type that holds the state of a pending component, once, in the order of the first component that uses it.
type BootstrapConfirmFn ¶ added in v0.9.0
type BootstrapConfirmFn func(*BootstrapSummary) bool
BootstrapConfirmFn receives the bootstrap summary and returns true to proceed.
type BootstrapSummary ¶ added in v0.9.0
type BootstrapSummary struct {
ContextName string
BackendType string
Terraform []BootstrapTerraformEntry
Kustomize []string
}
BootstrapSummary describes the operator-visible intent of a bootstrap call.
func BuildBootstrapSummary ¶ added in v0.9.0
func BuildBootstrapSummary(blueprint *blueprintv1alpha1.Blueprint, contextName, backendType string) *BootstrapSummary
BuildBootstrapSummary constructs the operator-visible intent description for a bootstrap, independent of any Provisioner instance so the project layer can render the plan before committing to privileged work. The CRD layers are materialized via withCrdLayer so the bootstrap plan lists the synthesized "crds"/"crds-<source>" kustomizations the stack installs, matching what `windsor plan` shows rather than hiding them until apply.
type BootstrapTerraformEntry ¶ added in v0.9.0
BootstrapTerraformEntry is a single row in the Terraform section of the bootstrap summary.
type ComponentFailure ¶ added in v0.9.0
type ComponentFailure = terraforminfra.ComponentFailure
ComponentFailure is a per-component error captured during continue-on-error destroy. Aliased from the terraform package so callers can use a single type identity across the layer boundary without duplication.
type ComponentMove ¶ added in v0.10.0
ComponentMove names one component with a pending move and the backend type that holds its state.
type DestroyPlanSummary ¶ added in v0.9.0
type DestroyPlanSummary struct {
Terraform []terraforminfra.TerraformComponentPlan
Kustomize []fluxinfra.KustomizePlan
}
DestroyPlanSummary holds aggregated destroy-plan results across all infrastructure layers. The shape mirrors PlanSummary but without the Hints field: destroy is gated on a working cluster (the kustomize layer queries flux's live inventory), so a tooling-missing fallback is not part of the destroy contract — fail fast instead. The TerraformComponentPlan and KustomizePlan entries here come from the destroy-side producers; renderers must use a destroy-aware formatter to translate IsNew correctly (apply-side "(new)" becomes destroy-side "(no state)" / "(not deployed)").
type DestroyResult ¶ added in v0.9.0
type DestroyResult struct {
Destroyed []string
Skipped []string
SkippedClusterGone []string
Failed []ComponentFailure
TerraformDeferred bool
}
DestroyResult is the cmd-facing aggregate of a destroy pass. Destroyed, Skipped, and Failed roll up every component the provisioner attempted, kustomize and terraform. TerraformDeferred marks that the terraform stage was skipped: a kustomize failure occurred, or a non-backend component still needs work. Add fields for other destroy layers, such as Helm, to this type, not to the terraform-package outcome.
SkippedClusterGone is separate from Skipped. It names kustomizations skipped for a missing kubeconfig, not empty terraform state. An empty terraform state may be an orphan hazard. A missing kubeconfig on a destroy re-run just means the cluster is already gone. See reportSkippedDestroyComponents and reportSkippedClusterGoneKustomizations in cmd/destroy.go.
type NodeHealthCheckOptions ¶
type NodeHealthCheckOptions struct {
Nodes []string
Timeout time.Duration
Version string
K8SEndpoint string
K8SEndpointProvided bool
CheckNodeReady bool
SkipServices []string
WaitForReboot bool
OfflineTimeout time.Duration
}
NodeHealthCheckOptions contains options for node health checking.
type PartialRun ¶ added in v0.10.0
type PartialRun struct {
Command string `yaml:"command"`
StoppedAfter string `yaml:"stoppedAfter"`
Terraform []string `yaml:"terraform"`
Components []string `yaml:"components"`
}
PartialRun is the record that a stopped run saves in the scratch directory of the context. Terraform lists the finished component IDs in apply order. Components lists every enabled component ID at the stop, so a later change to the blueprint is detectable.
type PlanSummary ¶ added in v0.9.0
type PlanSummary struct {
Terraform []terraforminfra.TerraformComponentPlan
Kustomize []fluxinfra.KustomizePlan
Hints []string
}
PlanSummary holds aggregated plan results across all infrastructure layers. Terraform contains one entry per enabled component; Kustomize contains one entry per non-destroyOnly kustomization. Either slice may be nil when the corresponding layer is absent from the blueprint or its tooling is unavailable. Hints contains upgrade suggestions collected when required CLI tools are absent.
type Provisioner ¶
type Provisioner struct {
Shims *Shims
PollInterval time.Duration
TerraformStack terraforminfra.Stack
FluxStack fluxinfra.Stack
Notifier fluxinfra.Notifier
KubernetesManager kubernetes.KubernetesManager
KubernetesClient k8sclient.KubernetesClient
ClusterClient cluster.ClusterClient
// contains filtered or unexported fields
}
Provisioner runs the lifecycle of the terraform, kubernetes, and cluster components of a blueprint. The exported fields are dependencies that NewProvisioner creates when the overrides do not set them. PollInterval sets how often the readiness waits check again. Zero uses the default interval.
func NewProvisioner ¶
func NewProvisioner(rt *runtime.Runtime, blueprintHandler blueprint.BlueprintHandler, opts ...*Provisioner) *Provisioner
NewProvisioner creates a new Provisioner instance with the provided runtime and blueprint handler. It sets up kubernetes manager and kubernetes client. Terraform stack and cluster client are initialized lazily when needed by the Up(), Down(), and WaitForHealth() methods. Panics if runtime or blueprintHandler are nil.
func (*Provisioner) Apply ¶ added in v0.9.0
func (i *Provisioner) Apply(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, componentID string) error
Apply runs terraform init, plan, and apply for a single component identified by componentID. Returns an error if terraform is disabled, the stack cannot be initialized, the component is not found, its state is still in another backend, or any terraform operation fails.
func (*Provisioner) ApplyKustomize ¶ added in v0.9.0
func (i *Provisioner) ApplyKustomize(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, componentID string) error
ApplyKustomize applies one kustomization to the cluster and places its secrets. It filters the blueprint to that kustomization and keeps the sources, so Flux creates the correct source. It resolves the secrets, applies the kustomization, places the secrets, and waits until it is Ready. It does not prune secrets. It returns an error if the blueprint is nil, the kustomization is destroyOnly, or a step fails. A kustomization that is not in the blueprint returns an error with a remediation hint.
func (*Provisioner) ApplyKustomizeAll ¶ added in v0.9.0
func (i *Provisioner) ApplyKustomizeAll(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
ApplyKustomizeAll applies all non-destroyOnly kustomizations in the blueprint to the cluster and places their declared secrets. Delegates to Install with pruning off, since applying the full set is additive here — kustomization and secret pruning are separate, explicitly-flagged steps. Returns an error if the blueprint is nil, the kubernetes manager is not configured, or the apply, placement, or wait fails.
func (*Provisioner) BeginVersionTransition ¶ added in v0.9.0
func (i *Provisioner) BeginVersionTransition(blueprint *blueprintv1alpha1.Blueprint) error
BeginVersionTransition writes the in-flight marker for an upgrade toward blueprint: it preserves the applied source set from the existing marker (empty for a legacy context) and records the blueprint's set as the target under the upgrading phase. apply's version gate refuses while the marker is non-idle; WriteVersionMarker settles it to idle on success.
func (*Provisioner) Bootstrap ¶ added in v0.9.0
func (i *Provisioner) Bootstrap(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, onApply ...func(ctx context.Context, id string) (bool, error)) (bool, error)
Bootstrap brings up a context's infrastructure end-to-end; it is a thin alias for Up — see Up's doc for the backend pivot. Kept as a distinct, self-documenting entry point for `windsor bootstrap`'s explicit-confirmation flow. Returns (halted, err); halted=true means an inner apply call stopped cleanly after a component (e.g. cluster reachability needs operator action), leaving bootstrap partially complete until the operator re-runs it.
func (*Provisioner) CheckComponentDestroyable ¶ added in v0.9.0
func (i *Provisioner) CheckComponentDestroyable(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
CheckComponentDestroyable reports whether one terraform component can be destroyed on its own. On a remote backend, it refuses a backend component, because the other components keep their state in that backend. The refusal returns an error with a remediation hint. Callers run it before a destroy plan, so the refusal shows before terraform init fails against a cluster that can be gone. It also refuses a Backend that names no component, as resolveBackendComponents does.
func (*Provisioner) CheckNodeHealth ¶
func (i *Provisioner) CheckNodeHealth(ctx context.Context, options NodeHealthCheckOptions, outputFunc func(string)) error
CheckNodeHealth checks the health of cluster nodes and of the Kubernetes API endpoint. It checks nodes through the cluster client for Talos and Omni clusters. It also checks the version and the readiness of each node. The node check and the Kubernetes check each wait up to options.Timeout. It returns an error if a health check fails. Options with no health checks, or --ready without --nodes, return an error with a remediation hint.
func (*Provisioner) CheckVersionGate ¶ added in v0.9.0
func (i *Provisioner) CheckVersionGate(blueprint *blueprintv1alpha1.Blueprint) (VersionGate, error)
CheckVersionGate compares the blueprint with the version marker and makes no policy decision. A missing marker gives MarkerFound=false. InFlight reports a phase that is not idle, and VersionMatch compares the source refs of the blueprint with the applied refs. It returns an error when the read fails or the source refs of the blueprint are ambiguous.
func (*Provisioner) ClearPartialRun ¶ added in v0.10.0
func (i *Provisioner) ClearPartialRun() error
ClearPartialRun removes the saved record. A missing record is not an error.
func (*Provisioner) Close ¶
func (i *Provisioner) Close()
Close releases resources held by provisioner components. It closes cluster client connections if present. This method should be called when the provisioner instance is no longer needed to clean up resources.
func (*Provisioner) Destroy ¶ added in v0.9.0
func (i *Provisioner) Destroy(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, componentID string) (bool, error)
Destroy runs terraform init and destroy for a single component identified by componentID. Returns (skipped, nil) when the component's state is empty (nothing to destroy), (false, nil) when destroy ran successfully, or (false, err) on any failure. Returns an error if the blueprint is nil, terraform is disabled, the stack cannot be initialized, the component is not found, or any terraform operation fails. TerraformStack bounds refresh and destroy with a timeout, so an unreachable provider fails within that time instead of hanging.
func (*Provisioner) DestroyAll ¶ added in v0.9.0
func (i *Provisioner) DestroyAll(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, continueOnError bool, excludeIDs ...string) (DestroyResult, error)
DestroyAll destroys the kustomizations, then the terraform components. When no local kubeconfig exists, the cluster is gone: Uninstall does nothing and DestroyAll counts the kustomizations as SkippedClusterGone, so a repeated `windsor destroy` succeeds. With continueOnError, a kustomize failure defers terraform, because a controller can still be deleting a resource that terraform does not track. Terraform skips the components in excludeIDs, so a caller can destroy the backend last.
func (*Provisioner) DestroyAllTerraform ¶ added in v0.9.0
func (i *Provisioner) DestroyAllTerraform(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, continueOnError bool, excludeIDs ...string) (DestroyResult, error)
DestroyAllTerraform destroys all terraform components in reverse dependency order. Components with Destroy set to false, or listed in excludeIDs, are skipped. The cmd-layer symmetric-destroy flow excludes the backend component here, to migrate and destroy it last. Returns the IDs of components skipped for empty state, alongside any error, so callers see partial progress even when a later component fails.
func (*Provisioner) DestroyKustomize ¶ added in v0.9.0
func (i *Provisioner) DestroyKustomize(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, componentID string) error
DestroyKustomize deletes one kustomization by name from the cluster. It does nothing when there is no local kubeconfig, because the cluster and its kustomizations are already gone. It returns an error if the blueprint is nil, the kubernetes manager is not configured, or the delete fails. A kustomization that is not in the blueprint returns an error with a remediation hint.
func (*Provisioner) Down ¶
func (i *Provisioner) Down(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
Down destroys the "workstation" terraform component if it is present in the blueprint, then returns. All other terraform components are left untouched; use Destroy / DestroyAll for those. If terraform is disabled or the blueprint has no "workstation" component, Down is a no-op. Returns an error if the blueprint is nil or the destroy operation fails.
func (*Provisioner) GetVersionMarker ¶ added in v0.9.0
func (i *Provisioner) GetVersionMarker() (kubernetes.VersionMarker, bool, error)
GetVersionMarker reads the applied-version marker for this context's gitops namespace, reporting false when no marker exists (a pre-bootstrap, no-cluster, or legacy context). apply and plan read the marker to gate on the blueprint version; only bootstrap and upgrade write it. Returns false without consulting the cluster when no context-scoped kubeconfig is present — there is no cluster, so nothing is applied and there is no version to read.
func (*Provisioner) HasLocalStateWithResources ¶ added in v0.9.0
func (i *Provisioner) HasLocalStateWithResources(componentID string) (bool, error)
HasLocalStateWithResources reports whether the component's local state file exists and contains at least one resource entry.
func (*Provisioner) HasRemoteState ¶ added in v0.9.0
func (i *Provisioner) HasRemoteState(blueprint *blueprintv1alpha1.Blueprint, componentID string) (bool, error)
HasRemoteState reports whether the component has non-empty state in the currently-configured backend. Call before any backend override so the probe targets the configured remote.
func (*Provisioner) InitComponent ¶ added in v0.9.0
func (i *Provisioner) InitComponent(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
InitComponent runs `terraform init` for one component using the currently- configured backend; no -migrate-state, no plan, no apply.
func (*Provisioner) Install ¶
func (i *Provisioner) Install(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, prune bool) error
Install resolves the declared secrets, applies the blueprint, notifies flux, and places the secrets. It resolves first, so a bad secret fails before any change to the cluster. It places each secret when its namespace exists, not when its kustomization is ready, so a consumer cannot deadlock. prune removes placed secrets that the context no longer declares. Each kustomization is a step under one "Applying kustomizations" operation. A failed readiness wait returns an error that wraps ErrKustomizationsNotReady.
func (*Provisioner) ListLocalStateComponentIDs ¶ added in v0.9.1
func (i *Provisioner) ListLocalStateComponentIDs() ([]string, error)
ListLocalStateComponentIDs returns every componentID with local Terraform state on disk, whether or not it is still declared in the active blueprint.
func (*Provisioner) MigrateComponentState ¶ added in v0.9.0
func (i *Provisioner) MigrateComponentState(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
MigrateComponentState initializes the backend of one terraform component against the configured backend and migrates its state. `windsor bootstrap` calls it to move the state of the backend component after Windsor applies it with a local backend. It returns an error when the blueprint is nil, the component is missing, terraform is disabled, or a terraform operation fails.
func (*Provisioner) MigrateState ¶ added in v0.9.0
func (i *Provisioner) MigrateState(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) ([]string, error)
MigrateState initializes the backend of every terraform component against the configured backend and migrates the state. `windsor bootstrap` calls it after the local apply, when the backend infrastructure exists. It returns the IDs of the components it skipped because their directory was missing, also together with an error, so that a caller can report the skip and the failure together. The caller decides whether a skip is an error.
func (*Provisioner) Notify ¶ added in v0.9.0
func (i *Provisioner) Notify(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
Notify forwards to the flux webhook Notifier and is intended as the final step of bootstrap/up/apply so flux reconciles the blueprint's sources immediately instead of waiting for its next scheduled interval. The call is best-effort: every failure path inside the Notifier is converted to nil with a warning, so callers can invoke Notify unconditionally without risking command failure on clusters that have no webhook configured.
func (*Provisioner) OnTerraformApply ¶ added in v0.9.0
OnTerraformApply registers a hook to run after each Terraform component apply, inside the progress spinner. The hook returns (haltAfter, err); haltAfter=true signals the component apply succeeded but subsequent components must not be applied (e.g. cluster reachability needs host configuration the operator hasn't done yet). Errors are real failures.
func (*Provisioner) OnTerraformPostApply ¶ added in v0.9.0
func (i *Provisioner) OnTerraformPostApply(fn func(ctx context.Context, id string) error)
OnTerraformPostApply registers a hook to run after each Terraform component's Done line is printed. Use this for operations that must not run inside the progress spinner (e.g. interactive sudo prompts).
func (*Provisioner) PendingBackendMove ¶ added in v0.10.0
func (i *Provisioner) PendingBackendMove(blueprint *blueprintv1alpha1.Blueprint) (*BackendMove, error)
PendingBackendMove returns the enabled components whose terraform state is in another backend than the configured one. A component has a pending move when its backend pointer names another backend type and that backend holds its state. Local state with no pointer also counts as a move from local. It reads files only and runs no terraform command. It returns nil when no move is pending.
func (*Provisioner) PivotToLocalIfClusterGone ¶ added in v0.9.0
func (i *Provisioner) PivotToLocalIfClusterGone() (bool, error)
PivotToLocalIfClusterGone pivots terraform.backend.type to local, without migrating, when the kubernetes backend's cluster is gone or unreachable — the targeted-destroy counterpart to PrepareLocalTeardown, reading state a prior full teardown already migrated to local. No-op otherwise.
func (*Provisioner) PlaceSecrets ¶ added in v0.9.0
func (i *Provisioner) PlaceSecrets(ctx context.Context, resolved ResolvedSecrets, blueprint *blueprintv1alpha1.Blueprint, prune bool) error
PlaceSecrets writes the secrets that ResolveSecrets returned into their namespaces, and rolls the workloads that consume each one. Each round places every secret whose namespace exists and polls for the others, so a secret never waits behind another. A secret goes to the namespaces its entry names, or else to the one namespace of its kustomization. prune removes placed secrets that the context no longer declares. Without a kubernetes manager, it does nothing only when nothing waits.
func (*Provisioner) Plan ¶ added in v0.9.0
func (i *Provisioner) Plan(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
Plan runs terraform init and plan for a single component identified by componentID. It does not apply any changes. Returns an error if the terraform stack cannot be initialized, the component is not found, or any terraform operation fails.
func (*Provisioner) PlanAll ¶ added in v0.9.0
func (i *Provisioner) PlanAll(blueprint *blueprintv1alpha1.Blueprint) (*PlanSummary, error)
PlanAll runs a best-effort summary plan across every Terraform component and Flux kustomization in the blueprint. It initialises both stacks as needed and collects per-component results without aborting on individual failures, so callers always receive as complete a picture as possible. Returns an error only when blueprint is nil or stack initialisation itself fails.
func (*Provisioner) PlanDestroyAll ¶ added in v0.9.0
func (i *Provisioner) PlanDestroyAll(blueprint *blueprintv1alpha1.Blueprint) (*DestroyPlanSummary, error)
PlanDestroyAll previews the destroy plan across both Terraform and Flux layers, aggregating both into one DestroyPlanSummary. See PlanDestroyKustomizeSummary for the flux-side unreachable-cluster classification.
func (*Provisioner) PlanDestroyKustomizeComponentSummary ¶ added in v0.9.0
func (i *Provisioner) PlanDestroyKustomizeComponentSummary(blueprint *blueprintv1alpha1.Blueprint, name string) (fluxinfra.KustomizePlan, error)
PlanDestroyKustomizeComponentSummary previews the destroy plan for a single Flux kustomization by querying its live inventory. Returns an error if blueprint is nil, stack init fails, or the kustomization is destroyOnly / pinned destroy=false (which DeleteBlueprint would skip).
func (*Provisioner) PlanDestroyKustomizeSummary ¶ added in v0.9.0
func (i *Provisioner) PlanDestroyKustomizeSummary(blueprint *blueprintv1alpha1.Blueprint) (*DestroyPlanSummary, error)
PlanDestroyKustomizeSummary previews the destroy plan for every eligible Flux kustomization from live cluster inventory. A stale kubeconfig reports every kustomization as not-deployed; see FluxStack.PlanDestroySummary. DestroyOnly hooks and destroy=false pinned kustomizations are filtered to match DeleteBlueprint. withCrdLayer flattens FluxSystem tiers and CRD layers first, so the plan matches Uninstall's teardown set.
func (*Provisioner) PlanDestroyTerraformComponentSummary ¶ added in v0.9.0
func (i *Provisioner) PlanDestroyTerraformComponentSummary(blueprint *blueprintv1alpha1.Blueprint, componentID string) (terraforminfra.TerraformComponentPlan, error)
PlanDestroyTerraformComponentSummary previews the destroy plan for a single Terraform component. Returns an error if blueprint is nil, stack init fails, or the component is pinned destroy=false (which Teardown would skip).
func (*Provisioner) PlanDestroyTerraformSummary ¶ added in v0.9.0
func (i *Provisioner) PlanDestroyTerraformSummary(blueprint *blueprintv1alpha1.Blueprint) (*DestroyPlanSummary, error)
PlanDestroyTerraformSummary previews the destroy plan for every Terraform component the blueprint would actually tear down (filtering destroy=false pins). Mirrors PlanTerraformSummary but uses `terraform plan -destroy -json` per component. Returns an error only when blueprint is nil or stack init fails.
func (*Provisioner) PlanKustomization ¶ added in v0.9.0
func (i *Provisioner) PlanKustomization(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
PlanKustomization runs flux diff for a single kustomization identified by componentID. Returns an error if the flux CLI is not found, the component is not in the blueprint, or the diff fails.
func (*Provisioner) PlanKustomizeAll ¶ added in v0.9.0
func (i *Provisioner) PlanKustomizeAll(blueprint *blueprintv1alpha1.Blueprint) error
PlanKustomizeAll runs flux diff for every non-destroyOnly kustomization in the blueprint. Returns an error if the flux CLI is not found or any diff fails.
func (*Provisioner) PlanKustomizeAllJSON ¶ added in v0.9.0
func (i *Provisioner) PlanKustomizeAllJSON(blueprint *blueprintv1alpha1.Blueprint) error
PlanKustomizeAllJSON runs kustomize build for every non-destroyOnly kustomization and writes JSON to stdout. Returns an error if the kustomize CLI is not found or any build fails.
func (*Provisioner) PlanKustomizeComponentSummary ¶ added in v0.9.0
func (i *Provisioner) PlanKustomizeComponentSummary(blueprint *blueprintv1alpha1.Blueprint, name string) (fluxinfra.KustomizePlan, error)
PlanKustomizeComponentSummary plans a single Flux kustomization and returns its structured result. Returns an error only when blueprint is nil or stack initialisation fails.
func (*Provisioner) PlanKustomizeJSON ¶ added in v0.9.0
func (i *Provisioner) PlanKustomizeJSON(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
PlanKustomizeJSON runs kustomize build for the named kustomization (or all when componentID is "all") and writes the rendered manifests as JSON to stdout. Returns an error if blueprint is nil, the stack cannot be initialised, or the build fails.
func (*Provisioner) PlanKustomizeSummary ¶ added in v0.9.0
func (i *Provisioner) PlanKustomizeSummary(blueprint *blueprintv1alpha1.Blueprint) (*PlanSummary, error)
PlanKustomizeSummary runs a best-effort summary plan across every Flux kustomization in the blueprint without touching the Terraform layer. Returns an error only when blueprint is nil or stack initialisation fails.
func (*Provisioner) PlanRun ¶ added in v0.10.0
func (i *Provisioner) PlanRun(bp *blueprintv1alpha1.Blueprint, command, to string, continuing bool) (*RunPlan, error)
PlanRun builds the run plan for a run with --to, --continue, or both, and keeps it for the next Up. It returns nil, and keeps nothing, when both are unset. It reads the saved record when continuing. It rejects an unknown or ambiguous name, and a name inside the backend tier that is not its last component, because the tier runs as a unit. It runs before any work starts, so a bad request changes nothing.
func (*Provisioner) PlanTerraformAll ¶ added in v0.9.0
func (i *Provisioner) PlanTerraformAll(blueprint *blueprintv1alpha1.Blueprint) error
PlanTerraformAll runs terraform init and plan for every enabled component, streaming output directly. Returns an error if blueprint is nil, the stack cannot be initialised, or any component's plan fails.
func (*Provisioner) PlanTerraformAllJSON ¶ added in v0.9.0
func (i *Provisioner) PlanTerraformAllJSON(blueprint *blueprintv1alpha1.Blueprint) error
PlanTerraformAllJSON runs terraform plan -json for every enabled component, streaming machine-readable JSON lines output directly to stdout. Returns an error if blueprint is nil, the stack cannot be initialised, or any component's plan fails.
func (*Provisioner) PlanTerraformAllResourceChangesJSON ¶ added in v0.9.1
func (i *Provisioner) PlanTerraformAllResourceChangesJSON(blueprint *blueprintv1alpha1.Blueprint) error
PlanTerraformAllResourceChangesJSON runs terraform plan and show -json for every enabled component, printing each component's plan document directly to stdout. Returns an error if blueprint is nil, the stack cannot be initialised, or any component's plan fails.
func (*Provisioner) PlanTerraformComponentSummary ¶ added in v0.9.0
func (i *Provisioner) PlanTerraformComponentSummary(blueprint *blueprintv1alpha1.Blueprint, componentID string) (terraforminfra.TerraformComponentPlan, error)
PlanTerraformComponentSummary plans a single Terraform component and returns its structured result. Returns an error only when blueprint is nil or stack initialisation fails.
func (*Provisioner) PlanTerraformJSON ¶ added in v0.9.0
func (i *Provisioner) PlanTerraformJSON(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
PlanTerraformJSON runs terraform plan -json for a single component, streaming machine-readable JSON lines output directly to stdout. Returns an error if blueprint is nil, the stack cannot be initialised, or the plan fails.
func (*Provisioner) PlanTerraformResourceChangesJSON ¶ added in v0.9.1
func (i *Provisioner) PlanTerraformResourceChangesJSON(blueprint *blueprintv1alpha1.Blueprint, componentID string) error
PlanTerraformResourceChangesJSON runs terraform plan and show -json for a single component, printing the resulting plan document directly to stdout. Returns an error if blueprint is nil, the stack cannot be initialised, or the plan fails.
func (*Provisioner) PlanTerraformSummary ¶ added in v0.9.0
func (i *Provisioner) PlanTerraformSummary(blueprint *blueprintv1alpha1.Blueprint) (*PlanSummary, error)
PlanTerraformSummary runs a best-effort summary plan across every Terraform component in the blueprint without touching the Flux/Kustomize layer. Returns an error only when blueprint is nil or stack initialisation fails.
func (*Provisioner) PrepareLocalTeardown ¶ added in v0.9.0
func (i *Provisioner) PrepareLocalTeardown(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) (bool, error)
PrepareLocalTeardown migrates every component's state to local and pivots terraform.backend.type to local, so a kubernetes-backend teardown never dials the cluster it's about to destroy. A migration failure aborts only while the cluster is still reachable; once it's gone, state was already migrated on an earlier pass. No-op for a non-kubernetes backend.
func (*Provisioner) PrunableKustomizations ¶ added in v0.9.0
func (i *Provisioner) PrunableKustomizations(blueprint *blueprintv1alpha1.Blueprint) ([]string, error)
PrunableKustomizations returns the names of this context's Kustomizations that the blueprint no longer declares — exactly what Prune would delete. It is the read-only input to plan's prune preview and upgrade's confirmation gate; it deletes nothing. It prepares the blueprint with the synthesized CRD layers so the desired set matches what Prune deletes against.
func (*Provisioner) Prune ¶ added in v0.9.0
func (i *Provisioner) Prune(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
Prune removes Kustomizations belonging to this context that are no longer present in the blueprint, leaving every still-declared kustomization (platform and user) and any other context's kustomizations untouched. It prepares the blueprint with the synthesized CRD layers — matching what Install applied — so those layers are recognized as desired and not pruned.
func (*Provisioner) RecordPartialRun ¶ added in v0.10.0
func (i *Provisioner) RecordPartialRun(bp *blueprintv1alpha1.Blueprint, plan *RunPlan) error
RecordPartialRun saves the progress of a stopped run, so that --continue can skip the finished components. It overwrites an earlier record. It returns an error when the scratch directory is not set.
func (*Provisioner) RemoveLocalState ¶ added in v0.9.0
func (i *Provisioner) RemoveLocalState(componentID string) error
RemoveLocalState removes the per-component local terraform state file. Missing files are tolerated.
func (*Provisioner) ResolveSecrets ¶ added in v0.9.0
func (i *Provisioner) ResolveSecrets(blueprint *blueprintv1alpha1.Blueprint) (ResolvedSecrets, error)
ResolveSecrets resolves the secrets of every flux system to plaintext before Install. A misconfigured secret then fails the command before Windsor applies anything to the cluster. A reference that resolves to nil or to an empty string returns an error with a remediation hint, unless it has a ?? default. A ?? default makes the key optional. Windsor does not create a secret whose keys all resolve away. The shell masks each resolved value in command output, whatever its source. The result maps each owning kustomization to its secrets for PlaceSecrets.
func (*Provisioner) Teardown ¶ added in v0.9.0
func (i *Provisioner) Teardown(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, terraformOnly bool, continueOnError bool) (DestroyResult, error)
Teardown reverses Bootstrap. With no declared backend, it calls DestroyAll, or DestroyAllTerraform when terraformOnly is true. With a backend, it destroys the non-backend components, then the other components of the backend, then the backend component. A stage runs only if the stage before it had no failure that blocksNextStage reports. TerraformDeferred marks a skipped stage. A kubernetes backend type with no declared backend returns an error with a remediation hint.
func (*Provisioner) TeardownComponent ¶ added in v0.9.0
func (i *Provisioner) TeardownComponent(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, componentID string) (bool, error)
TeardownComponent destroys a single terraform component. Targeting any backend component on a non-local backend is refused: its state provides the backend that other components rely on, so destroying it in isolation would orphan their state. Use `windsor destroy` (no arguments) for the full-cycle teardown.
func (*Provisioner) Uninstall ¶
func (i *Provisioner) Uninstall(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint) error
Uninstall deletes the kustomizations of the blueprint, with the synthesized CRD layer. The CRD layer does not prune, so the vendored CRDs stay. DeleteBlueprint reports a step per kustomization, so Uninstall adds no progress of its own. Uninstall does nothing when no local kubeconfig exists, because the cluster is gone.
func (*Provisioner) Up ¶
func (i *Provisioner) Up(ctx context.Context, blueprint *blueprintv1alpha1.Blueprint, onApply ...func(ctx context.Context, id string) (bool, error)) (bool, error)
Up applies the terraform components and returns true when an onApply hook halts the apply. When the blueprint declares a backend, Up applies the backend components with a local backend first, as applyWithBackendPivot describes. Up refuses a kubernetes backend with no declared backend and no kubeconfig, and a declared backend that names no component. Each component shows as a step under one "Applying terraform" operation. Up does not ask for confirmation; the commands do that. When PlanRun kept a plan, Up applies only the components of the plan and runs the hooks of the skipped components again first, as replayFinished describes. The plan applies to one call.
func (*Provisioner) UpgradeNode ¶ added in v0.9.0
func (i *Provisioner) UpgradeNode(ctx context.Context, node string, image string, offlineTimeout time.Duration, powercycle bool, skipIfCurrent bool, outputFunc func(string)) error
UpgradeNode upgrades one node to image. It records the boot ID and the Kubernetes node names, sends the upgrade request, waits for the boot ID to change within offlineTimeout, and then waits for the node and its API server. If the node re-registered under a new name, it then deletes the old Node object when it is not Ready. A failure to read or delete Node objects is reported through outputFunc and does not fail the upgrade. powercycle requests a full reboot instead of kexec, for platforms where kexec does not show as offline. When skipIfCurrent is true, it first reads the running version of the node. If that version equals the image tag, it reports this through outputFunc and returns nil without an upgrade request or reboot. If the version cannot be read or the image has no tag, the upgrade proceeds. outputFunc receives status messages. It returns an error when a step fails or times out.
func (*Provisioner) UpgradeNodes ¶ added in v0.9.0
func (i *Provisioner) UpgradeNodes(ctx context.Context, nodes []string, image string, powercycle bool) error
UpgradeNodes sends an upgrade request to specified cluster nodes. powercycle requests a full ACPI reboot instead of the default kexec. It initializes the cluster client based on config, then calls UpgradeNodes on it. The caller is responsible for subsequently monitoring reboot status. Returns an error if the cluster client cannot be initialized or if any node upgrade request fails.
func (*Provisioner) ValidateBackendComponents ¶ added in v0.9.1
func (i *Provisioner) ValidateBackendComponents(blueprint *blueprintv1alpha1.Blueprint) error
ValidateBackendComponents refuses a Blueprint.Backend that names no real component, before a destroy plan is generated.
func (*Provisioner) WriteVersionMarker ¶ added in v0.9.0
func (i *Provisioner) WriteVersionMarker(blueprint *blueprintv1alpha1.Blueprint) error
WriteVersionMarker records the blueprint version applied to this context as a marker ConfigMap in the gitops namespace, capturing the resolved reference of each applied source. Only bootstrap and upgrade write the marker; apply and plan only read it, so the marker stays an authoritative record of what was deliberately rolled out rather than drifting with every reconcile.
type ResolvedSecret ¶ added in v0.9.0
ResolvedSecret is one Secret ready to place: its resolved plaintext data and the namespaces it targets. Namespaces is empty when the authored entry named none, in which case placement auto-resolves the single namespace the owning kustomization creates.
type ResolvedSecrets ¶ added in v0.9.0
type ResolvedSecrets map[string]map[string]ResolvedSecret
ResolvedSecrets maps an owning kustomization name to the Secrets ready to place in the namespace(s) it creates: Secret name -> ResolvedSecret (target namespaces plus resolved plaintext data). It holds resolved secret material in memory only (never serialized), produced by ResolveSecrets before Install and consumed by PlaceSecrets after.
type RunPlan ¶ added in v0.10.0
type RunPlan struct {
Command string
Skip []string
Apply []string
Install bool
KustomizeSubset bool
Kustomize []string
StopKind string
StopName string
}
RunPlan describes which parts of a run to do. Skip lists the Terraform components that an earlier stopped run finished. Apply lists the Terraform components to apply now, in blueprint order. Install is true when the run installs Kustomizations. Kustomize lists the names to install when KustomizeSubset is true, and the run installs all of them otherwise. StopKind and StopName name the --to target, and both are empty for a run to the end.
func BuildRunPlan ¶ added in v0.10.0
func BuildRunPlan(bp *blueprintv1alpha1.Blueprint, command, to string, record *PartialRun, tier []string) (*RunPlan, error)
BuildRunPlan resolves --to and the record into a RunPlan, with no side effects. A nil record means the run does not continue. tier lists the backend tier component IDs that the run applies through the backend pivot, or nothing when no pivot runs. The Terraform part of a --to Terraform target is every enabled component up to and including the target, which includes all dependencies, because the blueprint order is a topological order. The Kustomization part of a --to Kustomization target is the target and its dependsOn closure. A name that matches a Terraform component and a Kustomization needs the terraform/ or kustomize/ prefix.
func (*RunPlan) Finished ¶ added in v0.10.0
Finished returns the Terraform components that are finished when the run ends, in apply order.
func (*RunPlan) InstallBlueprint ¶ added in v0.10.0
func (p *RunPlan) InstallBlueprint(bp *blueprintv1alpha1.Blueprint) *blueprintv1alpha1.Blueprint
InstallBlueprint returns a copy of bp that holds only the Kustomizations in Kustomize, or bp itself when the run installs all of them. The CRD layers stay, because the install adds them from the sources. A nil plan returns bp unchanged.
func (*RunPlan) StopLabel ¶ added in v0.10.0
StopLabel names the --to target for a message, such as `terraform component "cluster"`.
func (*RunPlan) Stops ¶ added in v0.10.0
Stops reports whether the run ends at a --to target. A nil plan does not stop.
func (*RunPlan) TerraformBlueprint ¶ added in v0.10.0
func (p *RunPlan) TerraformBlueprint(bp *blueprintv1alpha1.Blueprint) *blueprintv1alpha1.Blueprint
TerraformBlueprint returns a copy of bp that holds only the components in Apply. It clears the backend field when the backend component is not in Apply, so the run applies the remaining components directly against the configured backend and does not run the pivot again. A nil plan returns bp unchanged.
type VersionGate ¶ added in v0.9.0
type VersionGate struct {
MarkerFound bool // a marker exists for this context (false = pre-bootstrap, no cluster, or legacy)
InFlight bool // the marker phase is not idle (an upgrade is in flight)
VersionMatch bool // the blueprint's resolved source-ref set equals the applied set
}
VersionGate describes how the blueprint a command is about to apply relates to the version marker recorded in the cluster. It is the input to apply's version-equality seam: apply may reconcile in place only when a settled marker matches the blueprint it would apply. Any other state — a version mismatch or an in-flight transition — belongs to upgrade. The caller decides policy (proceed, refuse, or honor --force); this struct only reports the relation.