api

package
v0.0.0-...-ec78eb8 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 7

Documentation

Overview

Package api provides koko's connector funcitionlity as API.

Index

Constants

This section is empty.

Variables

View Source
var (
	// RuntimeEndpoint is CRI server runtime endpoint
	RuntimeEndpoint string
	// Timeout  of connecting to server (default: 10s)
	Timeout time.Duration
)

Functions

func AddMacVLanInterface

func AddMacVLanInterface(macvlan MacVLan, devName string) (err error)

AddMacVLanInterface creates MacVLan interface by given macvlan object

func AddVLanInterface

func AddVLanInterface(vlan VLan, devName string) (err error)

AddVLanInterface creates VLan interface by given vlan object

func AddVxLanInterface

func AddVxLanInterface(vxlan VxLan, devName string) (err error)

AddVxLanInterface creates VxLan interface by given vxlan object

func CloseCrioConnection

func CloseCrioConnection(conn *grpc.ClientConn) error

CloseCrioConnection closes grpc connection in client

func GetCrioContainerNS

func GetCrioContainerNS(runtimeClient pb.RuntimeServiceClient, procPrefix, containerID string) (namespace string, err error)

GetCrioContainerNS retrieves container's network namespace from cri-o container id, given as containerID.

func GetCrioRuntimeClient

func GetCrioRuntimeClient() (pb.RuntimeServiceClient, *grpc.ClientConn, error)

GetCrioRuntimeClient retrieves crio grpc client

func GetDockerContainerNS

func GetDockerContainerNS(procPrefix, containerID string) (namespace string, err error)

GetDockerContainerNS retrieves container's network namespace from docker container id, given as containerID.

func GetMTU

func GetMTU(ifname string) (mtu int, err error)

GetMTU get veth's IF MTU

func GetVethPair

func GetVethPair(name1 string, name2 string) (link1 netlink.Link,
	link2 netlink.Link, err error)

GetVethPair takes two link names and create a veth pair and return both links.

func IsExistLinkInNS

func IsExistLinkInNS(nsName string, linkName string) (result bool, err error)

IsExistLinkInNS finds interface name in given namespace. if foud return true. otherwise false.

func MakeMacVLan

func MakeMacVLan(veth1 VEth, macvlan MacVLan) (err error)

MakeMacVLan makes macvlan interface

func MakeVLan

func MakeVLan(veth1 VEth, vlan VLan) (err error)

MakeVLan makes vlan interface

func MakeVeth

func MakeVeth(veth1 VEth, veth2 VEth) error

MakeVeth is top-level handler to create veth links given two VEth data objects: veth1 and veth2.

func MakeVxLan

func MakeVxLan(veth1 VEth, vxlan VxLan) (err error)

MakeVxLan makes vxlan interface and put it into container namespace

func SetLogLevel

func SetLogLevel(level string) error

SetLogLevel sets logger log level

func SetMTU

func SetMTU(ifname string, mtu int) (err error)

SetMTU set veth's IF MTU

Types

type MacVLan

type MacVLan struct {
	ParentIF string              // parent interface name
	Mode     netlink.MacvlanMode // MacVlan mode
}

MacVLan is a structure to descrive vlan endpoint.

type VEth

type VEth struct {
	NsName        string      // What's the network namespace?
	LinkName      string      // And what will we call the link.
	IPAddr        []net.IPNet // (optional) Slice of IPv4/v6 address.
	MirrorEgress  string      // (optional) source interface for egress mirror
	MirrorIngress string      // (optional) source interface for ingress mirror
}

VEth is a structure to descrive veth interfaces.

func (*VEth) GetEgressTxQLen

func (veth *VEth) GetEgressTxQLen() (qlen int, err error)

GetEgressTxQLen get veth's EgressIF TxQLen

func (veth *VEth) RemoveVethLink() (err error)

RemoveVethLink is low-level handler to get interface handle in container/netns namespace and remove it.

func (*VEth) SetEgressMirror

func (veth *VEth) SetEgressMirror() (err error)

SetEgressMirror sets TC to mirror egress from given port as MirrorEgress.

func (*VEth) SetEgressTxQLen

func (veth *VEth) SetEgressTxQLen(qlen int) (err error)

SetEgressTxQLen set veth's EgressIF TxQLen

func (*VEth) SetIngressMirror

func (veth *VEth) SetIngressMirror() (err error)

SetIngressMirror sets TC to mirror ingress from given port as MirrorIngress.

func (veth *VEth) SetVethLink(link netlink.Link) (err error)

SetVethLink is low-level handler to set IP address onveth links given a single VEth data object. ...primarily used privately by makeVeth().

func (*VEth) UnsetEgressMirror

func (veth *VEth) UnsetEgressMirror() (err error)

UnsetEgressMirror sets TC to mirror egress from given port as MirrorEgress.

func (*VEth) UnsetIngressMirror

func (veth *VEth) UnsetIngressMirror() (err error)

UnsetIngressMirror sets TC to mirror ingress from given port as MirrorIngress.

type VLan

type VLan struct {
	ParentIF string // parent interface name
	ID       int    // VLan ID
}

VLan is a structure to descrive vlan endpoint.

type VxLan

type VxLan struct {
	ParentIF string // parent interface name
	ID       int    // VxLan ID
	IPAddr   net.IP // VxLan destination address
	MTU      int    // VxLan Interface MTU (with VxLan encap), used mirroring
	UDPPort  int    // VxLan UDP port (src/dest, no range, single value)
}

VxLan is a structure to descrive vxlan endpoint.

Jump to

Keyboard shortcuts

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