kubernetesk8s.io/kubernetes/pkg/kubelet/apis/podresources Index | Files | Directories

package podresources

import "k8s.io/kubernetes/pkg/kubelet/apis/podresources"

Index

Constants

const (
	// Socket is the name of the podresources server socket
	Socket = "kubelet"

	// DefaultQPS is determined by empirically reviewing known consumers of the API.
	// It's at least unlikely that there is a legitimate need to query podresources
	// more than 100 times per second, the other subsystems are not guaranteed to react
	// so fast in the first place.
	DefaultQPS = 100

	// DefaultBurstTokens is determined by empirically reviewing known consumers of the API.
	// See the documentation of DefaultQPS, same caveats apply.
	DefaultBurstTokens = 10
)

Functions

func GetV1Client

func GetV1Client(socket string, connectionTimeout time.Duration, maxMsgSize int) (v1.PodResourcesListerClient, *grpc.ClientConn, error)

GetV1Client returns a client for the PodResourcesLister grpc service

func GetV1alpha1Client

func GetV1alpha1Client(socket string, connectionTimeout time.Duration, maxMsgSize int) (v1alpha1.PodResourcesListerClient, *grpc.ClientConn, error)

GetV1alpha1Client returns a client for the PodResourcesLister grpc service Note: This is deprecated

func NewV1PodResourcesServer

func NewV1PodResourcesServer(providers PodResourcesProviders) podresourcesv1.PodResourcesListerServer

NewV1PodResourcesServer returns a PodResourcesListerServer which lists pods provided by the PodsProvider with device information provided by the DevicesProvider

func NewV1alpha1PodResourcesServer

func NewV1alpha1PodResourcesServer(providers PodResourcesProviders) v1alpha1.PodResourcesListerServer

NewV1alpha1PodResourcesServer returns a PodResourcesListerServer which lists pods provided by the PodsProvider with device information provided by the DevicesProvider

Types

type CPUsProvider

type CPUsProvider interface {
	// GetCPUs returns information about the cpus assigned to pods and containers
	GetCPUs(podUID, containerName string) []int64
	// GetAllocatableCPUs returns the allocatable (not allocated) CPUs
	GetAllocatableCPUs() []int64
}

CPUsProvider knows how to provide the cpus used by the given container

type DevicesProvider

type DevicesProvider interface {
	// UpdateAllocatedDevices frees any Devices that are bound to terminated pods.
	UpdateAllocatedDevices()
	// GetDevices returns information about the devices assigned to pods and containers
	GetDevices(podUID, containerName string) []*podresourcesapi.ContainerDevices
	// GetAllocatableDevices returns information about all the devices known to the manager
	GetAllocatableDevices() []*podresourcesapi.ContainerDevices
}

DevicesProvider knows how to provide the devices used by the given container

type DynamicResourcesProvider

type DynamicResourcesProvider interface {
	// GetDynamicResources returns information about dynamic resources assigned to pods and containers
	GetDynamicResources(pod *v1.Pod, container *v1.Container) []*podresourcesapi.DynamicResource
}

type MemoryProvider

type MemoryProvider interface {
	// GetMemory returns information about the memory assigned to containers
	GetMemory(podUID, containerName string) []*podresourcesapi.ContainerMemory
	// GetAllocatableMemory returns the allocatable memory from the node
	GetAllocatableMemory() []*podresourcesapi.ContainerMemory
}

type PodResourcesProviders

type PodResourcesProviders struct {
	Pods             PodsProvider
	Devices          DevicesProvider
	Cpus             CPUsProvider
	Memory           MemoryProvider
	DynamicResources DynamicResourcesProvider
}

type PodsProvider

type PodsProvider interface {
	GetPods() []*v1.Pod
	GetPodByName(namespace, name string) (*v1.Pod, bool)
}

PodsProvider knows how to provide the pods admitted by the node

Source Files

client.go constants.go server_v1.go server_v1alpha1.go types.go

Directories

PathSynopsis
pkg/kubelet/apis/podresources/testing
Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
13 packages
Last checked
3 hours ago

Tools for package owners.