collector

package
v0.0.0-...-12b6ec9 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxItemSize = 1024 * 1500
)

Variables

View Source
var (
	TooEarlyError            = errors.New("server is unavailable for collecting kubernetes assets now")
	FetchingIsDisabled       = errors.New("cannot proceed with asset collection due to a suspension of the integration.\nPlease contact the Firefly support in order to restore your integration.")
	ClusterUniqueIdDuplicate = errors.New("cannot proceed with asset collection due to a reuse of another cluster configuration.\nPlease contact the Firefly support in order to repair your integration.")
)

Functions

This section is empty.

Types

type Collector

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

Collector is an execution-scoped object encapsulating the entire collection process.

func New

func New(
	clusterID string,
	clusterConfig *rest.Config,
	conf *config.Config,
	dataCollectors ...DataCollector,
) *Collector

New creates a new instance of the Collector struct. A Kubernetes cluster ID must be provided, together with a configuration object and a list of objects implementing the DataCollector interface.

The cluster ID is a string of alphanumeric characters, dashes and underscores, of any length. Spaces are not allowed.

A configuration object must be provided.

func (*Collector) Run

func (f *Collector) Run(ctx context.Context) (err error)

Run executes the collector. The process includes authentication with the Infralight App Server, execution of all data collectors, and sending of the data to the App Server for storage.

type DataCollector

type DataCollector interface {
	// Source is a method that returns a unique name for the collector source
	Source() string

	// Run executes the data collector. The configuration object is always passed
	// and is never empty or nil. Every collector must return a name for the
	// key under which the data will be sent to the Infralight App Server, the
	// data itself (which is a list of arbitrary objects), and an optional error.
	Run(context.Context, *config.Config) (
		keyName string,
		data []interface{},
		err error,
	)
}

DataCollector is an interface for objects that collect data from K8s-related components such as the Kubernetes API Server or Helm

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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