network

package
v1.4.43 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 35 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CNI_ADD    = "ADD"
	CNI_DEL    = "DEL"
	CNI_UPDATE = "UPDATE"
)

CNI Operation Types

View Source
const (
	OpModeTransparent = "transparent"
)

Variables

This section is empty.

Functions

func GetEndpointID

func GetEndpointID(args *cniSkel.CmdArgs) string

GetEndpointID returns a unique endpoint ID based on the CNI args.

func SetCustomDimensions

func SetCustomDimensions(cniMetric *telemetry.AIMetric, nwCfg *cni.NetworkConfig, err error)

Types

type AzureIPAMInvoker

type AzureIPAMInvoker struct {
	// contains filtered or unexported fields
}

func NewAzureIpamInvoker

func NewAzureIpamInvoker(plugin *NetPlugin, nwInfo *network.NetworkInfo) *AzureIPAMInvoker

Create an IPAM instance every time a CNI action is called.

func (*AzureIPAMInvoker) Add

func (invoker *AzureIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, error)

func (*AzureIPAMInvoker) Delete

func (invoker *AzureIPAMInvoker) Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, _ *cniSkel.CmdArgs, options map[string]interface{}) error

type AzureNetIOShim

type AzureNetIOShim struct{}

func (AzureNetIOShim) GetInterfaceSubnetWithSpecificIP

func (a AzureNetIOShim) GetInterfaceSubnetWithSpecificIP(ipAddr string) *net.IPNet

type CNSIPAMInvoker

type CNSIPAMInvoker struct {
	// contains filtered or unexported fields
}

func NewCNSInvoker

func NewCNSInvoker(podName, namespace string, cnsClient cnsclient, executionMode util.ExecutionMode, ipamMode util.IpamMode) *CNSIPAMInvoker

func (*CNSIPAMInvoker) Add

func (invoker *CNSIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, error)

Add uses the requestipconfig API in cns, and returns ipv4 and a nil ipv6 as CNS doesn't support IPv6 yet

func (*CNSIPAMInvoker) Delete

func (invoker *CNSIPAMInvoker) Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, args *cniSkel.CmdArgs, _ map[string]interface{}) error

Delete calls into the releaseipconfiguration API in CNS

type IPAMAddConfig

type IPAMAddConfig struct {
	// contains filtered or unexported fields
}

type IPAMAddResult

type IPAMAddResult struct {
	// contains filtered or unexported fields
}

type IPAMInvoker

type IPAMInvoker interface {
	// Add returns two results, one IPv4, the other IPv6.
	Add(IPAMAddConfig) (IPAMAddResult, error)

	// Delete calls to the invoker source, and returns error. Returning an error here will fail the CNI Delete call.
	Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, args *cniSkel.CmdArgs, options map[string]interface{}) error
}

IPAMInvoker is used by the azure-vnet CNI plugin to call different sources for IPAM. This interface can be used to call into external binaries, like the azure-vnet-ipam binary, or simply act as a client to an external ipam, such as azure-cns.

type IPv4ResultInfo added in v1.1.8

type IPv4ResultInfo struct {
	// contains filtered or unexported fields
}

type MockIpamInvoker

type MockIpamInvoker struct {
	// contains filtered or unexported fields
}

func NewMockIpamInvoker

func NewMockIpamInvoker(ipv6, v4Fail, v6Fail bool) *MockIpamInvoker

func (*MockIpamInvoker) Add

func (invoker *MockIpamInvoker) Add(opt IPAMAddConfig) (ipamAddResult IPAMAddResult, err error)

func (*MockIpamInvoker) Delete

func (invoker *MockIpamInvoker) Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, _ *skel.CmdArgs, options map[string]interface{}) error

type MockMultitenancy

type MockMultitenancy struct {
	// contains filtered or unexported fields
}

func NewMockMultitenancy

func NewMockMultitenancy(fail bool) *MockMultitenancy

func (*MockMultitenancy) DetermineSnatFeatureOnHost

func (m *MockMultitenancy) DetermineSnatFeatureOnHost(snatFile, nmAgentSupportedApisURL string) (snatDNS, snatHost bool, err error)

func (*MockMultitenancy) GetContainerNetworkConfiguration added in v1.4.13

func (m *MockMultitenancy) GetContainerNetworkConfiguration(
	ctx context.Context,
	nwCfg *cni.NetworkConfig,
	podName string,
	podNamespace string,
) (*cns.GetNetworkContainerResponse, net.IPNet, error)

func (*MockMultitenancy) Init

func (m *MockMultitenancy) Init(cnsclient cnsclient, netnetioshim netioshim)

