Documentation ¶
Index ¶
- Constants
- Variables
- func AddInfraEndpointRules(client *OVSEndpointClient, infraIP net.IPNet, hostPort string) error
- func AddInfraVnetEndpoint(client *OVSEndpointClient) error
- func AddSnatEndpoint(client *OVSEndpointClient) error
- func AddSnatEndpointRules(client *OVSEndpointClient) error
- func AddStaticRoute(ip string, interfaceName string) error
- func ConfigureInfraVnetContainerInterface(client *OVSEndpointClient, infraIP net.IPNet) error
- func ConfigureSnatContainerInterface(client *OVSEndpointClient) error
- func ConstructEndpointID(containerID string, netNsPath string, ifName string) (string, string)
- func DeleteInfraVnetEndpoint(client *OVSEndpointClient, epID string) error
- func DeleteInfraVnetEndpointRules(client *OVSEndpointClient, ep *endpoint, hostPort string)
- func DeleteSnatEndpoint(client *OVSEndpointClient) error
- func DeleteSnatEndpointRules(client *OVSEndpointClient)
- func GetPodNameWithoutSuffix(podName string) string
- func MoveInfraEndpointToContainerNS(client *OVSEndpointClient, netnsPath string, nsID uintptr) error
- func MoveSnatEndpointToContainerNS(client *OVSEndpointClient, netnsPath string, nsID uintptr) error
- func NewInfraVnetClient(client *OVSEndpointClient, epID string)
- func NewSnatClient(client *OVSEndpointClient, snatBridgeIP string, localIP string, ...)
- func SetupInfraVnetContainerInterface(client *OVSEndpointClient) error
- func SetupSnatContainerInterface(client *OVSEndpointClient) error
- type DNSInfo
- type EndpointClient
- type EndpointInfo
- type LinuxBridgeClient
- func (client *LinuxBridgeClient) AddL2Rules(extIf *externalInterface) error
- func (client *LinuxBridgeClient) AddRoutes(nwInfo *NetworkInfo, interfaceName string) error
- func (client *LinuxBridgeClient) CreateBridge() error
- func (client *LinuxBridgeClient) DeleteBridge() error
- func (client *LinuxBridgeClient) DeleteL2Rules(extIf *externalInterface)
- func (client *LinuxBridgeClient) SetBridgeMasterToHostInterface() error
- func (client *LinuxBridgeClient) SetHairpinOnHostInterface(enable bool) error
- type LinuxBridgeEndpointClient
- func (client *LinuxBridgeEndpointClient) AddEndpointRules(epInfo *EndpointInfo) error
- func (client *LinuxBridgeEndpointClient) AddEndpoints(epInfo *EndpointInfo) error
- func (client *LinuxBridgeEndpointClient) ConfigureContainerInterfacesAndRoutes(epInfo *EndpointInfo) error
- func (client *LinuxBridgeEndpointClient) DeleteEndpointRules(ep *endpoint)
- func (client *LinuxBridgeEndpointClient) DeleteEndpoints(ep *endpoint) error
- func (client *LinuxBridgeEndpointClient) MoveEndpointsToContainerNS(epInfo *EndpointInfo, nsID uintptr) error
- func (client *LinuxBridgeEndpointClient) SetupContainerInterfaces(epInfo *EndpointInfo) error
- type MockNetworkManager
- func (nm *MockNetworkManager) AddExternalInterface(ifName string, subnet string) error
- func (nm *MockNetworkManager) AttachEndpoint(networkID string, endpointID string, sandboxKey string) (*endpoint, error)
- func (nm *MockNetworkManager) CreateEndpoint(networkID string, epInfo *EndpointInfo) error
- func (nm *MockNetworkManager) CreateNetwork(nwInfo *NetworkInfo) error
- func (nm *MockNetworkManager) DeleteEndpoint(networkID string, endpointID string) error
- func (nm *MockNetworkManager) DeleteNetwork(networkID string) error
- func (nm *MockNetworkManager) DetachEndpoint(networkID string, endpointID string) error
- func (nm *MockNetworkManager) GetEndpointInfo(networkID string, endpointID string) (*EndpointInfo, error)
- func (nm *MockNetworkManager) GetEndpointInfoBasedOnPODDetails(networkID string, podName string, podNameSpace string, ...) (*EndpointInfo, error)
- func (nm *MockNetworkManager) GetNetworkInfo(networkID string) (NetworkInfo, error)
- func (nm *MockNetworkManager) GetNumberOfEndpoints(ifName string, networkID string) int
- func (nm *MockNetworkManager) Initialize(config *common.PluginConfig, isRehydrationRequired bool) error
- func (nm *MockNetworkManager) SetupNetworkUsingState(networkMonitor *cnms.NetworkMonitor) error
- func (nm *MockNetworkManager) Uninitialize()
- func (nm *MockNetworkManager) UpdateEndpoint(networkID string, existingEpInfo *EndpointInfo, targetEpInfo *EndpointInfo) error
- type Namespace
- type NetworkClient
- type NetworkInfo
- type NetworkManager
- type OVSEndpointClient
- func (client *OVSEndpointClient) AddEndpointRules(epInfo *EndpointInfo) error
- func (client *OVSEndpointClient) AddEndpoints(epInfo *EndpointInfo) error
- func (client *OVSEndpointClient) ConfigureContainerInterfacesAndRoutes(epInfo *EndpointInfo) error
- func (client *OVSEndpointClient) DeleteEndpointRules(ep *endpoint)
- func (client *OVSEndpointClient) DeleteEndpoints(ep *endpoint) error
- func (client *OVSEndpointClient) MoveEndpointsToContainerNS(epInfo *EndpointInfo, nsID uintptr) error
- func (client *OVSEndpointClient) SetupContainerInterfaces(epInfo *EndpointInfo) error
- type OVSNetworkClient
- func (client *OVSNetworkClient) AddL2Rules(extIf *externalInterface) error
- func (client *OVSNetworkClient) AddRoutes(nwInfo *NetworkInfo, interfaceName string) error
- func (client *OVSNetworkClient) CreateBridge() error
- func (client *OVSNetworkClient) DeleteBridge() error
- func (client *OVSNetworkClient) DeleteL2Rules(extIf *externalInterface)
- func (client *OVSNetworkClient) SetBridgeMasterToHostInterface() error
- func (client *OVSNetworkClient) SetHairpinOnHostInterface(enable bool) error
- type RouteInfo
- type SubnetInfo
- type TransparentEndpointClient
- func (client *TransparentEndpointClient) AddEndpointRules(epInfo *EndpointInfo) error
- func (client *TransparentEndpointClient) AddEndpoints(epInfo *EndpointInfo) error
- func (client *TransparentEndpointClient) ConfigureContainerInterfacesAndRoutes(epInfo *EndpointInfo) error
- func (client *TransparentEndpointClient) DeleteEndpointRules(ep *endpoint)
- func (client *TransparentEndpointClient) DeleteEndpoints(ep *endpoint) error
- func (client *TransparentEndpointClient) MoveEndpointsToContainerNS(epInfo *EndpointInfo, nsID uintptr) error
- func (client *TransparentEndpointClient) SetupContainerInterfaces(epInfo *EndpointInfo) error
Constants ¶
const ( VlanIDKey = "VlanID" AzureCNS = "azure-cns" SNATIPKey = "NCPrimaryIPKey" HostGWKey = "HostGatewayIP" )
const ( SnatBridgeIPKey = "snatBridgeIP" LocalIPKey = "localIP" InfraVnetIPKey = "infraVnetIP" OptVethName = "vethname" )
const ( FAKE_GW_IP = "169.254.1.1/32" DEFAULT_GW = "0.0.0.0/0" )
const (
// ipv6 modes
IPV6Nat = "ipv6nat"
)
const (
InfraVnet = 0
)
Variables ¶
Functions ¶
func AddInfraEndpointRules ¶
func AddInfraEndpointRules(client *OVSEndpointClient, infraIP net.IPNet, hostPort string) error
func AddInfraVnetEndpoint ¶
func AddInfraVnetEndpoint(client *OVSEndpointClient) error
func AddSnatEndpoint ¶
func AddSnatEndpoint(client *OVSEndpointClient) error
func AddSnatEndpointRules ¶
func AddSnatEndpointRules(client *OVSEndpointClient) error
func AddStaticRoute ¶
func ConfigureInfraVnetContainerInterface ¶
func ConfigureInfraVnetContainerInterface(client *OVSEndpointClient, infraIP net.IPNet) error
func ConfigureSnatContainerInterface ¶
func ConfigureSnatContainerInterface(client *OVSEndpointClient) error
func ConstructEndpointID ¶
func DeleteInfraVnetEndpoint ¶
func DeleteInfraVnetEndpoint(client *OVSEndpointClient, epID string) error
func DeleteInfraVnetEndpointRules ¶
func DeleteInfraVnetEndpointRules(client *OVSEndpointClient, ep *endpoint, hostPort string)
func DeleteSnatEndpoint ¶
func DeleteSnatEndpoint(client *OVSEndpointClient) error
func DeleteSnatEndpointRules ¶
func DeleteSnatEndpointRules(client *OVSEndpointClient)
func GetPodNameWithoutSuffix ¶
func MoveInfraEndpointToContainerNS ¶
func MoveInfraEndpointToContainerNS(client *OVSEndpointClient, netnsPath string, nsID uintptr) error
func MoveSnatEndpointToContainerNS ¶
func MoveSnatEndpointToContainerNS(client *OVSEndpointClient, netnsPath string, nsID uintptr) error
func NewInfraVnetClient ¶
func NewInfraVnetClient(client *OVSEndpointClient, epID string)
func NewSnatClient ¶ added in v1.0.12
func NewSnatClient(client *OVSEndpointClient, snatBridgeIP string, localIP string, epInfo *EndpointInfo)
func SetupInfraVnetContainerInterface ¶
func SetupInfraVnetContainerInterface(client *OVSEndpointClient) error
func SetupSnatContainerInterface ¶
func SetupSnatContainerInterface(client *OVSEndpointClient) error
Types ¶
type EndpointClient ¶
type EndpointClient interface { AddEndpoints(epInfo *EndpointInfo) error AddEndpointRules(epInfo *EndpointInfo) error DeleteEndpointRules(ep *endpoint) MoveEndpointsToContainerNS(epInfo *EndpointInfo, nsID uintptr) error SetupContainerInterfaces(epInfo *EndpointInfo) error ConfigureContainerInterfacesAndRoutes(epInfo *EndpointInfo) error DeleteEndpoints(ep *endpoint) error }
type EndpointInfo ¶
type EndpointInfo struct { Id string ContainerID string NetNsPath string IfName string SandboxKey string IfIndex int MacAddress net.HardwareAddr DNS DNSInfo IPAddresses []net.IPNet IPsToRouteViaHost []string InfraVnetIP net.IPNet Routes []RouteInfo Policies []policy.Policy Gateways []net.IP EnableSnatOnHost bool EnableInfraVnet bool EnableMultiTenancy bool EnableSnatForDns bool AllowInboundFromHostToNC bool AllowInboundFromNCToHost bool NetworkContainerID string PODName string PODNameSpace string Data map[string]interface{} InfraVnetAddressSpace string SkipHotAttachEp bool IPV6Mode string VnetCidrs string ServiceCidrs string }
EndpointInfo contains read-only information about an endpoint.
type LinuxBridgeClient ¶
type LinuxBridgeClient struct {
// contains filtered or unexported fields
}
func NewLinuxBridgeClient ¶
func NewLinuxBridgeClient(bridgeName string, hostInterfaceName string, nwInfo NetworkInfo) *LinuxBridgeClient
func (*LinuxBridgeClient) AddL2Rules ¶
func (client *LinuxBridgeClient) AddL2Rules(extIf *externalInterface) error
func (*LinuxBridgeClient) AddRoutes ¶ added in v1.1.8
func (client *LinuxBridgeClient) AddRoutes(nwInfo *NetworkInfo, interfaceName string) error
func (*LinuxBridgeClient) CreateBridge ¶
func (client *LinuxBridgeClient) CreateBridge() error
func (*LinuxBridgeClient) DeleteBridge ¶
func (client *LinuxBridgeClient) DeleteBridge() error
func (*LinuxBridgeClient) DeleteL2Rules ¶
func (client *LinuxBridgeClient) DeleteL2Rules(extIf *externalInterface)
func (*LinuxBridgeClient) SetBridgeMasterToHostInterface ¶
func (client *LinuxBridgeClient) SetBridgeMasterToHostInterface() error
func (*LinuxBridgeClient) SetHairpinOnHostInterface ¶
func (client *LinuxBridgeClient) SetHairpinOnHostInterface(enable bool) error
type LinuxBridgeEndpointClient ¶
type LinuxBridgeEndpointClient struct {
// contains filtered or unexported fields
}
func NewLinuxBridgeEndpointClient ¶
func NewLinuxBridgeEndpointClient( extIf *externalInterface, hostVethName string, containerVethName string, mode string, ) *LinuxBridgeEndpointClient
func (*LinuxBridgeEndpointClient) AddEndpointRules ¶
func (client *LinuxBridgeEndpointClient) AddEndpointRules(epInfo *EndpointInfo) error
func (*LinuxBridgeEndpointClient) AddEndpoints ¶
func (client *LinuxBridgeEndpointClient) AddEndpoints(epInfo *EndpointInfo) error
func (*LinuxBridgeEndpointClient) ConfigureContainerInterfacesAndRoutes ¶
func (client *LinuxBridgeEndpointClient) ConfigureContainerInterfacesAndRoutes(epInfo *EndpointInfo) error
func (*LinuxBridgeEndpointClient) DeleteEndpointRules ¶
func (client *LinuxBridgeEndpointClient) DeleteEndpointRules(ep *endpoint)
func (*LinuxBridgeEndpointClient) DeleteEndpoints ¶
func (client *LinuxBridgeEndpointClient) DeleteEndpoints(ep *endpoint) error
func (*LinuxBridgeEndpointClient) MoveEndpointsToContainerNS ¶
func (client *LinuxBridgeEndpointClient) MoveEndpointsToContainerNS(epInfo *EndpointInfo, nsID uintptr) error
func (*LinuxBridgeEndpointClient) SetupContainerInterfaces ¶
func (client *LinuxBridgeEndpointClient) SetupContainerInterfaces(epInfo *EndpointInfo) error
type MockNetworkManager ¶
type MockNetworkManager struct { NetworkInfo map[string]*NetworkInfo EndpointInfo map[string]*EndpointInfo }
MockNetworkManager is a mock structure for Network Manager
func NewMockNetworkmanager ¶
func NewMockNetworkmanager() *MockNetworkManager
NewMockNetworkmanager returns a new mock
func (*MockNetworkManager) AddExternalInterface ¶
func (nm *MockNetworkManager) AddExternalInterface(ifName string, subnet string) error
AddExternalInterface mock
func (*MockNetworkManager) AttachEndpoint ¶
func (nm *MockNetworkManager) AttachEndpoint(networkID string, endpointID string, sandboxKey string) (*endpoint, error)
AttachEndpoint mock
func (*MockNetworkManager) CreateEndpoint ¶
func (nm *MockNetworkManager) CreateEndpoint(networkID string, epInfo *EndpointInfo) error
CreateEndpoint mock
func (*MockNetworkManager) CreateNetwork ¶
func (nm *MockNetworkManager) CreateNetwork(nwInfo *NetworkInfo) error
CreateNetwork mock
func (*MockNetworkManager) DeleteEndpoint ¶
func (nm *MockNetworkManager) DeleteEndpoint(networkID string, endpointID string) error
DeleteEndpoint mock
func (*MockNetworkManager) DeleteNetwork ¶
func (nm *MockNetworkManager) DeleteNetwork(networkID string) error
DeleteNetwork mock
func (*MockNetworkManager) DetachEndpoint ¶
func (nm *MockNetworkManager) DetachEndpoint(networkID string, endpointID string) error
DetachEndpoint mock
func (*MockNetworkManager) GetEndpointInfo ¶
func (nm *MockNetworkManager) GetEndpointInfo(networkID string, endpointID string) (*EndpointInfo, error)
GetEndpointInfo mock
func (*MockNetworkManager) GetEndpointInfoBasedOnPODDetails ¶
func (nm *MockNetworkManager) GetEndpointInfoBasedOnPODDetails(networkID string, podName string, podNameSpace string, doExactMatchForPodName bool) (*EndpointInfo, error)
GetEndpointInfoBasedOnPODDetails mock
func (*MockNetworkManager) GetNetworkInfo ¶
func (nm *MockNetworkManager) GetNetworkInfo(networkID string) (NetworkInfo, error)
GetNetworkInfo mock
func (*MockNetworkManager) GetNumberOfEndpoints ¶
func (nm *MockNetworkManager) GetNumberOfEndpoints(ifName string, networkID string) int
GetNumberOfEndpoints mock
func (*MockNetworkManager) Initialize ¶
func (nm *MockNetworkManager) Initialize(config *common.PluginConfig, isRehydrationRequired bool) error
Initialize mock
func (*MockNetworkManager) SetupNetworkUsingState ¶
func (nm *MockNetworkManager) SetupNetworkUsingState(networkMonitor *cnms.NetworkMonitor) error
SetupNetworkUsingState mock
func (*MockNetworkManager) Uninitialize ¶
func (nm *MockNetworkManager) Uninitialize()
Uninitialize mock
func (*MockNetworkManager) UpdateEndpoint ¶
func (nm *MockNetworkManager) UpdateEndpoint(networkID string, existingEpInfo *EndpointInfo, targetEpInfo *EndpointInfo) error
UpdateEndpoint mock
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace represents a network namespace.
func GetCurrentThreadNamespace ¶ added in v1.0.0
GetCurrentThreadNamespace returns the caller thread's current namespace.
func OpenNamespace ¶ added in v1.0.0
OpenNamespace creates a new namespace object for the given netns path.
type NetworkClient ¶
type NetworkInfo ¶
type NetworkInfo struct { MasterIfName string Id string Mode string Subnets []SubnetInfo PodSubnet SubnetInfo DNS DNSInfo Policies []policy.Policy BridgeName string EnableSnatOnHost bool NetNs string Options map[string]interface{} DisableHairpinOnHostInterface bool IPV6Mode string IPAMType string ServiceCidrs string }
NetworkInfo contains read-only information about a container network.
type NetworkManager ¶
type NetworkManager interface { Initialize(config *common.PluginConfig, isRehydrationRequired bool) error Uninitialize() AddExternalInterface(ifName string, subnet string) error CreateNetwork(nwInfo *NetworkInfo) error DeleteNetwork(networkId string) error GetNetworkInfo(networkId string) (NetworkInfo, error) CreateEndpoint(networkId string, epInfo *EndpointInfo) error DeleteEndpoint(networkId string, endpointId string) error GetEndpointInfo(networkId string, endpointId string) (*EndpointInfo, error) GetEndpointInfoBasedOnPODDetails(networkId string, podName string, podNameSpace string, doExactMatchForPodName bool) (*EndpointInfo, error) AttachEndpoint(networkId string, endpointId string, sandboxKey string) (*endpoint, error) DetachEndpoint(networkId string, endpointId string) error UpdateEndpoint(networkId string, existingEpInfo *EndpointInfo, targetEpInfo *EndpointInfo) error GetNumberOfEndpoints(ifName string, networkId string) int SetupNetworkUsingState(networkMonitor *cnms.NetworkMonitor) error }
NetworkManager API.
func NewNetworkManager ¶
func NewNetworkManager() (NetworkManager, error)
Creates a new network manager.
type OVSEndpointClient ¶
type OVSEndpointClient struct {
// contains filtered or unexported fields
}
func NewOVSEndpointClient ¶
func NewOVSEndpointClient( nw *network, epInfo *EndpointInfo, hostVethName string, containerVethName string, vlanid int, localIP string) *OVSEndpointClient
func (*OVSEndpointClient) AddEndpointRules ¶
func (client *OVSEndpointClient) AddEndpointRules(epInfo *EndpointInfo) error
func (*OVSEndpointClient) AddEndpoints ¶
func (client *OVSEndpointClient) AddEndpoints(epInfo *EndpointInfo) error
func (*OVSEndpointClient) ConfigureContainerInterfacesAndRoutes ¶
func (client *OVSEndpointClient) ConfigureContainerInterfacesAndRoutes(epInfo *EndpointInfo) error
func (*OVSEndpointClient) DeleteEndpointRules ¶
func (client *OVSEndpointClient) DeleteEndpointRules(ep *endpoint)
func (*OVSEndpointClient) DeleteEndpoints ¶
func (client *OVSEndpointClient) DeleteEndpoints(ep *endpoint) error
func (*OVSEndpointClient) MoveEndpointsToContainerNS ¶
func (client *OVSEndpointClient) MoveEndpointsToContainerNS(epInfo *EndpointInfo, nsID uintptr) error
func (*OVSEndpointClient) SetupContainerInterfaces ¶
func (client *OVSEndpointClient) SetupContainerInterfaces(epInfo *EndpointInfo) error
type OVSNetworkClient ¶
type OVSNetworkClient struct {
// contains filtered or unexported fields
}
func NewOVSClient ¶
func NewOVSClient(bridgeName, hostInterfaceName string) *OVSNetworkClient
func (*OVSNetworkClient) AddL2Rules ¶
func (client *OVSNetworkClient) AddL2Rules(extIf *externalInterface) error
func (*OVSNetworkClient) AddRoutes ¶
func (client *OVSNetworkClient) AddRoutes(nwInfo *NetworkInfo, interfaceName string) error
func (*OVSNetworkClient) CreateBridge ¶
func (client *OVSNetworkClient) CreateBridge() error
func (*OVSNetworkClient) DeleteBridge ¶
func (client *OVSNetworkClient) DeleteBridge() error
func (*OVSNetworkClient) DeleteL2Rules ¶
func (client *OVSNetworkClient) DeleteL2Rules(extIf *externalInterface)
func (*OVSNetworkClient) SetBridgeMasterToHostInterface ¶
func (client *OVSNetworkClient) SetBridgeMasterToHostInterface() error
func (*OVSNetworkClient) SetHairpinOnHostInterface ¶
func (client *OVSNetworkClient) SetHairpinOnHostInterface(enable bool) error
type RouteInfo ¶
type RouteInfo struct { Dst net.IPNet Src net.IP Gw net.IP Protocol int DevName string Scope int Priority int }
RouteInfo contains information about an IP route.
type SubnetInfo ¶
type SubnetInfo struct { Family platform.AddressFamily Prefix net.IPNet Gateway net.IP PrimaryIP net.IP }
SubnetInfo contains subnet information for a container network.
type TransparentEndpointClient ¶
type TransparentEndpointClient struct {
// contains filtered or unexported fields
}
func NewTransparentEndpointClient ¶
func NewTransparentEndpointClient( extIf *externalInterface, hostVethName string, containerVethName string, mode string, ) *TransparentEndpointClient
func (*TransparentEndpointClient) AddEndpointRules ¶
func (client *TransparentEndpointClient) AddEndpointRules(epInfo *EndpointInfo) error
func (*TransparentEndpointClient) AddEndpoints ¶
func (client *TransparentEndpointClient) AddEndpoints(epInfo *EndpointInfo) error
func (*TransparentEndpointClient) ConfigureContainerInterfacesAndRoutes ¶
func (client *TransparentEndpointClient) ConfigureContainerInterfacesAndRoutes(epInfo *EndpointInfo) error
func (*TransparentEndpointClient) DeleteEndpointRules ¶
func (client *TransparentEndpointClient) DeleteEndpointRules(ep *endpoint)
func (*TransparentEndpointClient) DeleteEndpoints ¶
func (client *TransparentEndpointClient) DeleteEndpoints(ep *endpoint) error
func (*TransparentEndpointClient) MoveEndpointsToContainerNS ¶
func (client *TransparentEndpointClient) MoveEndpointsToContainerNS(epInfo *EndpointInfo, nsID uintptr) error
func (*TransparentEndpointClient) SetupContainerInterfaces ¶
func (client *TransparentEndpointClient) SetupContainerInterfaces(epInfo *EndpointInfo) error
Source Files ¶
- api.go
- bridge_endpointclient_linux.go
- bridge_networkclient_linux.go
- endpoint.go
- endpoint_linux.go
- manager.go
- manager_mock.go
- monitor_linux.go
- namespace_linux.go
- network.go
- network_linux.go
- ovs_endpoint_infraroute_linux.go
- ovs_endpoint_snatroute_linux.go
- ovs_endpointclient_linux.go
- ovs_networkclient_linux.go
- transparent_endpointclient_linux.go