node

package
v1.5.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoComplete added in v1.5.0

func AutoComplete() error

AutoComplete completes the parts of addressing that can be auto derived

func GetExternalIPv4 added in v1.5.0

func GetExternalIPv4() net.IP

GetExternalIPv4 returns the external IPv4 node address

func GetHostMasqueradeIPv4 added in v1.5.0

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 GetIPsecKeyIdentity added in v1.5.0

func GetIPsecKeyIdentity() uint8

GetIPsecKeyIdentity returns the IPsec key identity of the node

func GetIPv4AllocRange added in v1.5.0

func GetIPv4AllocRange() *cidr.CIDR

GetIPv4AllocRange returns the IPv4 allocation prefix of this node

func GetIPv4ClusterRange added in v1.5.0

func GetIPv4ClusterRange() *net.IPNet

GetIPv4ClusterRange returns the IPv4 prefix of the cluster

func GetIPv4Loopback added in v1.5.0

func GetIPv4Loopback() net.IP

GetIPv4Loopback returns the loopback IPv4 address of this node.

func GetIPv6 added in v1.5.0

func GetIPv6() net.IP

GetIPv6 returns the IPv6 address of the node

func GetIPv6AllocRange added in v1.5.0

func GetIPv6AllocRange() *cidr.CIDR

GetIPv6AllocRange returns the IPv6 allocation prefix of this node

func GetIPv6NodeRange added in v1.5.0

func GetIPv6NodeRange() *cidr.CIDR

GetIPv6NodeRange returns the IPv6 allocation prefix of this node

func GetIPv6Router added in v1.5.0

func GetIPv6Router() net.IP

GetIPv6Router returns the IPv6 address of the node

func GetInternalIPv4 added in v1.5.0

func GetInternalIPv4() net.IP

GetInternalIPv4 returns the internal IPv4 node address

func GetName added in v1.5.0

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 added in v1.5.0

func GetNodeAddressing() *models.NodeAddressing

GetNodeAddressing returns the NodeAddressing model for the local IPs.

func InitDefaultPrefix added in v1.5.0

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 IsHostIPv4 added in v1.5.0

func IsHostIPv4(ip net.IP) bool

IsHostIPv4 returns true if the IP specified is a host IP

func IsHostIPv6 added in v1.5.0

func IsHostIPv6(ip net.IP) bool

IsHostIPv6 returns true if the IP specified is a host IP

func SetExternalIPv4 added in v1.5.0

func SetExternalIPv4(ip net.IP)

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

func SetIPsecKeyIdentity added in v1.5.0

func SetIPsecKeyIdentity(id uint8)

SetIPsecKeyIdentity sets the IPsec key identity an opaque value used to identity encryption keys used on the node.

func SetIPv4AllocRange added in v1.5.0

func SetIPv4AllocRange(net *cidr.CIDR)

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

func SetIPv4ClusterCidrMaskSize added in v1.5.0

func SetIPv4ClusterCidrMaskSize(size int)

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

func SetIPv4Loopback added in v1.5.0

func SetIPv4Loopback(ip net.IP)

SetIPv4Loopback sets the loopback IPv4 address of this node.

func SetIPv6 added in v1.5.0

func SetIPv6(ip net.IP)

SetIPv6 sets the IPv6 address of the node

func SetIPv6NodeRange added in v1.5.0

func SetIPv6NodeRange(net *net.IPNet) error

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

func SetIPv6Router added in v1.5.0

func SetIPv6Router(ip net.IP)

SetIPv6Router returns the IPv6 address of the node

func SetInternalIPv4 added in v1.5.0

func SetInternalIPv4(ip net.IP)

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

func SetInternalIPv4From added in v1.5.0

func SetInternalIPv4From(ifaceName string) error

SetInternalIPv4From sets the internal IPv4 with the first global address found in that interface.

func SetName added in v1.5.0

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 added in v1.5.0

func Uninitialize()

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

func ValidatePostInit added in v1.5.0

func ValidatePostInit() error

ValidatePostInit validates the entire addressing setup and completes it as required

Types

type Address

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

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

+k8s:deepcopy-gen=true

func (*Address) DeepCopy added in v1.5.0

func (in *Address) DeepCopy() *Address

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Address.

func (*Address) DeepCopyInto added in v1.5.0

func (in *Address) DeepCopyInto(out *Address)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Identity

type Identity struct {
	Name    string
	Cluster string
}

Identity represents the node identity of a node.

func (Identity) String

func (nn Identity) String() string

String returns the string representation on NodeIdentity.

type Node

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 *cidr.CIDR

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

	// 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
}

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

+k8s:deepcopy-gen=true

func (*Node) DeepCopy added in v1.5.0

func (in *Node) DeepCopy() *Node

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node.

func (*Node) DeepCopyInto added in v1.5.0

func (in *Node) DeepCopyInto(out *Node)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Node) DeepKeyCopy added in v1.5.0

func (n *Node) DeepKeyCopy() store.LocalKey

DeepKeyCopy creates a deep copy of the LocalKey

func (*Node) Fullname added in v1.5.0

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) GetCiliumInternalIP added in v1.5.0

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

GetCiliumInternalIP returns the CiliumInternalIP e.g. the IP associated with cilium_host on the node.

func (*Node) GetKeyName added in v1.5.0

func (n *Node) GetKeyName() string

GetKeyName returns the kvstore key to be used for the node

func (*Node) GetModel added in v1.5.0

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

GetModel returns the API model representation of a node.

func (*Node) GetNodeIP

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 added in v1.5.0

func (n *Node) Identity() Identity

Identity returns the identity of the node

func (*Node) IsLocal added in v1.5.0

func (n *Node) IsLocal() bool

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

func (*Node) Marshal added in v1.5.0

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

Marshal returns the node object as JSON byte slice

func (*Node) PublicAttrEquals added in v1.5.0

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 added in v1.5.0

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

Unmarshal parses the JSON byte slice and updates the node receiver

type Source added in v1.5.0

type Source string

Source is the description of the source of an identity

const (
	// 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"

	// FromLocalNode is the source used for the local node
	FromLocalNode Source = "local-node"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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