kubelet

package
v0.101.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerMetricGroup = MetricGroup("container")
	PodMetricGroup       = MetricGroup("pod")
	NodeMetricGroup      = MetricGroup("node")
	VolumeMetricGroup    = MetricGroup("volume")
)

Values for MetricGroup enum.

Variables

ValidMetricGroups map of valid metrics.

Functions

func MetricsData

func MetricsData(
	logger *zap.Logger, summary *stats.Summary,
	metadata Metadata,
	metricGroupsToCollect map[MetricGroup]bool,
	mbs *metadata.MetricsBuilders) []pmetric.Metrics

func SetPersistentVolumeLabels added in v0.82.0

func SetPersistentVolumeLabels(rb *metadata.ResourceBuilder, pv v1.PersistentVolumeSource)

func ValidateMetadataLabelsConfig

func ValidateMetadataLabelsConfig(labels []MetadataLabel) error

ValidateMetadataLabelsConfig validates that provided list of metadata labels is supported

Types

type HTTPRestClient

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

HTTPRestClient is a thin wrapper around a kubelet client, encapsulating endpoints and their corresponding http methods. The endpoints /stats/container /spec/ are excluded because they require cadvisor. The /metrics endpoint is excluded because it returns Prometheus data.

func NewRestClient

func NewRestClient(client kube.Client) *HTTPRestClient

func (*HTTPRestClient) Pods

func (c *HTTPRestClient) Pods() ([]byte, error)

func (*HTTPRestClient) StatsSummary

func (c *HTTPRestClient) StatsSummary() ([]byte, error)

type Metadata

type Metadata struct {
	Labels                    map[MetadataLabel]bool
	PodsMetadata              *v1.PodList
	DetailedPVCResourceSetter func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error
	// contains filtered or unexported fields
}

func NewMetadata

func NewMetadata(labels []MetadataLabel, podsMetadata *v1.PodList,
	detailedPVCResourceSetter func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error) Metadata

type MetadataLabel

type MetadataLabel string
const (
	MetadataLabelContainerID MetadataLabel = conventions.AttributeContainerID
	MetadataLabelVolumeType  MetadataLabel = labelVolumeType
)

Values for MetadataLabel enum.

type MetadataProvider

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

MetadataProvider wraps a RestClient, returning an unmarshaled metadata.

func NewMetadataProvider

func NewMetadataProvider(rc RestClient) *MetadataProvider

func (*MetadataProvider) Pods

func (p *MetadataProvider) Pods() (*v1.PodList, error)

Pods calls the /pods endpoint and unmarshals the results into a v1.PodList struct.

type MetricGroup

type MetricGroup string

type RestClient

type RestClient interface {
	StatsSummary() ([]byte, error)
	Pods() ([]byte, error)
}

RestClient is swappable for testing.

type StatsProvider

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

StatsProvider wraps a RestClient, returning an unmarshaled stats.Summary struct from the kubelet API.

func NewStatsProvider

func NewStatsProvider(rc RestClient) *StatsProvider

func (*StatsProvider) StatsSummary

func (p *StatsProvider) StatsSummary() (*stats.Summary, error)

StatsSummary calls the /stats/summary kubelet endpoint and unmarshals the results into a stats.Summary struct.

Jump to

Keyboard shortcuts

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