tasknetworkconfig

package
v0.0.0-...-a080504 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkNamespace

type NetworkNamespace struct {
	Name  string
	Path  string
	Index int

	// NetworkInterfaces represents ENIs or any kind of network interface associated the particular netns.
	NetworkInterfaces []*networkinterface.NetworkInterface

	// AppMeshConfig holds AppMesh related parameters for the particular netns.
	AppMeshConfig *appmesh.AppMesh

	// ServiceConnectConfig holds ServiceConnect related parameters for the particular netns.
	ServiceConnectConfig *serviceconnect.ServiceConnectConfig

	KnownState   status.NetworkStatus
	DesiredState status.NetworkStatus

	Mutex sync.Mutex `json:"-"`
}

NetworkNamespace is model representing each network namespace.

func NewNetworkNamespace

func NewNetworkNamespace(
	netNSName string,
	netNSPath string,
	index int,
	proxyConfig *ecsacs.ProxyConfiguration,
	networkInterfaces ...*networkinterface.NetworkInterface) (*NetworkNamespace, error)

func (*NetworkNamespace) GetInterfaceByIndex

func (ns *NetworkNamespace) GetInterfaceByIndex(idx int64) *networkinterface.NetworkInterface

GetInterfaceByIndex returns the interface in the netns that has the specified index.

func (*NetworkNamespace) GetPrimaryInterface

func (ns *NetworkNamespace) GetPrimaryInterface() *networkinterface.NetworkInterface

GetPrimaryInterface returns the network interface that has the index value of 0 within the network namespace.

func (*NetworkNamespace) IsPrimary

func (ns *NetworkNamespace) IsPrimary() bool

IsPrimary returns true if the netns index is zero. This indicates that the primary interface of the task will be inside this netns. Image pulls, secret pulls, container logging, etc will happen over the primary netns.

type TaskNetworkConfig

type TaskNetworkConfig struct {
	NetworkNamespaces []*NetworkNamespace
	NetworkMode       string
}

TaskNetworkConfig is the top level network data structure associated with a task.

func New

func New(networkMode string, netNSs ...*NetworkNamespace) (*TaskNetworkConfig, error)

func (*TaskNetworkConfig) GetEniNamesToAssociationProtocolMapping

func (tnc *TaskNetworkConfig) GetEniNamesToAssociationProtocolMapping() map[string]string

GetEniNamesToAssociationProtocolMapping returns a map of ENI names to interface association protocols (like tunnel/veth).

func (*TaskNetworkConfig) GetInterfaceNamesToNetNSMapping

func (tnc *TaskNetworkConfig) GetInterfaceNamesToNetNSMapping() map[string]*NetworkNamespace

GetInterfaceNamesToNetNSMapping returns a map where key is interface name and value is the netns in which the interface exists.

func (*TaskNetworkConfig) GetPrimaryInterface

func (tnc *TaskNetworkConfig) GetPrimaryInterface() *ni.NetworkInterface

GetPrimaryInterface returns the interface with index 0 inside the network namespace with index 0 associated with the task's network config.

func (*TaskNetworkConfig) GetPrimaryNetNS

func (tnc *TaskNetworkConfig) GetPrimaryNetNS() *NetworkNamespace

GetPrimaryNetNS returns the netns with index 0 associated with the task's network config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL