ipassigner

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLocalIPDetector

func NewLocalIPDetector() *localIPDetector

Types

type IPAssigner

type IPAssigner interface {
	// AssignIP ensures the provided IP is assigned to the system.
	// It returns true only in the case when there is no error and the IP provided
	// was not assigned to the interface before the operation, in all other cases it
	// returns false.
	AssignIP(ip string, subnetInfo *v1beta1.SubnetInfo, forceAdvertise bool) (bool, error)
	// UnassignIP ensures the provided IP is not assigned to the system.
	// It returns true only in the case when there is no error and the IP provided
	// was assigned to the interface before the operation.
	UnassignIP(ip string) (bool, error)
	// AssignedIPs return the IPs that are assigned to the system by this IPAssigner.
	AssignedIPs() map[string]*v1beta1.SubnetInfo
	// InitIPs ensures the IPs that are assigned to the system match the given IPs.
	InitIPs(map[string]*v1beta1.SubnetInfo) error
	// GetInterfaceID returns the index of the network interface to which IPs in the provided subnet are assigned.
	GetInterfaceID(subnetInfo *v1beta1.SubnetInfo) (int, bool)
	// Run starts the IP assigner.
	Run(<-chan struct{})
}

IPAssigner provides methods to assign or unassign IP.

func NewIPAssigner

func NewIPAssigner(nodeTransportInterface string, dummyDeviceName string) (IPAssigner, error)

NewIPAssigner returns an *ipAssigner.

type LocalIPDetector

type LocalIPDetector interface {
	IsLocalIP(ip string) bool

	// Run starts the detector.
	Run(stopCh <-chan struct{})

	// AddEventHandler registers an eventHandler of IP address update. It's not thread-safe and should be called before
	// starting the detector.
	AddEventHandler(handler LocalIPEventHandler)

	// HasSynced returns true if the cache has been initialized with the full lists of IP addresses.
	HasSynced() bool
}

type LocalIPEventHandler

type LocalIPEventHandler func(ip string, added bool)

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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