Documentation ¶
Index ¶
- Constants
- Variables
- func CallPlugin(plugin PluginApi, cmd string, args *cniSkel.CmdArgs, config *NetworkConfig) (*cniTypes.Result, error)
- func GetCurrResult(network *network.NetworkInfo, endpoint *network.EndpointInfo, ifname string, ...) cniTypesCurr.Result
- func GetDualStackAddresses(endpoint *network.EndpointInfo) (*IP, *IP)
- type IP
- type Interface
- type IpamConfig
- type K8SPodEnvArgs
- type KVP
- type NetworkConfig
- type OptionalFlags
- type Plugin
- type PluginApi
- type PortMapping
- type Result
- type RuntimeConfig
Constants ¶
const ( // CNI commands. CmdAdd = "ADD" CmdDel = "DEL" Internal = "internal" )
Variables ¶
var VersionsSupported = []string{"0.2.0", "0.3.0"}
Supported CNI versions.
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 GetCurrResult ¶ added in v0.3.0
func GetCurrResult(network *network.NetworkInfo, endpoint *network.EndpointInfo, ifname string, cniConfig *NetworkConfig) cniTypesCurr.Result
GetCurrResult gets the result object
func GetDualStackAddresses ¶ added in v0.3.0
func GetDualStackAddresses(endpoint *network.EndpointInfo) (*IP, *IP)
GetDualStackAddresses returns the IPv4 and IPv6 addresses for the endpoint
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 IpamConfig ¶
type IpamConfig 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"` }
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 IpamConfig `json:"ipam"` DNS cniTypes.DNS `json:"dns"` OptionalFlags OptionalFlags `json:"optionalFlags"` RuntimeConfig RuntimeConfig `json:"runtimeConfig"` AdditionalRoutes []cniTypes.Route `json:"additionalRoutes"` 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) (*network.EndpointInfo, error)
GetEndpointInfo constructs endpoint info using endpoint id, containerid and netns
func (*NetworkConfig) GetNetworkInfo ¶
func (config *NetworkConfig) GetNetworkInfo(podNamespace string) (ninfo *network.NetworkInfo, err error)
GetNetworkInfo from the NetworkConfig
func (*NetworkConfig) Serialize ¶
func (config *NetworkConfig) Serialize() []byte
Serialize marshals a network configuration to bytes.
type OptionalFlags ¶
type OptionalFlags struct { LocalRoutePortMapping bool `json:"localRoutedPortMapping"` AllowAclPortMapping bool `json:"allowAclPortMapping"` ForceBridgeGateway bool `json:"forceBridgeGateway"` // Intended to be temporary workaround EnableDualStack bool `json:"enableDualStack"` LoopbackDSR bool `json:"loopbackDSR"` GatewayFromAdditionalRoutes bool `json:"gatewayFromAdditionalRoutes"` }
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 RuntimeConfig ¶
type RuntimeConfig struct { PortMappings []PortMapping `json:"portMappings,omitempty"` DNS cniDNSConfig `json:"dns"` }