ipam

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 14 Imported by: 14

Documentation

Overview

Package ipam handles address allocation management

Index

Constants

This section is empty.

Variables

View Source
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 Configuration

type Configuration struct {
	EnableIPv4 bool
	EnableIPv6 bool
}

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

const (
	IPv6 Family = "ipv6"
	IPv4 Family = "ipv4"
)

type IPAM

type IPAM struct {
	IPv6Allocator *ipallocator.Range
	IPv4Allocator *ipallocator.Range
	// 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) *IPAM

NewIPAM returns a new IP address manager

func (*IPAM) AllocateIP

func (ipam *IPAM) AllocateIP(ip net.IP, owner string) error

AllocateIP allocates a IP address.

func (*IPAM) AllocateIPString

func (ipam *IPAM) AllocateIPString(ipAddr, owner string) error

AllocateIPString is identical to AllocateIP but takes a string

func (*IPAM) AllocateNext

func (ipam *IPAM) AllocateNext(family, owner string) (ipv4 net.IP, ipv6 net.IP, 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) (ip net.IP, err error)

AllocateNextFamily allocates the next IP of the requested address family

func (*IPAM) Dump

func (ipam *IPAM) Dump() (map[string]string, map[string]string)

Dump dumps the list of allocated IP addresses

func (*IPAM) ReleaseIP

func (ipam *IPAM) ReleaseIP(ip net.IP) error

ReleaseIP release a IP address.

func (*IPAM) ReleaseIPString added in v1.5.0

func (ipam *IPAM) ReleaseIPString(ipAddr string) error

ReleaseIPString is identical to ReleaseIP but takes a string

func (*IPAM) ReserveLocalRoutes added in v1.5.0

func (ipam *IPAM) ReserveLocalRoutes()

ReserveLocalRoutes walks through local routes/subnets and reserves them in the allocator pool in case of overlap

Jump to

Keyboard shortcuts

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