bcesync

package
v0.0.0-...-ec72bf4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPKindAvailable     = "available"
	IPKindBorrowed      = "borrowed"
	IPKindBorrowedAvail = "borrowed_avail"
	IPKindCount         = "count"
	IPKindUsed          = "used"

	EniTypeSubnet = "subnet"
)
View Source
const (
	ENIReadyTimeToAttach = 1 * time.Second
	ENIMaxCreateDuration = 5 * time.Minute

	FinalizerENI = "eni-syncer"
)

Variables

This section is empty.

Functions

func ElectENIIPv6PrimaryIP

func ElectENIIPv6PrimaryIP(newObj *ccev2.ENI)

ElectENIIPv6PrimaryIP elect a ipv6 primary ip for eni set primary ip for IPv6 if not set by default, all IPv6 IPs are secondary IPs

func EnsureSubnet

func EnsureSubnet(vpcID, sbnID string) (*ccev1.Subnet, error)

func GlobalBSM

func GlobalBSM() *bsm

func InitBSM

func InitBSM() error

func SearchSubnetID

func SearchSubnetID(vpcID, defaultSbnID, privateIPStr string) string

Search the subnet ID of the IP address

Types

type BorrowedSubnet

type BorrowedSubnet struct {
	*ccev1.Subnet

	SubnetId                  string `json:"subnet_id"`
	BorrowedIPsCount          int    `json:"borrowed_ips_count"`
	BorrowedAvailableIPsCount int    `json:"borrowed_available_ips_count"`
	// contains filtered or unexported fields
}

func NewBorrowedSubnet

func NewBorrowedSubnet(subnet *ccev1.Subnet) *BorrowedSubnet

func (*BorrowedSubnet) Borrow

func (bs *BorrowedSubnet) Borrow(eniID string, ipNum int) (borrowedIPNum int)

func (*BorrowedSubnet) CanBorrow

func (bs *BorrowedSubnet) CanBorrow(ipNum int) bool

func (*BorrowedSubnet) Cancel

func (bs *BorrowedSubnet) Cancel(eniID string)

func (*BorrowedSubnet) Done

func (bs *BorrowedSubnet) Done(eniID string, ipNum int)

func (*BorrowedSubnet) GetBorrowedIPNum

func (bs *BorrowedSubnet) GetBorrowedIPNum(eniID string) int

type IPBorrowTask

type IPBorrowTask struct {
	SubnetId  string `json:"subnet_id"`
	EniID     string `json:"eni_id"`
	IPNum     int    `json:"ip_num"`
	TakeIPNum int    `json:"take_ip_num"`
}

type SyncManager

type SyncManager[T eni.Eni | vpc.RouteRule | vpc.Subnet | ccev2alpha1.SecurityGroupSpec] struct {
	sync.Mutex

	Name string
	// contains filtered or unexported fields
}

SyncManager synchronize data between k8s and VPC, run in operator

func NewSyncManager

func NewSyncManager[T eni.Eni | vpc.RouteRule | vpc.Subnet | ccev2alpha1.SecurityGroupSpec](name string, resyncPeriod time.Duration, resync func(ctx context.Context) ([]T, error)) *SyncManager[T]

func (*SyncManager[T]) AddItems

func (s *SyncManager[T]) AddItems(dataList []T)

func (*SyncManager[T]) Get

func (s *SyncManager[T]) Get(key string) *T

func (*SyncManager[T]) Run

func (s *SyncManager[T]) Run()

func (*SyncManager[T]) RunImmediately

func (s *SyncManager[T]) RunImmediately()

type VPCENISyncerRouter

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

VPCENISyncerRouter only work with single vpc cluster

func (*VPCENISyncerRouter) Create

func (es *VPCENISyncerRouter) Create(resource *ccev2.ENI) error

Create implements syncer.ENIEventHandler

func (*VPCENISyncerRouter) Delete

func (es *VPCENISyncerRouter) Delete(name string) error

Delete implements syncer.ENIEventHandler

func (*VPCENISyncerRouter) Init

func (es *VPCENISyncerRouter) Init(ctx context.Context) error

NewVPCENISyncer create a new VPCENISyncer

func (*VPCENISyncerRouter) ResyncENI

func (es *VPCENISyncerRouter) ResyncENI(ctx context.Context) time.Duration

ResyncENI implements syncer.ENIEventHandler

func (*VPCENISyncerRouter) StartENISyncer

func (es *VPCENISyncerRouter) StartENISyncer(ctx context.Context, updater syncer.ENIUpdater) syncer.ENIEventHandler

StartENISyncer implements syncer.ENISyncher

func (*VPCENISyncerRouter) Update

func (es *VPCENISyncerRouter) Update(resource *ccev2.ENI) error

Update implements syncer.ENIEventHandler

type VPCSubnetSyncher

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

func (VPCSubnetSyncher) Create

func (ss VPCSubnetSyncher) Create(resource *ccev1.Subnet) error

Create Process synchronization of new subnets For a new subnet, we should generally query the details of the subnet directly and synchronously

func (VPCSubnetSyncher) Delete

func (ss VPCSubnetSyncher) Delete(name string) error

func (*VPCSubnetSyncher) Init

func (ss *VPCSubnetSyncher) Init(ctx context.Context) error

func (VPCSubnetSyncher) ResyncSubnet

func (ss VPCSubnetSyncher) ResyncSubnet(context.Context) time.Duration

func (VPCSubnetSyncher) StartSubnetSyncher

func (ss VPCSubnetSyncher) StartSubnetSyncher(ctx context.Context, updater syncer.SubnetUpdater) syncer.SubnetEventHandler

func (VPCSubnetSyncher) Update

func (ss VPCSubnetSyncher) Update(resource *ccev1.Subnet) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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