kube_events_manager

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 31 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

Index

Constants

View Source
const (
	ResyncPeriodMedian            = time.Duration(3) * time.Hour
	ResyncPeriodSpread            = time.Duration(2) * time.Hour
	ResyncPeriodGranularity       = time.Duration(5) * time.Minute
	ResyncPeriodJitterGranularity = time.Duration(15) * time.Second
)

Variables

This section is empty.

Functions

func FormatFieldSelector

func FormatFieldSelector(selector *FieldSelector) (string, error)

func FormatLabelSelector

func FormatLabelSelector(selector *metav1.LabelSelector) (string, error)

func IsExpiredError

func IsExpiredError(err error) bool

IsExpiredError is a private method from k8s.io/client-go/tools/cache.

func NewKubeEventsManager

func NewKubeEventsManager(ctx context.Context, client *klient.Client) *kubeEventsManager

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 Factory

type Factory struct {
	// contains filtered or unexported fields
}

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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