Documentation
¶
Index ¶
- type Project
- func (p *Project) Bootstrap(confirm provisioner.BootstrapConfirmFn) (*blueprintv1alpha1.Blueprint, bool, bool, error)
- func (p *Project) ComposeBlueprint(blueprintURL ...string) error
- func (p *Project) Configure(flagOverrides map[string]any) error
- func (p *Project) EnsureWorkstation()
- func (p *Project) Initialize(overwrite bool, blueprintURL ...string) error
- func (p *Project) PerformCleanup() error
- func (p *Project) SetToolRequirements(reqs tools.Requirements)
- func (p *Project) Up() (*blueprintv1alpha1.Blueprint, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Project ¶
type Project struct {
Runtime *runtime.Runtime
Provisioner *provisioner.Provisioner
Composer *composer.Composer
Workstation *workstation.Workstation
// contains filtered or unexported fields
}
Project orchestrates the setup and initialization of a Windsor project. It coordinates context, provisioner, composer, and workstation managers to provide a unified interface for project initialization and management.
func NewProject ¶
NewProject creates and initializes a new Project instance with all required managers. It sets up the execution context, creates provisioner and composer, and creates the workstation when in dev mode or when is true (config is loaded if needed for the latter). Panics if required dependencies are nil. After creation, call Configure() to apply flag overrides. Optional overrides can be provided via opts to inject mocks for testing. If opts contains a Project with Runtime set, that runtime will be reused.
func (*Project) Bootstrap ¶ added in v0.9.0
func (p *Project) Bootstrap(confirm provisioner.BootstrapConfirmFn) (*blueprintv1alpha1.Blueprint, bool, bool, error)
Bootstrap is Up's first-run sibling. Operator confirmation runs first against a cheap blueprint summary; only after acceptance does workstation prep run (so declining never triggers privileged work like DNS resolver writes or sudo prompts). Then the provisioner pins backend.type=local for one Up pass and migrates state to the configured remote backend at the end.
Returns (blueprint, applied, halted, err). applied=false when confirm declined; in that case no workstation startup or terraform work has happened. halted=true means one of the inner Up calls signaled a clean halt-after-component.
func (*Project) ComposeBlueprint ¶ added in v0.9.0
ComposeBlueprint loads and composes the blueprint without writing files or generating infrastructure. It generates context ID if needed and loads all blueprint sources. Use this when the goal is only to obtain the composed blueprint (e.g. for windsor show blueprint). It does not run Composer.Generate() and thus does not write blueprint files, process terraform modules, or generate tfvars.
func (*Project) Configure ¶
Configure resolves project configuration including defaults, file loading, migration, and override processing. Loads project environment variables and returns an error if resolution or environment loading fails.
func (*Project) EnsureWorkstation ¶ added in v0.9.0
func (p *Project) EnsureWorkstation()
EnsureWorkstation creates Workstation if it is nil and workstation.runtime is set. Call before using p.Workstation in code paths that need it (e.g. Initialize, Up, Down).
func (*Project) Initialize ¶
Initialize runs the complete initialization sequence for the project. It prepares the workstation (creates services and assigns IPs), prepares context, generates infrastructure, prepares tools, and bootstraps the environment. The overwrite parameter controls whether infrastructure generation should overwrite existing files. The optional blueprintURL parameter specifies the blueprint artifact to load (OCI URL or local .tar.gz path). Returns an error if any step fails.
func (*Project) PerformCleanup ¶
PerformCleanup removes context-specific artifacts: config state, the local-cluster credentials (.kube, .talos) under contexts/<context>, and the contents of .windsor/contexts/<context> (preserving workstation.yaml). Returns an error if any step fails.
func (*Project) SetToolRequirements ¶ added in v0.9.0
func (p *Project) SetToolRequirements(reqs tools.Requirements)
SetToolRequirements narrows which tool families Initialize will check on this project. When unset, Initialize defaults to AllRequirements — the historical "check everything" behavior. Commands whose codepath is statically known (e.g. `windsor down` only stops the workstation, never invokes terraform) call this with a narrower set so the operator is not blocked on installing tools they will not actually use.
func (*Project) Up ¶ added in v0.9.0
func (p *Project) Up() (*blueprintv1alpha1.Blueprint, bool, error)
Up generates the blueprint, starts the workstation if present (using PrepareForUp to defer host/guest setup when a workstation Terraform component exists), runs the provisioner, and returns the blueprint for use by Install/Wait.
Returns (blueprint, halted, err). halted=true means a hook signaled a clean stop after a component apply (e.g. cluster reachability needs host configuration the operator hasn't done yet); err remains the path for real failures. Callers render the deferred-work summary based on the halt and exit cleanly.