Documentation ¶
Index ¶
- Constants
- Variables
- func IndexerPlugin(name string, c IndexerConstructor) map[string][]interface{}
- func MatcherPlugin(name string, m MatcherConstructor) map[string][]interface{}
- type ContainerIndexer
- type Enabled
- type FieldFormatMatcher
- type FieldMatcher
- type IPPortIndexer
- type Indexer
- type IndexerConstructor
- type Indexers
- type Matcher
- type MatcherConstructor
- type Matchers
- type MetadataIndex
- type PluginConfig
- type PodNameIndexer
- type Register
- func (r *Register) AddDefaultIndexerConfig(name string, config common.Config)
- func (r *Register) AddDefaultMatcherConfig(name string, config common.Config)
- func (r *Register) AddIndexer(name string, indexer IndexerConstructor)
- func (r *Register) AddMatcher(name string, matcher MatcherConstructor)
- func (r *Register) GetDefaultIndexerConfigs() map[string]common.Config
- func (r *Register) GetDefaultMatcherConfigs() map[string]common.Config
- func (r *Register) GetIndexer(name string) IndexerConstructor
- func (r *Register) GetMatcher(name string) MatcherConstructor
Constants ¶
const ( ContainerIndexerName = "container" PodNameIndexerName = "pod_name" IPPortIndexerName = "ip_port" )
const ( FieldMatcherName = "fields" FieldFormatMatcherName = "field_format" )
Variables ¶
var Indexing = NewRegister()
Indexing is the singleton Register instance where all Indexers and Matchers are stored
Functions ¶
func IndexerPlugin ¶
func IndexerPlugin(name string, c IndexerConstructor) map[string][]interface{}
func MatcherPlugin ¶
func MatcherPlugin(name string, m MatcherConstructor) map[string][]interface{}
Types ¶
type ContainerIndexer ¶
type ContainerIndexer struct {
// contains filtered or unexported fields
}
ContainerIndexer indexes pods based on all their containers IDs
func (*ContainerIndexer) GetIndexes ¶
func (c *ContainerIndexer) GetIndexes(pod *kubernetes.Pod) []string
GetIndexes returns the indexes for the given Pod
func (*ContainerIndexer) GetMetadata ¶
func (c *ContainerIndexer) GetMetadata(pod *kubernetes.Pod) []MetadataIndex
GetMetadata returns the composed metadata list from all registered indexers
type FieldFormatMatcher ¶
func (*FieldFormatMatcher) MetadataIndex ¶
func (f *FieldFormatMatcher) MetadataIndex(event common.MapStr) string
type FieldMatcher ¶
type FieldMatcher struct {
MatchFields []string
}
func (*FieldMatcher) MetadataIndex ¶
func (f *FieldMatcher) MetadataIndex(event common.MapStr) string
type IPPortIndexer ¶
type IPPortIndexer struct {
// contains filtered or unexported fields
}
IPPortIndexer indexes pods based on all their host:port combinations
func (*IPPortIndexer) GetIndexes ¶
func (h *IPPortIndexer) GetIndexes(pod *kubernetes.Pod) []string
GetIndexes returns the indexes for the given Pod
func (*IPPortIndexer) GetMetadata ¶
func (h *IPPortIndexer) GetMetadata(pod *kubernetes.Pod) []MetadataIndex
GetMetadata returns metadata for the given pod, if it matches the index
type Indexer ¶
type Indexer interface { // GetMetadata generates event metadata for the given pod, then returns the // list of indexes to create, with the metadata to put on them GetMetadata(pod *kubernetes.Pod) []MetadataIndex // GetIndexes return the list of indexes the given pod belongs to. This function // must return the same indexes than GetMetadata GetIndexes(pod *kubernetes.Pod) []string }
Indexer take known pods and generate all the metadata we need to enrich events in a efficient way. By preindexing the metadata in the way it will be checked when matching events
func NewContainerIndexer ¶
func NewContainerIndexer(_ common.Config, metaGen kubernetes.MetaGenerator) (Indexer, error)
NewContainerIndexer initializes and returns a ContainerIndexer
func NewIPPortIndexer ¶
func NewIPPortIndexer(_ common.Config, metaGen kubernetes.MetaGenerator) (Indexer, error)
NewIPPortIndexer creates and returns a new indexer for pod IP & ports
func NewPodNameIndexer ¶
func NewPodNameIndexer(_ common.Config, metaGen kubernetes.MetaGenerator) (Indexer, error)
NewPodNameIndexer initializes and returns a PodNameIndexer
type IndexerConstructor ¶
type IndexerConstructor func(config common.Config, metaGen kubernetes.MetaGenerator) (Indexer, error)
IndexerConstructor builds a new indexer from its settings
type Indexers ¶
func NewIndexers ¶
func NewIndexers(configs PluginConfig, metaGen kubernetes.MetaGenerator) *Indexers
NewIndexers builds indexers object
func (*Indexers) GetIndexes ¶
func (i *Indexers) GetIndexes(pod *kubernetes.Pod) []string
GetIndexes returns the composed index list from all registered indexers
func (*Indexers) GetMetadata ¶
func (i *Indexers) GetMetadata(pod *kubernetes.Pod) []MetadataIndex
GetMetadata returns the composed metadata list from all registered indexers
type Matcher ¶
type Matcher interface { // MetadataIndex returns the index string to use in annotation lookups for the given // event. A previous indexer should have generated that index for this to work // This function can return "" if the event doesn't match MetadataIndex(event common.MapStr) string }
Matcher takes a new event and returns the index
type Matchers ¶
func NewMatchers ¶
func NewMatchers(configs PluginConfig) *Matchers
type MetadataIndex ¶
MetadataIndex holds a pair of index -> metadata info
type PluginConfig ¶
type PodNameIndexer ¶
type PodNameIndexer struct {
// contains filtered or unexported fields
}
PodNameIndexer implements default indexer based on pod name
func (*PodNameIndexer) GetIndexes ¶
func (p *PodNameIndexer) GetIndexes(pod *kubernetes.Pod) []string
GetIndexes returns the indexes for the given Pod
func (*PodNameIndexer) GetMetadata ¶
func (p *PodNameIndexer) GetMetadata(pod *kubernetes.Pod) []MetadataIndex
GetMetadata returns metadata for the given pod, if it matches the index
type Register ¶
Register contains Indexer and Matchers to use on pod indexing and event matching
func (*Register) AddDefaultIndexerConfig ¶
AddIndexer to the register
func (*Register) AddDefaultMatcherConfig ¶
AddMatcher to the register
func (*Register) AddIndexer ¶
func (r *Register) AddIndexer(name string, indexer IndexerConstructor)
AddIndexer to the register
func (*Register) AddMatcher ¶
func (r *Register) AddMatcher(name string, matcher MatcherConstructor)
AddMatcher to the register
func (*Register) GetDefaultIndexerConfigs ¶
func (*Register) GetDefaultMatcherConfigs ¶
func (*Register) GetIndexer ¶
func (r *Register) GetIndexer(name string) IndexerConstructor
AddIndexer to the register
func (*Register) GetMatcher ¶
func (r *Register) GetMatcher(name string) MatcherConstructor
AddMatcher to the register