eni

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package eni implements AWS ENI allocation logic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstancesManager

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

InstancesManager maintains the list of instances. It must be kept up to date by calling resync() regularly.

func NewInstancesManager

func NewInstancesManager(api instanceAPI, metricsAPI metricsAPI) *InstancesManager

NewInstancesManager returns a new instances manager

func (*InstancesManager) FindSubnetByTags

func (m *InstancesManager) FindSubnetByTags(vpcID, availabilityZone string, required types.Tags) (bestSubnet *types.Subnet)

FindSubnetByTags returns the subnet with the most addresses matching VPC ID, availability zone and all required tags

The returned subnet is immutable so it can be safely accessed

func (*InstancesManager) GetENI

func (m *InstancesManager) GetENI(instanceID string, index int) *v2.ENI

GetENI returns the ENI of an instance at a particular interface index

func (*InstancesManager) GetENIs

func (m *InstancesManager) GetENIs(instanceID string) []*v2.ENI

GetENIs returns the list of ENIs associated with a particular instance

func (*InstancesManager) GetSubnet

func (m *InstancesManager) GetSubnet(subnetID string) *types.Subnet

GetSubnet returns the subnet by subnet ID

The returned subnet is immutable so it can be safely accessed

func (*InstancesManager) GetSubnets

func (m *InstancesManager) GetSubnets() types.SubnetMap

GetSubnets returns all the tracked subnets

The returned subnetMap is immutable so it can be safely accessed

func (*InstancesManager) Resync

func (m *InstancesManager) Resync() time.Time

Resync fetches the list of EC2 instances and subnets and updates the local cache in the instanceManager. It returns the time when the resync has started or time.Time{} if it did not complete.

func (*InstancesManager) UpdateENI

func (m *InstancesManager) UpdateENI(instanceID string, eni *v2.ENI)

UpdateENI updates the ENI definition of an ENI for a particular instance. If the ENI is already known, the definition is updated, otherwise the ENI is added to the instance.

type Limits

type Limits struct {
	// Adapters specifies the maximum number of ENIs that can be attached
	// to the instance
	Adapters int

	// IPv4 is the maximum number of IPv4 addresses per ENI
	IPv4 int

	// IPv6 is the maximum number of IPv6 addresses per ENI
	IPv6 int
}

Limits specifies the ENI relevant instance limits

func GetLimits

func GetLimits(instanceType string) (limit Limits, ok bool)

GetLimits returns the instance limits of a particular instance type

type Node

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

Node represents a Kubernetes node running Cilium with an associated CiliumNode custom resource

func (*Node) ENIs

func (n *Node) ENIs() (enis map[string]v2.ENI)

ENIs returns a copy of all ENIs attached to the node

func (*Node) Pool

func (n *Node) Pool() (pool map[string]v2.AllocationIP)

Pool returns the IP allocation pool available to the node

func (*Node) ResolveIPDeficit

func (n *Node) ResolveIPDeficit() error

ResolveIPDeficit attempts to allocate all required IPs to fulfill the needed gap n.neededAddresses. If required, ENIs are created.

func (*Node) ResourceCopy

func (n *Node) ResourceCopy() *v2.CiliumNode

ResourceCopy returns a deep copy of the CiliumNode custom resource associated with the node

func (*Node) SyncToAPIServer

func (n *Node) SyncToAPIServer() (err error)

SyncToAPIServer is called to synchronize the node content with the custom resource in the apiserver

type NodeManager

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

NodeManager manages all nodes with ENIs

func NewNodeManager

func NewNodeManager(instancesAPI nodeManagerAPI, ec2API ec2API, k8sAPI k8sAPI, metrics metricsAPI, parallelWorkers int64) (*NodeManager, error)

NewNodeManager returns a new NodeManager

func (*NodeManager) Delete

func (n *NodeManager) Delete(nodeName string)

Delete is called after a CiliumNode resource has been deleted via the Kubernetes apiserver

func (*NodeManager) Get

func (n *NodeManager) Get(nodeName string) *Node

Get returns the node with the given name

func (*NodeManager) GetNames

func (n *NodeManager) GetNames() (allNodeNames []string)

GetNames returns the list of all node names

func (*NodeManager) GetNodesByNeededAddresses

func (n *NodeManager) GetNodesByNeededAddresses() []*Node

GetNodesByNeededAddresses returns all nodes that require addresses to be allocated, sorted by the number of addresses needed in descending order

func (*NodeManager) Resync

func (n *NodeManager) Resync(syncTime time.Time)

Resync will attend all nodes and resolves IP deficits. The order of attendance is defined by the number of IPs needed to reach the configured watermarks. Any updates to the node resource are synchronized to the Kubernetes apiserver.

func (*NodeManager) Update

func (n *NodeManager) Update(resource *v2.CiliumNode) bool

Update is called whenever a CiliumNode resource has been updated in the Kubernetes apiserver

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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