containeridx

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexFunction

func IndexFunction(data interface{}) map[string][]string

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

Directories

Path Synopsis
Package container is a generated protocol buffer package.
Package container is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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