agent

package
v0.0.0-...-7b7dccf Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CniOk                = 0
	CniIncompatible      = 1
	InvalidNetworkConfig = 2
	ContainerNotExist    = 3
	CniTryLater          = 11
	DriverFailure        = 101
	FastPathFailure      = 102
	InternalIPAM         = "nimbess"
	FastPathNetwork      = "fastpath"
	DefaultBaseCNIDir    = "/var/lib/nimbess/cni"
	DefaultPodNs         = "default"
)

CNI Reply Values

View Source
const (
	ALL_NETWORKS = "ALL_NETWORKS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	ProcessEvent(event *clientv3.Event, s *NimbessAgent)
	Init(context.Context, etcdv3.Client) error
	GetChannel() clientv3.WatchChan
}

type L2FIBEntry

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

type NimbessAgent

type NimbessAgent struct {
	ID          string
	EtcdContext context.Context
	Mu          *sync.Mutex
	Config      *config.NimbessConfig
	Driver      drivers.Driver
	KubeClient  kubernetes.Interface
	// Pipelines contains a map of port name to pipeline pointer
	Pipelines map[string]*NimbessPipeline
	// MetaPipelines contains a map of network name to abstract pipelines
	MetaPipelines map[string]*NimbessPipeline

	EtcdClient etcdv3.Client
	// contains filtered or unexported fields
}

func (*NimbessAgent) Add

func (s *NimbessAgent) Add(ctx context.Context, req *cni.CNIRequest) (*cni.CNIReply, error)

Add implements CNI Add Handler. It returns a CNI Reply to be sent to the Nimbess CNI client.

func (*NimbessAgent) Delete

func (s *NimbessAgent) Delete(ctx context.Context, req *cni.CNIRequest) (*cni.CNIReply, error)

Delete implements CNI Delete Handler. It returns a CNI Reply to be sent to the Nimbess CNI client.

func (*NimbessAgent) EnsureNetwork

func (s *NimbessAgent) EnsureNetwork(network string) (bool, error)

EnsureNetwork ensures that a network exists already in meta pipelines and if not, creates it from a network attachment definition. If the network attachment definition does not exist, an error is thrown. boolean returned is true if this network already existed in meta pipelines, false if it was initialized here

func (*NimbessAgent) Init

func (s *NimbessAgent) Init() error

Init initializes the agent

func (*NimbessAgent) Run

func (s *NimbessAgent) Run() error

Run starts up the main Agent daemon.

type NimbessPipeline

type NimbessPipeline struct {
	Name        string
	Mu          *sync.Mutex
	Modules     []network.PipelineModule
	Driver      drivers.Driver
	EgressPorts []*network.EgressPort
	MetaKey     string
	Gateway     string
	// contains filtered or unexported fields
}

NimbessPipeline implements a Pipeline of network functions for packet traversal

func (*NimbessPipeline) AddPort

func (s *NimbessPipeline) AddPort(name string, port *network.Port) (*network.EgressPort, error)

AddPort adds a port to a pipeline. It returns a pointer to a EgressPort module to update other pipelines with

func (*NimbessPipeline) DisconnectPipeline

func (s *NimbessPipeline) DisconnectPipeline(modType reflect.Type) error

DisconnectPipeline disconnects any modules of type modType that are attached to the last module in a pipeline

func (*NimbessPipeline) GetEgressPorts

func (s *NimbessPipeline) GetEgressPorts() []*network.EgressPort

func (*NimbessPipeline) GetLastModule

func (s *NimbessPipeline) GetLastModule(excludedTypes []reflect.Type) network.PipelineModule

GetLastModule returns a pointer to the last module in a pipeline. excludedTypes may be used to exclude modules of certain types (like EgressPort).

func (*NimbessPipeline) GetModule

func (s *NimbessPipeline) GetModule(name string) network.PipelineModule

GetModule returns the module

func (*NimbessPipeline) GetModuleFromType

func (s *NimbessPipeline) GetModuleFromType(modType reflect.Type) network.PipelineModule

GetModuleFromType gets the first Module found of a specific type

func (*NimbessPipeline) Init

func (s *NimbessPipeline) Init(port string, forwarder string, metaPipeline *NimbessPipeline) error

Init is responsible for initializing a new pipeline. It checks the abstract pipeline for a network and builds the pipeline for this port. If meta pipeline is not nil, s is a port pipeline.

func (*NimbessPipeline) InsertModule

func (s *NimbessPipeline) InsertModule(mod network.PipelineModule, index int, agent *NimbessAgent) error

Inserts a Module at position idx in a pipeline. If idx is 0, the module is inserted after the source port If index is less than 0, it is inserted at the end of pipeline before all egress ports agent is a pointer to the NimbessAgent to use to render the changes when a port pipeline is updated

func (*NimbessPipeline) RemoveModule

func (s *NimbessPipeline) RemoveModule(modName string, agent *NimbessAgent) error

RemoveModule removes a module from a pipeline agent is a pointer to the agent to use to render the changes when a port pipeline is updated

type UNPGazer

type UNPGazer struct {
	Path      string
	WatchChan clientv3.WatchChan
}

func (*UNPGazer) GetChannel

func (u *UNPGazer) GetChannel() clientv3.WatchChan

func (*UNPGazer) Init

func (u *UNPGazer) Init(ctx context.Context, client etcdv3.Client) error

func (*UNPGazer) ProcessEvent

func (u *UNPGazer) ProcessEvent(event *clientv3.Event, s *NimbessAgent)

func (*UNPGazer) ProcessUNP

func (u *UNPGazer) ProcessUNP(unp *v1.UnifiedNetworkPolicy, s *NimbessAgent, add bool) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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