Documentation
¶
Index ¶
- type AdmissionResult
- type Allocation
- type Controller
- func (c Controller) Admit(ctx context.Context, host admission.HostSnapshot, observed []Allocation, ...) (admission.Decision, error)
- func (c Controller) AdmitPreemptible(ctx context.Context, host admission.HostSnapshot, observed []Allocation, ...) (AdmissionResult, error)
- func (c Controller) AuthorizeWarmDrain(ctx context.Context, instanceName string) error
- func (c Controller) ClaimWarm(ctx context.Context, observed []Allocation, request WarmClaimRequest) (WarmClaimResult, error)
- func (c Controller) MarkCreated(ctx context.Context, instanceName string) error
- func (c Controller) MarkDeleting(ctx context.Context, instanceName string) error
- func (c Controller) MarkWarmInjected(ctx context.Context, jobName, instanceName string) error
- func (c Controller) Reconcile(ctx context.Context, observed []Allocation) error
- func (c Controller) Release(ctx context.Context, instanceName string) error
- func (c Controller) Resolve(ctx context.Context, identifier string) (string, error)
- type Request
- type WarmClaimRequest
- type WarmClaimResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdmissionResult ¶
type Allocation ¶
type Allocation struct {
InstanceName string
ControllerID string
PoolID string
PoolName string
VCPU int
MemoryMiB int
ImageFingerprint string
// State is derived from immutable Incus lifecycle metadata. An empty value
// is treated as StateCreated for compatibility with cold workers.
State providerjournal.LeaseState
JobName string
}
type Controller ¶
type Controller struct {
Store providerjournal.Store
ControllerID string
Policy admission.ReservePolicy
LeaseTTL time.Duration
Now func() time.Time
}
func (Controller) Admit ¶
func (c Controller) Admit( ctx context.Context, host admission.HostSnapshot, observed []Allocation, request Request, ) (admission.Decision, error)
func (Controller) AdmitPreemptible ¶
func (c Controller) AdmitPreemptible( ctx context.Context, host admission.HostSnapshot, observed []Allocation, request Request, ) (AdmissionResult, error)
AdmitPreemptible atomically reserves a cold request and marks a deterministic capacity-satisfying set of unclaimed warm-ready leases as its victims. The caller must delete every returned VM before launching the reserved job worker, then call this method again with fresh host/inventory state to prove that the hand-off preserved all reserves.
func (Controller) AuthorizeWarmDrain ¶
func (c Controller) AuthorizeWarmDrain(ctx context.Context, instanceName string) error
AuthorizeWarmDrain verifies under the journal lock that the exact instance is an unclaimed ready lease. The manager must remain stopped after this check so no new claim can be admitted before the provider teardown begins.
func (Controller) ClaimWarm ¶
func (c Controller) ClaimWarm( ctx context.Context, observed []Allocation, request WarmClaimRequest, ) (WarmClaimResult, error)
ClaimWarm atomically binds one GARM job identity to one already observed, unregistered warm VM. It performs no Incus mutation and is safe to repeat after a provider crash: the same job always receives the same provider ID.
func (Controller) MarkCreated ¶
func (c Controller) MarkCreated(ctx context.Context, instanceName string) error
MarkCreated records that Incus accepted the create transaction. It refuses to manufacture a lease because admission must precede every mutation.
func (Controller) MarkDeleting ¶
func (c Controller) MarkDeleting(ctx context.Context, instanceName string) error
func (Controller) MarkWarmInjected ¶
func (c Controller) MarkWarmInjected(ctx context.Context, jobName, instanceName string) error
func (Controller) Reconcile ¶
func (c Controller) Reconcile(ctx context.Context, observed []Allocation) error
Reconcile records the exact observed Incus inventory without making a new capacity decision. It is used when a provider retry adopts a VM that already exists after a process or manager restart.
type Request ¶
type Request struct {
Allocation
QueueIntentAuthorized bool
}
type WarmClaimRequest ¶
type WarmClaimResult ¶
type WarmClaimResult struct {
InstanceName string
State providerjournal.ClaimState
Found bool
}