v1.15.0 Latest Latest

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

Go to latest
Published: Jan 27, 2024 License: Apache-2.0 Imports: 27 Imported by: 0




This section is empty.


View Source
var (
	ErrExternalIPPoolNotFound = errors.New("ExternalIPPool not found")


This section is empty.


type ExternalIPAllocator

type ExternalIPAllocator interface {
	// AddEventHandler adds a consumer for ExternalIPPool events. It will block other consumers from allocating new IPs by
	// AllocateIPFromPool() until it calls RestoreIPAllocations().
	AddEventHandler(handler ExternalIPPoolEventHandler)
	// RestoreIPAllocations is used to restore the previous allocated IPs after controller restarts. It will return the
	// succeeded IP Allocations.
	RestoreIPAllocations(allocations []IPAllocation) []IPAllocation
	// AllocateIPFromPool allocates an IP from the given IP pool.
	AllocateIPFromPool(externalIPPool string) (net.IP, error)
	// IPPoolExists checks whether the IP pool exists.
	IPPoolExists(externalIPPool string) bool
	// IPPoolHasIP checks whether the IP pool contains the given IP.
	IPPoolHasIP(externalIPPool string, ip net.IP) bool
	// UpdateIPAllocation marks the IP in the specified ExternalIPPool as occupied.
	UpdateIPAllocation(externalIPPool string, ip net.IP) error
	// ReleaseIP releases the IP to the IP pool.
	ReleaseIP(externalIPPool string, ip net.IP) error
	// HasSynced indicates ExternalIPAllocator has finished syncing all ExternalIPPool resources.
	HasSynced() bool

type ExternalIPPoolController

type ExternalIPPoolController struct {
	// contains filtered or unexported fields

ExternalIPPoolController is responsible for synchronizing the ExternalIPPool resources.

func NewExternalIPPoolController

func NewExternalIPPoolController(crdClient clientset.Interface, externalIPPoolInformer antreainformers.ExternalIPPoolInformer) *ExternalIPPoolController

NewExternalIPPoolController returns a new *ExternalIPPoolController.

func (*ExternalIPPoolController) AddEventHandler

func (c *ExternalIPPoolController) AddEventHandler(handler ExternalIPPoolEventHandler)

func (*ExternalIPPoolController) AllocateIPFromPool

func (c *ExternalIPPoolController) AllocateIPFromPool(ipPoolName string) (net.IP, error)

AllocateIPFromPool allocates an IP from the the given IP pool.

func (*ExternalIPPoolController) HasSynced

func (c *ExternalIPPoolController) HasSynced() bool

func (*ExternalIPPoolController) IPPoolExists

func (c *ExternalIPPoolController) IPPoolExists(pool string) bool

func (*ExternalIPPoolController) IPPoolHasIP

func (c *ExternalIPPoolController) IPPoolHasIP(poolName string, ip net.IP) bool

func (*ExternalIPPoolController) ReleaseIP

func (c *ExternalIPPoolController) ReleaseIP(poolName string, ip net.IP) error

ReleaseIP releases the IP to the pool.

func (*ExternalIPPoolController) RestoreIPAllocations

func (c *ExternalIPPoolController) RestoreIPAllocations(allocations []IPAllocation) []IPAllocation

func (*ExternalIPPoolController) Run

func (c *ExternalIPPoolController) Run(stopCh <-chan struct{})

Run begins watching and syncing of the ExternalIPPoolController.

func (*ExternalIPPoolController) UpdateIPAllocation

func (c *ExternalIPPoolController) UpdateIPAllocation(poolName string, ip net.IP) error

UpdateIPAllocation sets the IP in the specified ExternalIPPool.

func (*ExternalIPPoolController) ValidateExternalIPPool

func (c *ExternalIPPoolController) ValidateExternalIPPool(review *admv1.AdmissionReview) *admv1.AdmissionResponse

type ExternalIPPoolEventHandler

type ExternalIPPoolEventHandler func(externalIPPool string)

ExternalIPPoolEventHandler defines a consumer to subscribe for external ExternalIPPool events.

type IPAllocation

type IPAllocation struct {
	// ObjectReference is useful to track the owner of this IP allocation.
	ObjectReference corev1.ObjectReference
	// IPPoolName is the name of the IP pool.
	IPPoolName string
	// IP is the allocated IP.
	IP net.IP

IPAllocation contains the IP and the IP Pool which allocates it.

Jump to

Keyboard shortcuts

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