Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateIfaceName(namingScheme, chosenName, defaultName string, sequenceId int) string
- func DelegateInterfaceDelete(netConf *datastructs.NetConf, danmClient danmclientset.Interface, ...) error
- func DelegateInterfaceSetup(netConf *datastructs.NetConf, danmClient danmclientset.Interface, ...) (*current.Result, error)
- func FreeDelegatedIps(danmClient danmclientset.Interface, netInfo *danmtypes.DanmNet, ...) error
- func GetEnv(key, fallback string) string
- func IsDelegationRequired(netInfo *danmtypes.DanmNet) bool
- func IsDeviceNeeded(cniType string) bool
- type MacvlanNet
- type SriovNet
Constants ¶
const ( LegacyNamingScheme = "legacy" CniAddOp = "ADD" CniDelOp = "DEL" )
Variables ¶
var ( SupportedNativeCnis = map[string]*cniBackendConfig{ "sriov": &cniBackendConfig{ CniBackend: datastructs.CniBackend{ CNIVersion: "0.3.1", }, readConfig: cniConfigReader(getSriovCniConfig), ipamNeeded: true, deviceNeeded: true, }, "macvlan": &cniBackendConfig{ CniBackend: datastructs.CniBackend{ CNIVersion: "0.3.1", }, readConfig: cniConfigReader(getMacvlanCniConfig), ipamNeeded: true, deviceNeeded: false, }, } )
Functions ¶
func CalculateIfaceName ¶
CalculateIfaceName decides what should be the name of a container's interface. If a name is explicitly set in the related network API object, the NIC will be named accordingly. If a name is not explicitly set, then DANM names the interface ethX where X=sequence number of the interface When legacy naming scheme is configured container_prefix behaves as the exact name of an interface, rather than its name suggest
func DelegateInterfaceDelete ¶
func DelegateInterfaceDelete(netConf *datastructs.NetConf, danmClient danmclientset.Interface, netInfo *danmtypes.DanmNet, ep *danmtypes.DanmEp) error
DelegateInterfaceDelete delegates Ks8 Pod network interface delete task to the input 3rd party CNI plugin Returns an error if interface creation was unsuccessful, or if the 3rd party CNI config could not be loaded
func DelegateInterfaceSetup ¶
func DelegateInterfaceSetup(netConf *datastructs.NetConf, danmClient danmclientset.Interface, netInfo *danmtypes.DanmNet, ep *danmtypes.DanmEp) (*current.Result, error)
DelegateInterfaceSetup delegates K8s Pod network interface setup task to the input 3rd party CNI plugin Returns the CNI compatible result object, or an error if interface creation was unsuccessful, or if the 3rd party CNI config could not be loaded
func FreeDelegatedIps ¶
func IsDelegationRequired ¶
IsDelegationRequired decides if the interface creation operations should be delegated to a 3rd party CNI, or can be handled by DANM Decision is made based on the NetworkType parameter of the network object
func IsDeviceNeeded ¶
Types ¶
type MacvlanNet ¶
type MacvlanNet struct { types.NetConf //Name of the master NIC the MACVLAN slave needs to be connected to Master string `json:"master"` //The mode in which the MACVLAN slave is configured (default bridge) Mode string `json:"mode"` //MTU to be set to the MACVLAN slave interface (default 1500) MTU int `json:"mtu"` //IPAM configuration to be used for this network Ipam datastructs.IpamConfig `json:"ipam,omitEmpty"` }
type SriovNet ¶
type SriovNet struct { sriov_types.NetConf // IPAM configuration to be used for this network Ipam datastructs.IpamConfig `json:"ipam,omitEmpty"` }
sriovNet represent the configuration of sriov cni v1.0.0