Documentation ¶
Index ¶
- type Event
- type EventSource
- type PrometheusCRWatcher
- func (w *PrometheusCRWatcher) Close() error
- func (w *PrometheusCRWatcher) LoadConfig(ctx context.Context) (*promconfig.Config, error)
- func (w *PrometheusCRWatcher) WaitForNamedCacheSync(controllerName string, inf cache.InformerSynced) bool
- func (w *PrometheusCRWatcher) Watch(upstreamEvents chan Event, upstreamErrors chan error) error
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Source EventSource Watcher Watcher }
type EventSource ¶
type EventSource int
const ( EventSourceConfigMap EventSource = iota EventSourcePrometheusCR )
func (EventSource) String ¶
func (e EventSource) String() string
type PrometheusCRWatcher ¶
type PrometheusCRWatcher struct {
// contains filtered or unexported fields
}
func NewPrometheusCRWatcher ¶
func NewPrometheusCRWatcher(ctx context.Context, logger logr.Logger, cfg allocatorconfig.Config) (*PrometheusCRWatcher, error)
func (*PrometheusCRWatcher) Close ¶
func (w *PrometheusCRWatcher) Close() error
func (*PrometheusCRWatcher) LoadConfig ¶
func (w *PrometheusCRWatcher) LoadConfig(ctx context.Context) (*promconfig.Config, error)
func (*PrometheusCRWatcher) WaitForNamedCacheSync ¶ added in v0.113.0
func (w *PrometheusCRWatcher) WaitForNamedCacheSync(controllerName string, inf cache.InformerSynced) bool
WaitForNamedCacheSync adds a timeout to the informer's wait for the cache to be ready. If the PrometheusCRWatcher is unable to load an informer within 15 seconds, the method is cancelled and returns false. A successful informer load will return true. This method also will be cancelled if the target allocator's stopChannel is called before it returns.
This method is inspired by the upstream prometheus-operator implementation, with a shorter timeout and support for the PrometheusCRWatcher's stopChannel. https://github.com/prometheus-operator/prometheus-operator/blob/293c16c854ce69d1da9fdc8f0705de2d67bfdbfa/pkg/operator/operator.go#L433