Documentation
¶
Index ¶
Constants ¶
const MinDuration = 10 * time.Second
MinDuration defines the minimal report interval
Variables ¶
This section is empty.
Functions ¶
func LoadConfigFromSecret ¶
func LoadConfigFromSecret(secret *v1.Secret) (config.Controller, error)
LoadConfigFromSecret loads the controller config with given secret data
Types ¶
type Config ¶
type Config struct {
config.Controller
}
Config defines the configuration loaded from cluster secret
type ConfigAggregator ¶
type ConfigAggregator struct {
// contains filtered or unexported fields
}
ConfigAggregator is an auxiliary structure that should obviate the need for the use of legacy secret configurator and the new config map informer
func (*ConfigAggregator) Config ¶
func (c *ConfigAggregator) Config() *config.InsightsConfiguration
func (*ConfigAggregator) ConfigChanged ¶
func (c *ConfigAggregator) ConfigChanged() (configCh <-chan struct{}, closeFn func())
func (*ConfigAggregator) Listen ¶
func (c *ConfigAggregator) Listen(ctx context.Context)
Listen listens to the legacy Secret configurator/observer as well as the new config map informer. When any configuration change is observed then all the listeners are notified.
type ConfigMapInformer ¶
type ConfigMapInformer interface { factory.Controller // Config provides actual Insights configuration values from the "insights-config" configmap Config() *config.InsightsConfiguration // ConfigChanged notifies all the listeners that the content of the "insights-config" configmap has changed ConfigChanged() (<-chan struct{}, func()) }
func NewConfigMapObserver ¶
func NewConfigMapObserver(ctx context.Context, kubeConfig *rest.Config, eventRecorder events.Recorder, kubeInformer v1helpers.KubeInformersForNamespaces) (ConfigMapInformer, error)
type ConfigMapObserver ¶
type ConfigMapObserver struct { factory.Controller // contains filtered or unexported fields }
ConfigMapObserver is a controller for "insights-config" config map in the "openshift-insights" namespace.
func (*ConfigMapObserver) Config ¶
func (c *ConfigMapObserver) Config() *config.InsightsConfiguration
func (*ConfigMapObserver) ConfigChanged ¶
func (c *ConfigMapObserver) ConfigChanged() (configCh <-chan struct{}, closeFn func())
type ConfigReporter ¶
type ConfigReporter interface {
SetConfig(*config.Controller)
}
type Configurator ¶
type Configurator interface { Config() *config.Controller ConfigChanged() (<-chan struct{}, func()) }
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is responsible for periodically checking and (if necessary) updating the local configs/tokens according to the configs/tokens present on the cluster.
func New ¶
func New(defaultConfig config.Controller, kubeClient kubernetes.Interface) *Controller
New creates a new configobsever, the configs/tokens are updated from the configs/tokens present in the cluster if possible.
func (*Controller) Config ¶
func (c *Controller) Config() *config.Controller
Config provides the config in a thread-safe way.
func (*Controller) ConfigChanged ¶
func (c *Controller) ConfigChanged() (configCh <-chan struct{}, closeFn func())
ConfigChanged subscribe for config changes 1.Param: A channel where the listener is notified that the config has changed. 2.Param: A func which can be used to unsubscribe from the config changes.
func (*Controller) Start ¶
func (c *Controller) Start(ctx context.Context)
Start is periodically invoking check and set of config and token
func (*Controller) SupportSecret ¶
func (c *Controller) SupportSecret() *v1.Secret
type InsightsDataGatherObserver ¶
type InsightsDataGatherObserver interface { factory.Controller GatherConfig() *v1alpha1.GatherConfig GatherDisabled() bool }
func NewInsightsDataGatherObserver ¶
func NewInsightsDataGatherObserver(kubeConfig *rest.Config, eventRecorder events.Recorder, configInformer configinformers.SharedInformerFactory) (InsightsDataGatherObserver, error)
type Interface ¶
type Interface interface { Config() *config.InsightsConfiguration ConfigChanged() (<-chan struct{}, func()) Listen(ctx context.Context) }
func NewConfigAggregator ¶
func NewConfigAggregator(ctrl Configurator, configMapInf ConfigMapInformer) Interface
func NewStaticConfigAggregator ¶
func NewStaticConfigAggregator(ctrl Configurator, cli kubernetes.Interface) Interface
NewStaticConfigAggregator is a constructor used mainly for the techpreview configuration reading. There is no reason to create and start any informer in the techpreview when data gathering runs as a job. It is sufficient to read the config once when the job is created and/or starting.