ovs

package
v1.8.18 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Index

Constants

View Source
const (
	OvnNbCtl    = "ovn-nbctl"
	OvnSbCtl    = "ovn-sbctl"
	OVNIcNbCtl  = "ovn-ic-nbctl"
	OvsVsCtl    = "ovs-vsctl"
	MayExist    = "--may-exist"
	IfExists    = "--if-exists"
	Policy      = "--policy"
	PolicyDstIP = "dst-ip"
	PolicySrcIP = "src-ip"
)

Variables

View Source
var (
	ErrNoAddr   = errors.New("no address")
	ErrNotFound = errors.New("not found")
)

Functions

func BridgeExists added in v1.8.3

func BridgeExists(name string) (bool, error)

BridgeExists checks whether the bridge already exists

func Bridges added in v1.7.2

func Bridges() ([]string, error)

Bridges returns bridges created by Kube-OVN

func CheckAlive added in v1.7.0

func CheckAlive() error

CheckAlive check if kube-ovn-controller can access ovn-nb from nbctl-daemon

func CleanDuplicatePort added in v1.7.0

func CleanDuplicatePort(ifaceID string)

Find and remove any existing OVS port with this iface-id. Pods can have multiple sandboxes if some are waiting for garbage collection, but only the latest one should have the iface-id set. See: https://github.com/ovn-org/ovn-kubernetes/pull/869

func CleanLostInterface

func CleanLostInterface()

CleanLostInterface will clean up related ovs port, interface and qos When reboot node, the ovs internal interface will be deleted.

func ClearPodBandwidth

func ClearPodBandwidth(podName, podNamespace string) error

ClearPodBandwidth remove qos related to this pod. Only used when remove pod.

func ConfigInterfaceMirror added in v1.8.0

func ConfigInterfaceMirror(globalMirror bool, open string, iface string) error

config mirror for interface by pod annotations and install param

func Exec added in v1.7.0

func Exec(args ...string) (string, error)

func GetResidualInternalPorts added in v1.7.2

func GetResidualInternalPorts() []string

func GetSgPortGroupName added in v1.8.0

func GetSgPortGroupName(sgName string) string

func GetSgV4AssociatedName added in v1.8.0

func GetSgV4AssociatedName(sgName string) string

func GetSgV6AssociatedName added in v1.8.0

func GetSgV6AssociatedName(sgName string) string

func PodNameToLocalnetName added in v1.7.0

func PodNameToLocalnetName(subnet string) string

func PodNameToPortName

func PodNameToPortName(pod, namespace, provider string) string

PodNameToPortName return the ovn port name for a given pod

func SetInterfaceBandwidth added in v1.7.0

func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress string) error

SetInterfaceBandwidth set ingress/egress qos for given pod, annotation values are for node/pod but ingress/egress parameters here are from the point of ovs port/interface view, so reverse input parameters when call func SetInterfaceBandwidth

func SetPortTag added in v1.7.0

func SetPortTag(port, tag string) error

func StartOvnNbctlDaemon added in v1.7.0

func StartOvnNbctlDaemon(ovnNbAddr string) error

StartOvnNbctlDaemon start a daemon and set OVN_NB_DAEMON env

func ValidatePortVendor added in v1.7.1

func ValidatePortVendor(port string) (bool, error)

ValidatePortVendor returns true if the port's external_ids:vendor=kube-ovn

Types

type AclDirection added in v1.8.0

type AclDirection string
const (
	SgAclIngressDirection AclDirection = "to-lport"
	SgAclEgressDirection  AclDirection = "from-lport"
)

type Client

type Client struct {
	OvnNbAddress                  string
	OvnTimeout                    int
	OvnSbAddress                  string
	OVNIcNBAddress                string
	ClusterRouter                 string
	ClusterTcpLoadBalancer        string
	ClusterUdpLoadBalancer        string
	ClusterTcpSessionLoadBalancer string
	ClusterUdpSessionLoadBalancer string
	NodeSwitch                    string
	NodeSwitchCIDR                string
	ExternalGatewayType           string
}

Client is the ovn client

func NewClient

func NewClient(ovnNbAddr string, ovnNbTimeout int, ovnSbAddr, clusterRouter, clusterTcpLoadBalancer, clusterUdpLoadBalancer, clusterTcpSessionLoadBalancer, clusterUdpSessionLoadBalancer, nodeSwitch, nodeSwitchCIDR string) *Client

NewClient init an ovn client

func (*Client) AclExists added in v1.8.2

func (c *Client) AclExists(priority, direction string) (bool, error)

func (Client) AddLbToLogicalSwitch added in v1.8.0

