Documentation ¶
Overview ¶
Package controllers is the package that contains controller functions.
Index ¶
- Constants
- func CloseCriConnection(conn *grpc.ClientConn) error
- func GetCriRuntimeClient(runtimeEndpoint, hostPrefix string) (pb.RuntimeServiceClient, *grpc.ClientConn, error)
- func IsMultiNetworkpolicyTarget(pod *v1.Pod) bool
- type InterfaceInfo
- type NamespaceChangeTracker
- type NamespaceConfig
- type NamespaceHandler
- type NamespaceInfo
- type NamespaceMap
- type NetDefChangeTracker
- type NetDefConfig
- type NetDefHandler
- type NetDefInfo
- type NetDefMap
- type NetworkPolicyConfig
- type NetworkPolicyHandler
- type PodChangeTracker
- type PodConfig
- type PodHandler
- type PodInfo
- type PodMap
- type PolicyChangeTracker
- type PolicyInfo
- type PolicyMap
- type RuntimeKind
Constants ¶
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 ¶
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 ...
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 ¶
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) 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.
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.
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.
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 ...
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.
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 ¶
CheckPolicyNetwork checks whether given pod is target or not, based on policyNetworks
func (*PodInfo) GetMultusNetIFs ¶
GetMultusNetIFs ...
type PodMap ¶
type PodMap map[types.NamespacedName]PodInfo
PodMap ...
func (*PodMap) GetPodInfo ¶
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) 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.
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