Documentation
¶
Index ¶
- type Project
- func (p *Project) Bootstrap(ctx context.Context, 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) PlanRun(command, to string, continuing bool) (*provisioner.RunPlan, error)
- func (p *Project) SetToolRequirements(reqs tools.Requirements)
- func (p *Project) Up(ctx context.Context) (*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 holds the runtime, composer, provisioner and workstation of one context.
func NewProject ¶
NewProject creates a Project for contextName and creates the runtime, composer and provisioner. It uses the current context, or "local", when contextName is empty. A non-empty contextName also sets the context of the config handler. It creates the Workstation only for a dev context. EnsureWorkstation creates it for other contexts after Configure. The fields of an optional Project in opts replace the default objects. Tests use this to inject mocks. It panics when the runtime has no config handler.
func (*Project) Bootstrap ¶ added in v0.9.0
func (p *Project) Bootstrap(ctx context.Context, confirm provisioner.BootstrapConfirmFn) (*blueprintv1alpha1.Blueprint, bool, bool, error)
Bootstrap is the first run of Up. It calls confirm with a blueprint summary before it starts the workstation. When the operator declines, no privileged work or terraform work runs. The provisioner applies with a local backend and then migrates the state to the configured backend. It returns the blueprint, an applied flag, a halt flag and an error. applied is false when confirm declines.
func (*Project) ComposeBlueprint ¶ added in v0.9.0
ComposeBlueprint generates the context ID and loads the blueprint from blueprintURL or the default sources. It does not write files or generate infrastructure. Use it when only the composed blueprint is necessary.
func (*Project) Configure ¶
Configure resolves the configuration of the project with flagOverrides and loads the environment variables. It returns an error when resolution or the environment load fails.
func (*Project) EnsureWorkstation ¶ added in v0.9.0
func (p *Project) EnsureWorkstation()
EnsureWorkstation creates the Workstation when it is nil and workstation.runtime is set. Call it before code that uses p.Workstation.
func (*Project) Initialize ¶
Initialize prepares the workstation, loads the blueprint, saves the config and generates the infrastructure files. Then it prepares the tools and loads the environment. overwrite lets the generate step replace existing files. blueprintURL is an optional OCI URL or local .tar.gz path. It returns an error when a step fails.
func (*Project) PerformCleanup ¶
PerformCleanup removes the artifacts of the context. It cleans the config state and removes the .kube and .talos directories under contexts/<context>. It removes the contents of .windsor/contexts/<context>, but keeps workstation.yaml. It returns an error if a step fails. When .windsor/contexts/<context> is a file, the error has a remediation hint.
func (*Project) PlanRun ¶ added in v0.10.0
PlanRun builds the run plan for --to and --continue and gives it to the provisioner for the next Up. It returns nil when both are unset. It runs before any work starts, so a bad --to value or a missing record fails before the workstation starts or the config changes.
func (*Project) SetToolRequirements ¶ added in v0.9.0
func (p *Project) SetToolRequirements(reqs tools.Requirements)
SetToolRequirements sets the tool families that Initialize checks. When it is not called, Initialize checks all tool families. A command that does not use a tool calls it, so the operator does not have to install that tool.
func (*Project) Up ¶ added in v0.9.0
Up generates the blueprint, starts the workstation when it exists and runs the provisioner. Before the provisioner runs, it restores the host route to a cluster that holds the Terraform state. It returns the blueprint, a halt flag and an error. The halt flag is true when an apply hook stops the run cleanly, or when the host route needs a privileged step. The caller then shows the deferred work and exits without an error.