ipam

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AntreaIPAMType = "antrea"
)

Variables

This section is empty.

Functions

func AddIPAMResult added in v1.11.0

func AddIPAMResult(key string, result *IPAMResult)

func ExecIPAMCheck

func ExecIPAMCheck(cniArgs *cnipb.CniCmdArgs, k8sArgs *types.K8sArgs, ipamType string) error

func ExecIPAMDelete

func ExecIPAMDelete(cniArgs *cnipb.CniCmdArgs, k8sArgs *types.K8sArgs, ipamType string, resultKey string) error

func GarbageCollectContainerIPs added in v1.15.0

func GarbageCollectContainerIPs(network string, desiredIPs sets.Set[string]) error

GarbageCollectContainerIPs will release IPs allocated by the delegated IPAM plugin that are no longer in-use (if there is any). It should be called on an agent restart to provide garbage collection for IPs, and to avoid IP leakage in case of missed CNI DEL events. Normally, it is not Antrea's responsibility to implement this, as the above layers should ensure that there is always one successful CNI DEL for every corresponding CNI ADD. However, we include this support to increase robustness in case of a container runtime bug. Only the host-local plugin is supported.

func IsIPAMTypeValid

func IsIPAMTypeValid(ipamType string) bool

func RegisterIPAMDriver

func RegisterIPAMDriver(ipamType string, ipamDriver IPAMDriver)

func ResetIPAMDriver added in v1.11.0

func ResetIPAMDriver(ipamType string, driver IPAMDriver)

The following functions are only for testing.

func ResetIPAMDrivers added in v1.11.4

func ResetIPAMDrivers(ipamType string)

func ResetIPAMResults added in v1.15.0

func ResetIPAMResults()

func SecondaryNetworkAdd added in v1.7.0

func SecondaryNetworkAdd(cniArgs *cnipb.CniCmdArgs, k8sArgs *types.K8sArgs, networkConfig *types.NetworkConfig) (*current.Result, error)

Antrea IPAM for secondary network.

func SecondaryNetworkCheck added in v1.7.0

func SecondaryNetworkCheck(cniArgs *cnipb.CniCmdArgs, k8sArgs *types.K8sArgs, networkConfig *types.NetworkConfig) error

func SecondaryNetworkDel added in v1.7.0

func SecondaryNetworkDel(cniArgs *cnipb.CniCmdArgs, k8sArgs *types.K8sArgs, networkConfig *types.NetworkConfig) error

Types

type AntreaIPAM added in v1.4.0

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

Antrea IPAM driver would allocate IP addresses according to object IPAM annotation, if present. If annotation is not present, the driver will delegate functionality to traditional IPAM driver.

func GetSecondaryNetworkAllocator added in v1.15.0

func GetSecondaryNetworkAllocator() *AntreaIPAM

GetSecondaryNetworkAllocator returns the Antrea IPAM driver as the SecondaryNetworkIPAMAllocator implementation.

func (*AntreaIPAM) Add added in v1.4.0

func (d *AntreaIPAM) Add(args *invoke.Args, k8sArgs *types.K8sArgs, networkConfig []byte) (bool, *IPAMResult, error)

Add allocates the next available IP address from the associated IP Pool. The allocated IP and associated resource will be stored in the IP Pool status.

func (*AntreaIPAM) Check added in v1.4.0

func (d *AntreaIPAM) Check(args *invoke.Args, k8sArgs *types.K8sArgs, networkConfig []byte) (bool, error)

Check verifies the IP associated with the resource is tracked in the IP Pool status.

func (*AntreaIPAM) Del added in v1.4.0

func (d *AntreaIPAM) Del(args *invoke.Args, k8sArgs *types.K8sArgs, networkConfig []byte) (bool, error)

Del releases the IP associated with the resource from the IP Pool status.

func (*AntreaIPAM) SecondaryNetworkAllocate added in v1.15.0

func (d *AntreaIPAM) SecondaryNetworkAllocate(podOwner *crdv1a2.PodOwner, networkConfig *types.NetworkConfig) (*IPAMResult, error)

SecondaryNetworkAllocate allocates IP addresses for a Pod secondary network interface, based on the IPAM configuration of the passed CNI network configuration. It supports IPAM for both Antrea-managed secondary networks and Multus-managed secondary networks.

func (*AntreaIPAM) SecondaryNetworkRelease added in v1.15.0

func (d *AntreaIPAM) SecondaryNetworkRelease(owner *crdv1a2.PodOwner) error

SecondaryNetworkRelease releases the IP addresses allocated for a Pod secondary network interface.

type AntreaIPAMController added in v1.4.0

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

Antrea IPAM Controller maintains map of Namespace annotations using Namespace informer. In future, which Antrea IPAM support expands, this controller can be used to store annotations for other objects, such as Statefulsets.

func InitializeAntreaIPAMController added in v1.4.0

func InitializeAntreaIPAMController(crdClient clientsetversioned.Interface,
	namespaceInformer coreinformers.NamespaceInformer,
	ipPoolInformer crdinformers.IPPoolInformer,
	podInformer cache.SharedIndexInformer, ipamAnnotations bool) (*AntreaIPAMController, error)

func (*AntreaIPAMController) Run added in v1.4.0

func (c *AntreaIPAMController) Run(stopCh <-chan struct{})

Run starts to watch and process Namespace updates for the Node where Antrea Agent is running, and maintain a mapping between Namespace name and IPAM annotations.

type IPAMDelegator

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

func (*IPAMDelegator) Add

func (d *IPAMDelegator) Add(args *invoke.Args, k8sArgs *argtypes.K8sArgs, networkConfig []byte) (bool, *IPAMResult, error)

func (*IPAMDelegator) Check

func (d *IPAMDelegator) Check(args *invoke.Args, k8sArgs *argtypes.K8sArgs, networkConfig []byte) (bool, error)

func (*IPAMDelegator) Del

func (d *IPAMDelegator) Del(args *invoke.Args, k8sArgs *argtypes.K8sArgs, networkConfig []byte) (bool, error)

type IPAMDriver

type IPAMDriver interface {
	Add(args *invoke.Args, k8sArgs *types.K8sArgs, networkConfig []byte) (bool, *IPAMResult, error)
	Del(args *invoke.Args, k8sArgs *types.K8sArgs, networkConfig []byte) (bool, error)
	Check(args *invoke.Args, k8sArgs *types.K8sArgs, networkConfig []byte) (bool, error)
}

type IPAMResult added in v1.6.0

type IPAMResult struct {
	current.Result
	VLANID uint16
}

func ExecIPAMAdd

func ExecIPAMAdd(cniArgs *cnipb.CniCmdArgs, k8sArgs *types.K8sArgs, ipamType string, resultKey string) (*IPAMResult, error)

func GetIPFromCache

func GetIPFromCache(resultKey string) (*IPAMResult, bool)

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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