Documentation ¶
Overview ¶
Package containeridx implements a mapping structure that allows to store configured container networking. The main aim is to lookup interfaces associated with a pod while applying policies.
Index ¶
- func IndexFunction(data interface{}) map[string][]string
- type Config
- type ConfigIndex
- func (ci *ConfigIndex) ListAll() (containerIDs []string)
- func (ci *ConfigIndex) LookupContainer(containerID string) (found bool, data *Config)
- func (ci *ConfigIndex) LookupPodName(podName string) (containerIDs []string)
- func (ci *ConfigIndex) LookupPodNamespace(podNamespace string) (containerIDs []string)
- func (ci *ConfigIndex) RegisterContainer(containerID string, data *Config)
- func (ci *ConfigIndex) UnregisterContainer(containerID string) (data *Config, found bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexFunction ¶
IndexFunction creates secondary indexes. Currently podName and podNamespace fields are indexed.
Types ¶
type Config ¶
type Config struct { // PodName from the CNI request PodName string // PodNamespace from the CNI request PodNamespace string // Veth1 one end end of veth pair that is in the given container namespace Veth1 *linux_intf.LinuxInterfaces_Interface // Veth2 is the other end of veth pair in the default namespace Veth2 *linux_intf.LinuxInterfaces_Interface // Afpacket connects Veth2 into vpp Afpacket *vpp_intf.Interfaces_Interface // Route to the container Route *l3.StaticRoutes_Route }
Config groups applied configuration for a container
type ConfigIndex ¶
type ConfigIndex struct {
// contains filtered or unexported fields
}
ConfigIndex implements a cache for configured containers. Primary index is containerID.
func NewConfigIndex ¶
func NewConfigIndex(logger logging.Logger, owner core.PluginName, title string) *ConfigIndex
NewConfigIndex creates new instance of ConfigIndex
func (*ConfigIndex) ListAll ¶
func (ci *ConfigIndex) ListAll() (containerIDs []string)
ListAll returns all registered names in the mapping.
func (*ConfigIndex) LookupContainer ¶
func (ci *ConfigIndex) LookupContainer(containerID string) (found bool, data *Config)
LookupContainer looks up entry in the container based on containerID.
func (*ConfigIndex) LookupPodName ¶
func (ci *ConfigIndex) LookupPodName(podName string) (containerIDs []string)
LookupPodName performs lookup based on secondary index podName.
func (*ConfigIndex) LookupPodNamespace ¶
func (ci *ConfigIndex) LookupPodNamespace(podNamespace string) (containerIDs []string)
LookupPodNamespace performs lookup based on secondary index podNamespace.
func (*ConfigIndex) RegisterContainer ¶
func (ci *ConfigIndex) RegisterContainer(containerID string, data *Config)
RegisterContainer adds new entry into the mapping
func (*ConfigIndex) UnregisterContainer ¶
func (ci *ConfigIndex) UnregisterContainer(containerID string) (data *Config, found bool)
UnregisterContainer removes the entry from the nbmapping