gameserverallocations

package
v1.39.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 61 Imported by: 1

Documentation

Overview

Package gameserverallocations handles management of allocating Ready GameServers via selectors

Index

Constants

View Source
const (
	// LastAllocatedAnnotationKey is a GameServer annotation containing an RFC 3339 formatted
	// timestamp of the most recent allocation.
	LastAllocatedAnnotationKey = "agones.dev/last-allocated"
)

Variables

View Source
var (
	// ErrNoGameServer is returned when there are no Allocatable GameServers
	// available
	ErrNoGameServer = errors.New("Could not find an Allocatable GameServer")
	// ErrConflictInGameServerSelection is returned when the candidate gameserver already allocated
	ErrConflictInGameServerSelection = errors.New("The Gameserver was already allocated")
	// ErrTotalTimeoutExceeded is used to signal that total retry timeout has been exceeded and no additional retries should be made
	ErrTotalTimeoutExceeded = status.Errorf(codes.DeadlineExceeded, "remote allocation total timeout exceeded")
)

Functions

func Retry added in v0.9.0

func Retry(backoff wait.Backoff, fn func() error) error

Retry retries fn based on backoff provided.

Types

type AllocationCache added in v1.16.0

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

AllocationCache maintains a cache of GameServers that could potentially be allocated.

func NewAllocationCache added in v1.16.0

func NewAllocationCache(informer informerv1.GameServerInformer, counter *gameservers.PerNodeCounter, health healthcheck.Handler) *AllocationCache

NewAllocationCache creates a new instance of AllocationCache

func (*AllocationCache) AddGameServer added in v1.16.0

func (c *AllocationCache) AddGameServer(gs *agonesv1.GameServer)

AddGameServer adds a gameserver to the cache of allocatable GameServers

func (*AllocationCache) ListSortedGameServers added in v1.16.0

func (c *AllocationCache) ListSortedGameServers(gsa *allocationv1.GameServerAllocation) []*agonesv1.GameServer

ListSortedGameServers returns a list of the cached gameservers sorted by most allocated to least.

func (*AllocationCache) ListSortedGameServersPriorities added in v1.34.0

func (c *AllocationCache) ListSortedGameServersPriorities(gsa *allocationv1.GameServerAllocation) []*agonesv1.GameServer

ListSortedGameServersPriorities sorts and returns a list of game servers based on the list of Priorities.

func (*AllocationCache) RemoveGameServer added in v1.16.0

func (c *AllocationCache) RemoveGameServer(gs *agonesv1.GameServer) error

RemoveGameServer removes a gameserver from the cache of game servers

func (*AllocationCache) Resync added in v1.16.0

func (c *AllocationCache) Resync()

Resync enqueues an empty game server to be synced. Using queue helps avoiding multiple threads syncing at the same time.

func (*AllocationCache) Run added in v1.16.0

func (c *AllocationCache) Run(ctx context.Context) error

Run prepares cache to start

func (*AllocationCache) Sync added in v1.16.0

func (c *AllocationCache) Sync(ctx context.Context) error

Sync builds the initial cache from the current set GameServers in the cluster

func (*AllocationCache) SyncGameServers added in v1.16.0

func (c *AllocationCache) SyncGameServers(ctx context.Context, key string) error

SyncGameServers synchronises the GameServers to Gameserver cache. This is called when a failure happened during the allocation. This method will sync and make sure the cache is up to date.

type Allocator added in v1.0.0

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

Allocator handles game server allocation

func NewAllocator added in v1.0.0

func NewAllocator(policyInformer multiclusterinformerv1.GameServerAllocationPolicyInformer, secretInformer informercorev1.SecretInformer, gameServerGetter getterv1.GameServersGetter,
	kubeClient kubernetes.Interface, allocationCache *AllocationCache, remoteAllocationTimeout time.Duration, totalRemoteAllocationTimeout time.Duration, batchWaitTime time.Duration) *Allocator

NewAllocator creates an instance of Allocator

func (*Allocator) Allocate added in v1.0.0

Allocate CRDHandler for allocating a gameserver.

func (*Allocator) ListenAndAllocate added in v1.0.0

func (c *Allocator) ListenAndAllocate(ctx context.Context, updateWorkerCount int)

ListenAndAllocate is a blocking function that runs in a loop looking at c.requestBatches for batches of requests that are coming through.

func (*Allocator) Run added in v1.14.0

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

Run initiates the listeners.

func (*Allocator) Sync added in v1.0.0

func (c *Allocator) Sync(ctx context.Context) error

Sync waits for cache to sync

type Extensions added in v1.29.0

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

Extensions is a GameServerAllocation controller within the Extensions service

func NewExtensions added in v1.29.0

func NewExtensions(apiServer *apiserver.APIServer,
	health healthcheck.Handler,
	counter *gameservers.PerNodeCounter,
	kubeClient kubernetes.Interface,
	kubeInformerFactory informers.SharedInformerFactory,
	agonesClient versioned.Interface,
	agonesInformerFactory externalversions.SharedInformerFactory,
	remoteAllocationTimeout time.Duration,
	totalAllocationTimeout time.Duration,
	allocationBatchWaitTime time.Duration,
) *Extensions

NewExtensions returns the extensions controller for a GameServerAllocation

func (*Extensions) Run added in v1.29.0

func (c *Extensions) Run(ctx context.Context, _ int) error

Run runs this extensions controller. Will block until stop is closed. Ignores threadiness, as we only needs 1 worker for cache sync

Jump to

Keyboard shortcuts

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