utils

package
v0.0.0-...-cc51b46 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LoadConfiguration = (*Collector).loadConfiguration
)

Functions

This section is empty.

Types

type Collector

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

Collector is the client that implements methods to collect resources and logs

func GetCollectorInstance

func GetCollectorInstance(scheme *runtime.Scheme, restConfig *rest.Config,
	directory, configMapName string) (*Collector, error)

GetCollectorInstance return k8sAccess instance used to access resources in the management cluster.

func (*Collector) CollectResouces

func (a *Collector) CollectResouces(ctx context.Context, logger logr.Logger) error

func (*Collector) GetClient

func (a *Collector) GetClient() client.Client

GetClient returns scheme

func (*Collector) GetConfig

func (a *Collector) GetConfig() *rest.Config

GetConfig returns restConfig

func (*Collector) GetScheme

func (a *Collector) GetScheme() *runtime.Scheme

GetScheme returns scheme

type Configuration

type Configuration struct {
	// Resources indicates what resorces to collect
	// +optional
	Resources []Resource `json:"resources,omitempty" yaml:"resources,omitempty"`

	// Logs indicates what pods' log to collect
	// +optional
	Logs []Log `json:"logs,omitempty" yaml:"logs,omitempty"`
}

Configuration defines the instruction for collector

type Log

type Log struct {
	// Namespace of the pods deployed in the Cluster.
	// +optional
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`

	// LabelFilters allows to filter pods based on current labels.
	LabelFilters []libsveltosv1alpha1.LabelFilter `json:"labelFilters,omitempty" yaml:"labelFilters,omitempty"`

	// A relative time in seconds before the current time from which to collect logs.
	// If this value precedes the time a pod was started, only logs since the pod start will be returned.
	// If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.
	// +optional
	SinceSeconds *int64 `json:"sinceSeconds,omitempty" yaml:"sinceSeconds,omitempty"`
}

LogFilter allows to select which logs to collect

type Resource

type Resource struct {
	// Namespace of the resource deployed in the Cluster.
	// Empty for resources scoped at cluster level.
	// +optional
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`

	// Group of the resource deployed in the Cluster.
	Group string `json:"group" yaml:"group"`

	// Version of the resource deployed in the Cluster.
	Version string `json:"version" yaml:"version"`

	// Kind of the resource deployed in the Cluster.
	// +kubebuilder:validation:MinLength=1
	Kind string `json:"kind" yaml:"kind"`

	// LabelFilters allows to filter resources based on current labels.
	LabelFilters []libsveltosv1alpha1.LabelFilter `json:"labelFilters,omitempty" yaml:"labelFilters,omitempty"`
}

Resource indicates the type of resources to collect.

Jump to

Keyboard shortcuts

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