Documentation
¶
Overview ¶
Package fleetdriver rolls one runtime release out to a list of machines in waves: it uploads the tarball, stages it everywhere first (nothing that runs changes), then activates the machines wave by wave with `harnessly fleet activate` on each, checks them, and puts the machines already moved back with `harnessly fleet rollback` when a wave fails. The machine's own side (stage, activate, rollback, delta, the units spec) is internal/selfupdate; this is the part that used to be a shell script in a deployment's repository. It knows no machine: the list, the way in and the settings of each machine come from the fleet file.
Index ¶
Constants ¶
const LocalTarget = "local"
LocalTarget is a target that is this machine itself: the command runs here with `sh -c`, no ssh. A fleet whose machine is the one the driver runs on (one pair of a developer's machine, a single-host install) names it so.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecRunner ¶
ExecRunner runs `<Cmd...> <target> <command>` on this machine (ssh, tsh ssh, ...); the target "local" is `sh -c`.
type ExitError ¶
type ExitError struct{ Code int }
ExitError is a command on a machine that ended with a code.
type Fleet ¶
type Fleet struct {
Schema int `json:"schema"`
// SSH is the command that runs another command on a machine: `<SSH...> <target> <command>`, with stdin passed
// through. Empty: the caller's default (`ssh`).
SSH []string `json:"ssh,omitempty"`
// Transfers is the folder on a machine the tarball is uploaded to.
Transfers string `json:"transfers,omitempty"`
// Binary is the harnessly command on a machine (a path or a name on its PATH).
Binary string `json:"binary,omitempty"`
Hosts []Host `json:"hosts"`
}
Fleet is the fleet file (schema 1).
type Host ¶
type Host struct {
// Name identifies the machine in `--only` and in the log.
Name string `json:"name"`
// Target is the first argument of the ssh command: `root@name`, a Teleport node and so on.
Target string `json:"target"`
// Wave orders the rollout: waves go in ascending order, the machines of one wave at the same time. A machine
// without a wave is in wave 0, the first.
Wave int `json:"wave,omitempty"`
// EnvFile is a shell file on the machine with the fleet settings (RUNTIME_FLEET_ROOT, _RESTART, _HEALTH_URL,
// _SERVICES, _UNITS_SPEC ...). It is sourced before every fleet command.
EnvFile string `json:"envFile,omitempty"`
// Root overrides RUNTIME_FLEET_ROOT for this machine (`--root`).
Root string `json:"root,omitempty"`
// Binary overrides Fleet.Binary.
Binary string `json:"binary,omitempty"`
}
Host is one machine.
type Plan ¶
type Plan struct {
Fleet *Fleet
Runner Runner
Version string
// Tarball is the whole release; Delta (with DeltaBase, the commit it was cut against) is optional, see
// docs/hub/fleet-rollout.md: a machine that runs the base takes the delta, any other gets the whole release.
Tarball string
Delta string
DeltaBase string
Only []string
// Force passes --force to activate (the machine's window between rollouts, RUNTIME_FLEET_MIN_GAP).
Force bool
// StageJobs caps the machines staged at once (default 4), ActivateJobs those of a wave activated at once
// (default: the whole wave).
StageJobs, ActivateJobs int
StageTimeout time.Duration // one machine, upload included (default 25 min)
ActivateTimeout time.Duration // one machine (default 30 min)
// Soak is the pause after a wave whose machines all passed, before the next wave starts.
Soak time.Duration
UploadDelay time.Duration // between upload attempts (default 10 s)
Log func(format string, a ...any)
DryRun bool
// contains filtered or unexported fields
}
Plan is one rollout.
type Result ¶
type Result struct {
Skipped []string `json:"skipped,omitempty"` // already ran the version
Activated []string `json:"activated,omitempty"` // runs the version now
Failed []string `json:"failed,omitempty"` // failed and went back to its own release by itself
RolledBack []string `json:"rolledBack,omitempty"` // moved, then put back after another machine failed
NotTouched []string `json:"notTouched,omitempty"` // waves after the failed one
}
Result says what happened to each machine.