Documentation
¶
Index ¶
- Constants
- func FormatFieldSelector(selector *FieldSelector) (string, error)
- func FormatLabelSelector(selector *metav1.LabelSelector) (string, error)
- func IsExpiredError(err error) bool
- func NewKubeEventsManager(ctx context.Context, client *klient.Client) *kubeEventsManager
- func NewMonitor(ctx context.Context, client *klient.Client, ...) *monitor
- func NewNamespaceInformer(ctx context.Context, client *klient.Client, monitor *MonitorConfig) *namespaceInformer
- type CachedObjectsInfo
- type Factory
- type FactoryIndex
- type FactoryStore
- type KubeEventsManager
- type Monitor
- type MonitorConfig
- func (c *MonitorConfig) WithEventTypes(types []WatchEventType) *MonitorConfig
- func (c *MonitorConfig) WithFieldSelector(fieldSel *FieldSelector)
- func (c *MonitorConfig) WithLabelSelector(labelSel *metav1.LabelSelector)
- func (c *MonitorConfig) WithMode(mode KubeEventMode)
- func (c *MonitorConfig) WithNameSelector(nSel *NameSelector)
- func (c *MonitorConfig) WithNamespaceSelector(nsSel *NamespaceSelector)
- type WatchErrorHandler
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func FormatFieldSelector ¶
func FormatLabelSelector ¶
func FormatLabelSelector(selector *metav1.LabelSelector) (string, error)
func IsExpiredError ¶
IsExpiredError is a private method from k8s.io/client-go/tools/cache.
func NewKubeEventsManager ¶
NewKubeEventsManager returns an implementation of KubeEventsManager.
func NewMonitor ¶
func NewMonitor(ctx context.Context, client *klient.Client, mstor *metric_storage.MetricStorage, config *MonitorConfig, eventCb func(KubeEvent)) *monitor
func NewNamespaceInformer ¶
func NewNamespaceInformer(ctx context.Context, client *klient.Client, monitor *MonitorConfig) *namespaceInformer
Types ¶
type CachedObjectsInfo ¶
type CachedObjectsInfo struct {
Count uint64 `json:"count"`
Added uint64 `json:"added"`
Deleted uint64 `json:"deleted"`
Modified uint64 `json:"modified"`
Cleaned uint64 `json:"cleaned"`
}
CachedObjectsInfo stores counters of operations over resources in Monitors and Informers.
type FactoryIndex ¶
type FactoryIndex struct {
GVR schema.GroupVersionResource
Namespace string
FieldSelector string
LabelSelector string
}
type FactoryStore ¶
type FactoryStore struct {
// contains filtered or unexported fields
}
var ( DefaultFactoryStore *FactoryStore DefaultSyncTime = 100 * time.Millisecond )
func NewFactoryStore ¶
func NewFactoryStore() *FactoryStore
func (*FactoryStore) Start ¶
func (c *FactoryStore) Start(ctx context.Context, client dynamic.Interface, index FactoryIndex, handler cache.ResourceEventHandler, errorHandler *WatchErrorHandler) error
func (*FactoryStore) Stop ¶
func (c *FactoryStore) Stop(index FactoryIndex)
type KubeEventsManager ¶
type KubeEventsManager interface {
WithMetricStorage(mstor *metric_storage.MetricStorage)
AddMonitor(monitorConfig *MonitorConfig) error
HasMonitor(monitorID string) bool
GetMonitor(monitorID string) Monitor
StartMonitor(monitorID string)
StopMonitor(monitorID string) error
Ch() chan KubeEvent
PauseHandleEvents()
}
type Monitor ¶
type Monitor interface {
CreateInformers() error
Start(context.Context)
Stop()
PauseHandleEvents()
Snapshot() []ObjectAndFilterResult
EnableKubeEventCb()
GetConfig() *MonitorConfig
SnapshotOperations() (total *CachedObjectsInfo, last *CachedObjectsInfo)
}
type MonitorConfig ¶
type MonitorConfig struct {
Metadata struct {
MonitorId string
DebugName string
LogLabels map[string]string
MetricLabels map[string]string
}
EventTypes []WatchEventType
ApiVersion string
Kind string
NameSelector *NameSelector
NamespaceSelector *NamespaceSelector
LabelSelector *metav1.LabelSelector
FieldSelector *FieldSelector
JqFilter string
LogEntry *log.Entry
Mode KubeEventMode
KeepFullObjectsInMemory bool
FilterFunc func(*unstructured.Unstructured) (interface{}, error)
}
MonitorConfig is a config that suits the latest version of OnKubernetesEventConfig.
func (*MonitorConfig) WithEventTypes ¶
func (c *MonitorConfig) WithEventTypes(types []WatchEventType) *MonitorConfig
func (*MonitorConfig) WithFieldSelector ¶
func (c *MonitorConfig) WithFieldSelector(fieldSel *FieldSelector)
WithFieldSelector copies input FieldSelector into monitor.FieldSelector
func (*MonitorConfig) WithLabelSelector ¶
func (c *MonitorConfig) WithLabelSelector(labelSel *metav1.LabelSelector)
WithLabelSelector copies input LabelSelector into monitor.LabelSelector
func (*MonitorConfig) WithMode ¶
func (c *MonitorConfig) WithMode(mode KubeEventMode)
func (*MonitorConfig) WithNameSelector ¶
func (c *MonitorConfig) WithNameSelector(nSel *NameSelector)
WithNameSelector copies input NameSelector into monitor.NameSelector
func (*MonitorConfig) WithNamespaceSelector ¶
func (c *MonitorConfig) WithNamespaceSelector(nsSel *NamespaceSelector)
WithNamespaceSelector copies input NamespaceSelector into monitor.NamespaceSelector
type WatchErrorHandler ¶
type WatchErrorHandler struct {
// contains filtered or unexported fields
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.