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
- func ToChan(ch chan ChangeEvent) func(dto ChangeEvent)
- type ChangeEvent
- type ConfigIndex
- func (ci *ConfigIndex) ListAll() (containerIDs []string)
- func (ci *ConfigIndex) LookupContainer(containerID string) (data *container.Persisted, found bool)
- func (ci *ConfigIndex) LookupPodAppNs(namespaceID string) (containerIDs []string)
- func (ci *ConfigIndex) LookupPodIf(ifname string) (containerIDs []string)
- func (ci *ConfigIndex) LookupPodName(podName string) (containerIDs []string)
- func (ci *ConfigIndex) LookupPodNamespace(podNamespace string) (containerIDs []string)
- func (ci *ConfigIndex) RegisterContainer(containerID string, data *container.Persisted) error
- func (ci *ConfigIndex) UnregisterContainer(containerID string) (data *container.Persisted, found bool, err error)
- func (ci *ConfigIndex) Watch(subscriber infra.PluginName, callback func(ChangeEvent)) error
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexFunction ¶
IndexFunction creates secondary indexes. Currently podName, podNamespace, and the associated interface/namespace are indexed.
func ToChan ¶
func ToChan(ch chan ChangeEvent) func(dto ChangeEvent)
ToChan creates a callback that can be passed to the Watch function in order to receive notifications through a channel. If the notification can not be delivered until timeout, it is dropped.
Types ¶
type ChangeEvent ¶
type ChangeEvent struct { idxmap.NamedMappingEvent Value *container.Persisted }
ChangeEvent represents a notification about change in ConfigIndex delivered to subscribers
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, title string, broker keyval.ProtoBroker) *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) (data *container.Persisted, found bool)
LookupContainer looks up entry in the container based on containerID.
func (*ConfigIndex) LookupPodAppNs ¶
func (ci *ConfigIndex) LookupPodAppNs(namespaceID string) (containerIDs []string)
LookupPodAppNs performs lookup based on secondary index podRelatedNs.
func (*ConfigIndex) LookupPodIf ¶
func (ci *ConfigIndex) LookupPodIf(ifname string) (containerIDs []string)
LookupPodIf performs lookup based on secondary index podRelatedIfs.
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 *container.Persisted) error
RegisterContainer adds new entry into the mapping
func (*ConfigIndex) UnregisterContainer ¶
func (ci *ConfigIndex) UnregisterContainer(containerID string) (data *container.Persisted, found bool, err error)
UnregisterContainer removes the entry from the mapping
func (*ConfigIndex) Watch ¶
func (ci *ConfigIndex) Watch(subscriber infra.PluginName, callback func(ChangeEvent)) error
Watch subscribe to monitor changes in ConfigIndex
type Reader ¶
type Reader interface { // LookupContainer looks up entry in the container based on containerID. LookupContainer(containerID string) (data *container.Persisted, found bool) // LookupPodName performs lookup based on secondary index podName. LookupPodName(podName string) (containerIDs []string) // LookupPodNamespace performs lookup based on secondary index podNamespace. LookupPodNamespace(podNamespace string) (containerIDs []string) // LookupPodIf performs lookup based on secondary index podRelatedIfs. LookupPodIf(ifname string) (containerIDs []string) // LookupPodAppNs performs lookup based on secondary index podRelatedAppNs. LookupPodAppNs(namespaceID string) (containerIDs []string) // ListAll returns all registered names in the mapping. ListAll() (containerIDs []string) // Watch subscribe to monitor changes in ConfigIndex Watch(subscriber infra.PluginName, callback func(ChangeEvent)) error }
Reader provides read API to ConfigIndex