Documentation
¶
Index ¶
- Constants
- func BridgeToNic(bridge string) error
- func FetchIfMacWindows(interfaceName string) (string, error)
- func GatewayCleanup(nodeName string) error
- func GatewayInit(clusterIPSubnet []string, ...) error
- func GenerateMac() string
- func GetExec() kexec.Interface
- func GetK8sClusterRouter() (string, error)
- func GetK8sMgmtIntfName(nodeName string) string
- func GetNicName(brName string) string
- func IsServiceIPSet(service *kapi.Service) bool
- func NewClientset(conf *config.KubernetesConfig) (*kubernetes.Clientset, error)
- func NextIP(ip net.IP) net.IP
- func NicToBridge(iface string) (string, error)
- func RawExec(cmdPath string, args ...string) (string, string, error)
- func RunIP(args ...string) (string, string, error)
- func RunNetsh(args ...string) (string, string, error)
- func RunOVNNbctl(args ...string) (string, string, error)
- func RunOVNNbctlUnix(args ...string) (string, string, error)
- func RunOVNNbctlWithTimeout(timeout int, args ...string) (string, string, error)
- func RunOVSOfctl(args ...string) (string, string, error)
- func RunOVSVsctl(args ...string) (string, string, error)
- func RunPowershell(args ...string) (string, string, error)
- func RunRoute(args ...string) (string, string, error)
- func SetExec(exec kexec.Interface) error
- func StringArg(context *cli.Context, name string) (string, error)
- type FakeIPTables
- func (f *FakeIPTables) Exists(tableName, chainName string, rulespec ...string) (bool, error)
- func (f *FakeIPTables) Insert(tableName, chainName string, pos int, rulespec ...string) error
- func (f *FakeIPTables) ListChains(tableName string) ([]string, error)
- func (f *FakeIPTables) MatchState(tables map[string]FakeTable) error
- func (f *FakeIPTables) NewChain(tableName, chainName string) error
- type FakeTable
- type IPTablesHelper
Constants ¶
const ( // PhysicalNetworkName is the name that maps to an OVS bridge that provides // access to physical/external network PhysicalNetworkName = "physnet" )
Variables ¶
This section is empty.
Functions ¶
func BridgeToNic ¶
BridgeToNic moves the IP address and routes of internal port of the bridge to underlying NIC interface and deletes the OVS bridge.
func FetchIfMacWindows ¶
FetchIfMacWindows gets the mac of the interfaceName via powershell commands There is a known issue with OVS not correctly picking up the physical network interface MAC address.
func GatewayCleanup ¶
GatewayCleanup removes all the NB DB objects created for a node's gateway
func GatewayInit ¶
func GatewayInit(clusterIPSubnet []string, nodeName, nicIP, physicalInterface, bridgeInterface, defaultGW, rampoutIPSubnet string, gatewayVLANId uint, gatewayLBEnable bool) error
GatewayInit creates a gateway router for the local chassis.
func GetExec ¶
GetExec returns the exec interface which can be used for running commands directly. Only use for passing an exec interface into pkg/config which cannot call this function directly because this module imports pkg/config already.
func GetK8sClusterRouter ¶
GetK8sClusterRouter returns back the OVN distibuted router
func GetK8sMgmtIntfName ¶
GetK8sMgmtIntfName returns the correct length interface name to be used as an OVS internal port on the node
func GetNicName ¶
GetNicName returns the physical NIC name, given an OVS bridge name configured by NicToBridge()
func IsServiceIPSet ¶
IsServiceIPSet checks if the service is an headless service or not
func NewClientset ¶
func NewClientset(conf *config.KubernetesConfig) (*kubernetes.Clientset, error)
NewClientset creates a Kubernetes clientset from either a kubeconfig, TLS properties, or an apiserver URL
func NicToBridge ¶
NicToBridge creates a OVS bridge for the 'iface' and also moves the IP address and routes of 'iface' to OVS bridge.
func RawExec ¶
RawExec runs the given command via the exec interface. Should only be used for early calls before configuration is read.
func RunOVNNbctl ¶
RunOVNNbctl runs a command via ovn-nbctl.
func RunOVNNbctlUnix ¶
RunOVNNbctlUnix runs command via ovn-nbctl, with ovn-nbctl using the unix domain sockets to connect to the ovsdb-server backing the OVN NB database.
func RunOVNNbctlWithTimeout ¶
RunOVNNbctlWithTimeout runs command via ovn-nbctl with a specific timeout
func RunOVSOfctl ¶
RunOVSOfctl runs a command via ovs-ofctl.
func RunOVSVsctl ¶
RunOVSVsctl runs a command via ovs-vsctl.
func RunPowershell ¶
RunPowershell runs a command via the Windows powershell utility
Types ¶
type FakeIPTables ¶
type FakeIPTables struct {
// contains filtered or unexported fields
}
FakeIPTables is a mock implementation of go-iptables
func NewFakeWithProtocol ¶
func NewFakeWithProtocol(proto iptables.Protocol) (*FakeIPTables, error)
NewFakeWithProtocol creates a new IPTablesHelper wrapping a mock iptables implementation that can be used in unit tests
func (*FakeIPTables) Exists ¶
func (f *FakeIPTables) Exists(tableName, chainName string, rulespec ...string) (bool, error)
Exists checks if given rulespec in specified table/chain exists
func (*FakeIPTables) Insert ¶
func (f *FakeIPTables) Insert(tableName, chainName string, pos int, rulespec ...string) error
Insert inserts a rule into the specified table/chain
func (*FakeIPTables) ListChains ¶
func (f *FakeIPTables) ListChains(tableName string) ([]string, error)
ListChains returns the names of all chains in the table
func (*FakeIPTables) MatchState ¶
func (f *FakeIPTables) MatchState(tables map[string]FakeTable) error
MatchState matches the expected state against the actual rules code under test added to iptables
func (*FakeIPTables) NewChain ¶
func (f *FakeIPTables) NewChain(tableName, chainName string) error
NewChain creates a new chain in the specified table
type FakeTable ¶
FakeTable represents a mock iptables table and can be used for unit tests to verify that the code creates the expected rules
type IPTablesHelper ¶
type IPTablesHelper interface { // ListChains returns the names of all chains in the table ListChains(string) ([]string, error) // NewChain creates a new chain in the specified table NewChain(string, string) error // Exists checks if given rulespec in specified table/chain exists Exists(string, string, ...string) (bool, error) // Insert inserts a rule into the specified table/chain Insert(string, string, int, ...string) error }
IPTablesHelper is an interface that wraps go-iptables to allow mock implementations for unti testing
func NewWithProtocol ¶
func NewWithProtocol(proto iptables.Protocol) (IPTablesHelper, error)
NewWithProtocol creates a new IPTablesHelper wrapping "live" go-iptables