Documentation ¶
Overview ¶
***************************************************************************
- Base class for interface managed by Contrail Cni ***************************************************************************
***************************************************************************
File responsible to create and configure macvlan interfaces
This is typically used in nested-k8s scenario where containers are spawned
inside the container. The VMI for container is modeled as sub-interface in
this case.
The class creates a vlan-interface corresponding to the vlan in
sub-interface and then creates a macvlan interface over it. ***************************************************************************
***************************************************************************
- File responsible to create and configure veth interfaces ***************************************************************************
Index ¶
Constants ¶
const CNI_ID_IFNAME_END_LEN = 5
Number of characters from end to pick from container-id for ifname
const CNI_ID_IFNAME_START_LEN = 5
Number of characters from start to pick from container-id for ifname
const CNI_MTU = 1500
Default MTU for interface configured
const CNI_UUID_IFNAME_LEN = 11
Number of characters to pick from UUID for ifname
const INTF_ALIAS = "contrail-k8s-cni-vlan-"
Prefix for macvlan interface alias
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CniIntf ¶
type CniIntf struct {
// contains filtered or unexported fields
}
Base definition for CniIntf
func (CniIntf) Configure ¶
Configure MAC address and IP address on the interface Assumes that interface inside container is already created.
func (CniIntf) DeleteByAlias ¶
DeleteByAlias deletes an interface with the given link alias
func (CniIntf) DeleteByName ¶
Delete an interface with given name Every interface inside a container has a peer in host-namespace. Deleting the interface in host-namespace deletes interface in container also. The API is used to delete interface in host-namespace
type CniIntfMethods ¶
type CniIntfMethods interface { Log() Create() error Delete() error Configure(mac string, result *current.Result) error GetHostIfName() string }
Common methods for all CniIntf
type MacVlan ¶
type MacVlan struct { CniIntf // parent interface on which vlan-interface is created ParentIfName string // contains filtered or unexported fields }
Definition for MacVlan interfaces
func InitMacVlan ¶
func InitMacVlan(parentIfName, containerIfName, containerId, containerUuid, containerNamespace string, mtu, vlanId int) MacVlan
Create MacVlan interface object
func (MacVlan) Delete ¶
Remove macvlan interface Deletes the vlan interface from host-os. It will automatically remove the corresponding interface from container namespace also
func (MacVlan) GetHostIfName ¶
type VEth ¶
type VEth struct { CniIntf HostIfName string // Since HostIfName interface is in host-namespace, veth interface is // initially created in host-namespace with a temporary name. The temporary // interface is then moved to container-namespace with containerIfName TmpHostIfName string }
Definition for veth interface
func (VEth) Create ¶
Create veth interfaces. One end of interface will be inside container and another end in host-os network namespace
func (VEth) Delete ¶
Remove veth interface Deletes the tap interface from host-os. It will automatically remove the corresponding interface from container namespace also