Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBaseInfrastructurePipeline(r RunnerInterface, name string) (int, TerraformPlan, *BaseInfrastructureDestructiveChanges, error)
- func CheckPipeline(r RunnerInterface, name string, opts PlanOptions) (int, TerraformPlan, *PlanDestructiveChanges, error)
- func DestroyPipeline(r RunnerInterface, name string) error
- type BaseInfraRunnerOptions
- type BaseInfrastructureDestructiveChanges
- type BootstrapNodeRunnerOptions
- type CMDExecutor
- type ChangeActionSettings
- type DestroyBaseInfraRunnerOptions
- type DestroyNodeRunnerOptions
- type DummyHook
- type Executor
- type InfraActionHook
- type NodeDeleteRunnerOptions
- type NodeRunnerOptions
- type PipelineOutputs
- type PlanDestructiveChanges
- type PlanOptions
- type Runner
- func (r *Runner) Apply() error
- func (r *Runner) Destroy() error
- func (r *Runner) GetChangesInPlan() int
- func (r *Runner) GetPlanDestructiveChanges() *PlanDestructiveChanges
- func (r *Runner) GetPlanPath() string
- func (r *Runner) GetState() ([]byte, error)
- func (r *Runner) GetStep() string
- func (r *Runner) GetTerraformExecutor() Executor
- func (r *Runner) GetTerraformOutput(output string) ([]byte, error)
- func (r *Runner) Init() error
- func (r *Runner) Plan(opts PlanOptions) error
- func (r *Runner) ResourcesQuantityInState() int
- func (r *Runner) Stop()
- func (r *Runner) WithAdditionalStateSaverDestination(destinations ...SaverDestination) *Runner
- func (r *Runner) WithAllowedCachedState(flag bool) *Runner
- func (r *Runner) WithAutoApprove(flag bool) *Runner
- func (r *Runner) WithAutoDismissDestructiveChanges(flag bool) *Runner
- func (r *Runner) WithCache(cache state.Cache) *Runner
- func (r *Runner) WithConfirm(confirm func() *input.Confirmation) *Runner
- func (r *Runner) WithHook(h InfraActionHook) *Runner
- func (r *Runner) WithName(name string) *Runner
- func (r *Runner) WithSingleShotMode(enabled bool) RunnerInterface
- func (r *Runner) WithSkipChangesOnDeny(flag bool) *Runner
- func (r *Runner) WithState(stateData []byte) *Runner
- func (r *Runner) WithStatePath(statePath string) *Runner
- func (r *Runner) WithVariables(variablesData []byte) *Runner
- type RunnerInterface
- type SaverDestination
- type SingleShotRunner
- func (r *SingleShotRunner) Apply() (err error)
- func (r *SingleShotRunner) Destroy() (err error)
- func (r *SingleShotRunner) GetTerraformOutput(output string) ([]byte, error)
- func (r *SingleShotRunner) Init() (err error)
- func (r *SingleShotRunner) Plan(opts PlanOptions) (err error)
- func (r *SingleShotRunner) ResourcesQuantityInState() int
- func (r *SingleShotRunner) Stop()
- type StateSaver
- type TerraformContext
- func (f *TerraformContext) GetBootstrapBaseInfraRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache) RunnerInterface
- func (f *TerraformContext) GetBootstrapNodeRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache, ...) RunnerInterface
- func (f *TerraformContext) GetCheckBaseInfraRunner(metaConfig *config.MetaConfig, opts BaseInfraRunnerOptions) RunnerInterface
- func (f *TerraformContext) GetCheckNodeDeleteRunner(metaConfig *config.MetaConfig, opts NodeDeleteRunnerOptions) RunnerInterface
- func (f *TerraformContext) GetCheckNodeRunner(metaConfig *config.MetaConfig, opts NodeRunnerOptions) RunnerInterface
- func (f *TerraformContext) GetConvergeBaseInfraRunner(metaConfig *config.MetaConfig, opts BaseInfraRunnerOptions) RunnerInterface
- func (f *TerraformContext) GetConvergeNodeDeleteRunner(metaConfig *config.MetaConfig, opts NodeDeleteRunnerOptions) RunnerInterface
- func (f *TerraformContext) GetConvergeNodeRunner(metaConfig *config.MetaConfig, opts NodeRunnerOptions) RunnerInterface
- func (f *TerraformContext) GetDestroyBaseInfraRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache, ...) RunnerInterface
- func (f *TerraformContext) GetDestroyNodeRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache, ...) RunnerInterface
- type TerraformPlan
- type ValueChange
Constants ¶
View Source
const ( PlanHasNoChanges = iota PlanHasChanges PlanHasDestructiveChanges )
Variables ¶
View Source
var ( ErrRunnerStopped = errors.New("Terraform runner was stopped.") ErrTerraformApplyAborted = errors.New("Terraform apply aborted.") )
Functions ¶
func CheckBaseInfrastructurePipeline ¶
func CheckBaseInfrastructurePipeline(r RunnerInterface, name string) (int, TerraformPlan, *BaseInfrastructureDestructiveChanges, error)
func CheckPipeline ¶
func CheckPipeline(r RunnerInterface, name string, opts PlanOptions) (int, TerraformPlan, *PlanDestructiveChanges, error)
func DestroyPipeline ¶
func DestroyPipeline(r RunnerInterface, name string) error
Types ¶
type BaseInfraRunnerOptions ¶
type BaseInfraRunnerOptions struct { AutoDismissDestructive bool AutoApprove bool CommanderMode bool StateCache dstate.Cache ClusterState []byte AdditionalStateSaverDestinations []SaverDestination }
TODO: use same runner in check+converge only in commander mode, use as-is otherwise, implement destroy and bootstrap
type BaseInfrastructureDestructiveChanges ¶
type BaseInfrastructureDestructiveChanges struct { PlanDestructiveChanges OutputBrokenReason string `json:"output_broken_reason,omitempty"` OutputZonesChanged ValueChange `json:"output_zones_changed,omitempty"` }
type CMDExecutor ¶
type CMDExecutor struct {
// contains filtered or unexported fields
}
CMDExecutor straightforward cmd executor which provides convenient output and handles quit signal.
func (*CMDExecutor) Stop ¶
func (c *CMDExecutor) Stop()
type ChangeActionSettings ¶
type DestroyBaseInfraRunnerOptions ¶
type DestroyBaseInfraRunnerOptions struct {
AutoApprove bool
}
type DummyHook ¶
type DummyHook struct{}
func (*DummyHook) AfterAction ¶
func (*DummyHook) BeforeAction ¶
type InfraActionHook ¶
type NodeDeleteRunnerOptions ¶
type NodeRunnerOptions ¶
type NodeRunnerOptions struct { AutoDismissDestructive bool AutoApprove bool NodeName string NodeGroupName string NodeGroupStep string NodeIndex int NodeState []byte NodeCloudConfig string CommanderMode bool StateCache dstate.Cache AdditionalStateSaverDestinations []SaverDestination ReadinessChecker InfraActionHook }
type PipelineOutputs ¶
type PipelineOutputs struct { TerraformState []byte CloudDiscovery []byte BastionHost string MasterIPForSSH string NodeInternalIP string KubeDataDevicePath string }
func ApplyPipeline ¶
func ApplyPipeline(r RunnerInterface, name string, extractFn func(r RunnerInterface) (*PipelineOutputs, error)) (*PipelineOutputs, error)
func GetBaseInfraResult ¶
func GetBaseInfraResult(r RunnerInterface) (*PipelineOutputs, error)
func GetMasterNodeResult ¶
func GetMasterNodeResult(r RunnerInterface) (*PipelineOutputs, error)
func OnlyState ¶
func OnlyState(r RunnerInterface) (*PipelineOutputs, error)
type PlanDestructiveChanges ¶
type PlanDestructiveChanges struct { ResourcesDeleted []ValueChange `json:"resources_deleted,omitempty"` ResourcesRecreated []ValueChange `json:"resourced_recreated,omitempty"` }
type PlanOptions ¶
type PlanOptions struct {
Destroy bool
}
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewImmutableRunnerFromConfig ¶
func NewImmutableRunnerFromConfig(cfg *config.MetaConfig, step string) *Runner
func NewRunnerFromConfig ¶
func (*Runner) GetChangesInPlan ¶
func (*Runner) GetPlanDestructiveChanges ¶
func (r *Runner) GetPlanDestructiveChanges() *PlanDestructiveChanges
func (*Runner) GetPlanPath ¶
func (*Runner) GetTerraformExecutor ¶
func (*Runner) GetTerraformOutput ¶
func (*Runner) Plan ¶
func (r *Runner) Plan(opts PlanOptions) error
func (*Runner) ResourcesQuantityInState ¶
func (*Runner) Stop ¶
func (r *Runner) Stop()
Stop interrupts the current runner command and sets a flag to prevent executions of next runner commands.
func (*Runner) WithAdditionalStateSaverDestination ¶
func (r *Runner) WithAdditionalStateSaverDestination(destinations ...SaverDestination) *Runner
WithAdditionalStateSaverDestination by default we use intermediate save state to cache destination
func (*Runner) WithAllowedCachedState ¶
func (*Runner) WithAutoApprove ¶
func (*Runner) WithAutoDismissDestructiveChanges ¶
func (*Runner) WithConfirm ¶
func (r *Runner) WithConfirm(confirm func() *input.Confirmation) *Runner
func (*Runner) WithHook ¶
func (r *Runner) WithHook(h InfraActionHook) *Runner
func (*Runner) WithSingleShotMode ¶
func (r *Runner) WithSingleShotMode(enabled bool) RunnerInterface
func (*Runner) WithSkipChangesOnDeny ¶
func (*Runner) WithStatePath ¶
func (*Runner) WithVariables ¶
type RunnerInterface ¶
type RunnerInterface interface { Init() error Apply() error Plan(opts PlanOptions) error Destroy() error Stop() ResourcesQuantityInState() int GetTerraformOutput(output string) ([]byte, error) GetState() ([]byte, error) GetStep() string GetChangesInPlan() int GetPlanDestructiveChanges() *PlanDestructiveChanges GetPlanPath() string GetTerraformExecutor() Executor }
type SaverDestination ¶
type SaverDestination interface {
SaveState(outputs *PipelineOutputs) error
}
type SingleShotRunner ¶
type SingleShotRunner struct { *Runner // contains filtered or unexported fields }
func NewSingleShotRunner ¶
func NewSingleShotRunner(runner *Runner) *SingleShotRunner
func (*SingleShotRunner) Apply ¶
func (r *SingleShotRunner) Apply() (err error)
func (*SingleShotRunner) Destroy ¶
func (r *SingleShotRunner) Destroy() (err error)
func (*SingleShotRunner) GetTerraformOutput ¶
func (r *SingleShotRunner) GetTerraformOutput(output string) ([]byte, error)
func (*SingleShotRunner) Init ¶
func (r *SingleShotRunner) Init() (err error)
func (*SingleShotRunner) Plan ¶
func (r *SingleShotRunner) Plan(opts PlanOptions) (err error)
func (*SingleShotRunner) ResourcesQuantityInState ¶
func (r *SingleShotRunner) ResourcesQuantityInState() int
func (*SingleShotRunner) Stop ¶
func (r *SingleShotRunner) Stop()
type StateSaver ¶
type StateSaver struct {
// contains filtered or unexported fields
}
func NewStateSaver ¶
func NewStateSaver(destinations []SaverDestination) *StateSaver
func (*StateSaver) DoneCh ¶
func (s *StateSaver) DoneCh() chan struct{}
func (*StateSaver) FsEventHandler ¶
func (s *StateSaver) FsEventHandler(event fsnotify.Event)
func (*StateSaver) IsStarted ¶
func (s *StateSaver) IsStarted() bool
func (*StateSaver) Start ¶
func (s *StateSaver) Start(runner *Runner) error
Start creates a new file watcher for r.statePath and a chan to stop it.
type TerraformContext ¶
type TerraformContext struct {
// contains filtered or unexported fields
}
func NewTerraformContext ¶
func NewTerraformContext() *TerraformContext
func (*TerraformContext) GetBootstrapBaseInfraRunner ¶
func (f *TerraformContext) GetBootstrapBaseInfraRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache) RunnerInterface
func (*TerraformContext) GetBootstrapNodeRunner ¶
func (f *TerraformContext) GetBootstrapNodeRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache, opts BootstrapNodeRunnerOptions) RunnerInterface
func (*TerraformContext) GetCheckBaseInfraRunner ¶
func (f *TerraformContext) GetCheckBaseInfraRunner(metaConfig *config.MetaConfig, opts BaseInfraRunnerOptions) RunnerInterface
TODO(dhctl-for-commander): Use same tf-runner for check & converge in commander mode only, keep things as-is without changes
func (*TerraformContext) GetCheckNodeDeleteRunner ¶
func (f *TerraformContext) GetCheckNodeDeleteRunner(metaConfig *config.MetaConfig, opts NodeDeleteRunnerOptions) RunnerInterface
func (*TerraformContext) GetCheckNodeRunner ¶
func (f *TerraformContext) GetCheckNodeRunner(metaConfig *config.MetaConfig, opts NodeRunnerOptions) RunnerInterface
func (*TerraformContext) GetConvergeBaseInfraRunner ¶
func (f *TerraformContext) GetConvergeBaseInfraRunner(metaConfig *config.MetaConfig, opts BaseInfraRunnerOptions) RunnerInterface
func (*TerraformContext) GetConvergeNodeDeleteRunner ¶
func (f *TerraformContext) GetConvergeNodeDeleteRunner(metaConfig *config.MetaConfig, opts NodeDeleteRunnerOptions) RunnerInterface
func (*TerraformContext) GetConvergeNodeRunner ¶
func (f *TerraformContext) GetConvergeNodeRunner(metaConfig *config.MetaConfig, opts NodeRunnerOptions) RunnerInterface
func (*TerraformContext) GetDestroyBaseInfraRunner ¶
func (f *TerraformContext) GetDestroyBaseInfraRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache, opts DestroyBaseInfraRunnerOptions) RunnerInterface
func (*TerraformContext) GetDestroyNodeRunner ¶
func (f *TerraformContext) GetDestroyNodeRunner(metaConfig *config.MetaConfig, stateCache dstate.Cache, opts DestroyNodeRunnerOptions) RunnerInterface
type TerraformPlan ¶
type ValueChange ¶
type ValueChange struct { CurrentValue interface{} `json:"current_value,omitempty"` NextValue interface{} `json:"next_value,omitempty"` }
Click to show internal directories.
Click to hide internal directories.