Documentation ¶
Index ¶
- Variables
- func SetupNetworkInterfacesPhase1(vmi *v1.VirtualMachineInstance, pid int) error
- func SetupNetworkInterfacesPhase2(vmi *v1.VirtualMachineInstance, domain *api.Domain) error
- type BindMechanism
- type BridgePodInterface
- type CriticalNetworkError
- type MasqueradePodInterface
- type MockBindMechanism
- type MockNetworkHandler
- func (_m *MockNetworkHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error
- func (_m *MockNetworkHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error
- func (_m *MockNetworkHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error)
- func (_m *MockNetworkHandler) ConfigureIpv6Forwarding() error
- func (_m *MockNetworkHandler) EXPECT() *_MockNetworkHandlerRecorder
- func (_m *MockNetworkHandler) GenerateRandomMac() (net.HardwareAddr, error)
- func (_m *MockNetworkHandler) GetHostAndGwAddressesFromCIDR(s string) (string, string, error)
- func (_m *MockNetworkHandler) GetMacDetails(iface string) (net.HardwareAddr, error)
- func (_m *MockNetworkHandler) GetNFTIPString(proto iptables.Protocol) string
- func (_m *MockNetworkHandler) HasNatIptables(proto iptables.Protocol) bool
- func (_m *MockNetworkHandler) IptablesAppendRule(proto iptables.Protocol, table string, chain string, rulespec ...string) error
- func (_m *MockNetworkHandler) IptablesNewChain(proto iptables.Protocol, table string, chain string) error
- func (_m *MockNetworkHandler) IsIpv6Enabled() bool
- func (_m *MockNetworkHandler) LinkAdd(link netlink.Link) error
- func (_m *MockNetworkHandler) LinkByName(name string) (netlink.Link, error)
- func (_m *MockNetworkHandler) LinkSetDown(link netlink.Link) error
- func (_m *MockNetworkHandler) LinkSetLearningOff(link netlink.Link) error
- func (_m *MockNetworkHandler) LinkSetMaster(link netlink.Link, master *netlink.Bridge) error
- func (_m *MockNetworkHandler) LinkSetUp(link netlink.Link) error
- func (_m *MockNetworkHandler) NftablesAppendRule(proto iptables.Protocol, table string, chain string, rulespec ...string) error
- func (_m *MockNetworkHandler) NftablesLoad(fnName string) error
- func (_m *MockNetworkHandler) NftablesNewChain(proto iptables.Protocol, table string, chain string) error
- func (_m *MockNetworkHandler) ParseAddr(s string) (*netlink.Addr, error)
- func (_m *MockNetworkHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error)
- func (_m *MockNetworkHandler) SetRandomMac(iface string) (net.HardwareAddr, error)
- func (_m *MockNetworkHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr, bridgeInterfaceName string, ...) error
- type MockNetworkInterface
- func (_m *MockNetworkInterface) EXPECT() *_MockNetworkInterfaceRecorder
- func (_m *MockNetworkInterface) PlugPhase1(vmi *v1.VirtualMachineInstance, iface *v1.Interface, network *v1.Network, ...) error
- func (_m *MockNetworkInterface) PlugPhase2(vmi *v1.VirtualMachineInstance, iface *v1.Interface, network *v1.Network, ...) error
- func (_m *MockNetworkInterface) Unplug()
- type NetworkHandler
- type NetworkInterface
- type NetworkUtilsHandler
- func (h *NetworkUtilsHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error
- func (h *NetworkUtilsHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error
- func (h *NetworkUtilsHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error)
- func (h *NetworkUtilsHandler) ConfigureIpv6Forwarding() error
- func (h *NetworkUtilsHandler) GenerateRandomMac() (net.HardwareAddr, error)
- func (h *NetworkUtilsHandler) GetHostAndGwAddressesFromCIDR(s string) (string, string, error)
- func (h *NetworkUtilsHandler) GetMacDetails(iface string) (net.HardwareAddr, error)
- func (h *NetworkUtilsHandler) GetNFTIPString(proto iptables.Protocol) string
- func (h *NetworkUtilsHandler) HasNatIptables(proto iptables.Protocol) bool
- func (h *NetworkUtilsHandler) IptablesAppendRule(proto iptables.Protocol, table, chain string, rulespec ...string) error
- func (h *NetworkUtilsHandler) IptablesNewChain(proto iptables.Protocol, table, chain string) error
- func (h *NetworkUtilsHandler) IsIpv6Enabled() bool
- func (h *NetworkUtilsHandler) LinkAdd(link netlink.Link) error
- func (h *NetworkUtilsHandler) LinkByName(name string) (netlink.Link, error)
- func (h *NetworkUtilsHandler) LinkSetDown(link netlink.Link) error
- func (h *NetworkUtilsHandler) LinkSetLearningOff(link netlink.Link) error
- func (h *NetworkUtilsHandler) LinkSetMaster(link netlink.Link, master *netlink.Bridge) error
- func (h *NetworkUtilsHandler) LinkSetUp(link netlink.Link) error
- func (h *NetworkUtilsHandler) NftablesAppendRule(proto iptables.Protocol, table, chain string, rulespec ...string) error
- func (h *NetworkUtilsHandler) NftablesLoad(fnName string) error
- func (h *NetworkUtilsHandler) NftablesNewChain(proto iptables.Protocol, table, chain string) error
- func (h *NetworkUtilsHandler) ParseAddr(s string) (*netlink.Addr, error)
- func (h *NetworkUtilsHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error)
- func (h *NetworkUtilsHandler) SetRandomMac(iface string) (net.HardwareAddr, error)
- func (h *NetworkUtilsHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr, bridgeInterfaceName string, ...) error
- type PodCacheInterface
- type PodInterface
- type SlirpPodInterface
- type VIF
Constants ¶
This section is empty.
Variables ¶
var DHCPServer = dhcp.SingleClientDHCPServer
var NetworkInterfaceFactory = getNetworkClass
var SetupPodNetworkPhase1 = SetupNetworkInterfacesPhase1
Allow mocking for tests
var SetupPodNetworkPhase2 = SetupNetworkInterfacesPhase2
Functions ¶
func SetupNetworkInterfacesPhase1 ¶ added in v0.27.0
func SetupNetworkInterfacesPhase1(vmi *v1.VirtualMachineInstance, pid int) error
func SetupNetworkInterfacesPhase2 ¶ added in v0.27.0
func SetupNetworkInterfacesPhase2(vmi *v1.VirtualMachineInstance, domain *api.Domain) error
Types ¶
type BindMechanism ¶ added in v0.6.0
type BindMechanism interface {
// contains filtered or unexported methods
}
type BridgePodInterface ¶ added in v0.6.0
type BridgePodInterface struct {
// contains filtered or unexported fields
}
type CriticalNetworkError ¶ added in v0.31.0
type CriticalNetworkError struct {
Msg string
}
func (*CriticalNetworkError) Error ¶ added in v0.31.0
func (e *CriticalNetworkError) Error() string
type MasqueradePodInterface ¶ added in v0.11.1
type MasqueradePodInterface struct {
// contains filtered or unexported fields
}
type MockBindMechanism ¶ added in v0.6.0
type MockBindMechanism struct {
// contains filtered or unexported fields
}
Mock of BindMechanism interface
func NewMockBindMechanism ¶ added in v0.6.0
func NewMockBindMechanism(ctrl *gomock.Controller) *MockBindMechanism
func (*MockBindMechanism) EXPECT ¶ added in v0.6.0
func (_m *MockBindMechanism) EXPECT() *_MockBindMechanismRecorder
type MockNetworkHandler ¶
type MockNetworkHandler struct {
// contains filtered or unexported fields
}
Mock of NetworkHandler interface
func NewMockNetworkHandler ¶
func NewMockNetworkHandler(ctrl *gomock.Controller) *MockNetworkHandler
func (*MockNetworkHandler) ConfigureIpv6Forwarding ¶ added in v0.29.0
func (_m *MockNetworkHandler) ConfigureIpv6Forwarding() error
func (*MockNetworkHandler) EXPECT ¶
func (_m *MockNetworkHandler) EXPECT() *_MockNetworkHandlerRecorder
func (*MockNetworkHandler) GenerateRandomMac ¶ added in v0.11.1
func (_m *MockNetworkHandler) GenerateRandomMac() (net.HardwareAddr, error)
func (*MockNetworkHandler) GetHostAndGwAddressesFromCIDR ¶ added in v0.11.1
func (_m *MockNetworkHandler) GetHostAndGwAddressesFromCIDR(s string) (string, string, error)
func (*MockNetworkHandler) GetMacDetails ¶
func (_m *MockNetworkHandler) GetMacDetails(iface string) (net.HardwareAddr, error)
func (*MockNetworkHandler) GetNFTIPString ¶ added in v0.29.0
func (_m *MockNetworkHandler) GetNFTIPString(proto iptables.Protocol) string
func (*MockNetworkHandler) HasNatIptables ¶ added in v0.29.0
func (_m *MockNetworkHandler) HasNatIptables(proto iptables.Protocol) bool
func (*MockNetworkHandler) IptablesAppendRule ¶ added in v0.11.1
func (*MockNetworkHandler) IptablesNewChain ¶ added in v0.11.1
func (*MockNetworkHandler) IsIpv6Enabled ¶ added in v0.29.0
func (_m *MockNetworkHandler) IsIpv6Enabled() bool
func (*MockNetworkHandler) LinkByName ¶
func (_m *MockNetworkHandler) LinkByName(name string) (netlink.Link, error)
func (*MockNetworkHandler) LinkSetDown ¶
func (_m *MockNetworkHandler) LinkSetDown(link netlink.Link) error
func (*MockNetworkHandler) LinkSetLearningOff ¶ added in v0.9.2
func (_m *MockNetworkHandler) LinkSetLearningOff(link netlink.Link) error
func (*MockNetworkHandler) LinkSetMaster ¶ added in v0.11.1
func (*MockNetworkHandler) LinkSetUp ¶
func (_m *MockNetworkHandler) LinkSetUp(link netlink.Link) error
func (*MockNetworkHandler) NftablesAppendRule ¶ added in v0.20.0
func (*MockNetworkHandler) NftablesLoad ¶ added in v0.20.0
func (_m *MockNetworkHandler) NftablesLoad(fnName string) error
func (*MockNetworkHandler) NftablesNewChain ¶ added in v0.20.0
func (*MockNetworkHandler) ParseAddr ¶
func (_m *MockNetworkHandler) ParseAddr(s string) (*netlink.Addr, error)
func (*MockNetworkHandler) SetRandomMac ¶ added in v0.6.0
func (_m *MockNetworkHandler) SetRandomMac(iface string) (net.HardwareAddr, error)
func (*MockNetworkHandler) StartDHCP ¶
func (_m *MockNetworkHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr, bridgeInterfaceName string, dhcpOptions *v1.DHCPOptions) error
type MockNetworkInterface ¶ added in v0.6.0
type MockNetworkInterface struct {
// contains filtered or unexported fields
}
Mock of NetworkInterface interface
func NewMockNetworkInterface ¶ added in v0.6.0
func NewMockNetworkInterface(ctrl *gomock.Controller) *MockNetworkInterface
func (*MockNetworkInterface) EXPECT ¶ added in v0.6.0
func (_m *MockNetworkInterface) EXPECT() *_MockNetworkInterfaceRecorder
func (*MockNetworkInterface) PlugPhase1 ¶ added in v0.27.0
func (_m *MockNetworkInterface) PlugPhase1(vmi *v1.VirtualMachineInstance, iface *v1.Interface, network *v1.Network, podInterfaceName string, pid int) error
func (*MockNetworkInterface) PlugPhase2 ¶ added in v0.27.0
func (*MockNetworkInterface) Unplug ¶ added in v0.6.0
func (_m *MockNetworkInterface) Unplug()
type NetworkHandler ¶
type NetworkHandler interface { LinkByName(name string) (netlink.Link, error) AddrList(link netlink.Link, family int) ([]netlink.Addr, error) RouteList(link netlink.Link, family int) ([]netlink.Route, error) AddrDel(link netlink.Link, addr *netlink.Addr) error AddrAdd(link netlink.Link, addr *netlink.Addr) error LinkSetDown(link netlink.Link) error LinkSetUp(link netlink.Link) error LinkAdd(link netlink.Link) error LinkSetLearningOff(link netlink.Link) error ParseAddr(s string) (*netlink.Addr, error) GetHostAndGwAddressesFromCIDR(s string) (string, string, error) SetRandomMac(iface string) (net.HardwareAddr, error) GenerateRandomMac() (net.HardwareAddr, error) GetMacDetails(iface string) (net.HardwareAddr, error) LinkSetMaster(link netlink.Link, master *netlink.Bridge) error StartDHCP(nic *VIF, serverAddr *netlink.Addr, bridgeInterfaceName string, dhcpOptions *v1.DHCPOptions) error HasNatIptables(proto iptables.Protocol) bool IsIpv6Enabled() bool ConfigureIpv6Forwarding() error IptablesNewChain(proto iptables.Protocol, table, chain string) error IptablesAppendRule(proto iptables.Protocol, table, chain string, rulespec ...string) error NftablesNewChain(proto iptables.Protocol, table, chain string) error NftablesAppendRule(proto iptables.Protocol, table, chain string, rulespec ...string) error NftablesLoad(fnName string) error GetNFTIPString(proto iptables.Protocol) string }
var Handler NetworkHandler
type NetworkInterface ¶ added in v0.6.0
type NetworkInterface interface { PlugPhase1(vmi *v1.VirtualMachineInstance, iface *v1.Interface, network *v1.Network, podInterfaceName string, pid int) error PlugPhase2(vmi *v1.VirtualMachineInstance, iface *v1.Interface, network *v1.Network, domain *api.Domain, podInterfaceName string) error Unplug() }
Network configuration is split into two parts, or phases, each executed in a different context. Phase1 is run by virt-handler and heavylifts most configuration steps. Phase2 is run by virt-launcher in the pod context and completes steps left out of virt-handler. The reason to have a separate phase for virt-launcher and not just have all the work done by virt-handler is because there is no ready solution for DHCP server startup in virt-handler context yet. This is a temporary limitation and the split is expected to go once the final gap is closed. Moving all configuration steps into virt-handler will also allow to downgrade privileges for virt-launcher, specifically, to remove NET_ADMIN capability. Future patches should address that. See: https://github.com/kubevirt/kubevirt/issues/3085
type NetworkUtilsHandler ¶
type NetworkUtilsHandler struct{}
func (*NetworkUtilsHandler) ConfigureIpv6Forwarding ¶ added in v0.29.0
func (h *NetworkUtilsHandler) ConfigureIpv6Forwarding() error
func (*NetworkUtilsHandler) GenerateRandomMac ¶ added in v0.11.1
func (h *NetworkUtilsHandler) GenerateRandomMac() (net.HardwareAddr, error)
Generate a random mac for interface Avoid MAC address starting with reserved value 0xFE (https://github.com/kubevirt/kubevirt/issues/1494)
func (*NetworkUtilsHandler) GetHostAndGwAddressesFromCIDR ¶ added in v0.11.1
func (h *NetworkUtilsHandler) GetHostAndGwAddressesFromCIDR(s string) (string, string, error)
func (*NetworkUtilsHandler) GetMacDetails ¶
func (h *NetworkUtilsHandler) GetMacDetails(iface string) (net.HardwareAddr, error)
GetMacDetails from an interface
func (*NetworkUtilsHandler) GetNFTIPString ¶ added in v0.29.0
func (h *NetworkUtilsHandler) GetNFTIPString(proto iptables.Protocol) string
func (*NetworkUtilsHandler) HasNatIptables ¶ added in v0.29.0
func (h *NetworkUtilsHandler) HasNatIptables(proto iptables.Protocol) bool
func (*NetworkUtilsHandler) IptablesAppendRule ¶ added in v0.11.1
func (*NetworkUtilsHandler) IptablesNewChain ¶ added in v0.11.1
func (h *NetworkUtilsHandler) IptablesNewChain(proto iptables.Protocol, table, chain string) error
func (*NetworkUtilsHandler) IsIpv6Enabled ¶ added in v0.29.0
func (h *NetworkUtilsHandler) IsIpv6Enabled() bool
func (*NetworkUtilsHandler) LinkAdd ¶
func (h *NetworkUtilsHandler) LinkAdd(link netlink.Link) error
func (*NetworkUtilsHandler) LinkByName ¶
func (h *NetworkUtilsHandler) LinkByName(name string) (netlink.Link, error)
func (*NetworkUtilsHandler) LinkSetDown ¶
func (h *NetworkUtilsHandler) LinkSetDown(link netlink.Link) error
func (*NetworkUtilsHandler) LinkSetLearningOff ¶ added in v0.9.2
func (h *NetworkUtilsHandler) LinkSetLearningOff(link netlink.Link) error
func (*NetworkUtilsHandler) LinkSetMaster ¶ added in v0.11.1
func (*NetworkUtilsHandler) LinkSetUp ¶
func (h *NetworkUtilsHandler) LinkSetUp(link netlink.Link) error
func (*NetworkUtilsHandler) NftablesAppendRule ¶ added in v0.20.0
func (*NetworkUtilsHandler) NftablesLoad ¶ added in v0.20.0
func (h *NetworkUtilsHandler) NftablesLoad(fnName string) error
func (*NetworkUtilsHandler) NftablesNewChain ¶ added in v0.20.0
func (h *NetworkUtilsHandler) NftablesNewChain(proto iptables.Protocol, table, chain string) error
func (*NetworkUtilsHandler) ParseAddr ¶
func (h *NetworkUtilsHandler) ParseAddr(s string) (*netlink.Addr, error)
func (*NetworkUtilsHandler) SetRandomMac ¶ added in v0.6.0
func (h *NetworkUtilsHandler) SetRandomMac(iface string) (net.HardwareAddr, error)
SetRandomMac changes the MAC address for a given interface to a randomly generated, preserving the vendor prefix
func (*NetworkUtilsHandler) StartDHCP ¶
func (h *NetworkUtilsHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr, bridgeInterfaceName string, dhcpOptions *v1.DHCPOptions) error
type PodCacheInterface ¶ added in v0.32.0
type PodInterface ¶ added in v0.6.0
type PodInterface struct{}
func (*PodInterface) PlugPhase1 ¶ added in v0.27.0
func (l *PodInterface) PlugPhase1(vmi *v1.VirtualMachineInstance, iface *v1.Interface, network *v1.Network, podInterfaceName string, pid int) error
func (*PodInterface) PlugPhase2 ¶ added in v0.27.0
func (*PodInterface) Unplug ¶ added in v0.6.0
func (l *PodInterface) Unplug()
type SlirpPodInterface ¶ added in v0.7.0
type SlirpPodInterface struct {
// contains filtered or unexported fields
}