func (*MockMultitenancy) SetupRoutingForMultitenancy

func (m *MockMultitenancy) SetupRoutingForMultitenancy(
	nwCfg *cni.NetworkConfig,
	cnsNetworkConfig *cns.GetNetworkContainerResponse,
	azIpamResult *current.Result,
	epInfo *network.EndpointInfo,
	result *current.Result)

type Multitenancy

type Multitenancy struct {
	// contains filtered or unexported fields
}

func (*Multitenancy) DetermineSnatFeatureOnHost

func (m *Multitenancy) DetermineSnatFeatureOnHost(snatFile, nmAgentSupportedApisURL string) (snatForDNS, snatOnHost bool, err error)

DetermineSnatFeatureOnHost - Temporary function to determine whether we need to disable SNAT due to NMAgent support

func (*Multitenancy) GetContainerNetworkConfiguration added in v1.4.13

func (m *Multitenancy) GetContainerNetworkConfiguration(
	ctx context.Context, nwCfg *cni.NetworkConfig, podName, podNamespace string,
) (*cns.GetNetworkContainerResponse, net.IPNet, error)

func (*Multitenancy) Init

func (m *Multitenancy) Init(cnsclient cnsclient, netioshim netioshim)

func (*Multitenancy) SetupRoutingForMultitenancy

func (m *Multitenancy) SetupRoutingForMultitenancy(
	nwCfg *cni.NetworkConfig,
	cnsNetworkConfig *cns.GetNetworkContainerResponse,
	azIpamResult *cniTypesCurr.Result,
	epInfo *network.EndpointInfo,
	result *cniTypesCurr.Result,
)

type MultitenancyClient

type MultitenancyClient interface {
	SetupRoutingForMultitenancy(
		nwCfg *cni.NetworkConfig,
		cnsNetworkConfig *cns.GetNetworkContainerResponse,
		azIpamResult *cniTypesCurr.Result,
		epInfo *network.EndpointInfo,
		result *cniTypesCurr.Result)
	DetermineSnatFeatureOnHost(
		snatFile string,
		nmAgentSupportedApisURL string) (bool, bool, error)
	GetContainerNetworkConfiguration(
		ctx context.Context,
		nwCfg *cni.NetworkConfig,
		podName string,
		podNamespace string) (*cns.GetNetworkContainerResponse, net.IPNet, error)
	Init(cnsclient cnsclient, netioshim netioshim)
}

MultitenancyClient interface

type NetPlugin

type NetPlugin struct {
	*cni.Plugin
	// contains filtered or unexported fields
}

NetPlugin represents the CNI network plugin.

func NewPlugin

func NewPlugin(name string,
	config *common.PluginConfig,
	client NnsClient,
	multitenancyClient MultitenancyClient,
) (*NetPlugin, error)

NewPlugin creates a new NetPlugin object.

func (*NetPlugin) Add

func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error

Add handles CNI add commands.

func (*NetPlugin) Delete

func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error

Delete handles CNI delete commands.

func (*NetPlugin) Get

func (plugin *NetPlugin) Get(args *cniSkel.CmdArgs) error

Get handles CNI Get commands.

func (*NetPlugin) GetAllEndpointState

func (plugin *NetPlugin) GetAllEndpointState(networkid string) (*api.AzureCNIState, error)

func (*NetPlugin) SetCNIReport

func (plugin *NetPlugin) SetCNIReport(report *telemetry.CNIReport, tb *telemetry.TelemetryBuffer)

func (*NetPlugin) Start

func (plugin *NetPlugin) Start(config *common.PluginConfig) error

Starts the plugin.

func (*NetPlugin) Stop

func (plugin *NetPlugin) Stop()

Stops the plugin.

func (*NetPlugin) Update

func (plugin *NetPlugin) Update(args *cniSkel.CmdArgs) error

Update handles CNI update commands. Update is only supported for multitenancy and to update routes.

type NnsClient

type NnsClient interface {
	// Do network port programming for the pod via node network service.
	// podName - name of the pod as received from containerD
	// nwNamesapce - network namespace name as received from containerD
	AddContainerNetworking(ctx context.Context, podName, nwNamespace string) (*nnscontracts.ConfigureContainerNetworkingResponse, error)

	// Undo or delete network port programming for the pod via node network service.
	// podName - name of the pod as received from containerD
	// nwNamesapce - network namespace name as received from containerD
	DeleteContainerNetworking(ctx context.Context, podName, nwNamespace string) (*nnscontracts.ConfigureContainerNetworkingResponse, error)
}

client for node network service

type PolicyArgs

type PolicyArgs struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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