Documentation
¶
Overview ¶
Package agentbinary installs and switches agent binaries from release archives.
Index ¶
- Variables
- func EnsureDaemonBinaryLinks(ctx context.Context, log *slog.Logger, paths goalstates.AgentUpgradePaths) error
- func Verify(ctx context.Context, path string) error
- type ActivationOptions
- type ActivationPlan
- type ActivationResult
- type DaemonService
- type DaemonServiceInspector
- type HostActivationLock
- type InstallOptions
- type Layout
- type ServicePlan
- type SwitchResult
Constants ¶
This section is empty.
Variables ¶
var ErrActivationInProgress = errors.New("host agent activation is already in progress")
ErrActivationInProgress indicates that another host agent activation owns the shared activation lock.
Functions ¶
func EnsureDaemonBinaryLinks ¶
func EnsureDaemonBinaryLinks(ctx context.Context, log *slog.Logger, paths goalstates.AgentUpgradePaths) error
EnsureDaemonBinaryLinks initializes daemon current, last-good, and compatibility binary links.
Types ¶
type ActivationOptions ¶ added in v0.2.3
type ActivationOptions struct {
Layout Layout
CandidatePath string
BinaryMode os.FileMode
LockPath string
}
ActivationOptions configures a host-driven daemon binary activation.
type ActivationPlan ¶ added in v0.2.3
type ActivationPlan struct {
CandidatePath string
ActivePath string
TargetPath string
CurrentLinkPath string
LastGoodLinkPath string
RollbackPath string
InitializeLayout bool
CandidateChanged bool
RepairLastGood bool
UpdateLastGood bool
Service ServicePlan
Actions []string
// contains filtered or unexported fields
}
ActivationPlan describes a host activation without changing host state.
func PreflightHostDaemonActivation ¶ added in v0.2.3
func PreflightHostDaemonActivation( ctx context.Context, opts ActivationOptions, service DaemonServiceInspector, ) (ActivationPlan, error)
PreflightHostDaemonActivation validates and plans a host-driven activation without changing files, links, services, or locks.
type ActivationResult ¶ added in v0.2.3
type ActivationResult struct {
PreviousPath string
CurrentPath string
Initialized bool
Changed bool
RolledBack bool
}
ActivationResult describes a completed host activation.
func ActivateHostDaemon ¶ added in v0.2.3
func ActivateHostDaemon( ctx context.Context, log *slog.Logger, opts ActivationOptions, service DaemonService, ) (ActivationResult, error)
ActivateHostDaemon installs the candidate, switches the daemon entrypoint, restarts the service, verifies health, and rolls back on restart or health failure.
type DaemonService ¶ added in v0.2.3
type DaemonService interface {
DaemonServiceInspector
Prepare(context.Context, string) error
Reload(context.Context) error
Restart(context.Context) error
WaitHealthy(context.Context, string) error
}
DaemonService adapts host-specific service management to binary activation.
type DaemonServiceInspector ¶ added in v0.2.3
type DaemonServiceInspector interface {
Preflight(context.Context, string) (ServicePlan, error)
}
DaemonServiceInspector inspects host-specific service configuration without changing it.
type HostActivationLock ¶ added in v0.2.3
type HostActivationLock struct {
// contains filtered or unexported fields
}
HostActivationLock is an exclusive lock shared by host-driven and MachineOperation-driven agent activation paths.
func AcquireHostActivationLock ¶ added in v0.2.3
func AcquireHostActivationLock(path string) (*HostActivationLock, error)
AcquireHostActivationLock acquires the shared, nonblocking host activation lock. The caller must close the returned lock.
func (*HostActivationLock) Close ¶ added in v0.2.3
func (l *HostActivationLock) Close() error
Close releases the host activation lock.
type InstallOptions ¶ added in v0.2.3
type InstallOptions struct {
DownloadURL string
// ExpectedSHA256 may be empty only when the caller trusts both the archive
// source and the transport path.
ExpectedSHA256 string
ExpectedMember string
Mode os.FileMode
MaxArchiveBytes int64
MaxExtractedBytes int64
HTTPClient *http.Client
ExactMember bool
}
InstallOptions configures a bounded agent release archive install.
type Layout ¶ added in v0.2.3
type Layout struct {
// BinaryPath is an optional compatibility path included in collision validation.
BinaryPath string
BluePath string
GreenPath string
CurrentPath string
LastGoodPath string
}
Layout describes caller-owned blue-green agent binary paths.
type ServicePlan ¶ added in v0.2.3
ServicePlan describes service configuration work needed by an activation.
type SwitchResult ¶ added in v0.2.3
SwitchResult describes a completed blue-green binary switch.
func InstallAndSwitchFromTarGz ¶
func InstallAndSwitchFromTarGz( ctx context.Context, log *slog.Logger, paths Layout, opts InstallOptions, ) (SwitchResult, error)
InstallAndSwitchFromTarGz downloads a bounded HTTP or HTTPS release archive, installs the configured member into the inactive slot, and atomically updates the last-good and current links. When ExactMember is set, the archive must contain only the exact configured base name.