server

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: 26 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (

	// DefaultMultusDaemonConfigFile is the Default path of the config file
	DefaultMultusDaemonConfigFile = "/etc/cni/net.d/multus.d/daemon-config.json"
	// DefaultMultusRunDir specifies default RunDir for multus
	DefaultMultusRunDir = "/run/multus/"
)

Variables

This section is empty.

Functions

func FilesystemPreRequirements

func FilesystemPreRequirements(rundir string) error

FilesystemPreRequirements ensures the target `rundir` features the correct permissions.

func GetListener

func GetListener(socketPath string) (net.Listener, error)

GetListener creates a listener to a unix socket located in `socketPath`

Types

type ChrootExec

type ChrootExec struct {
	Stderr io.Writer

	version.PluginDecoder
	// contains filtered or unexported fields
}

ChrootExec implements invoke.Exec to execute CNI with chroot

func (*ChrootExec) ExecPlugin

func (e *ChrootExec) ExecPlugin(ctx context.Context, pluginPath string, stdinData []byte, environ []string) ([]byte, error)

ExecPlugin executes CNI plugin with given environment/stdin data.

func (*ChrootExec) FindInPath

func (e *ChrootExec) FindInPath(plugin string, paths []string) (string, error)

FindInPath try to find CNI plugin based on given path

type ControllerNetConf

type ControllerNetConf struct {
	ChrootDir   string `json:"chrootDir,omitempty"`
	LogFile     string `json:"logFile"`
	LogLevel    string `json:"logLevel"`
	LogToStderr bool   `json:"logToStderr,omitempty"`

	MetricsPort *int `json:"metricsPort,omitempty"`

	// Option to point to the path of the unix domain socket through which the
	// multus client / server communicate.
	SocketDir string `json:"socketDir"`

	ConfigFileContents []byte `json:"-"`
}

ControllerNetConf for the controller cni configuration

func LoadDaemonNetConf

func LoadDaemonNetConf(config []byte) (*ControllerNetConf, error)

LoadDaemonNetConf loads the configuration for the multus daemon

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics represents server's metrics.

type Server

type Server struct {
	http.Server
	// contains filtered or unexported fields
}

Server represents an HTTP server listening to a unix socket. It will handle the CNI shim requests issued when a pod is added / removed.

func NewCNIServer

func NewCNIServer(daemonConfig *ControllerNetConf, serverConfig []byte) (*Server, error)

NewCNIServer creates and returns a new Server object which will listen on a socket in the given path

func (*Server) HandleCNIRequest

func (s *Server) HandleCNIRequest(cmd string, k8sArgs *types.K8sArgs, cniCmdArgs *skel.CmdArgs, exec invoke.Exec, kubeClient *k8s.ClientInfo) ([]byte, error)

HandleCNIRequest is the CNI server handler function; it is invoked whenever a CNI request is processed.

func (*Server) HandleDelegateRequest

func (s *Server) HandleDelegateRequest(cmd string, k8sArgs *types.K8sArgs, cniCmdArgs *skel.CmdArgs, exec invoke.Exec, kubeClient *k8s.ClientInfo, interfaceAttributes *api.DelegateInterfaceAttributes) ([]byte, error)

HandleDelegateRequest is the CNI server handler function; it is invoked whenever a CNI request is processed as delegate CNI request.

Directories

Path Synopsis
Package api is the package that contains thick pluigin's server apis.
Package api is the package that contains thick pluigin's server apis.
Package config is the package that contains the libraries that operates CNI config files
Package config is the package that contains the libraries that operates CNI config files

Jump to

Keyboard shortcuts

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