rawk8seventsreceiver

package module
v0.97.0-sumo-1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0, MIT Imports: 27 Imported by: 0

README

Raw Kubernetes Events Receiver

Stability level: Beta

Receiver for ingesting Kubernetes Events in their raw format, exactly as the Kubernetes API returns them. It intends to return exactly the same output as the following Fluentd plugin.

Supported pipeline types: logs

Configuration

receivers:
  raw_k8s_events:
    # Namespaces to collect events from. Empty array means all namespaces and is the default.
    # default = []
    namespaces: []

    # Maximum age of collected events relative to receiver start time.
    # The default setting of 1 minute means that we're going to collect events up to 1 minute backwards in time.
    # default = 1m
    max_event_age: 1m

    # Authentication type for the Kubernetes client. Valid values are: `serviceAccount`, `kubeConfig`, `tls` and `none`.
    # default = `serviceAccount`
    auth_type: serviceAccount

    # The retry delay for recoverable errors from the rest of the pipeline.
    # Don't change this or the related setting below unless you know what you're doing.
    # default = 500ms
    consume_retry_delay: 500ms

    # The maximum number of retries for recoverable errors from the rest of the pipeline.
    # default = 20
    consume_max_retries: 20

The full list of settings exposed for this receiver are documented in config.go.

Persistent Storage

If a storage extension is configured in the collector configuration's service.extensions property, the raw_k8s_events receiver stores the latest resource version retrieved from the Kubernetes API server so that after a restart, the receiver will continue retrieving events starting from that resource version instead of using the max_event_age property. This prevents the receiver from reporting duplicate events when the receiver is restarted in less than the max_event_age time. On the other hand, this also allows the receiver to catch up on missed events in case it was not running for longer than max_event_age time. Note that the default maximum age of events retained by the API Server is one hour - see the --event-ttl option of kube-apiserver.

Example configuration:

extensions:
  file_storage:
    directory: .

receivers:
  raw_k8s_events:

service:
  extensions:
  - file_storage
  pipelines:
    logs:
      receivers:
      - raw_k8s_events
      exporters:
      - nop

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Type = component.MustNewType(typeStr)

Functions

func MakeClient

func MakeClient(apiConf APIConfig) (k8s.Interface, error)

MakeClient can take configuration if needed for other types of auth

func MakeOpenShiftQuotaClient

func MakeOpenShiftQuotaClient(apiConf APIConfig) (quotaclientset.Interface, error)

MakeOpenShiftQuotaClient can take configuration if needed for other types of auth and return an OpenShift quota API client

func NewFactory

func NewFactory() receiver.Factory

NewFactory creates a factory for rawk8sevents receiver.

Types

type APIConfig

type APIConfig struct {
	// How to authenticate to the K8s API server.  This can be one of `none`
	// (for no auth), `serviceAccount` (to use the standard service account
	// token provided to the agent pod), or `kubeConfig` to use credentials
	// from `~/.kube/config`.
	AuthType AuthType `mapstructure:"auth_type"`
}

APIConfig contains options relevant to connecting to the K8s API

func (APIConfig) Validate

func (c APIConfig) Validate() error

Validate validates the K8s API config

type AuthType

type AuthType string

AuthType describes the type of authentication to use for the K8s API

const (
	// AuthTypeNone means no auth is required
	AuthTypeNone AuthType = "none"
	// AuthTypeServiceAccount means to use the built-in service account that
	// K8s automatically provisions for each pod.
	AuthTypeServiceAccount AuthType = "serviceAccount"
	// AuthTypeKubeConfig uses local credentials like those used by kubectl.
	AuthTypeKubeConfig AuthType = "kubeConfig"
	// AuthTypeTLS indicates that client TLS auth is desired
	AuthTypeTLS AuthType = "tls"
)

TODO: Add option for TLS once https://go.opentelemetry.io/collector/issues/933 is addressed.

type Config

type Config struct {
	APIConfig `mapstructure:",squash"`
	// List of ‘namespaces’ to collect events from.
	// Empty list means all namespaces
	Namespaces []string `mapstructure:"namespaces"`

	// Maximum age of event relative to receiver start time
	// Events older than StartTime - MaxEventAge will not be collected
	MaxEventAge time.Duration `mapstructure:"max_event_age"`

	// ConsumeRetryDelay is the retry delay for recoverable pipeline errors
	// one frequent source of these kinds of errors is the memory_limiter processor
	ConsumeRetryDelay time.Duration `mapstructure:"consume_retry_delay"`

	// ConsumeMaxRetries is the maximum number of retries for recoverable pipeline errors
	ConsumeMaxRetries uint64 `mapstructure:"consume_max_retries"`
}

Config defines configuration for the receiver.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate checks if the receiver configuration is valid

type ListerWatcherFactory

type ListerWatcherFactory func(c cache.Getter, resource string, namespace string, fieldSelector fields.Selector) cache.ListerWatcher

Function type for creating ListerWatcher objects. Used for injecting mocks into k8s informers.

Jump to

Keyboard shortcuts

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