portallocator

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 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(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