plugin

package
v1.5.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdAdd

func CmdAdd(args *skel.CmdArgs) error

CmdAdd is the implementation of the cmdAdd interface of CNI plugin

func CmdCheck

func CmdCheck(*skel.CmdArgs) (err error)

CmdCheck is the implementation of the cmdCheck interface of CNI plugin

func CmdDelete

func CmdDelete(args *skel.CmdArgs) error

CmdDelete is the implementation of the cmdDelete interface of CNI plugin

func GetConfig

func GetConfig() string

func GetUnixSock

func GetUnixSock() string

func SetLogFile

func SetLogFile(file string)

Types

type Config

type Config struct {
	LogLevel string `json:"LogLevel,omitempty"`
	LogFile  string `json:"LogFile,omitempty"`
}

type K8sArgs

type K8sArgs struct {
	types.CommonArgs
	IP                         net.IP
	K8S_POD_NAME               types.UnmarshallableString // nolint: revive, stylecheck
	K8S_POD_NAMESPACE          types.UnmarshallableString // nolint: revive, stylecheck
	K8S_POD_INFRA_CONTAINER_ID types.UnmarshallableString // nolint: revive, stylecheck
}

K8sArgs is the valid CNI_ARGS used for Kubernetes The field names need to match exact keys in kubelet args for unmarshalling

type Kubernetes

type Kubernetes struct {
	K8sAPIRoot           string   `json:"k8s_api_root"`
	Kubeconfig           string   `json:"kubeconfig"`
	InterceptRuleMgrType string   `json:"intercept_type"`
	NodeName             string   `json:"node_name"`
	ExcludeNamespaces    []string `json:"exclude_namespaces"`
	CNIBinDir            string   `json:"cni_bin_dir"`
}

Kubernetes a K8s specific struct to hold config

type PodNetConf

type PodNetConf struct {
	types.NetConf // You may wish to not nest this type
	RuntimeConfig *struct {
	} `json:"runtimeConfig"`

	// This is the previous result, when called in the context of a chained
	// plugin. Because this plugin supports multiple versions, we'll have to
	// parse this in two passes. If your plugin is not chained, this can be
	// removed (though you may wish to error if a non-chainable plugin is
	// chained.
	// If you need to modify the result before returning it, you will need
	// to actually convert it to a concrete versioned struct.
	RawPrevResult *map[string]any `json:"prevResult"`
	PrevResult    *cniv1.Result   `json:"-"`

	// Add plugin-specific flags here
	LogLevel        string     `json:"log_level"`
	LogUDSAddress   string     `json:"log_uds_address"`
	Kubernetes      Kubernetes `json:"kubernetes"`
	HostNSEnterExec bool       `json:"hostNSEnterExec"`
}

PodNetConf is whatever you expect your configuration json to be. This is whatever is passed in on stdin. Your plugin may wish to expose its functionality via runtime args, see CONVENTIONS.md in the CNI spec.

Jump to

Keyboard shortcuts

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