eni

package
v1.6.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 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 InstanceMap

type InstanceMap map[string]*instance

InstanceMap is the list of all instances indexed by instance ID

func (InstanceMap) Add

func (m InstanceMap) Add(instanceID string, eni *v2.ENI)

Add adds an instance definition to the instance map. instanceMap may not be subject to concurrent access while add() is used.

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) Resync

func (m *InstancesManager) Resync()

Resync fetches the list of EC2 instances and subnets and updates the local cache in the instanceManager

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()

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

type SubnetMap

type SubnetMap map[string]*types.Subnet

SubnetMap indexes AWS subnets by subnet ID

type VpcMap

type VpcMap map[string]*types.Vpc

VpcMap indexes AWS VPCs by VPC ID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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