pool_manager

package
v0.43.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RangeStartEnv              = "RANGE_START"
	RangeEndEnv                = "RANGE_END"
	RuntimeObjectFinalizerName = "k8s.v1.cni.cncf.io/kubeMacPool"
	NetworksAnnotation         = "k8s.v1.cni.cncf.io/networks"

	TransactionTimestampAnnotation = "kubemacpool.io/transaction-timestamp"
)

Variables

This section is empty.

Functions

func CreateTransactionTimestamp added in v0.23.0

func CreateTransactionTimestamp() time.Time

func GetMacPoolSize added in v0.15.0

func GetMacPoolSize(rangeStart, rangeEnd net.HardwareAddr) (int64, error)

func GetTransactionTimestampAnnotationFromVm added in v0.23.0

func GetTransactionTimestampAnnotationFromVm(virtualMachine *kubevirt.VirtualMachine) (time.Time, error)

func IsVirtualMachineDeletionInProgress added in v0.23.0

func IsVirtualMachineDeletionInProgress(vm *kubevirt.VirtualMachine) bool

func NewMacKey added in v0.42.1

func NewMacKey(macAddress string) macKey

NewMacKey creates a macKey struct containing a mac string that can be used for different mac string format comparison. It uses net.ParseMAC function to parse the given macAddress and then stores its String() value. The given macAddress MUST have already been validated.

func SetTransactionTimestampAnnotationToVm added in v0.23.0

func SetTransactionTimestampAnnotationToVm(virtualMachine *kubevirt.VirtualMachine, transactionTimestamp time.Time)

func VmNamespaced added in v0.23.0

func VmNamespaced(machine *kubevirt.VirtualMachine) string

func VmNamespacedFromRequest added in v0.30.0

func VmNamespacedFromRequest(request *reconcile.Request) string

Types

type OptMode added in v0.22.0

type OptMode string
const (
	OptInMode  OptMode = "Opt-in"
	OptOutMode OptMode = "Opt-out"
)

type PoolManager

type PoolManager struct {
	// contains filtered or unexported fields
}

func NewPoolManager

func NewPoolManager(kubeClient, cachedKubeClient client.Client, rangeStart, rangeEnd net.HardwareAddr, managerNamespace string, kubevirtExist bool, waitTime int) (*PoolManager, error)

func (*PoolManager) AllocatePodMac

func (p *PoolManager) AllocatePodMac(pod *corev1.Pod, isNotDryRun bool) error

func (*PoolManager) AllocateVirtualMachineMac

func (p *PoolManager) AllocateVirtualMachineMac(virtualMachine *kubevirt.VirtualMachine, transactionTimestamp *time.Time, isNotDryRun bool, parentLogger logr.Logger) error

func (*PoolManager) InitMaps

func (p *PoolManager) InitMaps() error

func (*PoolManager) IsKubevirtEnabled

func (p *PoolManager) IsKubevirtEnabled() bool

func (*PoolManager) IsNamespaceManaged added in v0.22.0

func (p *PoolManager) IsNamespaceManaged(namespaceName, webhookName string) (bool, error)

IsNamespaceManaged checks if the namespace of the instance is managed by kubemacpool in terms of opt-mode

func (*PoolManager) IsPodManaged added in v0.23.0

func (p *PoolManager) IsPodManaged(namespaceName string) (bool, error)

IsPodManaged checks if the namespace of a pod instance is opted in for kubemacpool

func (*PoolManager) IsVirtualMachineManaged added in v0.23.0

func (p *PoolManager) IsVirtualMachineManaged(namespaceName string) (bool, error)

IsVirtualMachineManaged checks if the namespace of a VirtualMachine instance is managed by kubemacpool

func (*PoolManager) MarkVMAsReady added in v0.5.0

func (p *PoolManager) MarkVMAsReady(vm *kubevirt.VirtualMachine, latestPersistedTransactionTimeStamp *time.Time, parentLogger logr.Logger) error

Remove all the mac addresses from the waiting configmap this mean the vm was saved in the etcd and pass validations

func (*PoolManager) ReleaseAllPodMacs added in v0.23.0

func (p *PoolManager) ReleaseAllPodMacs(podFullName string) error

func (*PoolManager) ReleaseAllVirtualMachineMacs added in v0.23.0

func (p *PoolManager) ReleaseAllVirtualMachineMacs(vmFullName string, parentLogger logr.Logger) error

func (*PoolManager) Start added in v0.14.3

func (p *PoolManager) Start() error

func (*PoolManager) UpdateMacAddressesForVirtualMachine added in v0.5.0

func (p *PoolManager) UpdateMacAddressesForVirtualMachine(previousVirtualMachine, virtualMachine *kubevirt.VirtualMachine, transactionTimestamp *time.Time, isNotDryRun bool, parentLogger logr.Logger) error

Jump to

Keyboard shortcuts

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