allocator

package
v0.0.0-...-fda977c Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHIFT_BYTE_VAL  = 256
	HISTORY_TIMEOUT = 60 // seconds

	HOSTNAME_LABEL_NAME = "hostname"
	DEFNAME_LABEL_NAME  = "netname"
)

Variables

View Source
var IppoolHandler *backend.IPPoolHandler
View Source
var K8sClientset *kubernetes.Clientset

Functions

func CleanHangingAllocation

func CleanHangingAllocation(hostName string) error

func FindAvailableIndex

func FindAvailableIndex(indexes []int, leftIndex int) int

func FlushExpiredHistory

func FlushExpiredHistory()

func GenerateAllocateIndexes

func GenerateAllocateIndexes(allocations []backend.Allocation, maxIndex int, excludes []ExcludeRange) []int

Types

type ExcludeRange

type ExcludeRange struct {
	MinIndex int
	MaxIndex int
}

func (ExcludeRange) Contains

func (r ExcludeRange) Contains(index int) bool

type IPRequest

type IPRequest struct {
	PodName          string   `json:"pod"`
	PodNamespace     string   `json:"namespace"`
	HostName         string   `json:"host"`
	NetAttachDefName string   `json:"def"`
	InterfaceNames   []string `json:"masters"`
}

For IPAM Allocation/Deallocation

type IPResponse

type IPResponse struct {
	InterfaceName string `json:"interface"`
	IPAddress     string `json:"ip"`
	VLANBlockSize string `json:"block"`
}

func AllocateIP

func AllocateIP(req IPRequest) []IPResponse

func DeallocateIP

func DeallocateIP(req IPRequest) []IPResponse

type IPValue

type IPValue struct {
	Address string
	Value   int64
}

Jump to

Keyboard shortcuts

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