Documentation
¶
Overview ¶
Package nodepool manages node pools and the cluster autoscaler (§6.5): provider-backed pools create servers that join with cloud-init, grow when tasks cannot be placed or capacity runs low, and shrink by draining and deleting underused nodes.
Index ¶
- func UserData(controller, token, name, pin string) string
- func Validate(name, role string, provider bool, s *Spec, min, max int) error
- type Manager
- func (m *Manager) Draining() map[string]string
- func (m *Manager) EdgeNodes() []nodes.View
- func (m *Manager) JoinToken(ctx context.Context, poolID, nodeName string, ttl time.Duration) (string, error)
- func (m *Manager) PoolOf(nodeID string) (string, string)
- func (m *Manager) Provider(ctx context.Context, id string) (cloud.Provider, error)
- func (m *Manager) Reload(ctx context.Context) error
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) SealProvider(id string, c cloud.Config) []byte
- type Spec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// ControllerURL is the address new servers join through (public).
ControllerURL func() string
// Pin is the controller certificate's key pin while it is self-signed.
Pin func() string
// contains filtered or unexported fields
}
Manager runs pools.
func (*Manager) EdgeNodes ¶
EdgeNodes lists the nodes of edge pools (they run Traefik replicas, §8.5).
func (*Manager) JoinToken ¶
func (m *Manager) JoinToken(ctx context.Context, poolID, nodeName string, ttl time.Duration) (string, error)
JoinToken creates a single-use token that puts a node in a pool.
type Spec ¶
type Spec struct {
// Servers created by the provider.
Region string `json:"region,omitempty"`
Type string `json:"type,omitempty"`
Image string `json:"image,omitempty"`
SSHKeys []string `json:"sshKeys,omitempty"`
// Capacity of one new node, for planning (cores, MiB).
NodeCPU float64 `json:"nodeCpu,omitempty"`
NodeMemoryMiB int `json:"nodeMemoryMiB,omitempty"`
// Cluster autoscaling.
Autoscale bool `json:"autoscale"`
Headroom int `json:"headroom,omitempty"` // % reserved above which to add a node (default 80)
ScaleInBelow int `json:"scaleInBelow,omitempty"` // % reserved below which a node may go (default 40)
ScaleInAfter int `json:"scaleInAfter,omitempty"` // seconds below that first (default 600)
PendingAfter int `json:"pendingAfter,omitempty"` // seconds tasks wait unplaced before adding nodes (default 60)
MaxStep int `json:"maxStep,omitempty"` // nodes added or removed at once (default 2)
JoinTimeout int `json:"joinTimeout,omitempty"` // seconds a new server has to join (default 600)
}
Spec is a pool's settings.