Documentation ¶
Overview ¶
Package discovery contains types and methods pertaining to the discovery of aspects of a kubernetes cluster. For example, when new images are used on Pods or new Namespaces are created.
Index ¶
- func NewImageDiscoverer(writer EventWriter, store ImageStore) event.Handler
- func NewNamespaceDiscoverer(writer EventWriter, store NamespaceStore) event.Handler
- type BadgerStore
- func (bs *BadgerStore) Close() error
- func (bs *BadgerStore) ImageExists(ctx context.Context, image string) (bool, error)
- func (bs *BadgerStore) NamespaceExists(ctx context.Context, namespace string) (bool, error)
- func (bs *BadgerStore) SaveImage(ctx context.Context, image string) error
- func (bs *BadgerStore) SaveNamespace(ctx context.Context, namespace string) error
- type Discoverer
- type EventReader
- type EventWriter
- type ImageStore
- type NamespaceStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewImageDiscoverer ¶
func NewImageDiscoverer(writer EventWriter, store ImageStore) event.Handler
NewImageDiscoverer returns an event.Handler that handles inbound resource creation and update events and produces discovery events when a Pod is using a container image that has not been persisted to the ImageStore.
func NewNamespaceDiscoverer ¶
func NewNamespaceDiscoverer(writer EventWriter, store NamespaceStore) event.Handler
NewNamespaceDiscoverer returns an event.Handler that handles inbound resource creation and update events and produces discovery events when a namespace is created/updated that has not been persisted to the NamespaceStore.
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
The BadgerStore type implements the ImageStore and NamespaceStore interfaces and persists data to a badgerdb instance.
func NewBadgerStore ¶
func NewBadgerStore(path string) (*BadgerStore, error)
NewBadgerStore returns a new instance of the BadgerStore type that will create/open a badger database at the given path. Returns an error if opening or creating the database fails.
func (*BadgerStore) ImageExists ¶
ImageExists returns true if the provided image has already been persisted.
func (*BadgerStore) NamespaceExists ¶
NamespaceExists returns true if the provided namespace has already been persisted.
func (*BadgerStore) SaveImage ¶
func (bs *BadgerStore) SaveImage(ctx context.Context, image string) error
SaveImage adds a new image to the database.
func (*BadgerStore) SaveNamespace ¶
func (bs *BadgerStore) SaveNamespace(ctx context.Context, namespace string) error
SaveNamespace adds a new namespace to the database.
type Discoverer ¶
type Discoverer struct {
// contains filtered or unexported fields
}
The Discoverer type is used to check resource data from inbound events and produce discovery events.
func NewDiscoverer ¶
func NewDiscoverer(reader EventReader, handlers []event.Handler) *Discoverer
NewDiscoverer returns a new instance of the Discoverer type that will read inbound events from the provided EventReader implementation. For each inbound event, the provided event.Handler functions will be invoked. These handlers are responsible for checking the resource data and publishing discovery events if necessary.
type EventReader ¶
The EventReader interface describes types that can read events from an arbitrary event stream.
type EventWriter ¶
The EventWriter interface describes types that can write events to an arbitrary event stream.