plugin

package
v0.0.0-...-afeb7c6 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Overview

This is a sample chained plugin that supports multiple CNI versions. It parses prevResult according to the cniVersion

This is a sample chained plugin that supports multiple CNI versions. It parses prevResult according to the cniVersion

This is a sample chained plugin that supports multiple CNI versions. It parses prevResult according to the cniVersion

Defines the redirect object and operations.

Index

Constants

View Source
const (
	ISTIOINIT  = "istio-init"
	ISTIOPROXY = "istio-proxy"
)

Variables

This section is empty.

Functions

func CmdAdd

func CmdAdd(args *skel.CmdArgs) (err error)

CmdAdd is called for ADD requests

func CmdCheck

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

func CmdDelete

func CmdDelete(args *skel.CmdArgs) (err error)

func GetLoggingOptions

func GetLoggingOptions(udsAddress string) *log.Options

func PushCNIEvent

func PushCNIEvent(cniClient CNIEventClient, event *skel.CmdArgs, prevResIps []*cniv1.IPConfig, podName, podNamespace string) error

func TestLoadArgs

func TestLoadArgs(t *testing.T)

Validate k8sArgs struct works for unmarshalling kubelet args This is important for CNI plugin conformance

Types

type CNIEventClient

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

An udsCore write entries to an UDS server with HTTP Post. Log messages will be encoded into a JSON array.

type Config

type Config struct {
	types.NetConf

	// Add plugin-specific flags here
	LogLevel        string     `json:"log_level"`
	LogUDSAddress   string     `json:"log_uds_address"`
	CNIEventAddress string     `json:"cni_event_address"`
	AmbientEnabled  bool       `json:"ambient_enabled"`
	Kubernetes      Kubernetes `json:"kubernetes"`
}

Config 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.

type InterceptRuleMgr

type InterceptRuleMgr interface {
	Program(podName, netns string, redirect *Redirect) error
}

InterceptRuleMgr configures networking tables (e.g. iptables or nftables) for redirecting traffic to an Istio proxy.

func IptablesInterceptRuleMgr

func IptablesInterceptRuleMgr() InterceptRuleMgr

Constructor for iptables InterceptRuleMgr

type K8sArgs

type K8sArgs struct {
	types.CommonArgs
	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 containerd args for unmarshalling https://github.com/containerd/containerd/blob/ced9b18c231a28990617bc0a4b8ce2e81ee2ffa1/pkg/cri/server/sandbox_run.go#L526-L532

type Kubernetes

type Kubernetes struct {
	Kubeconfig        string   `json:"kubeconfig"`
	ExcludeNamespaces []string `json:"exclude_namespaces"`
}

Kubernetes a K8s specific struct to hold config

type PodInfo

type PodInfo struct {
	Containers        sets.String
	Labels            map[string]string
	Annotations       map[string]string
	ProxyType         string
	ProxyEnvironments map[string]string
	ProxyUID          *int64
	ProxyGID          *int64
}

func ExtractPodInfo

func ExtractPodInfo(pod *v1.Pod) *PodInfo

func (PodInfo) String

func (pi PodInfo) String() string

type Redirect

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

Redirect -- the istio-cni redirect object

func NewRedirect

func NewRedirect(pi *PodInfo) (*Redirect, error)

NewRedirect returns a new Redirect Object constructed from a list of ports and annotations

Jump to

Keyboard shortcuts

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