calico

package
v3.29.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalicoClientStub

type CalicoClientStub struct {
	IPPoolsStub *IPPoolsStub
	IPAMStub    *IpamInterfaceStub
	NodesMock   *NodesMock
}

CalicoClientStub is stub implementation of clientv3.Interface. It is used for communication with other Calico parts.

func NewCalicoClientStub

func NewCalicoClientStub() *CalicoClientStub

NewCalicoClientStub creates new CalicoClientStub instance

func (*CalicoClientStub) BGPConfigurations

func (cc *CalicoClientStub) BGPConfigurations() clientv3.BGPConfigurationInterface

BGPConfigurations returns an interface for managing the BGP configuration resources.

func (*CalicoClientStub) BGPFilter added in v3.26.0

func (*CalicoClientStub) BGPPeers

BGPPeers returns an interface for managing BGP peer resources.

func (*CalicoClientStub) BlockAffinities added in v3.25.1

func (cc *CalicoClientStub) BlockAffinities() clientv3.BlockAffinityInterface

BlockAffinities returns an interface for viewing IPAM block affinity resources.

func (*CalicoClientStub) CalicoNodeStatus

func (cc *CalicoClientStub) CalicoNodeStatus() clientv3.CalicoNodeStatusInterface

CalicoNodeStatus returns an interface for managing CalicoNodeStatus resources.

func (*CalicoClientStub) ClusterInformation

func (cc *CalicoClientStub) ClusterInformation() clientv3.ClusterInformationInterface

ClusterInformation returns an interface for managing the cluster information resource.

func (*CalicoClientStub) EnsureInitialized

func (cc *CalicoClientStub) EnsureInitialized(ctx context.Context, calicoVersion, clusterType string) error

EnsureInitialized is used to ensure the backend datastore is correctly initialized for use by Calico. This method may be called multiple times, and will have no effect if the datastore is already correctly initialized. Most Calico deployment scenarios will automatically implicitly invoke this method and so a general consumer of this API can assume that the datastore is already initialized.

func (*CalicoClientStub) FelixConfigurations

func (cc *CalicoClientStub) FelixConfigurations() clientv3.FelixConfigurationInterface

FelixConfigurations returns an interface for managing the Felix configuration resources.

func (*CalicoClientStub) GlobalNetworkPolicies

func (cc *CalicoClientStub) GlobalNetworkPolicies() clientv3.GlobalNetworkPolicyInterface

GlobalNetworkPolicies returns an interface for managing global network policy resources.

func (*CalicoClientStub) GlobalNetworkSets

func (cc *CalicoClientStub) GlobalNetworkSets() clientv3.GlobalNetworkSetInterface

GlobalNetworkSets returns an interface for managing global network sets resources.

func (*CalicoClientStub) HostEndpoints

func (cc *CalicoClientStub) HostEndpoints() clientv3.HostEndpointInterface

HostEndpoints returns an interface for managing host endpoint resources.

func (*CalicoClientStub) IPAM

func (cc *CalicoClientStub) IPAM() ipam.Interface

IPAM returns an interface for managing IP address assignment and releasing.

func (*CalicoClientStub) IPAMConfig added in v3.25.1

IPAMConfig returns an interface for managing IPAMConfig resources.

func (*CalicoClientStub) IPPools

IPPools returns an interface for managing IP pool resources.

func (*CalicoClientStub) IPReservations

func (cc *CalicoClientStub) IPReservations() clientv3.IPReservationInterface

IPReservations returns an interface for managing IP reservation resources.

func (*CalicoClientStub) KubeControllersConfiguration

func (cc *CalicoClientStub) KubeControllersConfiguration() clientv3.KubeControllersConfigurationInterface

KubeControllersConfiguration returns an interface for managing the KubeControllersConfiguration resource.

func (*CalicoClientStub) NetworkPolicies

func (cc *CalicoClientStub) NetworkPolicies() clientv3.NetworkPolicyInterface

NetworkPolicies returns an interface for managing namespaced network policy resources.

func (*CalicoClientStub) NetworkSets

func (cc *CalicoClientStub) NetworkSets() clientv3.NetworkSetInterface

NetworkSets returns an interface for managing network sets resources.

func (*CalicoClientStub) Nodes

Nodes returns an interface for managing node resources.

func (*CalicoClientStub) Profiles

Profiles returns an interface for managing profile resources.

func (*CalicoClientStub) Tiers added in v3.29.0

func (*CalicoClientStub) WorkloadEndpoints