func (c Client) AddLbToLogicalSwitch(tcpLb, tcpSessLb, udpLb, udpSessLb, ls string) error

func (Client) AddStaticRoute added in v1.7.0

func (c Client) AddStaticRoute(policy, cidr, nextHop, router string, routeType string) error

AddStaticRoute add a static route rule in ovn

func (Client) CleanLogicalSwitchAcl

func (c Client) CleanLogicalSwitchAcl(ls string) error

CleanLogicalSwitchAcl clean acl of a switch

func (Client) CombineEgressACLCmd added in v1.8.14

func (c Client) CombineEgressACLCmd(pgName, asEgressName, asExceptName, protocol string, npp []netv1.NetworkPolicyPort, portSvcName string, logEnable bool, aclCmds []string, index int) []string

func (Client) CombineIngressACLCmd added in v1.8.14

func (c Client) CombineIngressACLCmd(pgName, asIngressName, asExceptName, svcAsName, protocol string, npp []netv1.NetworkPolicyPort, logEnable bool, aclCmds []string, index int) []string

func (Client) CreateACL added in v1.8.14

func (c Client) CreateACL(aclCmds []string) error

func (Client) CreateACLForNodePg added in v1.8.0

func (c Client) CreateACLForNodePg(pgName, nodeIpStr string) error

func (Client) CreateAddressSet added in v0.5.0

func (c Client) CreateAddressSet(asName, npNamespace, npName, direction string) error

func (Client) CreateGatewayACL added in v1.7.0

func (c Client) CreateGatewayACL(pgName, gateway, cidr string) error

func (Client) CreateGatewaySwitch added in v1.7.0

func (c Client) CreateGatewaySwitch(name, ip, mac string, chassises []string) error

func (Client) CreateICLogicalRouterPort added in v1.7.0

func (c Client) CreateICLogicalRouterPort(az, mac, subnet string, chassises []string) error

func (Client) CreateLoadBalancer

func (c Client) CreateLoadBalancer(lb, protocol, selectFields string) error

CreateLoadBalancer create loadbalancer in ovn

func (Client) CreateLoadBalancerRule

func (c Client) CreateLoadBalancerRule(lb, vip, ips, protocol string) error

CreateLoadBalancerRule create loadbalancer rul in ovn

func (Client) CreateLocalnetPort added in v1.7.0

func (c Client) CreateLocalnetPort(ls, port, provider string, vlanID int) error

func (Client) CreateLogicalRouter

func (c Client) CreateLogicalRouter(lr string) error

CreateLogicalRouter delete logical router in ovn

func (Client) CreateLogicalSwitch

func (c Client) CreateLogicalSwitch(ls, lr, protocol, subnet, gateway string, underlay bool) error

CreateLogicalSwitch create logical switch in ovn, connect it to router and apply tcp/udp lb rules

func (Client) CreateNpPortGroup added in v1.8.0

func (c Client) CreateNpPortGroup(pgName, npNs, npName string) error

func (Client) CreatePort

func (c Client) CreatePort(ls, port, ip, cidr, mac, pod, namespace string, portSecurity bool, securityGroups string) error

CreatePort create logical switch port in ovn

func (Client) CreateSgAssociatedAddressSet added in v1.8.0

func (c Client) CreateSgAssociatedAddressSet(sgName string) error

func (Client) CreateSgDenyAllACL added in v1.8.0

func (c Client) CreateSgDenyAllACL() error

func (Client) CreateSgPortGroup added in v1.8.0

func (c Client) CreateSgPortGroup(sgName string) error

func (Client) CustomFindEntity added in v1.8.0

func (c Client) CustomFindEntity(entity string, attris []string, args ...string) (result []map[string][]string, err error)

func (Client) DeleteACL added in v0.5.0

func (c Client) DeleteACL(pgName, direction string) (err error)

func (Client) DeleteAclForNodePg added in v1.8.0

func (c Client) DeleteAclForNodePg(pgName string) error

func (Client) DeleteAddressSet added in v0.5.0

func (c Client) DeleteAddressSet(asName string) error

func (Client) DeleteChassis added in v1.7.0

func (c Client) DeleteChassis(node string) error

func (Client) DeleteGatewaySwitch added in v1.7.0

func (c Client) DeleteGatewaySwitch(name string) error

func (Client) DeleteICLogicalRouterPort added in v1.7.0

func (c Client) DeleteICLogicalRouterPort(az string) error

func (Client) DeleteLoadBalancer added in v1.8.0

func (c Client) DeleteLoadBalancer(lbs ...string) error

DeleteLoadBalancer delete loadbalancer in ovn

func (Client) DeleteLoadBalancerVip

