api

package
v4.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Overview

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

Index

Constants

View Source
const (
	// APIReadyPollDuration specifies duration for API readiness check polling
	APIReadyPollDuration = 100 * time.Millisecond
	// APIReadyPollTimeout specifies timeout for API readiness check polling
	APIReadyPollTimeout = 60000 * time.Millisecond

	// 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 CheckAPIReadyNow added in v4.1.0

func CheckAPIReadyNow(socketPath string) error

CheckAPIReadyNow checks API readiness once

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

func WaitUntilAPIReady added in v4.1.0

func WaitUntilAPIReady(socketPath string) error

WaitUntilAPIReady checks API readiness

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