k8s

package
v0.0.0-...-ebfd914 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector is a struct implementing the DataCollector interface. It wraps a Kubernetes API client object.

func DefaultConfiguration

func DefaultConfiguration(apiConfig *rest.Config) (
	collector *Collector,
	err error,
)

DefaultConfiguration creates a Collector instance with default configuration to connect to a local Kubernetes API Server. When running outside of the Kubernetes cluster, the path to the kubeconfig file must be provided. If empty, the default in-cluster configuration is used.

func New

func New(api kubernetes.Interface) *Collector

New creates a new instance of the Collector struct. A Kubernetes API client object must be provided. This can either be a client for a real API server, a fake client from k8s.io/client-go/kubernetes/fake, or any object that implements the kubernetes.Interface interface.

func (*Collector) Run

func (f *Collector) Run(ctx context.Context, conf *config.Config) (
	keyName string,
	objects []interface{},
	err error,
)

Run executes the collector with the provided configuration object, and returns a list of collected objects from the Kubernetes cluster.

func (*Collector) Source

func (f *Collector) Source() string

Source is required by the DataCollector interface to return a name for the collector's source, in this case the K8s API Server.

type KubernetesObject

type KubernetesObject struct {
	Kind   string      `json:"kind"`
	Object interface{} `json:"object"`
}

Jump to

Keyboard shortcuts

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