func (c Client) DeleteLoadBalancerVip(vip, lb string) error

DeleteLoadBalancerVip delete a vip rule from loadbalancer

func (Client) DeleteLogicalRouter added in v1.7.0

func (c Client) DeleteLogicalRouter(lr string) error

DeleteLogicalRouter create logical router in ovn

func (Client) DeleteLogicalRouterPort added in v1.7.0

func (c Client) DeleteLogicalRouterPort(port string) error

DeleteLogicalRouterPort delete logical switch port in ovn

func (Client) DeleteLogicalSwitch

func (c Client) DeleteLogicalSwitch(ls string) error

DeleteLogicalSwitch delete logical switch

func (Client) DeleteLogicalSwitchPort added in v1.7.0

func (c Client) DeleteLogicalSwitchPort(port string) error

DeleteLogicalSwitchPort delete logical switch port in ovn

func (Client) DeleteMatchedStaticRoute added in v1.7.1

func (c Client) DeleteMatchedStaticRoute(cidr, nexthop, router string) error

func (Client) DeleteNatRule added in v1.7.0

func (c Client) DeleteNatRule(logicalIP, router string) error

func (Client) DeletePortGroup added in v0.5.0

func (c Client) DeletePortGroup(pgName string) error

func (Client) DeleteSgPortGroup added in v1.8.0

func (c Client) DeleteSgPortGroup(sgName string) error

func (Client) DeleteStaticRoute added in v1.7.0

func (c Client) DeleteStaticRoute(cidr, router string) error

DeleteStaticRoute delete a static route rule in ovn

func (Client) DeleteStaticRouteByNextHop added in v1.7.0

func (c Client) DeleteStaticRouteByNextHop(nextHop string) error

func (Client) FindLoadbalancer

func (c Client) FindLoadbalancer(lb string) (string, error)

FindLoadbalancer find ovn loadbalancer uuid by name

func (Client) GetALlChassisHostname added in v1.8.2

func (c Client) GetALlChassisHostname() ([]string, error)

func (Client) GetChassis added in v1.7.0

func (c Client) GetChassis(node string) (string, error)

func (Client) GetEntityInfo added in v1.8.0

func (c Client) GetEntityInfo(entity string, index string, attris []string) (result map[string]string, err error)

func (Client) GetLoadBalancerVips

func (c Client) GetLoadBalancerVips(lb string) (map[string]string, error)

GetLoadBalancerVips return vips of a loadbalancer

func (Client) GetLogicalSwitchExcludeIPS added in v1.7.0

func (c Client) GetLogicalSwitchExcludeIPS(logicalSwitch string) ([]string, error)

GetLogicalSwitchExcludeIPS get a logical switch exclude ips ovn-nbctl get logical_switch ovn-default other_config:exclude_ips => "10.17.0.1 10.17.0.2 10.17.0.3..10.17.0.5"

func (Client) GetLogicalSwitchPortAddress

func (c Client) GetLogicalSwitchPortAddress(port string) ([]string, error)

func (Client) GetLogicalSwitchPortByLogicalSwitch added in v1.7.0

func (c Client) GetLogicalSwitchPortByLogicalSwitch(logicalSwitch string) ([]string, error)

func (Client) GetLogicalSwitchPortDynamicAddress

func (c Client) GetLogicalSwitchPortDynamicAddress(port string) ([]string, error)

func (*Client) GetLspExternalIds added in v1.8.5

func (c *Client) GetLspExternalIds(lsp string) (map[string]string, []string)

func (Client) GetPortAddr

func (c Client) GetPortAddr(port string) ([]string, error)

GetPortAddr return port [mac, ip]

func (Client) GetStaticRouteList added in v1.7.0

func (c Client) GetStaticRouteList(router string) (routeList []*StaticRoute, err error)

func (Client) GetTsSubnet added in v1.7.0

func (c Client) GetTsSubnet(ts string) (string, error)

func (Client) ListAddressSet added in v1.7.0

func (c Client) ListAddressSet(npNamespace, npName, direction string) ([]string, error)

func (Client) ListLoadBalancer added in v1.8.0

func (c Client) ListLoadBalancer() ([]string, error)

ListLoadBalancer list loadbalancer names

func (Client) ListLogicalEntity added in v1.8.0

func (c Client) ListLogicalEntity(entity string, args ...string) ([]string, error)

func (Client) ListLogicalRouter

func (c Client) ListLogicalRouter(needVendorFilter bool, args ...string) ([]string, error)

ListLogicalRouter list logical router names

func (Client) ListLogicalSwitch

func (c Client) ListLogicalSwitch(needVendorFilter bool, args ...string) ([]string, error)

ListLogicalSwitch list logical switch names

