Documentation ¶
Overview ¶
Package eni implements AWS ENI allocation logic
Index ¶
- type InstancesManager
- func (m *InstancesManager) FindSubnetByTags(vpcID, availabilityZone string, required types.Tags) (bestSubnet *types.Subnet)
- func (m *InstancesManager) GetENI(instanceID string, index int) *v2.ENI
- func (m *InstancesManager) GetENIs(instanceID string) []*v2.ENI
- func (m *InstancesManager) GetSubnet(subnetID string) *types.Subnet
- func (m *InstancesManager) GetSubnets() types.SubnetMap
- func (m *InstancesManager) Resync() time.Time
- func (m *InstancesManager) UpdateENI(instanceID string, eni *v2.ENI)
- type Limits
- type Node
- type NodeManager
- func (n *NodeManager) Delete(nodeName string)
- func (n *NodeManager) Get(nodeName string) *Node
- func (n *NodeManager) GetNames() (allNodeNames []string)
- func (n *NodeManager) GetNodesByNeededAddresses() []*Node
- func (n *NodeManager) Resync(syncTime time.Time)
- func (n *NodeManager) Update(resource *v2.CiliumNode) bool
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.
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
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) Pool ¶
func (n *Node) Pool() (pool map[string]v2.AllocationIP)
Pool returns the IP allocation pool available to the node
func (*Node) ResolveIPDeficit ¶
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 ¶
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