package state

import "k8s.io/kubernetes/pkg/kubelet/allocation/state"

Index

Types

type Checkpoint

type Checkpoint struct {
	// Data is a serialized PodResourceAllocationInfo
	Data string `json:"data"`
	// Checksum is a checksum of Data
	Checksum checksum.Checksum `json:"checksum"`
}

Checkpoint represents a structure to store pod resource allocation checkpoint data

func NewCheckpoint

func NewCheckpoint(allocations *PodResourceCheckpointInfo) (*Checkpoint, error)

NewCheckpoint creates a new checkpoint from a list of claim info states

func (*Checkpoint) GetPodResourceCheckpointInfo

func (cp *Checkpoint) GetPodResourceCheckpointInfo() (*PodResourceCheckpointInfo, error)

GetPodResourceCheckpointInfo returns Pod Resource Allocation info states from checkpoint

func (*Checkpoint) MarshalCheckpoint

func (cp *Checkpoint) MarshalCheckpoint() ([]byte, error)

func (*Checkpoint) UnmarshalCheckpoint

func (cp *Checkpoint) UnmarshalCheckpoint(blob []byte) error

UnmarshalCheckpoint unmarshals checkpoint from JSON

func (*Checkpoint) VerifyChecksum

func (cp *Checkpoint) VerifyChecksum() error

VerifyChecksum verifies that current checksum of checkpointed Data is valid

type PodResourceCheckpointInfo

type PodResourceCheckpointInfo struct {
	Entries PodResourceInfoMap `json:"entries,omitempty"`
}

type PodResourceInfo

type PodResourceInfo struct {
	// ContainerResources maps container names to their respective ResourceRequirements.
	ContainerResources map[string]v1.ResourceRequirements
}

PodResourceInfo stores resource requirements for containers within a pod.

type PodResourceInfoMap

type PodResourceInfoMap map[types.UID]PodResourceInfo

PodResourceInfoMap maps pod UIDs to their corresponding PodResourceInfo, tracking resource requirements for all containers within each pod.

func (PodResourceInfoMap) Clone

Clone returns a copy of PodResourceInfoMap

type Reader

type Reader interface {
	GetContainerResources(podUID types.UID, containerName string) (v1.ResourceRequirements, bool)
	GetPodResourceInfoMap() PodResourceInfoMap
}

Reader interface used to read current pod resource state

type State

type State interface {
	Reader
	// contains filtered or unexported methods
}

State interface provides methods for tracking and setting pod resources

func NewNoopStateCheckpoint

func NewNoopStateCheckpoint() State

NewNoopStateCheckpoint creates a dummy state checkpoint manager

func NewStateCheckpoint

func NewStateCheckpoint(stateDir, checkpointName string) (State, error)

NewStateCheckpoint creates new State for keeping track of pod resource information with checkpoint backend

func NewStateMemory

func NewStateMemory(resources PodResourceInfoMap) State

NewStateMemory creates new State to track resources resourcesated to pods

Source Files

checkpoint.go state.go state_checkpoint.go state_mem.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
3 hours ago

Tools for package owners.