cilium: Index | Files | Directories

package node

import ""

Package node provides functionality related to the local and remote node addresses


Package Files

datapath.go doc.go local_node.go logfields.go manager.go node.go node_address.go node_address_linux.go nodename.go


const (
    // TunnelRoute is the route type to set up the BPF tunnel maps
    TunnelRoute RouteType = 1 << iota
    // DirectRoute is the route type to set up the L3 route using iproute

    // FromKubernetes is the source used for identities derived from k8s
    // resources (pods)
    FromKubernetes Source = "k8s"

    // FromKVStore is the source used for identities derived from the
    // kvstore
    FromKVStore Source = "kvstore"

    // FromAgentLocal is the source used for identities derived during the
    // agent bootup process. This includes identities for endpoint IPs.
    FromAgentLocal Source = "agent-local"

func AddAuxPrefix Uses

func AddAuxPrefix(prefix *net.IPNet)

AddAuxPrefix adds additional prefixes for which routes should be installed that point to the Cilium network. This function does not directly install the route but schedules it for addition by InstallHostRoutes

func AutoComplete Uses

func AutoComplete() error

AutoComplete completes the parts of addressing that can be auto derived

func ConfigureLocalNode Uses

func ConfigureLocalNode() error

ConfigureLocalNode configures the local node. This is called on agent startup to configure the local node based on the configuration options passed to the agent

func DeleteAllNodes Uses

func DeleteAllNodes()

DeleteAllNodes deletes all nodes from the node maanger.

func DeleteNode Uses

func DeleteNode(ni Identity, routesTypes RouteType)

DeleteNode remove the node from the nodes' maps and / or the L3 routes to reach that node.

func GetExternalIPv4 Uses

func GetExternalIPv4() net.IP

GetExternalIPv4 returns the external IPv4 node address

func GetHostMasqueradeIPv4 Uses

func GetHostMasqueradeIPv4() net.IP

GetHostMasqueradeIPv4 returns the IPv4 address to be used for masquerading any traffic that is being forwarded from the host into the Cilium cluster.

func GetIPv4AllocRange Uses

func GetIPv4AllocRange() *net.IPNet

GetIPv4AllocRange returns the IPv4 allocation prefix of this node

func GetIPv4ClusterRange Uses

func GetIPv4ClusterRange() *net.IPNet

GetIPv4ClusterRange returns the IPv4 prefix of the cluster

func GetIPv4HealthIP Uses

func GetIPv4HealthIP() net.IP

GetIPv4HealthIP returns the IPv4 address of the local cilium-health endpoint

func GetIPv4Loopback Uses

func GetIPv4Loopback() net.IP

GetIPv4Loopback returns the loopback IPv4 address of this node.

func GetIPv4NodeRoute Uses

func GetIPv4NodeRoute() net.IPNet

GetIPv4NodeRoute returns a route pointing to the IPv4 node address

func GetIPv6 Uses

func GetIPv6() net.IP

GetIPv6 returns the IPv6 address of the node

func GetIPv6AllocRange Uses

func GetIPv6AllocRange() *net.IPNet

GetIPv6AllocRange returns the IPv6 allocation prefix of this node

func GetIPv6HealthIP Uses

func GetIPv6HealthIP() net.IP

GetIPv6HealthIP returns the IPv6 address of the local cilium-health endpoint

func GetIPv6NodeRange Uses

func GetIPv6NodeRange() *net.IPNet

GetIPv6NodeRange returns the IPv6 allocation prefix of this node

func GetIPv6NodeRoute Uses

func GetIPv6NodeRoute() net.IPNet

GetIPv6NodeRoute returns a route pointing to the IPv6 node address

func GetIPv6Router Uses

func GetIPv6Router() net.IP

GetIPv6Router returns the IPv6 address of the node

func GetInternalIPv4 Uses

func GetInternalIPv4() net.IP

GetInternalIPv4 returns the internal IPv4 node address

func GetName Uses

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 GetNodeAddressing Uses

func GetNodeAddressing(enableIPv4 bool) *models.NodeAddressing

GetNodeAddressing returns the NodeAddressing model for the local IPs.

func GetNodes Uses

func GetNodes() map[Identity]Node

GetNodes returns a copy of all of the nodes as a map from Identity to Node.

func InitDefaultPrefix Uses

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 InstallHostRoutes Uses

func InstallHostRoutes()

InstallHostRoutes installs all required routes to make the following IP spaces available from the local host:

- node CIDR of local and remote nodes
- service CIDR range

This may only be called after the defaults.HostDevice interface has been initialized for the first time

func IsHostIPv4 Uses

func IsHostIPv4(ip net.IP) bool

IsHostIPv4 returns true if the IP specified is a host IP

func IsHostIPv6 Uses

func IsHostIPv6(ip net.IP) bool

IsHostIPv6 returns true if the IP specified is a host IP

func NotifyLocalNodeUpdated Uses

func NotifyLocalNodeUpdated()

NotifyLocalNodeUpdated Update local node information in the key-value storage

func SetExternalIPv4 Uses

func SetExternalIPv4(ip net.IP)

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

func SetIPv4AllocRange Uses

func SetIPv4AllocRange(net *net.IPNet)

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

func SetIPv4ClusterCidrMaskSize Uses

func SetIPv4ClusterCidrMaskSize(size int)

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

func SetIPv4HealthIP Uses

func SetIPv4HealthIP(ip net.IP) error

SetIPv4HealthIP sets the IPv4 address of the local cilium-health endpoint

func SetIPv4Loopback Uses

func SetIPv4Loopback(ip net.IP)

SetIPv4Loopback sets the loopback IPv4 address of this node.

func SetIPv6 Uses

func SetIPv6(ip net.IP)

SetIPv6 sets the IPv6 address of the node

func SetIPv6HealthIP Uses

func SetIPv6HealthIP(ip net.IP) error

SetIPv6HealthIP sets the IPv6 address of the local cilium-health endpoint

func SetIPv6NodeRange Uses

func SetIPv6NodeRange(net *net.IPNet) error

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

func SetIPv6Router Uses

func SetIPv6Router(ip net.IP)

SetIPv6Router returns the IPv6 address of the node

func SetInternalIPv4 Uses

func SetInternalIPv4(ip net.IP)

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

func SetName Uses

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 Uninitialize Uses

func Uninitialize()

Uninitialize resets this package to the default state, for use in testsuite code.

func UpdateNode Uses

func UpdateNode(n *Node, routesTypes RouteType, ownAddr net.IP)

UpdateNode updates the new node in the nodes' map with the given identity. When using DirectRoute RouteType the field ownAddr should contain the IPv6 address of the interface that can reach the other nodes.

func UseNodeAddresses Uses

func UseNodeAddresses(node *Node) error

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

func UseNodeCIDR Uses

func UseNodeCIDR(node *Node) error

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

func ValidatePostInit Uses

func ValidatePostInit() error

ValidatePostInit validates the entire addressing setup and completes it as required

type Address Uses

type Address struct {
    Type addressing.AddressType
    IP   net.IP

Address is a node address which contains an IP and the address type.

type Identity Uses

type Identity struct {
    Name    string
    Cluster string

Identity represents the node identity of a node.

func (Identity) String Uses

func (nn Identity) String() string

String returns the string representation on NodeIdentity.

type Node Uses

type Node struct {
    // Name is the name of the node. This is typically the hostname of the node.
    Name string

    // Cluster is the name of the cluster the node is associated with
    Cluster string

    IPAddresses []Address

    // IPv4AllocCIDR if set, is the IPv4 address pool out of which the node
    // allocates IPs for local endpoints from
    IPv4AllocCIDR *net.IPNet

    // IPv6AllocCIDR if set, is the IPv6 address pool out of which the node
    // allocates IPs for local endpoints from
    IPv6AllocCIDR *net.IPNet

    // IPv4HealthIP if not nil, this is the IPv4 address of the
    // cilium-health endpoint located on the node.
    IPv4HealthIP net.IP

    // IPv6HealthIP if not nil, this is the IPv6 address of the
    // cilium-health endpoint located on the node.
    IPv6HealthIP net.IP

    // ClusterID is the unique identifier of the cluster
    ClusterID int

    // Source is the source where the node configuration was generated / created.
    Source Source
    // contains filtered or unexported fields

Node contains the nodes name, the list of addresses to this address

func GetLocalNode Uses

func GetLocalNode() *Node

GetLocalNode returns the identity and node spec for the local node

func (*Node) Fullname Uses

func (n *Node) Fullname() string

Fullname returns the node's full name including the cluster name if a cluster name value other than the default value has been specified

func (*Node) GetKeyName Uses

func (n *Node) GetKeyName() string

GetKeyName returns the kvstore key to be used for the node

func (*Node) GetModel Uses

func (n *Node) GetModel(ipv4 bool) *models.NodeElement

GetModel returns the API model representation of a node.

func (*Node) GetNodeIP Uses

func (n *Node) GetNodeIP(ipv6 bool) net.IP

GetNodeIP returns one of the node's IP addresses available with the following priority: - NodeInternalIP - NodeExternalIP - other IP address type

func (*Node) Identity Uses

func (n *Node) Identity() Identity

Identity returns the identity of the node

func (*Node) IsLocal Uses

func (n *Node) IsLocal() bool

IsLocal returns true if this is the node on which the agent itself is running on

func (*Node) Marshal Uses

func (n *Node) Marshal() ([]byte, error)

Marshal returns the node object as JSON byte slice

func (*Node) OnDelete Uses

func (n *Node) OnDelete()

OnDelete is called when a node has been deleted from the cluster

func (*Node) OnUpdate Uses

func (n *Node) OnUpdate()

OnUpdate is called each time the node information is updated

Updates the new node in the nodes' map with the given identity. This also updates the local routing tables and tunnel lookup maps according to the node's preferred way of being reached.

func (*Node) PublicAttrEquals Uses

func (n *Node) PublicAttrEquals(o *Node) bool

PublicAttrEquals returns true only if the public attributes of both nodes are the same otherwise returns false.

func (*Node) Unmarshal Uses

func (n *Node) Unmarshal(data []byte) error

Unmarshal parses the JSON byte slice and updates the node receiver

type NodeRegistrar Uses

type NodeRegistrar interface {
    RegisterNode(n *Node) error
    UpdateLocalKeySync(n *Node) error

NodeRegistrar is an interface which allows for propagating information about nodes to remote stores.

var (

    // NodeReg is responsible for registering nodes with a remote store.
    NodeReg NodeRegistrar

type RouteType Uses

type RouteType int

RouteType represents the route type to be configured when adding the node routes

type Source Uses

type Source string

Source is the description of the source of an identity

type TunnelEndpointOwner Uses

type TunnelEndpointOwner interface {
    DeleteTunnelEndpoint(prefix net.IP) error
    SetTunnelEndpoint(prefix net.IP, endpoint net.IP) error

TunnelEndpointOwner configures connectivity for a range of IP addresses (specified by prefix) via a tunnel to a specified remote tunnel endpoint address (node IP).

var (
    // TunnelDatapath is the object which manages the datapath for tunnels.
    TunnelDatapath TunnelEndpointOwner



Package node imports 26 packages (graph) and is imported by 16 packages. Updated 2018-12-14. Refresh now. Tools for package owners.