Documentation
¶
Index ¶
Constants ¶
const (
DefaultOvsBrName = "br-int"
)
Defaults that can be overwritten by CNI Args
Variables ¶
var NbCtlCommand = func(path string, timeout int, args ...string) (string, error) { args = append([]string{fmt.Sprintf("--timeout=%d", timeout)}, args...) cmd := exec.Command(path, args...) cmd.Env = os.Environ() raw, err := cmd.CombinedOutput() return strings.Trim(strings.TrimSpace(string(raw)), `"`), err }
NbCtlCommand function object wraps system call
var OvsVsctlExec = func(path string, args ...string) (string, error) { if path == "" { path = defaultOvsCtlPath } raw, err := exec.Command(path, args...).CombinedOutput() return strings.Trim(strings.TrimSpace(string(raw)), `"`), err }
OvsVsctlExec function object wraps system call
Functions ¶
Types ¶
type CNIConfig ¶
type CNIConfig struct { types.NetConf IPAM IPAMConfig `json:"ipam"` }
CNIConfig represents OVNCNI configuration structure
type CNIContext ¶
type CNIContext struct { Cfg CNIConfig Args *skel.CmdArgs OVNCli OVNClient OvsBrName string HostIfName string IfMTU uint64 Subnet string OvsCtlPath string OVNCtlPath string AppID string }
CNIContext CNI runtime context used for ADD/DEL/CHECK requests
func GetContext ¶
func GetContext(args *skel.CmdArgs) (CNIContext, error)
GetContext parses args to provide CNIContext structure
func (*CNIContext) Add ¶
func (c *CNIContext) Add() error
Add is called for ADD CNI requests NOTE: OVN port has to be already created for Add to succeed.
This package provides the following helper function to create an OVN port: func CreatePort(lSwitch, id, ip string) (LPort, error)
func (*CNIContext) Check ¶
func (c *CNIContext) Check() error
Check is called for CHECK CNI requests
func (*CNIContext) Del ¶
func (c *CNIContext) Del() error
Del is called for DELETE CNI requests NOTE: OVN port has to be removed after calling CNI DELETE.
This package provides the following helper function to delete an OVN port: func DeletePort(id string) error
type IPAMConfig ¶
type IPAMConfig struct { Type string `json:"type"` Gateway net.IP `json:"gateway"` Routes []types.Route `json:"routes,omitempty"` }
IPAMConfig represents IPAM configuration for OVNCNI It is used purely for setting the Gateway and Routes
type OVNClient ¶
type OVNClient struct {
// contains filtered or unexported fields
}
OVNClient wraps ovn-nbctl calls to manage ports
func GetOVNClient ¶
GetOVNClient create OVN client
func (*OVNClient) CreatePort ¶
CreatePort creates a logical (id) port in OVN (lSwitch) ip parameter is optional and a 'dynamic' value will be used if it is empty
func (*OVNClient) DeletePort ¶
DeletePort deletes a logical port from OVN
func (*OVNClient) GetNbCtlPath ¶
GetNbCtlPath returns system path to executable