Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultAllocTimeout = 10 * time.Second
DefaultAllocTimeout is the default timeout duration for NodeIPAM.Allocate
Variables ¶
View Source
var ErrNoBlock = errors.New("out of blocks")
ErrNoBlock is an error indicating there are no available address blocks in a pool.
Functions ¶
Types ¶
type NodeIPAM ¶
type NodeIPAM interface { // Register registers previously allocated IP addresses. Register(ctx context.Context, poolName, containerID, iface string, ipv4, ipv6 net.IP) error // GC returns unused address blocks to the pool. // // This method is intended to be called once during the startup // and just after all existing containers are registered. GC(ctx context.Context) error // Allocate allocates IP addresses for `(containerID, iface)` from the pool. // // Allocate may timeout. The default timeout duration is DefaultAllocTimeout. // To specify shorter duration, pass `ctx` with timeout. // https://golang.org/pkg/context/#WithTimeout // // To test whether the returned error came from the timeout, do // `errors.Is(err, context.DeadlineExceeded)`. Allocate(ctx context.Context, poolName, containerID, iface string) (ipv4, ipv6 net.IP, err error) // Free frees the addresses allocated for `(containerID, iface)`. // // If no IP address has been allocated, this returns `nil`. // // non-nil error is returned only when it fails to return an unused // AddressBlock to the pool. Free(ctx context.Context, containerID, iface string) error // Notify notifies a goroutine waiting for BlockRequest completion Notify(req *coilv2.BlockRequest) }
NodeIPAM manages IP address assignments to Pods on each node.
func NewNodeIPAM ¶
func NewNodeIPAM(nodeName string, l logr.Logger, mgr manager.Manager, exporter nodenet.RouteExporter) NodeIPAM
NewNodeIPAM creates a new NodeIPAM object.
If `exporter` is non-nil, this calls `exporter.Sync` to add or delete routes when it allocate or delete AddressBlocks.
type PoolManager ¶
type PoolManager interface { // DropPool removes an address pool for an AddressPool, if any. DropPool(name string) // SyncPool sync address blocks of a pool. // This also updates the metrics of the pool. SyncPool(ctx context.Context, name string) error // AllocateBlock curves an AddressBlock out of the pool for a node. // If the pool runs out of the free blocks, this returns ErrNoBlock. AllocateBlock(ctx context.Context, poolName, nodeName string) (*coilv2.AddressBlock, error) }
PoolManager manages address pools.
func NewPoolManager ¶
NewPoolManager creates a new PoolManager.
Click to show internal directories.
Click to hide internal directories.