Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowedTargetVersion ¶
func AllowedTargetVersion( curVersion version.Number, targetVersion version.Number, ) bool
AllowedTargetVersion checks if targetVersion is too different from curVersion to allow a downgrade.
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency manifold that runs an upgrader worker, using the resource names defined in the supplied config.
Types ¶
type Config ¶
type Config struct { Clock clock.Clock Logger logger.Logger Client UpgraderClient AgentConfig agent.Config OrigAgentVersion version.Number UpgradeStepsWaiter gate.Waiter InitialUpgradeCheckComplete gate.Unlocker CheckDiskSpace func(string, uint64) error }
Config contains the items the worker needs to start.
type ManifoldConfig ¶
type ManifoldConfig struct { AgentName string APICallerName string UpgradeStepsGateName string UpgradeCheckGateName string PreviousAgentVersion version.Number Logger logger.Logger Clock clock.Clock }
ManifoldConfig defines the names of the manifolds on which a Manifold will depend.
type Upgrader ¶
type Upgrader struct {
// contains filtered or unexported fields
}
Upgrader represents a worker that watches the state for upgrade requests.
func NewAgentUpgrader ¶
NewAgentUpgrader returns a new upgrader worker. It watches changes to the current version of the current agent (with the given tag) and tries to download the tools for any new version into the given data directory. If an upgrade is needed, the worker will exit with an UpgradeReadyError holding details of the requested upgrade. The tools will have been downloaded and unpacked.
type UpgraderClient ¶
type UpgraderClient interface { DesiredVersion(ctx context.Context, tag string) (version.Number, error) SetVersion(ctx context.Context, tag string, v version.Binary) error WatchAPIVersion(ctx context.Context, agentTag string) (watcher.NotifyWatcher, error) Tools(ctx context.Context, tag string) (coretools.List, error) }
UpgraderClient provides the facade methods used by the worker.