provision

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package provision runs the PROVISIONING workflow's asynchronous part: placement and reservation happen when a server is created; this worker resolves the server's software to an exact build, makes sure the artifact is in the Controller's cache, records it on the server and pushes the spec to the Node. A server that cannot be provisioned within the deadline becomes FAILED with a condition saying why.

It also obtains the new software of servers whose version is being changed (UPDATING); if that fails, they keep their current software.

Everything it needs is in the database, so it picks up where it left off after a Controller restart.

Index

Constants

View Source
const ConditionID = "provisioning"

ConditionID is the Controller condition a failed provisioning leaves.

View Source
const DefaultDeadline = 10 * time.Minute

DefaultDeadline is how long a server may stay in PROVISIONING.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Store    *store.Store
	Catalog  *catalog.Catalog
	Cache    *artifacts.Cache
	Notifier Notifier
	Logger   *slog.Logger
	// Deadline defaults to DefaultDeadline, Interval (between passes) to
	// 15 seconds, Now to time.Now.
	Deadline time.Duration
	Interval time.Duration
	Now      func() time.Time
}

Config wires the worker.

type Notifier

type Notifier interface {
	ServerChanged(serverID uuid.UUID)
}

Notifier is told when a server's spec changed.

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker provisions servers.

func New

func New(cfg Config) *Worker

New returns a worker.

func (*Worker) Kick

func (w *Worker) Kick()

Kick asks for a pass soon, for example after a server was created.

func (*Worker) Pass

func (w *Worker) Pass(ctx context.Context)

Pass handles every server waiting for provisioning once.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

Run makes passes until ctx ends.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL