Documentation
¶
Index ¶
Constants ¶
View Source
const (
VethMTU = 1400
)
Variables ¶
View Source
var ( ErrPlatformdListenSockNotSet = errors.New("platformd listen socket not set") ErrIPAMConfigNotSet = errors.New("ipam config not set") ErrPodUIDMissing = errors.New("K8S_POD_UID in CNI_ARGS missing") ErrInsufficientAddresses = errors.New("ipam: need 2 ip addresses") ErrInvalidPort = errors.New("invalid port") )
View Source
var (
// HostVethMAC is the mac address configured for the host-side veth
HostVethMAC = mustParseMAC("7e:90:c4:ed:df:d0")
)
Functions ¶
This section is empty.
Types ¶
type CNI ¶
type CNI struct {
// contains filtered or unexported fields
}
func (*CNI) ExecAdd ¶
func (c *CNI) ExecAdd( args *skel.CmdArgs, conf Conf, proxyClient proxyv1alpha1.ProxyServiceClient, wlClient workloadv1alpha2.WorkloadServiceClient, ) (err error)
ExecAdd sets up the veth pair for a container. internally the following happens: * first allocated ip address for host side veth using cni ipam plugin. * then create veth pair and move one peer into the containers netns. * configure ip address on container iface and bring it up. * configure ip address on host iface and bring it up. * attach snat bpf program to host-side veth peer (tc ingress)
func (*CNI) ExecDel ¶
func (c *CNI) ExecDel( args *skel.CmdArgs, conf Conf, proxyClient proxyv1alpha1.ProxyServiceClient, wlClient workloadv1alpha2.WorkloadServiceClient, ) error
type Handler ¶
type Handler interface {
AllocVethPair(netNS string, hostAddr, podAddr net.IPNet) (datapath.VethPair, error)
// AttachHostVethBPF installs all BPF programs intended for the host-side veth peer
AttachHostVethBPF(veth datapath.VethPair) error
AttachCtrVethBPF(veth datapath.VethPair, netNS string) error
AllocIPs(plugin string, stdinData []byte) ([]net.IPNet, error)
DeallocIPs(plugin string, stdinData []byte) error
AddDefaultRoute(veth datapath.VethPair, nsPath string) error
// AddFullMatchRoute will create a rule in the root ns, which routes packets
// with the fully matching ip address (/32 CIDR) to the given interface.
AddFullMatchRoute(veth datapath.VethPair) error
// AddDNATTarget maps the passed port to the veth pairs pod peer.
AddDNATTarget(veth datapath.VethPair, port uint16) error
AddNetData(data datapath.NetData) error
GetVethPair(hostPort uint16) (datapath.VethPair, error)
DelFullMatchRoute(veth datapath.VethPair) error
DelMapEntries(veth datapath.VethPair, hostPort uint16) error
DeallocVethPair(veth datapath.VethPair) error
}
func NewHandler ¶
Click to show internal directories.
Click to hide internal directories.