Skip to content

Commit 1eb4c59

Browse files
author
Jose Villalta
committed
bug fix
1 parent 79f4dac commit 1eb4c59

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

ecs-agent/netlib/network_builder.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ func (nb *networkBuilder) Start(
102102
err = nb.startAWSVPC(ctx, taskID, netNS)
103103
case types.NetworkModeHost:
104104
err = nb.platformAPI.HandleHostMode()
105+
case "daemon-bridge":
106+
err = nb.platformAPI.ConfigureDaemonNetNS(netNS)
105107
default:
106108
err = errors.New("invalid network mode: " + string(mode))
107109
}

ecs-agent/netlib/platform/managed_linux.go

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -416,25 +416,19 @@ func (m *managedLinux) configureDaemonNetNS(ctx context.Context, taskID string,
416416
return errors.New("invalid transition state encountered: " + netNS.DesiredState.String())
417417
}
418418

419-
// Create the network namespace and setup DNS configuration within the netns.
420-
// This has to happen before any CNI plugin is executed.
421-
if netNS.KnownState == status.NetworkNone &&
422-
netNS.DesiredState == status.NetworkReadyPull {
423-
424-
logger.Debug("Creating netns: " + netNS.Path)
425-
// Create network namespace on the host.
426-
err = m.CreateNetNS(netNS.Path)
427-
if err != nil {
428-
return err
429-
}
419+
logger.Debug("Creating netns: " + netNS.Path)
420+
// Create network namespace on the host.
421+
err = m.CreateNetNS(netNS.Path)
422+
if err != nil {
423+
return err
424+
}
430425

431-
logger.Debug("Creating DNS config files")
426+
logger.Debug("Creating DNS config files")
432427

433-
// Create necessary DNS config files for the netns.
434-
err = m.CreateDNSConfig(taskID, netNS)
435-
if err != nil {
436-
return err
437-
}
428+
// Create necessary DNS config files for the netns.
429+
err = m.CreateDNSConfig(taskID, netNS)
430+
if err != nil {
431+
return err
438432
}
439433

440434
// Create MI-Bridge

0 commit comments

Comments
 (0)