windataplane

package
v0.0.0-...-21cfbab Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorUnknownEndpoint = errors.New("Endpoint could not be found")
	ErrorUpdateFailed    = errors.New("Endpoint update failed")
)
View Source
var (
	ErrUpdatesFailed = errors.New("some VXLAN route updates failed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	IPv6Enabled      bool
	HealthAggregator *health.HealthAggregator

	// Currently set to maximum value.
	MaxIPSetSize int

	Hostname     string
	VXLANEnabled bool
	VXLANID      int
	VXLANPort    int
}

type Manager

type Manager interface {
	// OnUpdate is called for each protobuf message from the datastore.  May either directly
	// send updates to the IPSets and PolicySets objects (which will queue the updates
	// until the main loop instructs them to act) or (for efficiency) may wait until
	// a call to CompleteDeferredWork() to flush updates to the dataplane.
	OnUpdate(protoBufMsg interface{})
	// Called to allow for any batched work to be completed.
	CompleteDeferredWork() error
}

Interface for Managers. Each Manager is responsible for processing updates from felix and for applying any necessary updates to the dataplane.

type WindowsDataplane

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

winDataplane implements an in-process Felix dataplane driver capable of applying network policy dataplane updates via the Host Network Service (HNS) on Windows. It communicates with the datastore-facing part of Felix via the Send/RecvMessage methods, which operate on the protobuf-defined API objects.

Architecture

The Windows dataplane driver is organised around a main event loop, which handles update events from the datastore and dataplane.

Each pass around the main loop has two phases. In the first phase, updates are fanned out to "manager" objects, which calculate the changes that are needed. In the second phase, the set of pending changes are communicated to the HNS service so that they will be immediately applied to the dataplane. The second phase is skipped until the datastore is in sync; this ensures that the first update to the dataplane applies a consistent snapshot.

Several optimizations and improvements are forthcoming. At this time, the Windows dataplane does not have a native concept similar to IP sets, which means that IP set information needs to be cached in the driver along with associated Policies/Profiles. As datastore updates are received, we refer back to the caches to recalculate the sets of rules which need to be sent to HNS. As the HNS API surface is enhanced, we may be able to optimize and remove some or all of these caches.

Requirements on the API

The dataplane does not do consistency checks on the incoming data. It expects to be told about dependent resources before they are needed and for their lifetime to exceed that of the resources that depend on them. For example, it is important the the datastore layer send an IP set create event before it sends a rule that references that IP set.

func NewWinDataplaneDriver

func NewWinDataplaneDriver(hns hns.API, config Config) *WindowsDataplane

NewWinDataplaneDriver creates and initializes a new dataplane driver using the provided configuration.

func (*WindowsDataplane) RecvMessage

func (d *WindowsDataplane) RecvMessage() (interface{}, error)

Called by Felix.go so that it can receive a channel to listen for message being sent by this dataplane driver.

func (*WindowsDataplane) RegisterManager

func (d *WindowsDataplane) RegisterManager(mgr Manager)

Registers a new Manager with the driver.

func (*WindowsDataplane) SendMessage

func (d *WindowsDataplane) SendMessage(msg interface{}) error

Called by someone to put a message into our channel so that the loop will pick it up and process it.

func (*WindowsDataplane) Start

func (d *WindowsDataplane) Start()

Starts the driver.

Directories

Path Synopsis
Dummy version of the HCN API for compilation on Linux.
Dummy version of the HCN API for compilation on Linux.

Jump to

Keyboard shortcuts

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