Documentation ¶
Overview ¶
Package gameserverallocations handles management of allocating Ready GameServers via selectors
Index ¶
- Constants
- Variables
- func Retry(backoff wait.Backoff, fn func() error) error
- type AllocationCache
- func (c *AllocationCache) AddGameServer(gs *agonesv1.GameServer)
- func (c *AllocationCache) ListSortedGameServers(gsa *allocationv1.GameServerAllocation) []*agonesv1.GameServer
- func (c *AllocationCache) ListSortedGameServersPriorities(gsa *allocationv1.GameServerAllocation) []*agonesv1.GameServer
- func (c *AllocationCache) RemoveGameServer(gs *agonesv1.GameServer) error
- func (c *AllocationCache) Resync()
- func (c *AllocationCache) Run(ctx context.Context) error
- func (c *AllocationCache) Sync(ctx context.Context) error
- func (c *AllocationCache) SyncGameServers(_ context.Context, key string) error
- type Allocator
- func (c *Allocator) Allocate(ctx context.Context, gsa *allocationv1.GameServerAllocation) (out k8sruntime.Object, err error)
- func (c *Allocator) ListenAndAllocate(ctx context.Context, updateWorkerCount int)
- func (c *Allocator) Run(ctx context.Context) error
- func (c *Allocator) Sync(ctx context.Context) error
- type Extensions
Constants ¶
const ( // LastAllocatedAnnotationKey is a GameServer annotation containing an RFC 3339 formatted // timestamp of the most recent allocation. LastAllocatedAnnotationKey = "agones.dev/last-allocated" )
Variables ¶
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 ¶
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(_ 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
func (c *Allocator) Allocate(ctx context.Context, gsa *allocationv1.GameServerAllocation) (out k8sruntime.Object, err error)
Allocate CRDHandler for allocating a gameserver.
func (*Allocator) ListenAndAllocate ¶ added in v1.0.0
ListenAndAllocate is a blocking function that runs in a loop looking at c.requestBatches for batches of requests that are coming through.
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