Documentation ¶
Overview ¶
Package invoker handles invoking the 'mach' stage in a network-transparent manner with the c4t-mach binary.
Index ¶
- Variables
- type ConfigPlanQuantityOverrider
- type Invoker
- type NopPlanQuantityOverrider
- type Observer
- type Option
- func AllowReinvoke(allow bool) Option
- func ObserveCopiesWith(obs ...copier.Observer) Option
- func ObserveMachWith(obs ...observer.Observer) Option
- func Options(ops ...Option) Option
- func OverrideBaseQuantities(qs quantity.MachNodeSet) Option
- func OverrideQuantitiesFromPlanThen(qs quantity.MachNodeSet) Option
- type PlanQuantityOverrider
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDirEmpty occurs when the local directory filepath is empty. ErrDirEmpty = errors.New("local dir is empty string") )
Functions ¶
This section is empty.
Types ¶
type ConfigPlanQuantityOverrider ¶
type ConfigPlanQuantityOverrider struct { // PostPlanOverrides applies any overrides that should happen after the machine overrides. PostPlanOverrides quantity.MachNodeSet }
ConfigPlanQuantityOverrider overrides quantities by looking up the machine that the plan targets in a config map, then extracting the overrides from there.
func (*ConfigPlanQuantityOverrider) OverrideQuantitiesFromPlan ¶
func (c *ConfigPlanQuantityOverrider) OverrideQuantitiesFromPlan(p *plan.Plan, qs *quantity.MachNodeSet) error
type Invoker ¶
type Invoker struct {
// contains filtered or unexported fields
}
Invoker runs the machine-runner, through SSH if needed.
Much of the invoker's behaviour is injected through two sources: a runner factory (which can either pass in cached SSH-or-lack-therof configuration, or delegate to the incoming machine plan), and a set of quantity overrides (that can either be fully pre-cached, or also delegate in part to the plan). This set-up is intended to let the single-shot binary for the invoker rely almost entirely on information coming to it through the plan, while also letting the director set up the configuration in advance and bypass plan inspection.
func New ¶
New constructs a new Invoker with local directory ldir, runner factory fac, and options o.
type NopPlanQuantityOverrider ¶
type NopPlanQuantityOverrider struct{}
NopPlanQuantityOverrider is a PlanQuantityOverrider that doesn't actually override quantities.
func (NopPlanQuantityOverrider) OverrideQuantitiesFromPlan ¶
func (n NopPlanQuantityOverrider) OverrideQuantitiesFromPlan(*plan.Plan, *quantity.MachNodeSet) error
OverrideQuantitiesFromPlan does nothing.
type Option ¶
Option is the type of options for the invoker.
func AllowReinvoke ¶
AllowReinvoke sets whether the invoker should allow the re-invocation of plans that have already been invoked.
func ObserveCopiesWith ¶
ObserveCopiesWith adds each observer given to the invoker's copy observer pool.
func ObserveMachWith ¶
ObserveMachWith adds each observer given to the invoker's machine observer pool.
func OverrideBaseQuantities ¶
func OverrideBaseQuantities(qs quantity.MachNodeSet) Option
OverrideBaseQuantities overrides the base quantity set with qs.
func OverrideQuantitiesFromPlanThen ¶
func OverrideQuantitiesFromPlanThen(qs quantity.MachNodeSet) Option
OverrideQuantitiesFromPlanThen tells the invoker to override its base quantity set with the quantities in the incoming plan, and then override them again using qs.
This is intended for single-shot uses of the invoker, where there is no pre-calculation of the quantity set; in the director form of the invoker, the director will cache the expected quantity set, and there is no need to consult the plan.
type PlanQuantityOverrider ¶
type PlanQuantityOverrider interface { // OverrideQuantitiesFromPlan applies to qs any quantity overrides that require information from the plan p. // This is part of the Factory interface because some, but not all, factories require plan information. OverrideQuantitiesFromPlan(p *plan.Plan, qs *quantity.MachNodeSet) error }
PlanQuantityOverrider is the interface of things that may, or may not, override the invoker's quantity set with quantities according to information in a plan.