controllers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InterfaceInfo

type InterfaceInfo struct {
	NetattachName string
	DeviceID      string
	InterfaceName string
	InterfaceType string
	IPs           []string
}

InterfaceInfo contains information that defines a Pod Interface.

func (*InterfaceInfo) CheckPolicyNetwork

func (info *InterfaceInfo) CheckPolicyNetwork(policyNetworks []string) bool

CheckPolicyNetwork checks whether given interface is target or not, based on policyNetworks

type NamespaceChangeTracker

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

NamespaceChangeTracker carries state about uncommitted changes to an arbitrary number of Namespaces in the node, keyed by their namespace and name

func NewNamespaceChangeTracker

func NewNamespaceChangeTracker() *NamespaceChangeTracker

NewNamespaceChangeTracker creates a new instance of NamespaceChangeTracker

func (*NamespaceChangeTracker) Update

func (nct *NamespaceChangeTracker) Update(previous, current *v1.Namespace) bool

Update handles an update of a given Namespace

type NamespaceConfig

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

NamespaceConfig registers event handlers for NamespaceInformer

func NewNamespaceConfig

func NewNamespaceConfig(nsInformer coreinformers.NamespaceInformer, resyncPeriod time.Duration) *NamespaceConfig

NewNamespaceConfig creates a new NamespaceConfig.

func (*NamespaceConfig) RegisterEventHandler

func (c *NamespaceConfig) RegisterEventHandler(handler NamespaceHandler)

RegisterEventHandler registers a handler which is called on every pod change.

func (*NamespaceConfig) Run

func (c *NamespaceConfig) Run(stopCh <-chan struct{})

Run waits for cache synced and invokes handlers after syncing.

type NamespaceHandler

type NamespaceHandler interface {
	// OnNamespaceAdd is called whenever creation of new ns object
	// is observed.
	OnNamespaceAdd(ns *v1.Namespace)
	// OnNamespaceUpdate is called whenever modification of an existing
	// ns object is observed.
	OnNamespaceUpdate(oldNS, ns *v1.Namespace)
	// OnNamespaceDelete is called whenever deletion of an existing ns
	// object is observed.
	OnNamespaceDelete(ns *v1.Namespace)
	// OnNamespaceSynced is called once all the initial event handlers were
	// called and the state is fully propagated to local cache.
	OnNamespaceSynced()
}

NamespaceHandler is an abstract interface of objects which receive notifications about pod object changes.

type NamespaceInfo

type NamespaceInfo struct {
	Name   string
	Labels map[string]string
}

NamespaceInfo contains information that defines a namespace.

type NamespaceMap

type NamespaceMap map[string]NamespaceInfo

NamespaceMap maps Namespace name to NamespaceInfo

func (*NamespaceMap) GetNamespaceInfo

func (nm *NamespaceMap) GetNamespaceInfo(nsName string) (*NamespaceInfo, error)

GetNamespaceInfo returns NamespaceInfo keyed by nsName

func (*NamespaceMap) Update

func (nm *NamespaceMap) Update(changes *NamespaceChangeTracker)

Update updates podMap base on the given changes

type NetDefChangeTracker

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

NetDefChangeTracker carries state about uncommitted changes to an arbitrary number of NetworkAttachmentDefinition keyed by their namespace and name

func NewNetDefChangeTracker

func NewNetDefChangeTracker() *NetDefChangeTracker

NewNetDefChangeTracker creates a new instance of NetDefChangeTracker

func (*NetDefChangeTracker) GetPluginType

func (ndt *NetDefChangeTracker) GetPluginType(name types.NamespacedName) string

GetPluginType returns the CNI plugin name for the given (secondary) network represented by its namespaced name

func (*NetDefChangeTracker) String

func (ndt *NetDefChangeTracker) String() string

String returns string representation of the changes currently held in NetDefChangeTracker

func (*NetDefChangeTracker) Update

func (ndt *NetDefChangeTracker) Update(previous, current *netdefv1.NetworkAttachmentDefinition) bool

Update handles an update of a given NetworkAttachmentDefinition

type NetDefConfig

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

NetDefConfig registers event handlers for NetworkAttachmentDefinitionInformer

func NewNetDefConfig

func NewNetDefConfig(netdefInformer netdefinformerv1.NetworkAttachmentDefinitionInformer,
	resyncPeriod time.Duration) *NetDefConfig

