@@ -120,6 +120,8 @@ func (b *NetworkServiceBuilder) InitK8S() *NetworkServiceBuilder {
120120
121121 if types .NodeExclusiveENIMode (b .service .k8s .Node ().Labels ) == types .ExclusiveENIOnly {
122122 b .service .daemonMode = daemon .ModeENIOnly
123+ b .daemonMode = daemon .ModeENIOnly
124+ b .service .ipamType = types .IPAMTypeCRD
123125 }
124126
125127 if utils .ISLinJunNode (b .service .k8s .Node ().Labels ) {
@@ -382,34 +384,40 @@ func (b *NetworkServiceBuilder) setupENIManager() error {
382384
383385 var eniList []eni.NetworkInterface
384386
385- var (
386- normalENICount int
387- erdmaENICount int
388- )
389- for _ , ni := range attached {
390- serviceLog .V (5 ).Info ("found attached eni" , "eni" , ni )
391- if b .config .EnableENITrunking && ni .Trunk && trunkENIID == ni .ID {
392- lo := eni .NewLocal (ni , "trunk" , factory , poolConfig )
393- normalENICount ++
394- eniList = append (eniList , eni .NewTrunk (b .service .k8s .GetClient (), lo ))
395- } else if b .config .EnableERDMA && ni .ERdma {
396- erdmaENICount ++
397- eniList = append (eniList , eni .NewLocal (ni , "erdma" , factory , poolConfig ))
398- } else {
399- normalENICount ++
400- eniList = append (eniList , eni .NewLocal (ni , "secondary" , factory , poolConfig ))
387+ if b .daemonMode == daemon .ModeENIOnly {
388+ eniList = append (eniList , eni .NewRemote (b .service .k8s .GetClient (), nil ))
389+ } else {
390+ var (
391+ normalENICount int
392+ erdmaENICount int
393+ )
394+ for _ , ni := range attached {
395+ serviceLog .Info ("found attached eni" , "eni" , ni )
396+ if b .config .EnableENITrunking && ni .Trunk && trunkENIID == ni .ID {
397+ lo := eni .NewLocal (ni , "trunk" , factory , poolConfig )
398+
399+ serviceLog .Info ("trunk inited" )
400+ normalENICount ++
401+ eniList = append (eniList , eni .NewTrunk (b .service .k8s .GetClient (), lo ))
402+ } else if b .config .EnableERDMA && ni .ERdma {
403+ erdmaENICount ++
404+ eniList = append (eniList , eni .NewLocal (ni , "erdma" , factory , poolConfig ))
405+ } else {
406+ normalENICount ++
407+ eniList = append (eniList , eni .NewLocal (ni , "secondary" , factory , poolConfig ))
408+ }
401409 }
402- }
403- normalENINeeded := poolConfig . MaxENI - normalENICount
404- if b . config . EnableERDMA {
405- normalENINeeded = poolConfig . MaxENI - b .limit .ERDMARes () - normalENICount
406- for i := 0 ; i < b . limit . ERDMARes () - erdmaENICount ; i ++ {
407- eniList = append ( eniList , eni . NewLocal ( nil , "erdma" , factory , poolConfig ))
410+ normalENINeeded := poolConfig . MaxENI - normalENICount
411+ if b . config . EnableERDMA {
412+ normalENINeeded = poolConfig . MaxENI - b . limit . ERDMARes () - normalENICount
413+ for i := 0 ; i < b .limit .ERDMARes ()- erdmaENICount ; i ++ {
414+ eniList = append ( eniList , eni . NewLocal ( nil , "erdma" , factory , poolConfig ))
415+ }
408416 }
409- }
410417
411- for i := 0 ; i < normalENINeeded ; i ++ {
412- eniList = append (eniList , eni .NewLocal (nil , "secondary" , factory , poolConfig ))
418+ for i := 0 ; i < normalENINeeded ; i ++ {
419+ eniList = append (eniList , eni .NewLocal (nil , "secondary" , factory , poolConfig ))
420+ }
413421 }
414422
415423 eniManager := eni .NewManager (poolConfig .MinPoolSize , poolConfig .MaxPoolSize , poolConfig .Capacity , 30 * time .Second , eniList , daemon .EniSelectionPolicy (b .config .EniSelectionPolicy ), b .service .k8s )
0 commit comments