diff --git a/daemon/daemon.go b/daemon/daemon.go index 7f598ce3..85df4189 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -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 diff --git a/daemon/eni-multi-ip.go b/daemon/eni-multi-ip.go index 30b818fe..e942b40e 100644 --- a/daemon/eni-multi-ip.go +++ b/daemon/eni-multi-ip.go @@ -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 { @@ -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) diff --git a/types/config.go b/types/config.go index 1a7decd9..d8498b75 100644 --- a/types/config.go +++ b/types/config.go @@ -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 @@ -43,4 +44,5 @@ type PoolConfig struct { EniCapRatio float64 EniCapShift int VSwitchSelectionPolicy string + EnableENITrunking bool }