agent

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package agent provides the implementation of the in-cluster agent that reacts to resource changes and sends data to the collector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

The Agent type is responsible for handling changes in resources within a cluster namespace and sending them to a configured EventWriter.

func New

func New(config Config) *Agent

New returns a new instance of the Agent type with a set Config.

func (*Agent) Ready

func (a *Agent) Ready() bool

Ready returns true if all informer caches are synced.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context) error

Run starts the agent, any detected changes in cluster resources will be sent to the configured EventWriter. Blocks until an error occurs or until the provided context.Context is cancelled.

type Config

type Config struct {
	// The Namespace that resources will be collected for.
	Namespace string
	// The EventWriter is used to publish events onto an arbitrary event stream.
	EventWriter EventWriter
	// The configuration for the cluster.
	ClusterClient dynamic.Interface
	// The resource types to send via the EventWriter.
	Resources []schema.GroupVersionResource
	// If true, no events are published until the initial informer caches are synced. This prevents events being
	// publishing describing the current state.
	WaitForCacheSync bool
	// The unique name for the cluster the agent is running in
	ClusterID string
}

The Config type describes configuration values that can be set for the Agent.

type EventWriter

type EventWriter interface {
	Write(ctx context.Context, evt event.Event) error
}

The EventWriter interface describes types that publish events onto an event stream.

Jump to

Keyboard shortcuts

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