kube

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceAttributesPrefix   = "resource.opentelemetry.io/"
	ServiceNameAnnotation      = ResourceAttributesPrefix + serviceNameKey
	ServiceNamespaceAnnotation = ResourceAttributesPrefix + serviceNamespaceKey

	EnvResourceAttributes = "OTEL_RESOURCE_ATTRIBUTES"
	EnvServiceName        = "OTEL_SERVICE_NAME"
	EnvServiceNamespace   = "OTEL_SERVICE_NAMESPACE"
)

Variables

View Source
var DefaultResourceLabels = ResourceLabels{

	"service.name":      []string{"app.kubernetes.io/name"},
	"service.namespace": []string{"app.kubernetes.io/part-of"},
	"service.version":   []string{"app.kubernetes.io/version"},
}
View Source
var InfoForPID = container.InfoForPID

InfoForPID is an injectable dependency for system-independent testing

Functions

This section is empty.

Types

type MetaSourceLabels

type MetaSourceLabels struct {
	ServiceName      string `yaml:"service_name" env:"OTEL_EBPF_KUBE_META_SOURCE_LABEL_SERVICE_NAME"`
	ServiceNamespace string `yaml:"service_namespace" env:"OTEL_EBPF_KUBE_META_SOURCE_LABEL_SERVICE_NAMESPACE"`
}

MetaSourceLabels allow overriding some metadata from kubernetes labels Deprecated. Left here for backwards-compatibility.

type MetadataConfig

type MetadataConfig struct {
	Enable              kubeflags.EnableFlag
	DisabledInformers   []string
	KubeConfigPath      string
	SyncTimeout         time.Duration
	ResyncPeriod        time.Duration
	MetaCacheAddr       string
	ResourceLabels      ResourceLabels
	RestrictLocalNode   bool
	ServiceNameTemplate *template.Template
}

type MetadataProvider

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

func NewMetadataProvider

func NewMetadataProvider(config MetadataConfig, internalMetrics imetrics.Reporter) *MetadataProvider

func (*MetadataProvider) ClusterName

func (mp *MetadataProvider) ClusterName(ctx context.Context) (string, error)

func (*MetadataProvider) CurrentNodeName

func (mp *MetadataProvider) CurrentNodeName(ctx context.Context) (string, error)

func (*MetadataProvider) ForceDisable

func (mp *MetadataProvider) ForceDisable()

func (*MetadataProvider) Get

func (mp *MetadataProvider) Get(ctx context.Context) (*Store, error)

func (*MetadataProvider) IsKubeEnabled

func (mp *MetadataProvider) IsKubeEnabled() bool

func (*MetadataProvider) KubeClient

func (mp *MetadataProvider) KubeClient() (kubernetes.Interface, error)

type ResourceLabels

type ResourceLabels map[string][]string

type Store

type Store struct {

	// Instead of subscribing to the informer directly, the rest of components
	// will subscribe to this store, to make sure that any "new object" notification
	// they receive is already present in the store
	meta.BaseNotifier
	// contains filtered or unexported fields
}

Store aggregates Kubernetes information from multiple sources: - the informer that keep an indexed copy of the existing pods and replicasets. - the inspected container.Info objects, indexed either by container ID and PID namespace - a cache of decorated PodInfo that would avoid reconstructing them on each trace decoration

func NewStore

func NewStore(
	kubeMetadata meta.Notifier,
	resourceLabels ResourceLabels,
	serviceNameTemplate *template.Template,
	internalMetrics imetrics.Reporter,
) *Store

func (*Store) AddProcess

func (s *Store) AddProcess(pid uint32)

func (*Store) DeleteProcess

func (s *Store) DeleteProcess(pid uint32)

func (*Store) ID

func (s *Store) ID() string

func (*Store) ObjectMetaByIP

func (s *Store) ObjectMetaByIP(ip string) *kube.CachedObjMeta

func (*Store) On

func (s *Store) On(event *informer.Event) error

On is invoked by the informer when a new Kube object is created, updated or deleted. It will forward the notification to all the Store subscribers

func (*Store) PodByContainerID

func (s *Store) PodByContainerID(cid string) *kube.CachedObjMeta

func (*Store) PodContainerByPIDNs

func (s *Store) PodContainerByPIDNs(pidns uint32) (*kube.CachedObjMeta, string)

PodContainerByPIDNs second return value: container Name

func (*Store) ServiceNameNamespaceForIP

func (s *Store) ServiceNameNamespaceForIP(ip string) (string, string)

ServiceNameNamespaceForIP returns the service name and namespace for a given IP address This means that, for a given Pod, we will not return the Pod Name, but the Pod Owner Name

func (*Store) ServiceNameNamespaceForMetadata

func (s *Store) ServiceNameNamespaceForMetadata(om *informer.ObjectMeta, containerName string) (string, string)

func (*Store) Subscribe

func (s *Store) Subscribe(observer meta.Observer)

Subscribe overrides BaseNotifier to send a "welcome message" to each new observer containing the whole metadata store

Directories

Path Synopsis
meta/cni
Package cni provides utilities for working with Container Network Interface (CNI) configurations.
Package cni provides utilities for working with Container Network Interface (CNI) configurations.

Jump to

Keyboard shortcuts

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