cobalt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager fans resource operations out to the loaded plugins.

func New

func New(config types.Config) *Manager

func (*Manager) AddNode

func (m *Manager) AddNode(ctx context.Context, nodename string, opts resourcetypes.Resources, nodeInfo *enginetypes.Info) (resourcetypes.Resources, error)

func (*Manager) AddPlugins

func (m *Manager) AddPlugins(ps ...plugins.Plugin)

func (*Manager) Alloc

func (m *Manager) Alloc(ctx context.Context, nodename string, deployCount int, opts resourcetypes.Resources) ([]resourcetypes.Resources, []resourcetypes.Resources, error)

Alloc allocates resource for deployCount workloads on nodename, keyed by plugin name in opts.

func (*Manager) GetMetricsDescription

func (m *Manager) GetMetricsDescription(ctx context.Context) ([]*plugintypes.MetricsDescription, error)

func (*Manager) GetMostIdleNode

func (m *Manager) GetMostIdleNode(ctx context.Context, nodenames []string) (string, error)

func (*Manager) GetNodeMetrics

func (m *Manager) GetNodeMetrics(ctx context.Context, node *types.Node) ([]*plugintypes.Metrics, error)

func (*Manager) GetNodeResourceInfo

func (m *Manager) GetNodeResourceInfo(ctx context.Context, nodename string, workloads []*types.Workload, fix bool) (resourcetypes.Resources, resourcetypes.Resources, []string, error)

func (*Manager) GetNodesDeployCapacity

func (m *Manager) GetNodesDeployCapacity(ctx context.Context, nodenames []string, opts resourcetypes.Resources) (map[string]*plugintypes.NodeDeployCapacity, int, error)

GetNodesDeployCapacity returns the nodes meeting every plugin's requirements, and their total capacity. the caller must hold the node locks

func (*Manager) LoadPlugins

func (m *Manager) LoadPlugins(ctx context.Context, embeddedETCD *embedded.Cluster) error

func (*Manager) Realloc

func (*Manager) Remap

func (m *Manager) Remap(ctx context.Context, nodename string, workloads []*types.Workload) (map[string]resourcetypes.Resources, error)

Remap returns engine params per workload, format: {"workload-1": {"cpus": ["1-3"]}}. remap never changes resource params

func (*Manager) RemoveNode

func (m *Manager) RemoveNode(ctx context.Context, nodename string) error

func (*Manager) RollbackAlloc

func (m *Manager) RollbackAlloc(ctx context.Context, nodename string, workloadsParams []resourcetypes.Resources) error

RollbackAlloc returns the allocated resource to the node.

func (*Manager) RollbackRealloc

func (m *Manager) RollbackRealloc(ctx context.Context, nodename string, workloadParams resourcetypes.Resources) error

func (*Manager) SetNodeResourceCapacity

func (m *Manager) SetNodeResourceCapacity(ctx context.Context, nodename string, nodeResource, nodeResourceRequest resourcetypes.Resources, delta, incr bool) (resourcetypes.Resources, resourcetypes.Resources, error)

SetNodeResourceCapacity updates node capacity from resource options rather than resource args.

func (*Manager) SetNodeResourceUsage

func (m *Manager) SetNodeResourceUsage(ctx context.Context, nodename string, nodeResource, nodeResourceRequest resourcetypes.Resources, workloadsResource []resourcetypes.Resources, delta, incr bool) (resourcetypes.Resources, resourcetypes.Resources, error)

Jump to

Keyboard shortcuts

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