portallocator

package
v1.41.12 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const RELEASE_PORT_RETRY_INTERVAL = 10 * time.Second

Variables

View Source
var RETRY_CONFIG = wait.Backoff{
	Steps:    100,
	Duration: RELEASE_PORT_RETRY_INTERVAL,
	Factor:   1.1,
	Jitter:   0.1,
}

Functions

This section is empty.

Types

type PortAllocator

type PortAllocator struct {
	PortRangeStartNode int
	PortRangeEndNode   int

	PortRangeStartCluster int
	PortRangeEndCluster   int

	IsLeader bool

	BitmapPerNode map[string][]uint64
	BitmapCluster []uint64

	Client client.Client
	// contains filtered or unexported fields
}

Offer API for host port allocation, range from user configured port range Use label: `tensor-fusion.ai/host-port: auto` to assigned port at cluster level vGPU worker's hostPort will be managed by operator

func NewPortAllocator

func NewPortAllocator(ctx context.Context, client client.Client, nodeLevelPortRange string, clusterLevelPortRange string) (*PortAllocator, error)

func (*PortAllocator) AssignClusterLevelHostPort

func (s *PortAllocator) AssignClusterLevelHostPort(podName string) (int, error)

func (*PortAllocator) AssignHostPort

func (s *PortAllocator) AssignHostPort(nodeName string) (int, error)

AssignHostPort always called by operator itself, thus no Leader-Follower inconsistency issue

func (*PortAllocator) GetLeaderIP

func (s *PortAllocator) GetLeaderIP() string

func (*PortAllocator) ReleaseClusterLevelHostPort

func (s *PortAllocator) ReleaseClusterLevelHostPort(podName string, port int, immediateRelease bool) error

func (*PortAllocator) ReleaseHostPort

func (s *PortAllocator) ReleaseHostPort(nodeName string, podName string, port int, immediateRelease bool) error

func (*PortAllocator) SetupWithManager

func (s *PortAllocator) SetupWithManager(ctx context.Context, mgr manager.Manager) <-chan struct{}

Jump to

Keyboard shortcuts

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