func (cc *CalicoClientStub) WorkloadEndpoints() clientv3.WorkloadEndpointInterface

WorkloadEndpoints returns an interface for managing workload endpoint resources.

type IPPoolsStub

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

IPPoolsStub is stub implementation of clientv3.IPPoolInterface. It is used for managing IPPool resources.

func NewIPPoolsStub

func NewIPPoolsStub() *IPPoolsStub

NewIPPoolsStub creates new IPPoolsStub instance

func (*IPPoolsStub) Create

func (pools *IPPoolsStub) Create(ctx context.Context, res *apiv3.IPPool, opts options.SetOptions) (*apiv3.IPPool, error)

func (*IPPoolsStub) Delete

func (pools *IPPoolsStub) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv3.IPPool, error)

func (*IPPoolsStub) Get

func (pools *IPPoolsStub) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv3.IPPool, error)

func (*IPPoolsStub) List

func (pools *IPPoolsStub) List(ctx context.Context, opts options.ListOptions) (*apiv3.IPPoolList, error)

func (*IPPoolsStub) UnsafeCreate added in v3.25.1

func (pools *IPPoolsStub) UnsafeCreate(ctx context.Context, res *apiv3.IPPool, opts options.SetOptions) (*apiv3.IPPool, error)

func (*IPPoolsStub) UnsafeDelete added in v3.25.1

func (pools *IPPoolsStub) UnsafeDelete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv3.IPPool, error)

func (*IPPoolsStub) Update

func (pools *IPPoolsStub) Update(ctx context.Context, res *apiv3.IPPool, opts options.SetOptions) (*apiv3.IPPool, error)

func (*IPPoolsStub) Watch

func (pools *IPPoolsStub) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error)

type IpamInterfaceStub

type IpamInterfaceStub struct {
	// AssignedIPCounter holds the count of all assigned IP addresses. It is used in simplified assigning
	// of new IP addresses.
	AssignedIPCounter int
}

IpamInterfaceStub is stub implementation of ipam.Interface. It is used for IP address management.

func NewIpamInterfaceStub

func NewIpamInterfaceStub() *IpamInterfaceStub

NewIpamInterfaceStub creates new IpamInterfaceStub instance

func (*IpamInterfaceStub) AssignIP

func (iis *IpamInterfaceStub) AssignIP(ctx context.Context, args ipam.AssignIPArgs) error

AssignIP assigns the provided IP address to the provided host. The IP address must fall within a configured pool. AssignIP will claim block affinity as needed in order to satisfy the assignment. An error will be returned if the IP address is already assigned, or if StrictAffinity is enabled and the address is within a block that does not have affinity for the given host.

func (*IpamInterfaceStub) AutoAssign

AutoAssign automatically assigns one or more IP addresses as specified by the provided AutoAssignArgs. AutoAssign returns the list of the assigned IPv4 addresses, and the list of the assigned IPv6 addresses in IPNet format. The returned IPNet represents the allocation block from which the IP was allocated, which is useful for dataplanes that need to know the subnet (such as Windows).

In case of error, returns the IPs allocated so far along with the error.

func (*IpamInterfaceStub) ClaimAffinity

func (iis *IpamInterfaceStub) ClaimAffinity(ctx context.Context, cidr cnet.IPNet, host string) ([]cnet.IPNet,
	[]cnet.IPNet, error)

ClaimAffinity claims affinity to the given host for all blocks within the given CIDR. The given CIDR must fall within a configured pool. If an empty string is passed as the host, then the value returned by os.Hostname is used.

func (*IpamInterfaceStub) EnsureBlock

func (iis *IpamInterfaceStub) EnsureBlock(ctx context.Context, args ipam.BlockArgs) (*cnet.IPNet, *cnet.IPNet, error)

EnsureBlock returns single IPv4/IPv6 IPAM block for a host as specified by the provided BlockArgs. If there is no block allocated already for this host, allocate one and return its' CIDR. Otherwise, return the CIDR of the IPAM block allocated for this host. It returns IPv4, IPv6 block CIDR and any error encountered.

func (*IpamInterfaceStub) GetAssignmentAttributes

func (iis *IpamInterfaceStub) GetAssignmentAttributes(ctx context.Context, addr cnet.IP) (map[string]string,
	*string, error)

GetAssignmentAttributes returns the attributes stored with the given IP address upon assignment, as well as the handle used for assignment (if any).

func (*IpamInterfaceStub) GetIPAMConfig

func (iis *IpamInterfaceStub) GetIPAMConfig(ctx context.Context) (*ipam.IPAMConfig, error)

