Documentation ¶
Index ¶
- Constants
- func GetEndpointID(args *cniSkel.CmdArgs) string
- func HandleIfCniUpdate(update func(*skel.CmdArgs) error) (bool, error)
- func PrintCNIError(msg string)
- func ReportPluginError(reportManager *telemetry.ReportManager, tb *telemetry.TelemetryBuffer, ...)
- func SetCustomDimensions(cniMetric *telemetry.AIMetric, nwCfg *cni.NetworkConfig, err error)
- type AzureIPAMInvoker
- type AzureNetIOShim
- type CNSIPAMInvoker
- type IPAMAddConfig
- type IPAMAddResult
- type IPAMInvoker
- type IPResultInfo
- type InterfaceGetter
- type MockIpamInvoker
- type MockMultitenancy
- func (m *MockMultitenancy) DetermineSnatFeatureOnHost(snatFile, nmAgentSupportedApisURL string) (snatDNS, snatHost bool, err error)
- func (m *MockMultitenancy) GetAllNetworkContainers(ctx context.Context, nwCfg *cni.NetworkConfig, podName string, ...) (IPAMAddResult, error)
- func (m *MockMultitenancy) GetNetworkContainer(ctx context.Context, nwCfg *cni.NetworkConfig, podName string, ...) (*cns.GetNetworkContainerResponse, net.IPNet, error)
- func (m *MockMultitenancy) Init(cnsclient cnsclient, netnetioshim netioshim)
- func (m *MockMultitenancy) SetupRoutingForMultitenancy(nwCfg *cni.NetworkConfig, cnsNetworkConfig *cns.GetNetworkContainerResponse, ...)
- type Multitenancy
- func (m *Multitenancy) DetermineSnatFeatureOnHost(snatFile, nmAgentSupportedApisURL string) (snatForDNS, snatOnHost bool, err error)
- func (m *Multitenancy) GetAllNetworkContainers(ctx context.Context, nwCfg *cni.NetworkConfig, ...) (IPAMAddResult, error)
- func (m *Multitenancy) Init(cnsclient cnsclient, netioshim netioshim)
- func (m *Multitenancy) SetupRoutingForMultitenancy(nwCfg *cni.NetworkConfig, cnsNetworkConfig *cns.GetNetworkContainerResponse, ...)
- type MultitenancyClient
- type NetPlugin
- func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error
- func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error
- func (plugin *NetPlugin) Get(args *cniSkel.CmdArgs) error
- func (plugin *NetPlugin) GetAllEndpointState(networkid string) (*api.AzureCNIState, error)
- func (plugin *NetPlugin) SetCNIReport(report *telemetry.CNIReport, tb *telemetry.TelemetryBuffer)
- func (plugin *NetPlugin) Start(config *common.PluginConfig) error
- func (plugin *NetPlugin) Stop()
- func (plugin *NetPlugin) Update(args *cniSkel.CmdArgs) error
- type NnsClient
- type PolicyArgs
Constants ¶
const ( CNI_ADD = "ADD" CNI_DEL = "DEL" CNI_UPDATE = "UPDATE" )
CNI Operation Types
const (
OpModeTransparent = "transparent"
)
Variables ¶
This section is empty.
Functions ¶
func GetEndpointID ¶
GetEndpointID returns a unique endpoint ID based on the CNI args.
func HandleIfCniUpdate ¶ added in v1.5.17
func PrintCNIError ¶ added in v1.5.17
func PrintCNIError(msg string)
func ReportPluginError ¶ added in v1.5.17
func ReportPluginError(reportManager *telemetry.ReportManager, tb *telemetry.TelemetryBuffer, err error)
send error report to hostnetagent if CNI encounters any error.
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.EndpointInfo) *AzureIPAMInvoker
Create an IPAM instance every time a CNI action is called.
func (*AzureIPAMInvoker) Add ¶
func (invoker *AzureIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, 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
type IPAMAddConfig ¶
type IPAMAddConfig struct {
// contains filtered or unexported fields
}
type IPAMAddResult ¶
type IPAMAddResult struct {
// contains filtered or unexported fields
}
func (IPAMAddResult) PrettyString ¶ added in v1.5.30
func (ipamAddResult IPAMAddResult) PrettyString() string
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 IPResultInfo ¶
type IPResultInfo struct {
// contains filtered or unexported fields
}
func (IPResultInfo) MarshalLogObject ¶
func (i IPResultInfo) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type InterfaceGetter ¶ added in v1.5.30
client for getting interface
type MockIpamInvoker ¶
type MockIpamInvoker struct {
// contains filtered or unexported fields
}
func NewCustomMockIpamInvoker ¶ added in v1.5.30
func NewCustomMockIpamInvoker(customReturn map[string]network.InterfaceInfo) *MockIpamInvoker
func NewMockIpamInvoker ¶
func NewMockIpamInvoker(ipv6, v4Fail, v6Fail, delegatedVMNIC, delegatedVMNICFail, accelnetNIC, accelnetNICFail bool) *MockIpamInvoker
func (*MockIpamInvoker) Add ¶
func (invoker *MockIpamInvoker) Add(opt IPAMAddConfig) (ipamAddResult IPAMAddResult, err 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) GetAllNetworkContainers ¶
func (m *MockMultitenancy) GetAllNetworkContainers( ctx context.Context, nwCfg *cni.NetworkConfig, podName string, podNamespace string, ifName string, ) (IPAMAddResult, error)
func (*MockMultitenancy) GetNetworkContainer ¶
func (m *MockMultitenancy) GetNetworkContainer( 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, _ *network.InterfaceInfo)
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) GetAllNetworkContainers ¶
func (m *Multitenancy) GetAllNetworkContainers( ctx context.Context, nwCfg *cni.NetworkConfig, podName, podNamespace, ifName string, ) (IPAMAddResult, error)
get all network container configuration(s) for given orchestratorContext
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 *network.InterfaceInfo, )
type MultitenancyClient ¶
type MultitenancyClient interface { SetupRoutingForMultitenancy( nwCfg *cni.NetworkConfig, cnsNetworkConfig *cns.GetNetworkContainerResponse, azIpamResult *cniTypesCurr.Result, epInfo *network.EndpointInfo, result *network.InterfaceInfo) DetermineSnatFeatureOnHost( snatFile string, nmAgentSupportedApisURL string) (bool, bool, error) GetAllNetworkContainers( ctx context.Context, nwCfg *cni.NetworkConfig, podName string, podNamespace string, ifName string) (IPAMAddResult, error) Init(cnsclient cnsclient, netioshim netioshim) }
MultitenancyClient interface
type NetPlugin ¶
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) GetAllEndpointState ¶
func (plugin *NetPlugin) GetAllEndpointState(networkid string) (*api.AzureCNIState, error)
func (*NetPlugin) SetCNIReport ¶
func (plugin *NetPlugin) SetCNIReport(report *telemetry.CNIReport, tb *telemetry.TelemetryBuffer)
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
}