api

package
v4.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Overview

Package api is the package that contains thick pluigin's server apis.

Index

Constants

View Source
const (
	// MultusCNIAPIEndpoint is an endpoint for multus CNI request (for multus-shim)
	MultusCNIAPIEndpoint = "/cni"
	// MultusDelegateAPIEndpoint is an endpoint for multus delegate request (for hotplug)
	MultusDelegateAPIEndpoint = "/delegate"

	// MultusHealthAPIEndpoint is an endpoint API clients can query to know if they can communicate w/ multus server
	MultusHealthAPIEndpoint = "/healthz"
)

Variables

This section is empty.

Functions

func CmdAdd

func CmdAdd(args *skel.CmdArgs) error

CmdAdd implements the CNI spec ADD command handler

func CmdCheck

func CmdCheck(args *skel.CmdArgs) error

CmdCheck implements the CNI spec CHECK command handler

func CmdDel

func CmdDel(args *skel.CmdArgs) error

CmdDel implements the CNI spec DEL command handler

func DoCNI

func DoCNI(url string, req interface{}, socketPath string) ([]byte, error)

DoCNI sends a CNI request to the CNI server via JSON + HTTP over a root-owned unix socket, and returns the result

func GetAPIEndpoint

func GetAPIEndpoint(endpoint string) string

GetAPIEndpoint returns endpoint URL for multus-daemon

func SocketPath

func SocketPath(rundir string) string

SocketPath returns the path of the multus CNI socket

Types

type DelegateInterfaceAttributes

type DelegateInterfaceAttributes struct {
	// IPRequest contains an optional requested IP address for this network
	// attachment
	IPRequest []string `json:"ips,omitempty"`
	// MacRequest contains an optional requested MAC address for this
	// network attachment
	MacRequest string `json:"mac,omitempty"`
	// CNIArgs contains additional CNI arguments for the network interface
	CNIArgs *map[string]interface{} `json:"cni-args"`
}

DelegateInterfaceAttributes annotates delegate request for additional config

type Request

type Request struct {
	// CNI environment variables, like CNI_COMMAND and CNI_NETNS
	Env map[string]string `json:"env,omitempty"`
	// CNI configuration passed via stdin to the CNI plugin
	Config []byte `json:"config,omitempty"`
	// Annotation for Delegate request
	InterfaceAttributes *DelegateInterfaceAttributes `json:"interfaceAttributes,omitempty"`
}

Request sent to the Server by the multus-shim

func CreateDelegateRequest

func CreateDelegateRequest(cniCommand, cniContainerID, cniNetNS, cniIFName, podNamespace, podName, podUID string, cniConfig []byte, interfaceAttributes *DelegateInterfaceAttributes) *Request

CreateDelegateRequest creates Request for delegate API request

type Response

type Response struct {
	Result *cni100.Result
}

Response represents the response (computed in the CNI server) for ADD / DEL / CHECK for a Pod.

type ShimNetConf

type ShimNetConf struct {
	CNIVersion      string `json:"cniVersion,omitempty"`
	MultusSocketDir string `json:"daemonSocketDir"`
	LogFile         string `json:"logFile,omitempty"`
	LogLevel        string `json:"logLevel,omitempty"`
	LogToStderr     bool   `json:"logToStderr,omitempty"`
}

ShimNetConf for the SHIM cni config file written in json

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL