privatecloudbase

package
v0.0.0-...-686bfca Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelPrivateCloudBaseTopologySwitchName Private cloud base switch name
	LabelPrivateCloudBaseTopologySwitchName = "topology.kubernetes.io/subnet"

	// PrivateCloudBaseName type name of baidu base private cloud
	PrivateCloudBaseName = "PrivateCloudBase"
)

Variables

This section is empty.

Functions

func GetSubnetIDFromNodeLabels

func GetSubnetIDFromNodeLabels(labels map[string]string) string

Types

type IPPool

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

func NewIPPool

func NewIPPool() *IPPool

func (*IPPool) AddIP

func (pool *IPPool) AddIP(ip *api2.AllocatedIP)

func (*IPPool) DeleteByIP

func (pool *IPPool) DeleteByIP(subnet, ip string)

func (*IPPool) DeleteIP

func (pool *IPPool) DeleteIP(ip *api2.AllocatedIP)

func (*IPPool) GetIP

func (pool *IPPool) GetIP(subnet, ip string) *api2.AllocatedIP

func (*IPPool) GetIPByOwner

func (pool *IPPool) GetIPByOwner(subnet, id string) []*api2.AllocatedIP

GetIPByOwner Owner has two values

1. Node's available IP cache pool node/{nodeName}/{uid}

2. Fixed IP pod pod/{namespace}/{name}

type InstancesManager

type InstancesManager struct {

	// status of Private Cloud Base
	// index by subnetID and ip
	IPPool *IPPool
	// 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 api2.Client, getterUpdater ipam.NetResourceSetGetterUpdater) *InstancesManager

NewInstancesManager returns a new instances manager

func (*InstancesManager) CreateNetResource

func (m *InstancesManager) CreateNetResource(obj *v2.NetResourceSet, node *ipam.NetResource) ipam.NetResourceOperations

CreateNetResource is called when the IPAM layer has learned about a new node which requires IPAM services. This function must return a NodeOperations implementation which will render IPAM services to the node context provided.

func (*InstancesManager) GetIPPool

func (m *InstancesManager) GetIPPool() *IPPool

func (*InstancesManager) GetPodPool

func (m *InstancesManager) GetPodPool() *IPPool

func (*InstancesManager) GetPoolQuota

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

GetPoolQuota returns the number of available IPs in all IP pools

func (*InstancesManager) GetSubnet

func (m *InstancesManager) GetSubnet(id string) *api2.Subnet

func (*InstancesManager) NodeEndpoint

NodeEndpoint implements endpoint.DirectIPAllocator

func (*InstancesManager) Resync

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

Resync is called periodically to give the IPAM implementation a chance to resync its own state with external APIs or systems. It is also called when the IPAM layer detects that state got out of sync.

func (*InstancesManager) ResyncFixedIPs

func (m *InstancesManager) ResyncFixedIPs(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)

func (*InstancesManager) ResyncPool

func (*InstancesManager) ResyncPool(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)

ResyncPool implements endpoint.DirectIPAllocator

type Node

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

Node represents a Kubernetes node running CCE with an associated NetResourceSet custom resource

func NewNode

func NewNode(node *ipam.NetResource, k8sObj *v2.NetResourceSet, manager *InstancesManager) *Node

NewNode returns a new Node

func (*Node) AllocateIPs

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

func (*Node) CreateInterface

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

func (*Node) GetMaximumAllocatableIPv4

func (n *Node) GetMaximumAllocatableIPv4() int

func (*Node) GetMinimumAllocatableIPv4

func (n *Node) GetMinimumAllocatableIPv4() int

func (*Node) GetUsedIPWithPrefixes

func (n *Node) GetUsedIPWithPrefixes() int

func (*Node) IsPrefixDelegated

func (n *Node) IsPrefixDelegated() bool

func (*Node) PopulateStatusFields

func (n *Node) PopulateStatusFields(resource *v2.NetResourceSet)

func (*Node) PrepareIPAllocation

func (n *Node) PrepareIPAllocation(scopedLog *logrus.Entry) (a *ipam.AllocationAction, err error)

func (*Node) PrepareIPRelease

func (n *Node) PrepareIPRelease(excessIPs int, scopedLog *logrus.Entry) *ipam.ReleaseAction

func (*Node) ReleaseIPs

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

func (*Node) ResyncInterfacesAndIPs

func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *logrus.Entry) (ipamTypes.AllocationMap, error)

ResyncInterfacesAndIPs is called to synchronize the latest list of interfaces and IPs associated with the node. This function is called sparingly as this information is kept in sync based on the success of the functions AllocateIPs(), ReleaseIPs() and CreateInterface().

func (*Node) UpdatedNode

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

Directories

Path Synopsis
+k8s:deepcopy-gen=package,register +deepequal-gen=package
+k8s:deepcopy-gen=package,register +deepequal-gen=package

Jump to

Keyboard shortcuts

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