controllers

package
v0.0.0-...-2879925 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package controllers is the package that contains controller functions.

Index

Constants

View Source
const (
	// Cri based runtime (e.g. cri-o)
	Cri = "cri"
)

Variables

This section is empty.

Functions

func CloseCriConnection

func CloseCriConnection(conn *grpc.ClientConn) error

CloseCriConnection closes grpc connection in client

func GetCriRuntimeClient

func GetCriRuntimeClient(runtimeEndpoint, hostPrefix string) (pb.RuntimeServiceClient, *grpc.ClientConn, error)

GetCriRuntimeClient retrieves cri grpc client

func IsMultiNetworkpolicyTarget

func IsMultiNetworkpolicyTarget(pod *v1.Pod) bool

IsMultiNetworkpolicyTarget ...

Types

type InterfaceInfo

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

InterfaceInfo ...

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 ...

func (*NamespaceChangeTracker) Update

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

Update ...

type NamespaceConfig

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

NamespaceConfig ...

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 ...

func (*NamespaceMap) GetNamespaceInfo

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

GetNamespaceInfo ...

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 ...

func NewNetDefChangeTracker

func NewNetDefChangeTracker() *NetDefChangeTracker

NewNetDefChangeTracker ...

func (*NetDefChangeTracker) GetPluginType

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

GetPluginType ...

func (*NetDefChangeTracker) String

func (ndt *NetDefChangeTracker) String() string

String ...

func (*NetDefChangeTracker) Update

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

Update ...

type NetDefConfig

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

NetDefConfig ...

func NewNetDefConfig

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

NewNetDefConfig ...

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 ...

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 that defines a object.

func (*NetDefInfo) Name

func (info *NetDefInfo) Name() string

Name ...

type NetDefMap

type NetDefMap map[types.NamespacedName]NetDefInfo

NetDefMap ...

func (*NetDefMap) Update

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

Update ...

type NetworkPolicyConfig

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

NetworkPolicyConfig ...

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 ...

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 in the node, keyed by their namespace and name

func NewPodChangeTracker

func NewPodChangeTracker(runtime RuntimeKind, runtimeEndpoint, hostname, hostPrefix string, networkPlugins []string, ndt *NetDefChangeTracker) *PodChangeTracker

NewPodChangeTracker ...

func NewPodChangeTrackerCri

func NewPodChangeTrackerCri(runtimeEndpoint, hostname, hostPrefix string, networkPlugins []string, ndt *NetDefChangeTracker) *PodChangeTracker

NewPodChangeTrackerCri ...

func (*PodChangeTracker) String

func (pct *PodChangeTracker) String() string

String

func (*PodChangeTracker) Update

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

Update ...

type PodConfig

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

PodConfig ...

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 {
	Name          string
	Namespace     string
	NetNSPath     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) GetMultusNetIFs

func (info *PodInfo) GetMultusNetIFs() []string

GetMultusNetIFs ...

func (*PodInfo) String

func (info *PodInfo) String() string

String ...

type PodMap

type PodMap map[types.NamespacedName]PodInfo

PodMap ...

func (*PodMap) GetPodInfo

func (pm *PodMap) GetPodInfo(pod *v1.Pod) (*PodInfo, error)

GetPodInfo ...

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 ...

func NewPolicyChangeTracker

func NewPolicyChangeTracker() *PolicyChangeTracker

NewPolicyChangeTracker ...

func (*PolicyChangeTracker) String

func (pct *PolicyChangeTracker) String() string

String ...

func (*PolicyChangeTracker) Update

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

Update ...

type PolicyInfo

type PolicyInfo struct {
	Policy *multiv1beta1.MultiNetworkPolicy
}

PolicyInfo contains information that defines a policy.

func (*PolicyInfo) Name

func (info *PolicyInfo) Name() string

Name ...

func (*PolicyInfo) Namespace

func (info *PolicyInfo) Namespace() string

Namespace ...

type PolicyMap

type PolicyMap map[types.NamespacedName]PolicyInfo

PolicyMap ...

func (*PolicyMap) Update

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

Update ...

type RuntimeKind

type RuntimeKind string

RuntimeKind is enum type variable for container runtime

func (*RuntimeKind) Set

func (rk *RuntimeKind) Set(s string) error

Set specifies container runtime kind

func (RuntimeKind) String

func (rk RuntimeKind) String() string

String returns current runtime kind

func (RuntimeKind) Type

func (rk RuntimeKind) Type() string

Type returns its type, "RuntimeKind"

Jump to

Keyboard shortcuts

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