func (Client) ListLogicalSwitchPort added in v1.7.0

func (c Client) ListLogicalSwitchPort(needVendorFilter bool) ([]string, error)

func (Client) ListLspForNodePortgroup added in v1.8.2

func (c Client) ListLspForNodePortgroup() (map[string]string, map[string]string, error)

func (Client) ListNpPortGroup added in v1.8.0

func (c Client) ListNpPortGroup() ([]portGroup, error)

func (Client) ListPgPorts added in v1.8.0

func (c Client) ListPgPorts(pgName string) ([]string, error)

func (Client) ListPodLogicalSwitchPorts added in v1.7.0

func (c Client) ListPodLogicalSwitchPorts(pod, namespace string) ([]string, error)

func (Client) ListRemoteLogicalSwitchPortAddress added in v1.7.0

func (c Client) ListRemoteLogicalSwitchPortAddress() ([]string, error)

func (Client) ListSgRuleAddressSet added in v1.8.0

func (c Client) ListSgRuleAddressSet(sgName string, direction AclDirection) ([]string, error)

func (Client) ListStaticRoute added in v1.7.0

func (c Client) ListStaticRoute() ([]StaticRoute, error)

func (Client) LogicalSwitchExists added in v1.7.0

func (c Client) LogicalSwitchExists(logicalSwitch string, needVendorFilter bool, args ...string) (bool, error)

func (Client) LogicalSwitchPortExists added in v1.7.0

func (c Client) LogicalSwitchPortExists(port string) (bool, error)

func (*Client) NatRuleExists added in v1.8.11

func (c *Client) NatRuleExists(logicalIP string) (bool, error)

func (Client) OvnGet added in v1.7.3

func (c Client) OvnGet(table, record, column, key string) (string, error)

func (*Client) PortGroupExists added in v1.8.14

func (c *Client) PortGroupExists(pgName string) (bool, error)

func (Client) RemoveLbFromLogicalSwitch added in v1.8.0

func (c Client) RemoveLbFromLogicalSwitch(tcpLb, tcpSessLb, udpLb, udpSessLb, ls string) error

func (Client) RemoveRouterPort added in v1.7.0

func (c Client) RemoveRouterPort(ls, lr string) error

func (Client) ResetLogicalSwitchAcl added in v1.7.0

func (c Client) ResetLogicalSwitchAcl(ls string) error

ResetLogicalSwitchAcl reset acl of a switch

func (Client) SetAclLog added in v1.8.8

func (c Client) SetAclLog(pgName string, logEnable, isIngress bool) error

func (Client) SetAddressesToAddressSet added in v0.5.0

func (c Client) SetAddressesToAddressSet(addresses []string, as string) error

func (Client) SetAzName added in v1.7.0

func (c Client) SetAzName(azName string) error

func (Client) SetICAutoRoute added in v1.7.0

func (c Client) SetICAutoRoute(enable bool, blackList []string) error

func (Client) SetLogicalSwitchConfig added in v1.7.0

func (c Client) SetLogicalSwitchConfig(ls, lr, protocol, subnet, gateway string, underlay bool) error

func (Client) SetLogicalSwitchExcludeIPS added in v1.7.0

func (c Client) SetLogicalSwitchExcludeIPS(logicalSwitch string, excludeIPS []string) error

SetLogicalSwitchExcludeIPS set a logical switch exclude ips ovn-nbctl set logical_switch ovn-default other_config:exclude_ips="10.17.0.2 10.17.0.1"

func (Client) SetLspExternalIds added in v1.7.3

func (c Client) SetLspExternalIds(name string, externalIDs map[string]string) error

func (Client) SetPortExternalIds added in v1.8.0

func (c Client) SetPortExternalIds(port, key, value string) error

func (Client) SetPortTag added in v1.8.0

func (c Client) SetPortTag(name string, vlanID int) error

func (Client) SetPortsToPortGroup added in v0.5.0

func (c Client) SetPortsToPortGroup(portGroup string, portNames []string) error

func (Client) SetPrivateLogicalSwitch

func (c Client) SetPrivateLogicalSwitch(ls, cidr string, allow []string) error

SetPrivateLogicalSwitch will drop all ingress traffic except allow subnets

func (Client) UpdateNatRule added in v1.7.0

func (c Client) UpdateNatRule(policy, logicalIP, externalIP, router, logicalMac, port string) error

func (Client) UpdateSgACL added in v1.8.0

func (c Client) UpdateSgACL(sg *kubeovnv1.SecurityGroup, direction AclDirection) error

type StaticRoute added in v1.7.0

type StaticRoute struct {
	Policy  string
	CIDR    string
	NextHop string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL