func (task *Task) shouldOverrideNetworkMode(container *apicontainer.Container, dockerContainerMap map[string]*apicontainer.DockerContainer) (bool, string) {
	// TODO. We can do an early return here by determining which kind of task it is
	// Example: Does this task have ENIs in its payload, what is its networking mode etc
	if container.IsInternal() {
		// If it's an internal container, set the network mode to none.
		// Currently, internal containers are either for creating empty host
		// volumes or for creating the 'pause' container. Both of these
		// only need the network mode to be set to "none"
		return true, networkModeNone
	}

	// For other types of containers, determine if the container map contains
	// a pause container. Since a pause container is only added to the task
	// when using non docker daemon supported network modes, its existence
	// indicates the need to configure the network mode outside of supported
	// network drivers
	if task.GetTaskENI() == nil {
		return false, ""
	}

	pauseContName := ""
	for _, cont := range task.Containers {
		if cont.Type == apicontainer.ContainerCNIPause {
			pauseContName = cont.Name
			break
		}
	}
	if pauseContName == "" {
		seelog.Critical("Pause container required, but not found in the task: %s", task.String())
		return false, ""
	}
	pauseContainer, ok := dockerContainerMap[pauseContName]
	if !ok || pauseContainer == nil {
		// This should never be the case and implies a code-bug.
		seelog.Criticalf("Pause container required, but not found in container map for container: [%s] in task: %s",
			container.String(), task.String())
		return false, ""
	}
	return true, dockerMappingContainerPrefix + pauseContainer.DockerID
}
func (task *Task) shouldOverrideNetworkMode(container *apicontainer.Container, dockerContainerMap map[string]*apicontainer.DockerContainer) (bool, string) {
	// TODO. We can do an early return here by determining which kind of task it is
	// Example: Does this task have ENIs in its payload, what is its networking mode etc
	if container.IsInternal() {
		// If it's an internal container, set the network mode to none.
		// Currently, internal containers are either for creating empty host
		// volumes or for creating the 'pause' container. Both of these
		// only need the network mode to be set to "none"
		return true, networkModeNone
	}

	// For other types of containers, determine if the container map contains
	// a pause container. Since a pause container is only added to the task
	// when using non docker daemon supported network modes, its existence
	// indicates the need to configure the network mode outside of supported
	// network drivers
	if task.GetTaskENI() == nil {
		return false, ""
	}

	pauseContName := ""
	for _, cont := range task.Containers {
		if cont.Type == apicontainer.ContainerCNIPause {
			pauseContName = cont.Name
			break
		}
	}
	if pauseContName == "" {
		seelog.Critical("Pause container required, but not found in the task: %s", task.String())
		return false, ""
	}
	pauseContainer, ok := dockerContainerMap[pauseContName]
	if !ok || pauseContainer == nil {
		// This should never be the case and implies a code-bug.
		seelog.Criticalf("Pause container required, but not found in container map for container: [%s] in task: %s",
			container.String(), task.String())
		return false, ""
	}
	return true, dockerMappingContainerPrefix + pauseContainer.DockerID
}
func ( task * Task ) shouldOverrideNetworkMode ( container * apicontainer . Container , dockerContainerMap map [ string ] * apicontainer . DockerContainer ) ( bool , string ) { // TODO. We can do an early return here by determining which kind of task it is // Example: Does this task have ENIs in its payload, what is its networking mode etc if container . IsInternal ( ) { // If it's an internal container, set the network mode to none. // Currently, internal containers are either for creating empty host // volumes or for creating the 'pause' container. Both of these // only need the network mode to be set to "none" return true , networkModeNone } // For other types of containers, determine if the container map contains // a pause container. Since a pause container is only added to the task // when using non docker daemon supported network modes, its existence // indicates the need to configure the network mode outside of supported // network drivers if task . GetTaskENI ( ) == nil { return false , " " } pauseContName := " " for _ , cont := range task . Containers { if cont . Type == apicontainer . ContainerCNIPause { pauseContName = cont . Name break } } if pauseContName == " " { seelog . Critical ( " " , task . String ( ) ) return false , " " } pauseContainer , ok := dockerContainerMap [ pauseContName ] if ! ok || pauseContainer == nil { // This should never be the case and implies a code-bug. seelog . Criticalf ( " " , container . String ( ) , task . String ( ) ) return false , " " } return true , dockerMappingContainerPrefix + pauseContainer . DockerID }
// shouldOverrideNetworkMode returns true if the network mode of the container needs
// to be overridden. It also returns the override string in this case. It returns
// false otherwise
shouldOverrideNetworkMode returns true if the network mode of the container needs to be overridden . It also returns the override string in this case . It returns false otherwise