ipam

package
v1.18.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package ipam implements Azure IPAM logic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureAPI

type AzureAPI interface {
	GetInstance(ctx context.Context, subnets ipamTypes.SubnetMap, instanceID string) (*ipamTypes.Instance, error)
	GetInstances(ctx context.Context, subnets ipamTypes.SubnetMap) (*ipamTypes.InstanceMap, error)
	GetVpcsAndSubnets(ctx context.Context) (ipamTypes.VirtualNetworkMap, ipamTypes.SubnetMap, error)
	AssignPrivateIpAddressesVM(ctx context.Context, subnetID, interfaceName string, addresses int) error
	AssignPrivateIpAddressesVMSS(ctx context.Context, instanceID, vmssName, subnetID, interfaceName string, addresses int) error
}

AzureAPI is the API surface used of the Azure API

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(logger logging.FieldLogger, api AzureAPI) *InstancesManager

NewInstancesManager returns a new instances manager

func (*InstancesManager) CreateNode

func (m *InstancesManager) CreateNode(obj *v2.CiliumNode, n *ipam.Node) ipam.NodeOperations

CreateNode is called on discovery of a new node

func (*InstancesManager) DeleteInstance

func (m *InstancesManager) DeleteInstance(instanceID string)

DeleteInstance delete instance from m.instances

func (*InstancesManager) GetPoolQuota

func (m *InstancesManager) GetPoolQuota() (quota ipamTypes.PoolQuotaMap)

GetPoolQuota returns the number of available IPs in all IP pools

func (*InstancesManager) HasInstance

func (m *InstancesManager) HasInstance(instanceID string) bool

HasInstance returns whether the instance is in instances

func (*InstancesManager) InstanceSync

func (m *InstancesManager) InstanceSync(ctx context.Context, instanceID string) time.Time

func (*InstancesManager) Resync

func (m *InstancesManager) Resync(ctx context.Context) time.Time

Resync fetches the list of 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 Node

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

Node represents a node representing an Azure instance

func (*Node) AllocateIPs

func (n *Node) AllocateIPs(ctx context.Context, a *ipam.AllocationAction) error

AllocateIPs performs the Azure IP allocation operation

func (*Node) AllocateStaticIP added in v1.17.0

func (n *Node) AllocateStaticIP(ctx context.Context, staticIPTags ipamTypes.Tags) (string, error)

func (*Node) CreateInterface

func (n *Node) CreateInterface(ctx context.Context, allocation *ipam.AllocationAction, scopedLog *slog.Logger) (int, string, error)

CreateInterface is called to create a new interface. This operation is currently not supported on Azure.

func (*Node) GetMaximumAllocatableIPv4

func (n *Node) GetMaximumAllocatableIPv4() int

GetMaximumAllocatableIPv4 returns the maximum amount of IPv4 addresses that can be allocated to the instance

func (*Node) GetMinimumAllocatableIPv4

func (n *Node) GetMinimumAllocatableIPv4() int

GetMinimumAllocatableIPv4 returns the minimum amount of IPv4 addresses that must be allocated to the instance.

func (*Node) GetUsedIPWithPrefixes

func (n *Node) GetUsedIPWithPrefixes() int

func (*Node) IsPrefixDelegated

func (n *Node) IsPrefixDelegated() bool

func (*Node) PopulateStatusFields

func (n *Node) PopulateStatusFields(k8sObj *v2.CiliumNode)

PopulateStatusFields fills in the status field of the CiliumNode custom resource with Azure specific information

func (*Node) PrepareIPAllocation

func (n *Node) PrepareIPAllocation(scopedLog *slog.Logger) (a *ipam.AllocationAction, err error)

PrepareIPAllocation returns the number of IPs that can be allocated/created.

func (*Node) PrepareIPRelease

func (n *Node) PrepareIPRelease(excessIPs int, scopedLog *slog.Logger) *ipam.ReleaseAction

PrepareIPRelease prepares the release of IPs

func (*Node) ReleaseIPs

func (n *Node) ReleaseIPs(ctx context.Context, r *ipam.ReleaseAction) error

ReleaseIPs performs the IP release operation

func (*Node) ResyncInterfacesAndIPs

func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *slog.Logger) (
	available ipamTypes.AllocationMap,
	stats stats.InterfaceStats,
	err error)

ResyncInterfacesAndIPs is called to retrieve interfaces and IPs known to the Azure API and return them

func (*Node) UpdatedNode

func (n *Node) UpdatedNode(obj *v2.CiliumNode)

UpdatedNode is called when an update to the CiliumNode is received.

Jump to

Keyboard shortcuts

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