networkmanager

package
v0.0.0-...-f6398b5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultNetworkID is the default network.
	DefaultNetworkID = 0

	// MaxNetworks is the maximum number of networks allowed.
	MaxNetworks = 4096
)

Variables

View Source
var ErrNetworkControllerTopologyNotManaged = errors.New("no cluster network controller to manage topology")

Functions

This section is empty.

Types

type BaseNetworkController

type BaseNetworkController interface {
	ReconcilableNetworkController
	Start(ctx context.Context) error
	Stop()
}

BaseNetworkController is a ReconcilableNetworkController that can be started and stopped.

type Controller

type Controller interface {
	Interface() Interface
	Start() error
	Stop()
}

Controller handles the runtime of the package

func Default

func Default() Controller

Default returns a default implementation that assumes the default network is the only ever existing network. Used when multi-network capabilities are not enabled or testing.

func NewForCluster

func NewForCluster(
	cm ControllerManager,
	wf watchFactory,
	ovnClient *util.OVNClusterManagerClientset,
	recorder record.EventRecorder,
) (Controller, error)

NewForCluster builds a controller for cluster manager

func NewForNode

func NewForNode(
	node string,
	cm ControllerManager,
	wf watchFactory,
) (Controller, error)

NewForNode builds a controller for node manager

func NewForZone

func NewForZone(
	zone string,
	cm ControllerManager,
	wf watchFactory,
) (Controller, error)

NewForZone builds a controller for zone manager

type ControllerManager

type ControllerManager interface {
	NewNetworkController(netInfo util.NetInfo) (NetworkController, error)
	GetDefaultNetworkController() ReconcilableNetworkController
	CleanupStaleNetworks(validNetworks ...util.NetInfo) error

	// Reconcile informs the manager of network changes that other managed
	// network aware controllers might be interested in.
	Reconcile(name string, old, new util.NetInfo) error
}

ControllerManager manages controllers. Needs to be provided in order to build new network controllers and to to be informed of potential stale networks in case it has clean-up of it's own to do.

type Interface

type Interface interface {
	GetActiveNetworkForNamespace(namespace string) (util.NetInfo, error)

	// GetNetwork returns the network of the given name or nil if unknown
	GetNetwork(name string) util.NetInfo

	// DoWithLock takes care of locking and unlocking while iterating over all role primary user defined networks.
	DoWithLock(f func(network util.NetInfo) error) error
	GetActiveNetworkNamespaces(networkName string) ([]string, error)
}

Interface is the main package entrypoint and provides network related information to the rest of the project.

type NetworkController

type NetworkController interface {
	BaseNetworkController
	Cleanup() error
}

NetworkController is a BaseNetworkController that can also clean up after itself.

type ReconcilableNetworkController

type ReconcilableNetworkController interface {
	util.NetInfo

	// Reconcile informs the controller of network configuration changes.
	// Implementations should not return any error at or after updating this
	// network information on their as there is nothing network manager can do
	// about it. In this case implementations should either carry their on
	// retries or log the error and give up.
	Reconcile(util.NetInfo) error
}

ReconcilableNetworkController is a network controller that can reconcile certain network configuration changes.

Jump to

Keyboard shortcuts

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