gameserverallocations

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 55 Imported by: 1

Documentation

Overview

Package gameserverallocations handles management of allocating Ready GameServers via selectors

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoGameServerReady is returned when there are no Ready GameServers
	// available
	ErrNoGameServerReady = errors.New("Could not find a Ready GameServer")
	// ErrConflictInGameServerSelection is returned when the candidate gameserver already allocated
	ErrConflictInGameServerSelection = errors.New("The Gameserver was already allocated")
)

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 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 multiclusterinformerv1alpha1.GameServerAllocationPolicyInformer, secretInformer informercorev1.SecretInformer,
	kubeClient kubernetes.Interface, readyGameServerCache *ReadyGameServerCache) *Allocator

NewAllocator creates an instance off Allocator

func (*Allocator) Allocate added in v1.0.0

func (c *Allocator) Allocate(gsa *allocationv1.GameServerAllocation, stop <-chan struct{}) (k8sruntime.Object, error)

Allocate CRDHandler for allocating a gameserver.

func (*Allocator) ListenAndAllocate added in v1.0.0

func (c *Allocator) ListenAndAllocate(updateWorkerCount int, stop <-chan struct{})

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

func (*Allocator) Start added in v1.0.0

func (c *Allocator) Start(stop <-chan struct{}) error

Start initiates the listeners.

func (*Allocator) Sync added in v1.0.0

func (c *Allocator) Sync(stop <-chan struct{}) error

Sync waits for cache to sync

type Controller

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

Controller is a the GameServerAllocation controller

func NewController

func NewController(apiServer *apiserver.APIServer,
	health healthcheck.Handler,
	counter *gameservers.PerNodeCounter,
	kubeClient kubernetes.Interface,
	kubeInformerFactory informers.SharedInformerFactory,
	agonesClient versioned.Interface,
	agonesInformerFactory externalversions.SharedInformerFactory,
) *Controller

NewController returns a controller for a GameServerAllocation

func (*Controller) Run

func (c *Controller) Run(_ int, stop <-chan struct{}) error

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

type ReadyGameServerCache added in v1.0.0

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

ReadyGameServerCache handles the gameserver sync operations for cache

func NewReadyGameServerCache added in v1.0.0

func NewReadyGameServerCache(informer informerv1.GameServerInformer, gameServerGetter getterv1.GameServersGetter, counter *gameservers.PerNodeCounter, health healthcheck.Handler) *ReadyGameServerCache

NewReadyGameServerCache creates a new instance of ReadyGameServerCache

func (*ReadyGameServerCache) AddToReadyGameServer added in v1.0.0

func (c *ReadyGameServerCache) AddToReadyGameServer(gs *agonesv1.GameServer)

AddToReadyGameServer adds a gameserver to the list of ready game server list

func (*ReadyGameServerCache) ListSortedReadyGameServers added in v1.0.0

func (c *ReadyGameServerCache) ListSortedReadyGameServers() []*agonesv1.GameServer

ListSortedReadyGameServers returns a list of the cache ready gameservers sorted by most allocated to least

func (*ReadyGameServerCache) PatchGameServerMetadata added in v1.0.0

func (c *ReadyGameServerCache) PatchGameServerMetadata(fam allocationv1.MetaPatch, gs *agonesv1.GameServer) (*agonesv1.GameServer, error)

PatchGameServerMetadata patches the input gameserver with allocation meta patch and returns the updated gameserver

func (*ReadyGameServerCache) RemoveFromReadyGameServer added in v1.0.0

func (c *ReadyGameServerCache) RemoveFromReadyGameServer(gs *agonesv1.GameServer) error

RemoveFromReadyGameServer removes a gameserver from the list of ready game server list

func (*ReadyGameServerCache) Resync added in v1.0.0

func (c *ReadyGameServerCache) Resync()

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

func (*ReadyGameServerCache) Start added in v1.0.0

func (c *ReadyGameServerCache) Start(stop <-chan struct{}) error

Start prepares cache to start

func (*ReadyGameServerCache) Sync added in v1.0.0

func (c *ReadyGameServerCache) Sync(stop <-chan struct{}) error

Sync waits for cache to sync

func (*ReadyGameServerCache) SyncGameServers added in v1.0.0

func (c *ReadyGameServerCache) SyncGameServers(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.

Jump to

Keyboard shortcuts

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