Documentation ¶
Overview ¶
Package ipam handles address allocation management
Index ¶
- Variables
- func NewIPNotAvailableInPoolError(ip net.IP) error
- type AllocationAction
- type AllocationImplementation
- type AllocationResult
- type Allocator
- type CNIIPAMServer
- type Configuration
- type ErrAllocation
- type ErrIPNotAvailableInPool
- type Family
- type IPAM
- func (ipam *IPAM) AllocateIP(ip net.IP, owner string) (err error)
- func (ipam *IPAM) AllocateIPString(ipAddr, owner string) error
- func (ipam *IPAM) AllocateIPWithAllocationResult(ip net.IP, owner string) (result *AllocationResult, err error)
- func (ipam *IPAM) AllocateIPWithoutSyncUpstream(ip net.IP, owner string) (result *AllocationResult, err error)
- func (ipam *IPAM) AllocateNext(family, owner string) (ipv4Result, ipv6Result *AllocationResult, err error)
- func (ipam *IPAM) AllocateNextFamily(family Family, owner string) (result *AllocationResult, err error)
- func (ipam *IPAM) AllocateNextFamilyWithoutSyncUpstream(family Family, owner string) (result *AllocationResult, err error)
- func (ipam *IPAM) AllocateNextWithExpiration(family, owner string, timeout time.Duration) (ipv4Result, ipv6Result *AllocationResult, err error)
- func (ipam *IPAM) BlacklistIP(ip net.IP, owner string)
- func (ipam *IPAM) DebugStatus() string
- func (ipam *IPAM) Dump() (allocv4 map[string]string, allocv6 map[string]string, status string)
- func (ipam *IPAM) GetVpcCIDRs() (vpcCIDRs []*cidr.CIDR)
- func (ipam *IPAM) ReleaseIP(ip net.IP) error
- func (ipam *IPAM) ReleaseIPString(releaseArg string) (err error)
- func (ipam *IPAM) RestoreFinished()
- func (ipam *IPAM) StartExpirationTimer(ip net.IP, timeout time.Duration) (string, error)
- func (ipam *IPAM) StopExpirationTimer(ip net.IP, allocationUUID string) error
- type IPAMAllocator
- type IPBlacklist
- type K8sEventRegister
- type MetricsAPI
- type MtuConfiguration
- type NetResource
- func (n *NetResource) GetNeededAddresses() int
- func (n *NetResource) InstanceID() (id string)
- func (n *NetResource) IsPrefixDelegationEnabled() bool
- func (n *NetResource) IsRunning() bool
- func (n *NetResource) MaintainIPPool(ctx context.Context) error
- func (n *NetResource) Ops() NetResourceOperations
- func (n *NetResource) Pool() (pool ipamTypes.AllocationMap)
- func (n *NetResource) PopulateIPReleaseStatus(node *v2.NetResourceSet)
- func (n *NetResource) ResourceCopy() *v2.NetResourceSet
- func (n *NetResource) SetRunning()
- func (n *NetResource) Stats() Statistics
- func (n *NetResource) UpdatedResource(resource *v2.NetResourceSet) bool
- type NetResourceOperations
- type NetResourceSetGetterUpdater
- type NetResourceSetManager
- func (n *NetResourceSetManager) Create(resource *v2.NetResourceSet) error
- func (n *NetResourceSetManager) Delete(nodeName string) error
- func (n *NetResourceSetManager) Get(nodeName string) *NetResource
- func (n *NetResourceSetManager) GetNames() (allNodeNames []string)
- func (n *NetResourceSetManager) GetNodesByIPWatermark() []*NetResource
- func (n *NetResourceSetManager) InstancesAPIIsReady() bool
- func (n *NetResourceSetManager) ResourceType() string
- func (n *NetResourceSetManager) Resync(ctx context.Context, syncTime time.Time)
- func (n *NetResourceSetManager) SetInstancesAPIReadiness(ready bool)
- func (n *NetResourceSetManager) Start(ctx context.Context) error
- func (n *NetResourceSetManager) Update(resource *v2.NetResourceSet) error
- type Owner
- type ReleaseAction
- type RestoreTrigger
- type Statistics
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIPv4Disabled is returned when IPv4 allocation is disabled ErrIPv4Disabled = errors.New("IPv4 allocation disabled") // ErrIPv6Disabled is returned when Ipv6 allocation is disabled ErrIPv6Disabled = errors.New("IPv6 allocation disabled") )
Error definitions
Functions ¶
func NewIPNotAvailableInPoolError ¶
NewIPNotAvailableInPoolError returns an error resprenting the given IP not being available in the IPAM pool.
Types ¶
type AllocationAction ¶
type AllocationAction struct { // InterfaceID is set to the identifier describing the interface on // which the IPs must be allocated. This is optional, an IPAM // implementation can leave this empty to indicate that no interface // context is needed or a new interface must be created. InterfaceID string // Interface is the interface to allocate IPs on Interface ipamTypes.InterfaceRevision // PoolID is the IPAM pool identifier to allocate the IPs from. This // can correspond to a subnet ID or it can also left blank or set to a // value such as "global" to indicate a single address pool. PoolID ipamTypes.PoolID // AvailableForAllocation is the number IPs available for allocation. // If InterfaeID is set, then this number corresponds to the number of // IPs available for allocation on that interface. This number may be // lower than the number of IPs required to resolve the deficit. AvailableForAllocationIPv4 int AvailableForAllocationIPv6 int // MaxIPsToAllocate is set by the core IPAM layer before // NodeOperations.AllocateIPs() is called and defines the maximum // number of IPs to allocate in order to stay within the boundaries as // defined by NodeOperations.{ MinAllocate() | PreAllocate() | // getMaxAboveWatermark() }. MaxIPsToAllocate int // AvailableInterfaces is the number of interfaces available to be created AvailableInterfaces int }
AllocationAction is the action to be taken to resolve allocation deficits for a particular node. It is returned by NodeOperations.PrepareIPAllocation() and passed into NodeOperations.AllocateIPs().
type AllocationImplementation ¶
type AllocationImplementation interface { // CreateNetResource is called when the IPAM layer has learned about a new // node which requires IPAM services. This function must return a // NodeOperations implementation which will render IPAM services to the // node context provided. CreateNetResource(obj *v2.NetResourceSet, node *NetResource) NetResourceOperations // GetPoolQuota is called to retrieve the remaining IP addresses in all // IP pools known to the IPAM implementation. GetPoolQuota() ipamTypes.PoolQuotaMap // Resync is called periodically to give the IPAM implementation a // chance to resync its own state with external APIs or systems. It is // also called when the IPAM layer detects that state got out of sync. Resync(ctx context.Context) time.Time }
AllocationImplementation is the interface an implementation must provide. Other than NodeOperations, this implementation is not related to a node specifically.
type AllocationResult ¶
type AllocationResult struct { // IP is the allocated IP IP net.IP // CIDRs is a list of all CIDRs to which the IP has direct access to. // This is primarily useful if the IP has been allocated out of a VPC // subnet range and the VPC provides routing to a set of CIDRs in which // the IP is routable. CIDRs []string // PrimaryMAC is the MAC address of the primary interface. This is useful // when the IP is a secondary address of an interface which is // represented on the node as a Linux device and all routing of the IP // must occur through that master interface. PrimaryMAC string // GatewayIP is the IP of the gateway which must be used for this IP. // If the allocated IP is derived from a VPC, then the gateway // represented the gateway of the VPC or VPC subnet. GatewayIP string // ExpirationUUID is the UUID of the expiration timer. This field is // only set if AllocateNextWithExpiration is used. ExpirationUUID string // InterfaceNumber is a field for generically identifying an interface. // This is only useful in ENI mode. InterfaceNumber string }
AllocationResult is the result of an allocation
type Allocator ¶
type Allocator interface { // Allocate allocates a specific IP or fails Allocate(ip net.IP, owner string) (*AllocationResult, error) // AllocateWithoutSyncUpstream allocates a specific IP without syncing // upstream or fails AllocateWithoutSyncUpstream(ip net.IP, owner string) (*AllocationResult, error) // Release releases a previously allocated IP or fails Release(ip net.IP) error // AllocateNext allocates the next available IP or fails if no more IPs // are available AllocateNext(owner string) (*AllocationResult, error) // AllocateNextWithoutSyncUpstream allocates the next available IP without syncing // upstream or fails if no more IPs are available AllocateNextWithoutSyncUpstream(owner string) (*AllocationResult, error) // Dump returns a map of all allocated IPs with the IP represented as // key in the map. Dump must also provide a status one-liner to // represent the overall status, e.g. number of IPs allocated and // overall health information if available. Dump() (map[string]string, string) // RestoreFinished marks the status of restoration as done RestoreFinished() }
Allocator is the interface for an IP allocator implementation
type CNIIPAMServer ¶
type CNIIPAMServer interface { debug.StatusObject RestoreTrigger DEL(owner, containerID string) (err error) ADD(family, owner, containerID, netns string) (ipv4Result, ipv6Result *AllocationResult, err error) Dump() (allocv4 map[string]string, allocv6 map[string]string, status string) }
type Configuration ¶
type Configuration interface { // IPv4Enabled must return true when IPv4 is enabled IPv4Enabled() bool // IPv6 must return true when IPv6 is enabled IPv6Enabled() bool // IPAMMode returns the IPAM mode IPAMMode() string // HealthCheckingEnabled must return true when health-checking is // enabled HealthCheckingEnabled() bool // UnreachableRoutesEnabled returns true when unreachable-routes is // enabled UnreachableRoutesEnabled() bool // SetIPv4NativeRoutingCIDR is called by the IPAM module to announce // the native IPv4 routing CIDR if it exists SetIPv4NativeRoutingCIDR(cidr *cidr.CIDR) // IPv4NativeRoutingCIDR is called by the IPAM module retrieve // the native IPv4 routing CIDR if it exists GetIPv4NativeRoutingCIDR() *cidr.CIDR //GetCCEEndpointGC interval of single machine recycling endpoint GetCCEEndpointGC() time.Duration // GetFixedIPTimeout FixedIPTimeout Timeout for waiting for the fixed IP assignment to succeed GetFixedIPTimeout() time.Duration }
Configuration is the configuration passed into the IPAM subsystem
type ErrAllocation ¶
type ErrAllocation error
type ErrIPNotAvailableInPool ¶
type ErrIPNotAvailableInPool struct {
// contains filtered or unexported fields
}
ErrIPNotAvailableInPool represents an error when an IP is not available in the pool.
func (*ErrIPNotAvailableInPool) Error ¶
func (e *ErrIPNotAvailableInPool) Error() string
func (*ErrIPNotAvailableInPool) Is ¶
func (e *ErrIPNotAvailableInPool) Is(target error) bool
Is provides this error type with the logic for use with errors.Is.
type Family ¶
type Family string
Family is the type describing all address families support by the IP allocation manager
func DeriveFamily ¶
DeriveFamily derives the address family of an IP
type IPAM ¶
type IPAM struct { IPv6Allocator Allocator IPv4Allocator Allocator // contains filtered or unexported fields }
IPAM is the configuration used for a particular IPAM type.
func NewIPAM ¶
func NewIPAM(networkResourceSetName string, nodeAddressing types.NodeAddressing, c Configuration, owner Owner, k8sEventReg K8sEventRegister, mtuConfig MtuConfiguration) *IPAM
NewIPAM returns a new IP address manager
func (*IPAM) AllocateIP ¶
AllocateIP allocates a IP address.
func (*IPAM) AllocateIPString ¶
AllocateIPString is identical to AllocateIP but takes a string
func (*IPAM) AllocateIPWithAllocationResult ¶
func (ipam *IPAM) AllocateIPWithAllocationResult(ip net.IP, owner string) (result *AllocationResult, err error)
AllocateIPWithAllocationResult allocates an IP address, and returns the allocation result.
func (*IPAM) AllocateIPWithoutSyncUpstream ¶
func (ipam *IPAM) AllocateIPWithoutSyncUpstream(ip net.IP, owner string) (result *AllocationResult, err error)
AllocateIPWithoutSyncUpstream allocates a IP address without syncing upstream.
func (*IPAM) AllocateNext ¶
func (ipam *IPAM) AllocateNext(family, owner string) (ipv4Result, ipv6Result *AllocationResult, err error)
AllocateNext allocates the next available IPv4 and IPv6 address out of the configured address pool. If family is set to "ipv4" or "ipv6", then allocation is limited to the specified address family. If the pool has been drained of addresses, an error will be returned.
func (*IPAM) AllocateNextFamily ¶
func (ipam *IPAM) AllocateNextFamily(family Family, owner string) (result *AllocationResult, err error)
AllocateNextFamily allocates the next IP of the requested address family
func (*IPAM) AllocateNextFamilyWithoutSyncUpstream ¶
func (ipam *IPAM) AllocateNextFamilyWithoutSyncUpstream(family Family, owner string) (result *AllocationResult, err error)
AllocateNextFamilyWithoutSyncUpstream allocates the next IP of the requested address family without syncing upstream
func (*IPAM) AllocateNextWithExpiration ¶
func (ipam *IPAM) AllocateNextWithExpiration(family, owner string, timeout time.Duration) (ipv4Result, ipv6Result *AllocationResult, err error)
AllocateNextWithExpiration is identical to AllocateNext but registers an expiration timer as well. This is identical to using AllocateNext() in combination with StartExpirationTimer()
func (*IPAM) BlacklistIP ¶
BlacklistIP ensures that a certain IP is never allocated. It is preferred to use BlacklistIP() instead of allocating the IP as the allocation block can change and suddenly cover the IP to be blacklisted.
func (*IPAM) DebugStatus ¶
DebugStatus implements debug.StatusObject to provide debug status collection ability
func (*IPAM) GetVpcCIDRs ¶
GetVpcCIDRs returns all the CIDRs associated with the VPC this node belongs to. This works only cloud provider IPAM modes and returns nil for other modes. sharedNodeStore must be initialized before calling this method.
func (*IPAM) ReleaseIPString ¶
ReleaseIPString is identical to ReleaseIP but takes a string and supports referring to the IPs to be released with the IP itself or the owner name used during allocation. If the owner can be referred to multiple IPs, then all IPs are being released.
func (*IPAM) RestoreFinished ¶
func (ipam *IPAM) RestoreFinished()
func (*IPAM) StartExpirationTimer ¶
StartExpirationTimer installs an expiration timer for a previously allocated IP. Unless StopExpirationTimer is called in time, the IP will be released again after expiration of the specified timeout. The function will return a UUID representing the unique allocation attempt. The same UUID must be passed into StopExpirationTimer again.
This function is to be used as allocation and use of an IP can be controlled by an external entity and that external entity can disappear. Therefore such users should register an expiration timer before returning the IP and then stop the expiration timer when the IP has been used.
func (*IPAM) StopExpirationTimer ¶
StopExpirationTimer will remove the expiration timer for a particular IP. The UUID returned by the symmetric StartExpirationTimer must be provided. The expiration timer will only be removed if the UUIDs match. Releasing an IP will also stop the expiration timer.
type IPAMAllocator ¶
type IPAMAllocator interface { debug.StatusObject RestoreTrigger AllocateIPString(ipAddr, owner string) error AllocateIPWithoutSyncUpstream(ip net.IP, owner string) (result *AllocationResult, err error) ReleaseIPString(releaseArg string) (err error) AllocateNextWithExpiration(family, owner string, timeout time.Duration) (ipv4Result, ipv6Result *AllocationResult, err error) AllocateNext(family, owner string) (ipv4Result, ipv6Result *AllocationResult, err error) AllocateNextFamilyWithoutSyncUpstream(family Family, owner string) (result *AllocationResult, err error) Dump() (allocv4 map[string]string, allocv6 map[string]string, status string) }
type IPBlacklist ¶
type IPBlacklist struct {
// contains filtered or unexported fields
}
IPBlacklist is a structure used to store information related to blacklisted IPs and IPNetworks.
type K8sEventRegister ¶
type K8sEventRegister interface { // K8sEventReceived is called to do metrics accounting for received // Kubernetes events, as well as calculating timeouts for k8s watcher // cache sync. K8sEventReceived(apiGroupResourceName string, scope string, action string, valid, equal bool) // K8sEventProcessed is called to do metrics accounting for each processed // Kubernetes event. K8sEventProcessed(scope string, action string, status bool) // RegisterNetResourceSetSubscriber allows registration of subscriber.NetResourceSet // implementations. Events for all NetResourceSet events (not just the local one) // will be sent to the subscriber. RegisterNetResourceSetSubscriber(s subscriber.NetResourceSet) }
K8sEventRegister is used to register and handle events as they are processed by K8s controllers.
type MetricsAPI ¶
type MetricsAPI interface { IncAllocationAttempt(status, subnetID string) AddIPAllocation(subnetID string, allocated int64) AddIPRelease(subnetID string, released int64) SetAllocatedIPs(typ string, allocated int) SetAvailableInterfaces(available int) SetAvailableIPsPerSubnet(subnetID string, availabilityZone string, available int) SetNetResourceSets(category string, nodes int) IncResyncCount() PoolMaintainerTrigger() trigger.MetricsObserver K8sSyncTrigger() trigger.MetricsObserver ResyncTrigger() trigger.MetricsObserver }
MetricsAPI represents the metrics being maintained by a NodeManager
type MtuConfiguration ¶
type MtuConfiguration interface {
GetDeviceMTU() int
}
type NetResource ¶
type NetResource struct {
// contains filtered or unexported fields
}
NetResource represents a Kubernetes node running CCE with an associated NetResourceSet custom resource
func (*NetResource) GetNeededAddresses ¶
func (n *NetResource) GetNeededAddresses() int
GetNeededAddresses returns the number of needed addresses that need to be allocated or released. A positive number is returned to indicate allocation. A negative number is returned to indicate release of addresses.
func (*NetResource) InstanceID ¶
func (n *NetResource) InstanceID() (id string)
InstanceID returns the instance ID of the node
func (*NetResource) IsPrefixDelegationEnabled ¶
func (n *NetResource) IsPrefixDelegationEnabled() bool
func (*NetResource) IsRunning ¶
func (n *NetResource) IsRunning() bool
IsRunning returns true if the node is considered to be running
func (*NetResource) MaintainIPPool ¶
func (n *NetResource) MaintainIPPool(ctx context.Context) error
MaintainIPPool attempts to allocate or release all required IPs to fulfill the needed gap. If required, interfaces are created.
func (*NetResource) Ops ¶
func (n *NetResource) Ops() NetResourceOperations
Ops returns the IPAM implementation operations for the node
func (*NetResource) Pool ¶
func (n *NetResource) Pool() (pool ipamTypes.AllocationMap)
Pool returns the IP allocation pool available to the node
func (*NetResource) PopulateIPReleaseStatus ¶
func (n *NetResource) PopulateIPReleaseStatus(node *v2.NetResourceSet)
PopulateIPReleaseStatus Updates cce node IPAM status with excess IP release data
func (*NetResource) ResourceCopy ¶
func (n *NetResource) ResourceCopy() *v2.NetResourceSet
ResourceCopy returns a deep copy of the NetResourceSet custom resource associated with the node
func (*NetResource) SetRunning ¶
func (n *NetResource) SetRunning()
func (*NetResource) Stats ¶
func (n *NetResource) Stats() Statistics
Stats returns a copy of the node statistics
func (*NetResource) UpdatedResource ¶
func (n *NetResource) UpdatedResource(resource *v2.NetResourceSet) bool
UpdatedResource is called when an update to the NetResourceSet has been received. The IPAM layer will attempt to immediately resolve any IP deficits and also trigger the background sync to continue working in the background to resolve any deficits or excess.
type NetResourceOperations ¶
type NetResourceOperations interface { // UpdateNode is called when an update to the NetResourceSet is received. UpdatedNode(obj *v2.NetResourceSet) // PopulateStatusFields is called to give the implementation a chance // to populate any implementation specific fields in NetResourceSet.Status. PopulateStatusFields(resource *v2.NetResourceSet) // CreateInterface is called to create a new interface. This is only // done if PrepareIPAllocation indicates that no more IPs are available // (AllocationAction.AvailableForAllocation == 0) for allocation but // interfaces are available for creation // (AllocationAction.AvailableInterfaces > 0). This function must // create the interface *and* allocate up to // AllocationAction.MaxIPsToAllocate. CreateInterface(ctx context.Context, allocation *AllocationAction, scopedLog *logrus.Entry) (int, string, error) // ResyncInterfacesAndIPs is called to synchronize the latest list of // interfaces and IPs associated with the node. This function is called // sparingly as this information is kept in sync based on the success // of the functions AllocateIPs(), ReleaseIPs() and CreateInterface(). ResyncInterfacesAndIPs(ctx context.Context, scopedLog *logrus.Entry) (ipamTypes.AllocationMap, error) // PrepareIPAllocation is called to calculate the number of IPs that // can be allocated on the node and whether a new network interface // must be attached to the node. PrepareIPAllocation(scopedLog *logrus.Entry) (*AllocationAction, error) // AllocateIPs is called after invoking PrepareIPAllocation and needs // to perform the actual allocation. AllocateIPs(ctx context.Context, allocation *AllocationAction) error // PrepareIPRelease is called to calculate whether any IP excess needs // to be resolved. It behaves identical to PrepareIPAllocation but // indicates a need to release IPs. PrepareIPRelease(excessIPs int, scopedLog *logrus.Entry) *ReleaseAction // ReleaseIPs is called after invoking PrepareIPRelease and needs to // perform the release of IPs. ReleaseIPs(ctx context.Context, release *ReleaseAction) error // GetMaximumAllocatableIPv4 returns the maximum amount of IPv4 addresses // that can be allocated to the instance GetMaximumAllocatableIPv4() int // GetMinimumAllocatableIPv4 returns the minimum amount of IPv4 addresses that // must be allocated to the instance. GetMinimumAllocatableIPv4() int // IsPrefixDelegated helps identify if a node supports prefix delegation IsPrefixDelegated() bool // GetUsedIPWithPrefixes returns the total number of used IPs including all IPs in a prefix if at-least one of // the prefix IPs is in use. GetUsedIPWithPrefixes() int // GetMaximumBurstableAllocatableIPv4 returns the maximum amount of IPv4 addresses GetMaximumBurstableAllocatableIPv4() int }
NetResourceOperations is the interface an IPAM implementation must provide in order to provide IP allocation for a node. The structure implementing this API *must* be aware of the node connected to this implementation. This is achieved by considering the node context provided in AllocationImplementation.CreateNetResource() function and returning a NetResourceOperations implementation which performs operations in the context of that node.
type NetResourceSetGetterUpdater ¶
type NetResourceSetGetterUpdater interface { Create(node *v2.NetResourceSet) (*v2.NetResourceSet, error) Update(origResource, newResource *v2.NetResourceSet) (*v2.NetResourceSet, error) UpdateStatus(origResource, newResource *v2.NetResourceSet) (*v2.NetResourceSet, error) Get(name string) (*v2.NetResourceSet, error) Lister() listerv2.NetResourceSetLister }
NetResourceSetGetterUpdater defines the interface used to interact with the k8s apiserver to retrieve and update the NetResourceSet custom resource
type NetResourceSetManager ¶
type NetResourceSetManager struct {
// contains filtered or unexported fields
}
NetResourceSetManager manages all nodes with ENIs
func NewNetResourceSetManager ¶
func NewNetResourceSetManager(instancesAPI AllocationImplementation, k8sAPI NetResourceSetGetterUpdater, metrics MetricsAPI, parallelWorkers int64, releaseExcessIPs bool, prefixDelegation bool) (*NetResourceSetManager, error)
NewNetResourceSetManager returns a new NodeManager
func (*NetResourceSetManager) Create ¶
func (n *NetResourceSetManager) Create(resource *v2.NetResourceSet) error
func (*NetResourceSetManager) Delete ¶
func (n *NetResourceSetManager) Delete(nodeName string) error
Delete is called after a NetResourceSet resource has been deleted via the Kubernetes apiserver
func (*NetResourceSetManager) Get ¶
func (n *NetResourceSetManager) Get(nodeName string) *NetResource
Get returns the node with the given name
func (*NetResourceSetManager) GetNames ¶
func (n *NetResourceSetManager) GetNames() (allNodeNames []string)
GetNames returns the list of all node names
func (*NetResourceSetManager) GetNodesByIPWatermark ¶
func (n *NetResourceSetManager) GetNodesByIPWatermark() []*NetResource
GetNodesByIPWatermark returns all nodes that require addresses to be allocated or released, sorted by the number of addresses needed to be operated in descending order. Number of addresses to be released is negative value so that nodes with IP deficit are resolved first
func (*NetResourceSetManager) InstancesAPIIsReady ¶
func (n *NetResourceSetManager) InstancesAPIIsReady() bool
InstancesAPIIsReady returns true if the instances API is stable and ready
func (*NetResourceSetManager) ResourceType ¶
func (n *NetResourceSetManager) ResourceType() string
ResourceType implements allocator.NetResourceSetEventHandler.
func (*NetResourceSetManager) Resync ¶
func (n *NetResourceSetManager) Resync(ctx context.Context, syncTime time.Time)
Resync will attend all nodes and resolves IP deficits. The order of attendance is defined by the number of IPs needed to reach the configured watermarks. Any updates to the node resource are synchronized to the Kubernetes apiserver.
func (*NetResourceSetManager) SetInstancesAPIReadiness ¶
func (n *NetResourceSetManager) SetInstancesAPIReadiness(ready bool)
SetInstancesAPIReadiness sets the readiness state of the instances API
func (*NetResourceSetManager) Start ¶
func (n *NetResourceSetManager) Start(ctx context.Context) error
Start kicks of the NodeManager by performing the initial state synchronization and starting the background sync go routine
func (*NetResourceSetManager) Update ¶
func (n *NetResourceSetManager) Update(resource *v2.NetResourceSet) error
Update is called whenever a NetResourceSet resource has been updated in the Kubernetes apiserver
type Owner ¶
type Owner interface { // UpdateNetResourceSetResource is called to create/update the NetResourceSet // resource. The function must block until the custom resource has been // created. UpdateNetResourceSetResource() // LocalAllocCIDRsUpdated informs the agent that the local allocation CIDRs have // changed. LocalAllocCIDRsUpdated(ipv4AllocCIDRs, ipv6AllocCIDRs []*cidr.CIDR) // GetResourceType ResourceType() string }
Owner is the interface the owner of an IPAM allocator has to implement
type ReleaseAction ¶
type ReleaseAction struct { // InterfaceID is set to the identifier describing the interface on // which the IPs must be released. This is optional, an IPAM // implementation can leave this empty to indicate that no interface // context is needed. InterfaceID string // PoolID is the IPAM pool identifier to release the IPs from. This can // correspond to a subnet ID or it can also left blank or set to a // value such as "global" to indicate a single address pool. PoolID ipamTypes.PoolID // IPsToRelease is the list of IPs to release IPsToRelease []string }
ReleaseAction is the action to be taken to resolve allocation excess for a particular node. It is returned by NodeOperations.PrepareIPRelease() and passed into NodeOperations.ReleaseIPs().
type RestoreTrigger ¶
type RestoreTrigger interface {
RestoreFinished()
}
type Statistics ¶
type Statistics struct { // UsedIPs is the number of IPs currently in use UsedIPs int // AvailableIPs is the number of IPs currently available for allocation // by the node AvailableIPs int // NeededIPs is the number of IPs needed to reach the PreAllocate // watermwark NeededIPs int // ExcessIPs is the number of free IPs exceeding MaxAboveWatermark ExcessIPs int // RemainingInterfaces is the number of interfaces that can either be // allocated or have not yet exhausted the instance specific quota of // addresses RemainingInterfaces int }
Statistics represent the IP allocation statistics of a node