portallocator

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package portallocator defines a generic port allocator for game servers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// Run sets up the current state of port allocations and
	// starts tracking Pod and Node changes
	Run(ctx context.Context) error

	// Allocate assigns a port to the GameServer and returns it.
	Allocate(gs *agonesv1.GameServer) *agonesv1.GameServer

	// DeAllocate marks the given ports as no longer allocated
	DeAllocate(gs *agonesv1.GameServer)
}

Interface manages the dynamic port allocation strategy.

The portallocator does not currently support mixing static portAllocations (or any pods with defined HostPort) within the dynamic port range other than the ones it coordinates.

func New

func New(minPort, maxPort int32,
	kubeInformerFactory informers.SharedInformerFactory,
	agonesInformerFactory externalversions.SharedInformerFactory) Interface

New returns a new dynamic port allocator. minPort and maxPort are the top and bottom portAllocations that can be allocated in the range for the game servers.

Jump to

Keyboard shortcuts

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