Documentation ¶
Index ¶
- Variables
- func AllocTypeWithCtx(ctx context.Context, allocType AllocPolicy) context.Context
- type AllocManager
- func (a *AllocManager) Add(alloc *Allocation)
- func (a *AllocManager) Alloc(vSwitchID string) *client.NetworkInterface
- func (a *AllocManager) Dispose(eniID string)
- func (a *AllocManager) Load(eniID string) *Allocation
- func (a *AllocManager) Range(f func(key string, value *Allocation) bool)
- func (a *AllocManager) Release(eniID string)
- func (a *AllocManager) ReleaseIdle() *client.NetworkInterface
- func (a *AllocManager) ReleaseQuota()
- func (a *AllocManager) RequireQuota() bool
- type AllocPolicy
- type Allocation
- type Config
- type Manager
- func (m *Manager) AssignIpv6Addresses(ctx context.Context, eniID string, count int, idempotentKey string) ([]netip.Addr, error)
- func (m *Manager) AssignPrivateIPAddress(ctx context.Context, eniID string, count int, idempotent string) ([]netip.Addr, error)
- func (m *Manager) AttachNetworkInterface(ctx context.Context, eniID, instanceID, trunkENIID string) error
- func (m *Manager) CreateNetworkInterface(ctx context.Context, trunk, erdma bool, vSwitchID string, ...) (*aliyunClient.NetworkInterface, error)
- func (m *Manager) DeleteNetworkInterface(ctx context.Context, eniID string) (err error)
- func (m *Manager) DescribeInstanceTypes(ctx context.Context, types []string) ([]ecs.InstanceType, error)
- func (m *Manager) DescribeNetworkInterface(ctx context.Context, vpcID string, eniID []string, instanceID string, ...) ([]*aliyunClient.NetworkInterface, error)
- func (m *Manager) DescribeVSwitchByID(ctx context.Context, vSwitchID string) (*vpc.VSwitch, error)
- func (m *Manager) DetachNetworkInterface(ctx context.Context, eniID, instanceID, trunkENIID string) error
- func (m *Manager) ModifyNetworkInterfaceAttribute(ctx context.Context, eniID string, securityGroupIDs []string) error
- func (m *Manager) Run()
- func (m *Manager) Stop()
- func (m *Manager) UnAssignIpv6Addresses(ctx context.Context, eniID string, ips []netip.Addr) error
- func (m *Manager) UnAssignPrivateIPAddresses(ctx context.Context, eniID string, ips []netip.Addr) error
- func (m *Manager) WaitForNetworkInterface(ctx context.Context, eniID string, status string, bo wait.Backoff, ...) (*aliyunClient.NetworkInterface, error)
- type Status
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMaxENI = errors.New("max eni executed")
Functions ¶
func AllocTypeWithCtx ¶
func AllocTypeWithCtx(ctx context.Context, allocType AllocPolicy) context.Context
Types ¶
type AllocManager ¶
func NewAllocManager ¶
func NewAllocManager(max int, enableTrunk bool) *AllocManager
func (*AllocManager) Add ¶
func (a *AllocManager) Add(alloc *Allocation)
func (*AllocManager) Alloc ¶
func (a *AllocManager) Alloc(vSwitchID string) *client.NetworkInterface
Alloc try alloc eni by vSwitchID
func (*AllocManager) Dispose ¶
func (a *AllocManager) Dispose(eniID string)
func (*AllocManager) Load ¶
func (a *AllocManager) Load(eniID string) *Allocation
func (*AllocManager) Range ¶
func (a *AllocManager) Range(f func(key string, value *Allocation) bool)
func (*AllocManager) Release ¶
func (a *AllocManager) Release(eniID string)
Release set status to StatusIdle
func (*AllocManager) ReleaseIdle ¶
func (a *AllocManager) ReleaseIdle() *client.NetworkInterface
ReleaseIdle pick one idle and set status to StatusDeleting
func (*AllocManager) ReleaseQuota ¶
func (a *AllocManager) ReleaseQuota()
func (*AllocManager) RequireQuota ¶
func (a *AllocManager) RequireQuota() bool
type AllocPolicy ¶
type AllocPolicy int
const ( AllocPolicyDirect AllocPolicy = iota AllocPolicyPreferPool )
func AllocPolicyCtx ¶
func AllocPolicyCtx(ctx context.Context) AllocPolicy
type Allocation ¶
type Allocation struct { sync.RWMutex NetworkInterface *client.NetworkInterface // find a way to update the fields Status Status AllocType AllocPolicy }
Allocation store eni alloc status
func (*Allocation) GetNetworkInterface ¶
func (a *Allocation) GetNetworkInterface() *client.NetworkInterface
func (*Allocation) GetStatus ¶
func (a *Allocation) GetStatus() Status
func (*Allocation) SetStatus ¶
func (a *Allocation) SetStatus(status Status)
type Config ¶
type Config struct { IPv4Enable bool IPv6Enable bool NodeName string // instance metadata InstanceID string ZoneID string TrunkENIID string // eni VSwitchIDs []string SecurityGroupIDs []string ENITags map[string]string // pool config MaxENI int // max eni manager can allocate MaxIdle int MinIdle int SyncPeriod time.Duration }
Config for eni manager
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(cfg *Config, previous map[string]*Allocation, vSwitchPool *vswitch.SwitchPool, aliyun register.Interface) *Manager
func (*Manager) AssignIpv6Addresses ¶
func (*Manager) AssignPrivateIPAddress ¶
func (*Manager) AttachNetworkInterface ¶
func (*Manager) CreateNetworkInterface ¶
func (*Manager) DeleteNetworkInterface ¶
func (*Manager) DescribeInstanceTypes ¶
func (*Manager) DescribeNetworkInterface ¶
func (*Manager) DescribeVSwitchByID ¶
func (*Manager) DetachNetworkInterface ¶
func (*Manager) ModifyNetworkInterfaceAttribute ¶
func (*Manager) UnAssignIpv6Addresses ¶
func (*Manager) UnAssignPrivateIPAddresses ¶
func (*Manager) WaitForNetworkInterface ¶
Click to show internal directories.
Click to hide internal directories.