Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cfg control member eni #234

Merged
merged 1 commit into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ func getPoolConfig(cfg *types.Configure, ecs aliyun.ECS) (*types.PoolConfig, err
EniCapShift: cfg.EniCapShift,
SecurityGroup: cfg.SecurityGroup,
VSwitchSelectionPolicy: cfg.VSwitchSelectionPolicy,
EnableENITrunking: cfg.EnableENITrunking,
}
ins := aliyun.GetInstanceMeta()
zone := ins.ZoneID
Expand Down
15 changes: 11 additions & 4 deletions daemon/eni-multi-ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,11 @@ func newENIIPResourceManager(poolConfig *types.PoolConfig, ecs aliyun.ECS, alloc
if capacity < 0 {
capacity = 0
}
memberENIPod := limit.MemberAdapterLimit * limit.IPv4PerAdapter
if memberENIPod < 0 {
memberENIPod = 0
}

factory.maxENI = make(chan struct{}, maxEni)

if poolConfig.MinENI != 0 {
Expand Down Expand Up @@ -838,10 +843,12 @@ func newENIIPResourceManager(poolConfig *types.PoolConfig, ecs aliyun.ECS, alloc
}

//init deviceplugin for ENI
dp := deviceplugin.NewENIDevicePlugin(capacity, deviceplugin.ENITypeMember)
err = dp.Serve()
if err != nil {
return nil, fmt.Errorf("error start device plugin on node, %w", err)
if poolConfig.EnableENITrunking {
dp := deviceplugin.NewENIDevicePlugin(memberENIPod, deviceplugin.ENITypeMember)
err = dp.Serve()
if err != nil {
return nil, fmt.Errorf("error start device plugin on node, %w", err)
}
}

_ = tracing.Register(tracing.ResourceTypeFactory, factory.name, factory)
Expand Down
4 changes: 3 additions & 1 deletion types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ type Configure struct {
EnableEIPPool string `yaml:"enable_eip_pool" json:"enable_eip_pool"`
IPStack string `yaml:"ip_stack" json:"ip_stack"` // default ipv4 , support ipv4 dual
// rob the eip instance even the eip already bound to other resource
AllowEIPRob string `yaml:"allow_eip_rob" json:"allow_eip_rob"`
AllowEIPRob string `yaml:"allow_eip_rob" json:"allow_eip_rob"`
EnableENITrunking bool `yaml:"enable_eni_trunking" json:"enable_eni_trunking"`
}

// PoolConfig configuration of pool and resource factory
Expand All @@ -43,4 +44,5 @@ type PoolConfig struct {
EniCapRatio float64
EniCapShift int
VSwitchSelectionPolicy string
EnableENITrunking bool
}