ipam

package
v0.0.0-...-792cabc Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ipam is responsible for IP addresses management

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PodSubnetCIDR           string // subnet used for all pods across all nodes
	PodNetworkPrefixLen     uint8  // prefix length of subnet used for all pods of 1 host node (pod network = pod subnet for one 1 host node)
	VSwitchSubnetCIDR       string // subnet used in each host for vswitch-to-its-host connection
	VSwitchNetworkPrefixLen uint8  // prefix length of subnet used for vswitch-to-its-host connection on 1 host node (VSwitch network = VSwitch subnet for one 1 host node)
	HostNodeSubnetCidr      string // subnet used for all hosts node referencing IP addresses
}

Config is configuration for IPAM module

type IPAM

type IPAM struct {
	// contains filtered or unexported fields
}

IPAM represents the basic Contiv IPAM module.

func New

func New(logger logging.Logger, hostID uint8, config *Config) (*IPAM, error)

New returns new IPAM module to be used on the host.

func (*IPAM) HostID

func (i *IPAM) HostID() uint8

HostID returns unique host ID used to calculate the pod network CIDR.

func (*IPAM) HostIPAddress

func (i *IPAM) HostIPAddress(hostID uint8) (net.IP, error)

HostIPAddress computes IP address of host node based on host id

func (*IPAM) HostIPNetwork

func (i *IPAM) HostIPNetwork(hostID uint8) (*net.IPNet, error)

HostIPNetwork computes host node network with IP address of host node based on provided host id

func (*IPAM) NextPodIP

func (i *IPAM) NextPodIP(podID string) (net.IP, error)

NextPodIP returns next available pod IP address and remembers that this IP is meant to be used for pod with pod id <podID>

func (*IPAM) OtherHostPodNetwork

func (i *IPAM) OtherHostPodNetwork(hostID uint8) *net.IPNet

OtherHostPodNetwork returns pod network for other host identified by hostID.

func (*IPAM) OtherHostVSwitchNetwork

func (i *IPAM) OtherHostVSwitchNetwork(hostID uint8) *net.IPNet

OtherHostVSwitchNetwork returns vswitch network used to connect vswitch to other host identified by hostID.

func (*IPAM) PodGatewayIP

func (i *IPAM) PodGatewayIP() net.IP

PodGatewayIP returns gateway IP address for the pod network.

func (*IPAM) PodNetwork

func (i *IPAM) PodNetwork() *net.IPNet

PodNetwork returns pod network for current host (given by hostID given at IPAM creation)

func (*IPAM) PodSubnet

func (i *IPAM) PodSubnet() *net.IPNet

PodSubnet returns pod subnet ("network_address/prefix_length") that is base subnet for all pods of all hosts.

func (*IPAM) ReleasePodIP

func (i *IPAM) ReleasePodIP(podID string) error

ReleasePodIP releases the pod IP address remembered by pod ID string, so that it can be reused by the next pods.

func (*IPAM) VEthHostEndIP

func (i *IPAM) VEthHostEndIP() net.IP

VEthHostEndIP provides (for host given to IPAM) the IPv4 address for virtual ethernet's host end point

func (*IPAM) VEthVPPEndIP

func (i *IPAM) VEthVPPEndIP() net.IP

VEthVPPEndIP provides (for host given to IPAM) the IPv4 address for virtual ethernet's VPP end point

func (*IPAM) VSwitchNetwork

func (i *IPAM) VSwitchNetwork() *net.IPNet

VSwitchNetwork returns vswitch network used to connect vswitch to its host (given by hostID given at IPAM creation)

Jump to

Keyboard shortcuts

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