NewNetDefConfig creates a new instance of NetDefConfig

func (*NetDefConfig) RegisterEventHandler

func (c *NetDefConfig) RegisterEventHandler(handler NetDefHandler)

RegisterEventHandler registers a handler which is called on every netdef change.

func (*NetDefConfig) Run

func (c *NetDefConfig) Run(stopCh <-chan struct{})

Run waits for cache synced and invokes handlers after syncing.

type NetDefHandler

type NetDefHandler interface {
	// OnNetDefAdd is called whenever creation of new object
	// is observed.
	OnNetDefAdd(net *netdefv1.NetworkAttachmentDefinition)
	// OnNetDefUpdate is called whenever modification of an existing
	// object is observed.
	OnNetDefUpdate(oldNet, net *netdefv1.NetworkAttachmentDefinition)
	// OnNetDefDelete is called whenever deletion of an existing
	// object is observed.
	OnNetDefDelete(net *netdefv1.NetworkAttachmentDefinition)
	// OnNetDefSynced is called once all the initial event handlers were
	// called and the state is fully propagated to local cache.
	OnNetDefSynced()
}

NetDefHandler is an abstract interface of objects which receive notifications about net-attach-def object changes.

type NetDefInfo

type NetDefInfo struct {
	Netdef     *netdefv1.NetworkAttachmentDefinition
	PluginType string
}

NetDefInfo contains information about NetworkAttachmentDefinition.

func (*NetDefInfo) Name

func (info *NetDefInfo) Name() string

Name returns NetworkAttachmentDefinition name

type NetDefMap

type NetDefMap map[types.NamespacedName]NetDefInfo

NetDefMap maps NetworkAttachmentDefinition namespaced name to NetDefInfo

func (*NetDefMap) Update

func (n *NetDefMap) Update(changes *NetDefChangeTracker)

Update updates NetDefMap base on the given changes

type NetworkPolicyConfig

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

NetworkPolicyConfig registers event handlers for MultiNetworkPolicy

func NewNetworkPolicyConfig

func NewNetworkPolicyConfig(policyInformer multiinformerv1beta1.MultiNetworkPolicyInformer,
	resyncPeriod time.Duration) *NetworkPolicyConfig

NewNetworkPolicyConfig creates a new NetworkPolicyConfig .

func (*NetworkPolicyConfig) RegisterEventHandler

func (c *NetworkPolicyConfig) RegisterEventHandler(handler NetworkPolicyHandler)

RegisterEventHandler registers a handler which is called on every policy change.

func (*NetworkPolicyConfig) Run

func (c *NetworkPolicyConfig) Run(stopCh <-chan struct{})

Run waits for cache synced and invokes handlers after syncing.

type NetworkPolicyHandler

type NetworkPolicyHandler interface {
	// OnPolicyAdd is called whenever creation of new policy object
	// is observed.
	OnPolicyAdd(policy *multiv1beta1.MultiNetworkPolicy)
	// OnPolicyUpdate is called whenever modification of an existing
	// policy object is observed.
	OnPolicyUpdate(oldPolicy, policy *multiv1beta1.MultiNetworkPolicy)
	// OnPolicyDelete is called whenever deletion of an existing policy
	// object is observed.
	OnPolicyDelete(policy *multiv1beta1.MultiNetworkPolicy)
	// OnPolicySynced is called once all the initial event handlers were
	// called and the state is fully propagated to local cache.
	OnPolicySynced()
}

NetworkPolicyHandler is an abstract interface of objects which receive notifications about policy object changes.

type PodChangeTracker

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

PodChangeTracker carries state about uncommitted changes to an arbitrary number of Pods keyed by their namespace and name

func NewPodChangeTracker

func NewPodChangeTracker(networkPlugins []string, ndt *NetDefChangeTracker) *PodChangeTracker

NewPodChangeTracker creates a new instance of PodChangeTracker

func (*PodChangeTracker) String

func (pct *PodChangeTracker) String() string

String returns a string representation of PodChangeTracker

func (*PodChangeTracker) Update

func (pct *PodChangeTracker) Update(previous, current *v1.Pod) bool

Update handles an update of a given Pod

type PodConfig

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

PodConfig registers event handlers for PodInformer

func NewPodConfig

func NewPodConfig(podInformer coreinformers.PodInformer, resyncPeriod time.Duration) *PodConfig

