allocator

package
v2.0.0-...-e8ecf83 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package allocator aims to manage allocation of different cluster-wide resources on behalf of the manager. In particular, it manages a set of independent allocator processes which can mostly execute concurrently with only a minimal need for coordination.

One of the instances where it needs coordination is when deciding to move a task to the PENDING state. Since a task can move to the PENDING state only when all the task allocators have completed, they must cooperate. The way `allocator` achieves this is by creating a `taskBallot` to which all task allocators register themselves as mandatory voters. For each task that needs allocation, each allocator independently votes to indicate the completion of their allocation. Once all registered voters have voted then the task is moved to the PENDING state.

Other than the coordination needed for task PENDING state, all the allocators function fairly independently.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoIngress is returned when no ingress network is found in store
	ErrNoIngress = errors.New("no ingress network found")
)

Functions

func GetIngressNetwork

func GetIngressNetwork(s *store.MemoryStore) (*api.Network, error)

GetIngressNetwork fetches the ingress network from store. ErrNoIngress will be returned if the ingress network is not present, nil otherwise. In case of any other failure in accessing the store, the respective error will be reported as is.

func IsIngressNetwork

func IsIngressNetwork(nw *api.Network) bool

IsIngressNetwork returns whether the passed network is an ingress network.

func IsIngressNetworkNeeded

func IsIngressNetworkNeeded(s *api.Service) bool

IsIngressNetworkNeeded checks whether the service requires the routing-mesh

func RunAllocatorTests

func RunAllocatorTests(t *testing.T, np networkallocator.Provider)

Types

type Allocator

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

Allocator controls how the allocation stage in the manager is handled.

func New

New returns a new instance of Allocator for use during allocation stage of the manager.

func (*Allocator) Run

func (a *Allocator) Run(ctx context.Context) error

Run starts all allocator go-routines and waits for Stop to be called.

func (*Allocator) Stop

func (a *Allocator) Stop()

Stop stops the allocator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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