network

package
v1.4.22 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 34 Imported by: 1

Documentation

Index

Constants

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

CNI Operation Types

Variables

This section is empty.

Functions

func CleanupMultitenancyResources added in v1.0.12

func CleanupMultitenancyResources(enableInfraVnet bool, nwCfg *cni.NetworkConfig, azIpamResult *cniTypesCurr.Result, plugin *NetPlugin)

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

func (*AzureIPAMInvoker) Add

func (invoker *AzureIPAMInvoker) Add(nwCfg *cni.NetworkConfig, _ *cniSkel.CmdArgs, subnetPrefix *net.IPNet, options map[string]interface{}) (*cniTypesCurr.Result, *cniTypesCurr.Result, 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) *CNSIPAMInvoker

func (*CNSIPAMInvoker) Add

func (invoker *CNSIPAMInvoker) Add(
	_ *cni.NetworkConfig,
	args *cniSkel.CmdArgs,
	hostSubnetPrefix *net.IPNet,
	options map[string]interface{}) (*cniTypesCurr.Result, *cniTypesCurr.Result, 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, _ *cni.NetworkConfig, args *cniSkel.CmdArgs, _ map[string]interface{}) error

Delete calls into the releaseipconfiguration API in CNS

type IPAMInvoker

type IPAMInvoker interface {

	// Add returns two results, one IPv4, the other IPv6.
	Add(nwCfg *cni.NetworkConfig, args *cniSkel.CmdArgs, subnetPrefix *net.IPNet, options map[string]interface{}) (*cniTypesCurr.Result, *cniTypesCurr.Result, 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(nwCfg *cni.NetworkConfig, _ *skel.CmdArgs, subnetPrefix *net.IPNet, options map[string]interface{}) (v4, v6 *current.Result, 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,
	ifName string) (*current.Result, *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 string, podNamespace string, ifName string) (*cniTypesCurr.Result, *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,
		ifName string) (*cniTypesCurr.Result, *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,
	azHnsClient network.AzureHNSEndpointClient) (*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) GetMultiTenancyCNIResult added in v1.4.13

func (plugin *NetPlugin) GetMultiTenancyCNIResult(
	ctx context.Context,
	enableInfraVnet bool,
	nwCfg *cni.NetworkConfig,
	k8sPodName string,
	k8sNamespace string,
	ifName string) (res *cniTypesCurr.Result, resp *cns.GetNetworkContainerResponse, prefix net.IPNet, infraRes *cniTypesCurr.Result, err error)

GetMultiTenancyCNIResult retrieves network goal state of a container from CNS

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