Documentation ¶
Index ¶
- Constants
- func CallPlugin(plugin PluginApi, cmd string, args *cniSkel.CmdArgs, config *NetworkConfig) (*cniTypes.Result, error)
- func GetResult020(network *network.NetworkInfo, endpoint *network.EndpointInfo) cniTypes020.Result
- type IP
- type Interface
- type K8SPodEnvArgs
- type KVP
- type NetworkConfig
- type Plugin
- type PluginApi
- type PortMapping
- type Result
- type RuntimeConfig
Constants ¶
const ( // Supported CNI versions. Version = "0.2.0" // CNI commands. CmdAdd = "ADD" CmdDel = "DEL" Internal = "internal" )
Variables ¶
This section is empty.
Functions ¶
func CallPlugin ¶
func CallPlugin(plugin PluginApi, cmd string, args *cniSkel.CmdArgs, config *NetworkConfig) (*cniTypes.Result, error)
CallPlugin calls the given CNI plugin through the internal interface.
func GetResult020 ¶
func GetResult020(network *network.NetworkInfo, endpoint *network.EndpointInfo) cniTypes020.Result
GetResult020 gets the v020 result object
Types ¶
type IP ¶
type IP struct { Version string `json:"version"` // 4 or 6 Address cniTypes.IPNet `json:"address"` Gateway net.IP `json:"gateway"` InterfaceIndex int `json:"interface"` // Numeric index into 'interfaces' list }
func GetIP ¶
func GetIP(network *network.NetworkInfo, endpoint *network.EndpointInfo) IP
GetIP returns the IP for the corresponding endpoint
type Interface ¶
type Interface struct { Name string `json:"name"` MacAddress net.HardwareAddr `json:"mac"` Sandbox string `json:"sandbox"` }
func GetInterface ¶
func GetInterface(endpoint *network.EndpointInfo) Interface
GetInterface returns the interface for endpoint
type K8SPodEnvArgs ¶
type K8SPodEnvArgs struct { cniTypes.CommonArgs K8S_POD_NAMESPACE cniTypes.UnmarshallableString `json:"K8S_POD_NAMESPACE,omitempty"` K8S_POD_NAME cniTypes.UnmarshallableString `json:"K8S_POD_NAME,omitempty"` K8S_POD_INFRA_CONTAINER_ID cniTypes.UnmarshallableString `json:"K8S_POD_INFRA_CONTAINER_ID,omitempty"` }
type KVP ¶
type KVP struct { Name string `json:"name"` Value json.RawMessage `json:"value"` }
type NetworkConfig ¶
type NetworkConfig struct { CniVersion string `json:"cniVersion"` Name string `json:"name"` // Name is the Network Name. We would also use this as the Type of HNS Network Type string `json:"type"` // As per SPEC, Type is Name of the Binary Ipam struct { Type string `json:"type"` Environment string `json:"environment,omitempty"` AddrSpace string `json:"addressSpace,omitempty"` Subnet string `json:"subnet,omitempty"` Address string `json:"ipAddress,omitempty"` QueryInterval string `json:"queryInterval,omitempty"` Routes []cniTypes.Route `json:"routes,omitempty"` } DNS cniTypes.DNS `json:"dns"` RuntimeConfig RuntimeConfig `json:"runtimeConfig"` AdditionalArgs []KVP }
NetworkConfig represents the Windows CNI plugin's network configuration. Defined as per https://github.com/containernetworking/cni/blob/master/SPEC.md
func ParseNetworkConfig ¶
func ParseNetworkConfig(b []byte) (*NetworkConfig, error)
ParseNetworkConfig unmarshals network configuration from bytes.
func (*NetworkConfig) GetEndpointInfo ¶
func (config *NetworkConfig) GetEndpointInfo( networkinfo *network.NetworkInfo, containerID string, netNs string, podK8sNamespace string) *network.EndpointInfo
GetEndpointInfo constructs endpoint info using endpoint id, containerid and netns
func (*NetworkConfig) GetNetworkInfo ¶
func (config *NetworkConfig) GetNetworkInfo() *network.NetworkInfo
Get NetworkInfo from the NetworkConfig
func (*NetworkConfig) Serialize ¶
func (config *NetworkConfig) Serialize() []byte
Serialize marshals a network configuration to bytes.
type Plugin ¶
Plugin is the parent class for CNI plugins.
func (*Plugin) Initialize ¶
func (plugin *Plugin) Initialize(config *common.PluginConfig) error
Initialize initializes the plugin.
func (*Plugin) Uninitialize ¶
func (plugin *Plugin) Uninitialize()
Uninitialize uninitializes the plugin.
type PortMapping ¶
type Result ¶
type Result struct { CniVersion string `json:"cniVersion"` Interfaces []Interface `json:"interfaces"` IP []IP `json:"ip"` DNS cniTypes.DNS `json:"dns"` Routes []cniTypes.Route `json:"routes,omitempty"` }
func GetResult ¶
func GetResult(network *network.NetworkInfo, endpoint *network.EndpointInfo) Result
GetResult gets the result object
type RuntimeConfig ¶
type RuntimeConfig struct {
PortMappings []PortMapping `json:"portMappings,omitempty"`
}