nodeaddress

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package nodeaddress provides functionality relate to the node's address where a cilium agent is running on

Index

Constants

View Source
const (
	// DefaultIPv6Prefix is the prefix for all the IPv6 addresses.
	DefaultIPv6Prefix = "f00d::"

	// IPv6NodeAllocPrefixLen is the length of the prefix used for allocation per node
	IPv6NodeAllocPrefixLen = 112

	// IPv6NodePrefixLen is the length used to allocate container IPv6 addresses from.
	IPv6NodePrefixLen = 96

	// DefaultIPv6ClusterPrefixLen is the IPv6 prefix length of the entire cluster.
	DefaultIPv6ClusterPrefixLen = 64

	// DefaultIPv4Prefix is the prefix for all the IPv4 addresses.
	// %d is substituted with the last byte of first global IPv4 address
	// configured on the system.
	DefaultIPv4Prefix = "10.%d.0.1"

	// DefaultIPv4PrefixLen is the length used to allocate container IPv4 addresses from.
	DefaultIPv4PrefixLen = 16

	// DefaultIPv4ClusterPrefixLen is the IPv4 prefix length of the entire cluster.
	DefaultIPv4ClusterPrefixLen = 8

	// DefaultNAT46Prefix is the IPv6 prefix to represent NATed IPv4 addresses.
	DefaultNAT46Prefix = "0:0:0:0:0:FFFF::/96"
)

Variables

View Source
var (

	// ClusterIPv6Mask represents the CIDR Mask for an entire cluster.
	ClusterIPv6Mask = net.CIDRMask(64, 128)

	// NodeIPv6Mask represents the CIDR Mask for the cilium node.
	NodeIPv6Mask = net.CIDRMask(96, 128)

	// StateIPv6Mask represents the CIDR Mask for the state position.
	StateIPv6Mask = net.CIDRMask(112, 128)

	// ContainerIPv6Mask is the IPv6 prefix length for address assigned to
	// container. The default is L3 only and thus /128.
	ContainerIPv6Mask = net.CIDRMask(128, 128)

	// ContainerIPv4Mask is the IPv4 prefix length for address assigned to
	// container. The default is L3 only and thus /32.
	ContainerIPv4Mask = net.CIDRMask(32, 32)

	// IPv6DefaultRoute is the default IPv6 route.
	IPv6DefaultRoute = net.IPNet{IP: net.IPv6zero, Mask: net.CIDRMask(0, 128)}

	// IPv4DefaultRoute is the default IPv4 route.
	IPv4DefaultRoute = net.IPNet{IP: net.IPv4zero, Mask: net.CIDRMask(0, 32)}
)
View Source
var (
	// EnableIPv4 can be set to false to disable Ipv4
	EnableIPv4 = true
)

Functions

func AutoComplete

func AutoComplete() error

AutoComplete completes the parts of addressing that can be auto derived

func GetExternalIPv4

func GetExternalIPv4() net.IP

GetExternalIPv4 returns the external IPv4 node address

func GetIPv4AllocRange

func GetIPv4AllocRange() *net.IPNet

GetIPv4AllocRange returns the IPv4 allocation prefix of this node

func GetIPv4ClusterRange

func GetIPv4ClusterRange() *net.IPNet

GetIPv4ClusterRange returns the IPv4 prefix of the cluster

func GetIPv4NodeRoute

func GetIPv4NodeRoute() net.IPNet

GetIPv4NodeRoute returns a route pointing to the IPv4 node address

func GetIPv6

func GetIPv6() net.IP

GetIPv6 returns the IPv6 address of the node

func GetIPv6AllocRange

func GetIPv6AllocRange() *net.IPNet

GetIPv6AllocRange returns the IPv6 allocation prefix of this node

func GetIPv6ClusterRange

func GetIPv6ClusterRange() *net.IPNet

GetIPv6ClusterRange returns the IPv6 prefix of the clustr

func GetIPv6NoZeroComp

func GetIPv6NoZeroComp() string

GetIPv6NoZeroComp is similar to String but without generating zero compression in the address dump.

func GetIPv6NodeRange

func GetIPv6NodeRange() *net.IPNet

GetIPv6NodeRange returns the IPv6 allocation prefix of this node

func GetIPv6NodeRoute

func GetIPv6NodeRoute() net.IPNet

GetIPv6NodeRoute returns a route pointing to the IPv6 node address

func GetIPv6Router

func GetIPv6Router() net.IP

GetIPv6Router returns the IPv6 address of the node

func GetInternalIPv4

func GetInternalIPv4() net.IP

GetInternalIPv4 returns the internal IPv4 node address

func GetName

func GetName() string

GetName returns the name of the local node. The value returned was either previously set with SetName(), retrieved via `os.Hostname()`, or as a last resort is hardcoded to "localhost".

func GetNode

func GetNode() (node.Identity, *node.Node)

GetNode returns the identity and node spec for the local node

func InitDefaultPrefix

func InitDefaultPrefix(device string)

InitDefaultPrefix initializes the node address and allocation prefixes with default values derived from the system. device can be set to the primary network device of the system in which case the first address with global scope will be regarded as the system's node address.

func SetExternalIPv4

func SetExternalIPv4(ip net.IP)

SetExternalIPv4 sets the external IPv4 node address. It must be reachable on the network.

func SetIPv4AllocRange

func SetIPv4AllocRange(net *net.IPNet)

SetIPv4AllocRange sets the IPv4 address pool to use when allocating addresses for local endpoints

func SetIPv4ClusterCidrMaskSize

func SetIPv4ClusterCidrMaskSize(size int)

SetIPv4ClusterCidrMaskSize sets the size of the mask of the IPv4 cluster prefix

func SetIPv6

func SetIPv6(ip net.IP)

SetIPv6 sets the IPv6 address of the node

func SetIPv6NodeRange

func SetIPv6NodeRange(net *net.IPNet) error

SetIPv6NodeRange sets the IPv6 address pool to be used on this node

func SetIPv6Router

func SetIPv6Router(ip net.IP)

SetIPv6Router returns the IPv6 address of the node

func SetInternalIPv4

func SetInternalIPv4(ip net.IP)

SetInternalIPv4 sets the internal IPv4 node address, it is allocated from the node prefix

func SetName

func SetName(name string)

SetName sets the name of the local node. This will overwrite the value that is automatically retrieved with `os.Hostname()`.

Note: This function is currently designed to only be called during the bootstrapping procedure of the agent where no parallelism exists. If you want to use this function in later stages, a mutex must be added first.

func UseNodeAddresses

func UseNodeAddresses(node *node.Node) error

UseNodeAddresses sets the local ipv4-node and ipv6-node values from the addresses defined in the given node.

func UseNodeCIDR

func UseNodeCIDR(node *node.Node) error

UseNodeCIDR sets the ipv4-range and ipv6-range values values from the addresses defined in the given node.

func ValidatePostInit

func ValidatePostInit() error

ValidatePostInit validates the entire addressing setup and completes it as required

Types

This section is empty.

Jump to

Keyboard shortcuts

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