Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPAMConfig ¶
type IPAMConfig struct { *Range Name string Type string `json:"type"` Routes []*types.Route `json:"routes"` DataDir string `json:"dataDir"` ResolvConf string `json:"resolvConf"` Ranges []RangeSet `json:"ranges"` IPArgs []net.IP `json:"-"` // Requested IPs from CNI_ARGS, args and capabilities }
IPAMConfig represents the IP related network configuration. This nests Range because we initially only supported a single range directly, and wish to preserve backwards compatibility
func LoadIPAMConfig ¶
func LoadIPAMConfig(bytes []byte, envArgs string) (*IPAMConfig, string, error)
NewIPAMConfig creates a NetworkConfig from the given network name.
type IPAMEnvArgs ¶
type IPAMEnvArgs struct { types.CommonArgs IP ip.IP `json:"ip,omitempty"` }
type IPAllocator ¶
type IPAllocator struct {
// contains filtered or unexported fields
}
func NewIPAllocator ¶
func NewIPAllocator(s *RangeSet, store backend.Store, id int) *IPAllocator
func (*IPAllocator) GetIter ¶
func (a *IPAllocator) GetIter() (*RangeIter, error)
GetIter encapsulates the strategy for this allocator. We use a round-robin strategy, attempting to evenly use the whole set. More specifically, a crash-looping container will not see the same IP until the entire range has been run through. We may wish to consider avoiding recently-released IPs in the future.
type Net ¶
type Net struct { Name string `json:"name"` CNIVersion string `json:"cniVersion"` IPAM *IPAMConfig `json:"ipam"` RuntimeConfig struct { // The capability arg IPRanges []RangeSet `json:"ipRanges,omitempty"` IPs []*ip.IP `json:"ips,omitempty"` } `json:"runtimeConfig,omitempty"` Args *struct { A *IPAMArgs `json:"cni"` } `json:"args"` }
The top-level network config - IPAM plugins are passed the full configuration of the calling plugin, not just the IPAM section.
type Range ¶
type Range struct { RangeStart net.IP `json:"rangeStart,omitempty"` // The first ip, inclusive RangeEnd net.IP `json:"rangeEnd,omitempty"` // The last ip, inclusive Subnet types.IPNet `json:"subnet"` Gateway net.IP `json:"gateway,omitempty"` }
func (*Range) Canonicalize ¶
Canonicalize takes a given range and ensures that all information is consistent, filling out Start, End, and Gateway with sane values if missing
func (*Range) Contains ¶
IsValidIP checks if a given ip is a valid, allocatable address in a given Range
type RangeSet ¶
type RangeSet []Range
func (*RangeSet) Canonicalize ¶
Canonicalize ensures the RangeSet is in a standard form, and detects any invalid input. Call Range.Canonicalize() on every Range in the set