kubernetesk8s.io/kubernetes/pkg/kubelet/stats Index | Files | Directories

package stats

import "k8s.io/kubernetes/pkg/kubelet/stats"

Index

Functions

func NewFakeMetricsDu

func NewFakeMetricsDu(path string, stats *volume.Metrics) volume.MetricsProvider

NewFakeMetricsDu inserts fake statistics when asked for metrics

Types

type ByCreationTime

type ByCreationTime []containerInfoWithCgroup

ByCreationTime implements sort.Interface for []containerInfoWithCgroup based on the cinfo.Spec.CreationTime field.

func (ByCreationTime) Len

func (a ByCreationTime) Len() int

func (ByCreationTime) Less

func (a ByCreationTime) Less(i, j int) bool

func (ByCreationTime) Swap

func (a ByCreationTime) Swap(i, j int)

type HostStatsProvider

type HostStatsProvider interface {
	// contains filtered or unexported methods
}

HostStatsProvider defines an interface for providing host stats associated with pod.

func NewFakeHostStatsProvider

func NewFakeHostStatsProvider() HostStatsProvider

NewFakeHostStatsProvider provides a way to test with fake host statistics

func NewFakeHostStatsProviderWithData

func NewFakeHostStatsProviderWithData(fakeStats map[string]*volume.Metrics, osInterface kubecontainer.OSInterface) HostStatsProvider

NewFakeHostStatsProviderWithData provides a way to test with fake host statistics

func NewHostStatsProvider

func NewHostStatsProvider(osInterface kubecontainer.OSInterface, podEtcHostsPathFunc PodEtcHostsPathFunc, podLogsDirectory string) HostStatsProvider

NewHostStatsProvider returns a new HostStatsProvider type struct.

type PodEtcHostsPathFunc

type PodEtcHostsPathFunc func(podUID types.UID) string

PodEtcHostsPathFunc is a function to fetch a etc hosts path by pod uid and whether etc host path is supported by the runtime

type PodManager

type PodManager interface {
	TranslatePodUID(uid types.UID) kubetypes.ResolvedPodUID
}

PodManager is the subset of methods the manager needs to observe the actual state of the kubelet. See pkg/k8s.io/kubernetes/pkg/kubelet/pod.Manager for method godoc.

type Provider

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

Provider provides the stats of the node and the pod-managed containers.

func NewCRIStatsProvider

func NewCRIStatsProvider(
	cadvisor cadvisor.Interface,
	resourceAnalyzer stats.ResourceAnalyzer,
	podManager PodManager,
	runtimeCache kubecontainer.RuntimeCache,
	runtimeService internalapi.RuntimeService,
	imageService internalapi.ImageManagerService,
	hostStatsProvider HostStatsProvider,
	podAndContainerStatsFromCRI bool,
) *Provider

NewCRIStatsProvider returns a Provider that provides the node stats from cAdvisor and the container stats from CRI.

func NewCadvisorStatsProvider

func NewCadvisorStatsProvider(
	cadvisor cadvisor.Interface,
	resourceAnalyzer stats.ResourceAnalyzer,
	podManager PodManager,
	runtimeCache kubecontainer.RuntimeCache,
	imageService kubecontainer.ImageService,
	statusProvider status.PodStatusProvider,
	hostStatsProvider HostStatsProvider,
) *Provider

NewCadvisorStatsProvider returns a containerStatsProvider that provides both the node and the container stats from cAdvisor.

func (*Provider) GetCgroupCPUAndMemoryStats

func (p *Provider) GetCgroupCPUAndMemoryStats(cgroupName string, updateStats bool) (*statsapi.ContainerStats, error)

GetCgroupCPUAndMemoryStats returns the CPU and memory stats of the cgroup with the cgroupName. Note that this function doesn't generate filesystem stats.

func (*Provider) GetCgroupStats

func (p *Provider) GetCgroupStats(cgroupName string, updateStats bool) (*statsapi.ContainerStats, *statsapi.NetworkStats, error)

GetCgroupStats returns the stats of the cgroup with the cgroupName. Note that this function doesn't generate filesystem stats.

func (*Provider) HasDedicatedContainerFs

func (p *Provider) HasDedicatedContainerFs(ctx context.Context) (bool, error)

HasDedicatedImageFs returns true if a dedicated image filesystem exists for storing images. KEP Issue Number 4191: Enhanced this to allow for the containers to be separate from images.

func (*Provider) HasDedicatedImageFs

func (p *Provider) HasDedicatedImageFs(ctx context.Context) (bool, error)

HasDedicatedImageFs returns true if a dedicated image filesystem exists for storing images. KEP Issue Number 4191: Enhanced this to allow for the containers to be separate from images.

func (*Provider) RlimitStats

func (p *Provider) RlimitStats() (*statsapi.RlimitStats, error)

RlimitStats returns base information about process count

func (*Provider) RootFsStats

func (p *Provider) RootFsStats() (*statsapi.FsStats, error)

RootFsStats returns the stats of the node root filesystem.

Source Files

cadvisor_stats_provider.go cri_stats_provider.go cri_stats_provider_linux.go helper.go host_stats_provider.go host_stats_provider_fake.go provider.go

Directories

PathSynopsis
pkg/kubelet/stats/pidlimit
Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
36 packages
Last checked
3 hours ago

Tools for package owners.