NewPodConfig creates a new PodConfig.

func (*PodConfig) RegisterEventHandler

func (c *PodConfig) RegisterEventHandler(handler PodHandler)

RegisterEventHandler registers a handler which is called on every pod change.

func (*PodConfig) Run

func (c *PodConfig) Run(stopCh <-chan struct{})

Run waits for cache synced and invokes handlers after syncing.

type PodHandler

type PodHandler interface {
	// OnPodAdd is called whenever creation of new pod object
	// is observed.
	OnPodAdd(pod *v1.Pod)
	// OnPodUpdate is called whenever modification of an existing
	// pod object is observed.
	OnPodUpdate(oldPod, pod *v1.Pod)
	// OnPodDelete is called whenever deletion of an existing pod
	// object is observed.
	OnPodDelete(pod *v1.Pod)
	// OnPodSynced is called once all the initial event handlers were
	// called and the state is fully propagated to local cache.
	OnPodSynced()
}

PodHandler is an abstract interface of objects which receive notifications about pod object changes.

type PodInfo

type PodInfo struct {
	UID           string
	Name          string
	Labels        map[string]string
	Namespace     string
	NetworkStatus []netdefv1.NetworkStatus
	NodeName      string
	Interfaces    []InterfaceInfo
}

PodInfo contains information that defines a pod.

func (*PodInfo) CheckPolicyNetwork

func (info *PodInfo) CheckPolicyNetwork(policyNetworks []string) bool

CheckPolicyNetwork checks whether given pod is target or not, based on policyNetworks

func (*PodInfo) PolicyAppliesForPod

func (info *PodInfo) PolicyAppliesForPod(policy *multiv1beta1.MultiNetworkPolicy) (bool, error)

PolicyAppliesForPod returns true if provided policy is applicable to the provided pod by checking if the pod and policy share the same namespace and the pod matches the policy's pod selector Note: it does not mean it applies to any networks of that pod

func (*PodInfo) String

func (info *PodInfo) String() string

String returns a string representation of PodInfo

type PodMap

type PodMap map[types.NamespacedName]PodInfo

PodMap maps Pod namespaced name to PodInfo

func (*PodMap) GetPodInfo

func (pm *PodMap) GetPodInfo(namespace, name string) (*PodInfo, error)

GetPodInfo returns PodInfo identified by namespace and name from PodMap

func (*PodMap) List

func (pm *PodMap) List() ([]PodInfo, error)

List lists all PodInfo in PodMap, returns error if PodMap is nil

func (*PodMap) Update

func (pm *PodMap) Update(changes *PodChangeTracker)

Update updates podMap base on the given changes

type PolicyChangeTracker

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

PolicyChangeTracker carries state about uncommitted changes to an arbitrary number of MultiNetworkPolicies keyed by their namespace and name

func NewPolicyChangeTracker

func NewPolicyChangeTracker() *PolicyChangeTracker

NewPolicyChangeTracker creates a new instance of PolicyChangeTracker

func (*PolicyChangeTracker) String

func (pct *PolicyChangeTracker) String() string

String returns a string representation of PolicyChangeTracker changes

func (*PolicyChangeTracker) Update

func (pct *PolicyChangeTracker) Update(previous, current *multiv1beta1.MultiNetworkPolicy) bool

Update handles an update of a given MultiNetworkPolicy

type PolicyInfo

type PolicyInfo struct {
	PolicyNetworks []string
	Policy         *multiv1beta1.MultiNetworkPolicy
}

PolicyInfo contains information that defines a policy.

func (*PolicyInfo) AppliesForNetwork

func (info *PolicyInfo) AppliesForNetwork(networkName string) bool

AppliesForNetwork returns true if Policy applies for the provided network

func (*PolicyInfo) Name

func (info *PolicyInfo) Name() string

Name returns MultiNetworkPolicy name

func (*PolicyInfo) Namespace

func (info *PolicyInfo) Namespace() string

Namespace returns MultiNetworkPolicy namespace

type PolicyMap

type PolicyMap map[types.NamespacedName]PolicyInfo

PolicyMap maps MultiNetworkPolicy namespaced name to PolicyInfo

func (*PolicyMap) Update

func (pm *PolicyMap) Update(changes *PolicyChangeTracker)

Update updates PolicyMap base on the given changes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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