Documentation
¶
Overview ¶
Package nodescale finds cloud nodes that sit idle and could be scaled in. This release is dry run only: it reports would_destroy events and never destroys anything.
Index ¶
Constants ¶
const ( // EventWouldDestroy is the only event kind; nothing is ever destroyed here. EventWouldDestroy = "would_destroy" // LabelAutoscale opts a node in when set to LabelAutoscaleOn. LabelAutoscale = "autoscale" // LabelAutoscaleOn is the opt-in value. LabelAutoscaleOn = "on" // DefaultPool names the pool of a node that matches no pool selector. DefaultPool = "default" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
NodeID string `json:"node_id"`
NodeName string `json:"node_name"`
Pool string `json:"pool"`
IdleMinutes int `json:"idle_minutes"`
MonthlyPrice *float64 `json:"monthly_price,omitempty"`
}
Candidate is a node a real scale-in would remove.
type Event ¶
type Event struct {
Kind string `json:"kind"`
NodeID string `json:"node_id"`
NodeName string `json:"node_name"`
Pool string `json:"pool"`
IdleMinutes int `json:"idle_minutes"`
MonthlyPrice *float64 `json:"monthly_price,omitempty"`
At time.Time `json:"at"`
}
Event is one would_destroy finding.
type Node ¶
type Node struct {
ID string
Name string
// Pools are the pools whose selector matches the node; empty means DefaultPool.
Pools []string
Labels map[string]string
// Provisioned is true when Levelrail created the node through cloud provisioning.
Provisioned bool
ControlPlane bool
// Workloads counts apps and databases placed on the node.
Workloads int
// HoldsVolumes is true when the node may hold the only copy of a volume,
// for example while a volume move to or from it is running.
HoldsVolumes bool
// MonthlyPrice is zero when unknown.
MonthlyPrice float64
}
Node is what the evaluator needs to know about one node.
type Preview ¶
type Preview struct {
Enabled bool `json:"enabled"`
DryRunOnly bool `json:"dry_run_only"`
IdleMinutes int `json:"idle_minutes"`
Candidates []Candidate `json:"candidates"`
MonthlySaving float64 `json:"monthly_saving"`
UnpricedCandidate int `json:"unpriced_candidates"`
}
Preview is the read-only answer for the API and CLI.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker evaluates nodes and emits events. It holds idle timers in memory, so a restart only delays a finding, never invents one.