Documentation ¶
Overview ¶
Package ipam handles address allocation management
Index ¶
- Variables
- type AllocationResult
- type Allocator
- type Configuration
- type ErrAllocation
- 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) AllocateNext(family, owner string) (ipv4Result, ipv6Result *AllocationResult, err error)
- func (ipam *IPAM) AllocateNextFamily(family Family, owner string) (result *AllocationResult, err error)
- func (ipam *IPAM) BlacklistIP(ip net.IP, owner string)
- func (ipam *IPAM) BlacklistIPNet(ipNet net.IPNet, owner string)
- func (ipam *IPAM) DebugStatus() string
- func (ipam *IPAM) Dump() (allocv4 map[string]string, allocv6 map[string]string, status string)
- func (ipam *IPAM) ReleaseIP(ip net.IP) error
- func (ipam *IPAM) ReleaseIPString(ipAddr string) error
- func (ipam *IPAM) ReserveLocalRoutes()
- type IPBlacklist
- type IPNetWithOwner
- type Owner
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 ¶
This section is empty.
Types ¶
type AllocationResult ¶ added in v1.6.0
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 // Master is the MAC address of the master 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. Master 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 }
AllocationResult is the result of an allocation
type Allocator ¶ added in v1.6.0
type Allocator interface { // Allocate allocates a specific IP or fails Allocate(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) // 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) }
Allocator is the interface for an IP allocator implementation
type Configuration ¶
Configuration is the configuration of an IP address manager
type ErrAllocation ¶
type ErrAllocation error
type Family ¶
type Family string
Family is the type describing all address families support by the IP allocation manager
func DeriveFamily ¶ added in v1.6.0
DeriveFamily derives the address family of an IP
type IPAM ¶
type IPAM struct { IPv6Allocator Allocator IPv4Allocator Allocator // contains filtered or unexported fields }
Config is the IPAM configuration used for a particular IPAM type.
func NewIPAM ¶
func NewIPAM(nodeAddressing datapath.NodeAddressing, c Configuration, owner Owner) *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) 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) BlacklistIP ¶ added in v1.6.0
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) BlacklistIPNet ¶ added in v1.6.0
BlacklistIPNet ensures that a certain IPNetwork is never allocated, similar to BlacklistIP.
func (*IPAM) DebugStatus ¶ added in v1.6.0
DebugStatus implements debug.StatusObject to provide debug status collection ability
func (*IPAM) ReleaseIPString ¶
ReleaseIPString is identical to ReleaseIP but takes a string
func (*IPAM) ReserveLocalRoutes ¶
func (ipam *IPAM) ReserveLocalRoutes()
ReserveLocalRoutes walks through local routes/subnets and reserves them in the allocator pool in case of overlap
type IPBlacklist ¶ added in v1.6.0
type IPBlacklist struct {
// contains filtered or unexported fields
}
IPBlacklist is a structure used to store information related to blacklisted IPs and IPNetworks.
type IPNetWithOwner ¶ added in v1.6.0
type IPNetWithOwner struct {
// contains filtered or unexported fields
}
IPNetWithOwner is a structure containing a net.IPNet struct with the owner of that IP Network.
type Owner ¶ added in v1.6.0
type Owner interface { // GetNetConf must return the CNI configuration as passed in by the // user GetNetConf() *cnitypes.NetConf // K8sEventReceived is called to do metrics accounting for received // Kubernetes events K8sEventReceived(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) }
Owner is the interface the owner of an IPAM allocator has to implement