dataplane

package
v1.4.16 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AzureNetworkName is default network Azure CNI creates
	AzureNetworkName = "azure"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPlane

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

func NewDataPlane

func NewDataPlane(nodeName string, ioShim *common.IOShim) (*DataPlane, error)

func (*DataPlane) AddPolicy

func (dp *DataPlane) AddPolicy(policy *policies.NPMNetworkPolicy) error

AddPolicy takes in a translated NPMNetworkPolicy object and applies on dataplane

func (*DataPlane) AddToLists

func (dp *DataPlane) AddToLists(listName, setNames []*ipsets.IPSetMetadata) error

AddToLists takes a list name and list of sets which are to be added as members to given list

func (*DataPlane) AddToSets

func (dp *DataPlane) AddToSets(setNames []*ipsets.IPSetMetadata, podMetadata *PodMetadata) error

AddToSets takes in a list of IPSet names along with IP member and then updates it local cache

func (*DataPlane) ApplyDataPlane

func (dp *DataPlane) ApplyDataPlane() error

ApplyDataPlane all the IPSet operations just update cache and update a dirty ipset structure, they do not change apply changes into dataplane. This function needs to be called at the end of IPSet operations of a given controller event, it will check for the dirty ipset list and accordingly makes changes in dataplane. This function helps emulate a single call to dataplane instead of multiple ipset operations calls ipset operations calls to dataplane

func (*DataPlane) CreateIPSets

func (dp *DataPlane) CreateIPSets(setMetadata []*ipsets.IPSetMetadata)

CreateIPSets takes in a set object and updates local cache with this set

func (*DataPlane) DeleteIPSet

func (dp *DataPlane) DeleteIPSet(setMetadata *ipsets.IPSetMetadata)

DeleteSet checks for members and references of the given "set" type ipset if not used then will delete it from cache

func (*DataPlane) InitializeDataPlane added in v1.4.13

func (dp *DataPlane) InitializeDataPlane() error

InitializeDataPlane helps in setting up dataplane for NPM

func (*DataPlane) RemoveFromList

func (dp *DataPlane) RemoveFromList(listName *ipsets.IPSetMetadata, setNames []*ipsets.IPSetMetadata) error

RemoveFromList takes a list name and list of sets which are to be removed as members to given list

func (*DataPlane) RemoveFromSets

func (dp *DataPlane) RemoveFromSets(setNames []*ipsets.IPSetMetadata, podMetadata *PodMetadata) error

RemoveFromSets takes in list of setnames from which a given IP member should be removed and will update the local cache

func (*DataPlane) RemovePolicy

func (dp *DataPlane) RemovePolicy(policyKey string) error

RemovePolicy takes in network policyKey (namespace/name of network policy) and removes it from dataplane and cache

func (*DataPlane) ResetDataPlane added in v1.4.13

func (dp *DataPlane) ResetDataPlane() error

ResetDataPlane helps in cleaning up dataplane sets and policies programmed by NPM, returning a clean slate

func (*DataPlane) UpdatePolicy

func (dp *DataPlane) UpdatePolicy(policy *policies.NPMNetworkPolicy) error

UpdatePolicy takes in updated policy object, calculates the delta and applies changes onto dataplane accordingly

type GenericDataplane

type GenericDataplane interface {
	InitializeDataPlane() error
	ResetDataPlane() error
	CreateIPSets(setNames []*ipsets.IPSetMetadata)
	DeleteIPSet(setMetadata *ipsets.IPSetMetadata)
	AddToSets(setNames []*ipsets.IPSetMetadata, podMetadata *PodMetadata) error
	RemoveFromSets(setNames []*ipsets.IPSetMetadata, podMetadata *PodMetadata) error
	AddToLists(listName []*ipsets.IPSetMetadata, setNames []*ipsets.IPSetMetadata) error
	RemoveFromList(listName *ipsets.IPSetMetadata, setNames []*ipsets.IPSetMetadata) error
	ApplyDataPlane() error
	AddPolicy(policies *policies.NPMNetworkPolicy) error
	RemovePolicy(policyName string) error
	UpdatePolicy(policies *policies.NPMNetworkPolicy) error
}

type NPMEndpoint added in v1.4.13

type NPMEndpoint struct {
	Name string
	ID   string
	IP   string
	// TODO: check it may use PolicyKey instead of Policy name
	// Map with Key as Network Policy name to to emulate set
	// and value as struct{} for minimal memory consumption
	NetPolReference map[string]struct{}
}

type PodMetadata

type PodMetadata struct {
	PodKey   string
	PodIP    string
	NodeName string
}

PodMetadata is what is passed to dataplane to specify pod ipset todo definitely requires further optimization between the intersection of types, PodMetadata, NpmPod and corev1.pod

func NewPodMetadata

func NewPodMetadata(podKey, podIP, nodeName string) *PodMetadata

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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