portallocator

package
v1.62.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 ports to the GameServer, or returns an error if a request exceeds the range capacity.
	Allocate(gs *agonesv1.GameServer) (*agonesv1.GameServer, error)

	// 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(portRanges map[string]PortRange,
	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.

type PortRange added in v1.41.0

type PortRange struct {
	// MinPort is the minimum port that can be allocated in this range.
	MinPort int32
	// MaxPort is the maximum port that can be allocated in this range.
	MaxPort int32
}

PortRange is a named port range.

Jump to

Keyboard shortcuts

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