GetIPAMConfig returns the global IPAM configuration. If no IPAM configuration has been set, returns a default configuration with StrictAffinity disabled and AutoAllocateBlocks enabled.

func (*IpamInterfaceStub) GetUtilization

func (iis *IpamInterfaceStub) GetUtilization(ctx context.Context, args ipam.GetUtilizationArgs) (
	[]*ipam.PoolUtilization, error)

GetUtilization returns IP utilization info for the specified pools, or for all pools.

func (*IpamInterfaceStub) IPsByHandle

func (iis *IpamInterfaceStub) IPsByHandle(ctx context.Context, handleID string) ([]cnet.IP, error)

IPsByHandle returns a list of all IP addresses that have been assigned using the provided handle.

func (*IpamInterfaceStub) ReleaseAffinity

func (iis *IpamInterfaceStub) ReleaseAffinity(ctx context.Context, cidr cnet.IPNet, host string,
	mustBeEmpty bool) error

ReleaseAffinity releases affinity for all blocks within the given CIDR on the given host. If an empty string is passed as the host, then the value returned by os.Hostname will be used. If mustBeEmpty is true, then an error will be returned if any blocks within the CIDR are not empty - in this case, this function may release some but not all blocks within the given CIDR.

func (*IpamInterfaceStub) ReleaseBlockAffinity

func (iis *IpamInterfaceStub) ReleaseBlockAffinity(ctx context.Context, block *model.AllocationBlock,
	mustBeEmpty bool) error

ReleaseBlockAffinity releases the affinity of the exact block provided.

func (*IpamInterfaceStub) ReleaseByHandle

func (iis *IpamInterfaceStub) ReleaseByHandle(ctx context.Context, handleID string) error

ReleaseByHandle releases all IP addresses that have been assigned using the provided handle. Returns an error if no addresses are assigned with the given handle.

func (*IpamInterfaceStub) ReleaseHostAffinities

func (iis *IpamInterfaceStub) ReleaseHostAffinities(ctx context.Context, host string, mustBeEmpty bool) error

ReleaseHostAffinities releases affinity for all blocks that are affine to the given host. If an empty string is passed as the host, the value returned by os.Hostname will be used. If mustBeEmpty is true, then an error will be returned if any blocks within the CIDR are not empty - in this case, this function may release some but not all blocks attached to this host.

func (*IpamInterfaceStub) ReleaseIPs

func (iis *IpamInterfaceStub) ReleaseIPs(ctx context.Context, ips ...ipam.ReleaseOptions) ([]cnet.IP, error)

ReleaseIPs releases any of the given IP addresses that are currently assigned, so that they are available to be used in another assignment.

func (*IpamInterfaceStub) ReleasePoolAffinities

func (iis *IpamInterfaceStub) ReleasePoolAffinities(ctx context.Context, pool cnet.IPNet) error

ReleasePoolAffinities releases affinity for all blocks within the specified pool across all hosts.

func (*IpamInterfaceStub) RemoveIPAMHost

func (iis *IpamInterfaceStub) RemoveIPAMHost(ctx context.Context, host string) error

RemoveIPAMHost releases affinity for all blocks on the given host, and removes all host-specific IPAM data from the datastore. RemoveIPAMHost does not release any IP addresses claimed on the given host. If an empty string is passed as the host then the value returned by os.Hostname is used.

func (*IpamInterfaceStub) SetIPAMConfig

func (iis *IpamInterfaceStub) SetIPAMConfig(ctx context.Context, cfg ipam.IPAMConfig) error

SetIPAMConfig sets global IPAM configuration. This can only be done when there are no allocated blocks and IP addresses.

type NodesMock

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

NodesMock is mock implementation of clientv3.NodeInterface. It is used for managing Nodes resources.

func NewNodesMock

func NewNodesMock() *NodesMock

NewNodesMock creates new NodesMock instance

func (*NodesMock) Create

func (m *NodesMock) Create(ctx context.Context, res *libapiv3.Node, opts options.SetOptions) (*libapiv3.Node, error)

func (*NodesMock) Delete

func (m *NodesMock) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*libapiv3.Node, error)

func (*NodesMock) Get

func (m *NodesMock) Get(ctx context.Context, name string, opts options.GetOptions) (*libapiv3.Node, error)

func (*NodesMock) List

func (*NodesMock) Update

func (m *NodesMock) Update(ctx context.Context, res *libapiv3.Node, opts options.SetOptions) (*libapiv3.Node, error)

func (*NodesMock) Watch

Jump to

Keyboard shortcuts

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