Documentation ¶
Overview ¶
Package nodeaddress provides functionality relate to the node's address where a cilium agent is running on
Index ¶
- Constants
- Variables
- func AutoComplete() error
- func GetExternalIPv4() net.IP
- func GetIPv4AllocRange() *net.IPNet
- func GetIPv4ClusterRange() *net.IPNet
- func GetIPv4NodeRoute() net.IPNet
- func GetIPv6() net.IP
- func GetIPv6AllocRange() *net.IPNet
- func GetIPv6ClusterRange() *net.IPNet
- func GetIPv6NoZeroComp() string
- func GetIPv6NodeRange() *net.IPNet
- func GetIPv6NodeRoute() net.IPNet
- func GetIPv6Router() net.IP
- func GetInternalIPv4() net.IP
- func GetName() string
- func GetNode() (node.Identity, *node.Node)
- func InitDefaultPrefix(device string)
- func SetExternalIPv4(ip net.IP)
- func SetIPv4AllocRange(net *net.IPNet)
- func SetIPv4ClusterCidrMaskSize(size int)
- func SetIPv6(ip net.IP)
- func SetIPv6NodeRange(net *net.IPNet) error
- func SetIPv6Router(ip net.IP)
- func SetInternalIPv4(ip net.IP)
- func SetName(name string)
- func UseNodeAddresses(node *node.Node) error
- func UseNodeCIDR(node *node.Node) error
- func ValidatePostInit() error
Constants ¶
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 ¶
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)} )
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 ¶
GetExternalIPv4 returns the external IPv4 node address
func GetIPv4AllocRange ¶
GetIPv4AllocRange returns the IPv4 allocation prefix of this node
func GetIPv4ClusterRange ¶
GetIPv4ClusterRange returns the IPv4 prefix of the cluster
func GetIPv4NodeRoute ¶
GetIPv4NodeRoute returns a route pointing to the IPv4 node address
func GetIPv6AllocRange ¶
GetIPv6AllocRange returns the IPv6 allocation prefix of this node
func GetIPv6ClusterRange ¶
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 ¶
GetIPv6NodeRange returns the IPv6 allocation prefix of this node
func GetIPv6NodeRoute ¶
GetIPv6NodeRoute returns a route pointing to the IPv6 node address
func GetInternalIPv4 ¶
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 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 ¶
SetExternalIPv4 sets the external IPv4 node address. It must be reachable on the network.
func SetIPv4AllocRange ¶
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 SetIPv6NodeRange ¶
SetIPv6NodeRange sets the IPv6 address pool to be used on this node
func SetIPv6Router ¶
SetIPv6Router returns the IPv6 address of the node
func SetInternalIPv4 ¶
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 ¶
UseNodeAddresses sets the local ipv4-node and ipv6-node values from the addresses defined in the given node.
func UseNodeCIDR ¶
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.