kubernetesk8s.io/kubernetes/pkg/kubelet/cm/dra/state Index | Files

package state

import "k8s.io/kubernetes/pkg/kubelet/cm/dra/state"

Index

Constants

const (
	CheckpointAPIGroup   = "checkpoint.dra.kubelet.k8s.io"
	CheckpointKind       = "DRACheckpoint"
	CheckpointAPIVersion = CheckpointAPIGroup + "/v1"
)

Types

type Checkpoint

type Checkpoint struct {
	// Data is a JSON serialized checkpoint data
	Data string
	// Checksum is a checksum of Data
	Checksum uint32
}

Checkpoint represents a structure to store DRA checkpoint data

func NewCheckpoint

func NewCheckpoint(data ClaimInfoStateList) (*Checkpoint, error)

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

func (*Checkpoint) GetClaimInfoStateList

func (cp *Checkpoint) GetClaimInfoStateList() (ClaimInfoStateList, error)

GetClaimInfoStateList returns list of claim info states from checkpoint

func (*Checkpoint) MarshalCheckpoint

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

MarshalCheckpoint marshals checkpoint to JSON

func (*Checkpoint) UnmarshalCheckpoint

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

UnmarshalCheckpoint unmarshals checkpoint from JSON and verifies its data checksum

func (*Checkpoint) VerifyChecksum

func (cp *Checkpoint) VerifyChecksum() error

VerifyChecksum verifies that current checksum of checkpointed Data is valid

type CheckpointData

type CheckpointData struct {
	metav1.TypeMeta
	ClaimInfoStateList ClaimInfoStateList
}

type Checkpointer

type Checkpointer interface {
	GetOrCreate() (*Checkpoint, error)
	Store(*Checkpoint) error
}

func NewCheckpointer

func NewCheckpointer(stateDir, checkpointName string) (Checkpointer, error)

NewCheckpointer creates new checkpointer for keeping track of claim info with checkpoint backend

type ClaimInfoState

type ClaimInfoState struct {
	// ClaimUID is the UID of a resource claim
	ClaimUID types.UID

	// ClaimName is the name of a resource claim
	ClaimName string

	// Namespace is a claim namespace
	Namespace string

	// PodUIDs is a set of pod UIDs that reference a resource
	PodUIDs sets.Set[string]

	// DriverState contains information about all drivers which have allocation
	// results in the claim, even if they don't provide devices for their results.
	DriverState map[string]DriverState
}

+k8s:deepcopy-gen=true

func (*ClaimInfoState) DeepCopy

func (in *ClaimInfoState) DeepCopy() *ClaimInfoState

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimInfoState.

func (*ClaimInfoState) DeepCopyInto

func (in *ClaimInfoState) DeepCopyInto(out *ClaimInfoState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClaimInfoStateList

type ClaimInfoStateList []ClaimInfoState

type Device

type Device struct {
	PoolName     string
	DeviceName   string
	RequestNames []string
	CDIDeviceIDs []string
}

Device is how a DRA driver described an allocated device in a claim to kubelet. RequestName and CDI device IDs are optional. +k8s:deepcopy-gen=true

func (*Device) DeepCopy

func (in *Device) DeepCopy() *Device

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Device.

func (*Device) DeepCopyInto

func (in *Device) DeepCopyInto(out *Device)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DeviceHealth

type DeviceHealth struct {
	// PoolName is the name of the pool where the device is allocated.
	PoolName string

	// DeviceName is the name of the device.
	// The full identifier is '<driver name>/<pool name>/<device name>' across the system.
	DeviceName string

	// Health is the health status of the device.
	// Statuses: "Healthy", "Unhealthy", "Unknown".
	Health DeviceHealthStatus

	// LastUpdated keeps track of the last health status update of this device.
	LastUpdated time.Time
}

DeviceHealth is used to store health information of a device.

type DeviceHealthStatus

type DeviceHealthStatus string
const (
	// DeviceHealthStatusHealthy represents a healthy device.
	DeviceHealthStatusHealthy DeviceHealthStatus = "Healthy"
	// DeviceHealthStatusUnhealthy represents an unhealthy device.
	DeviceHealthStatusUnhealthy DeviceHealthStatus = "Unhealthy"
	// DeviceHealthStatusUnknown represents a device with unknown health status.
	DeviceHealthStatusUnknown DeviceHealthStatus = "Unknown"
)

type DevicesHealthMap

type DevicesHealthMap map[string]DriverHealthState

DevicesHealthMap is a map between driver names and the list of the device's health.

type DriverHealthState

type DriverHealthState struct {
	// Devices maps a device's unique key ("<pool>/<device>") to its health state.
	Devices map[string]DeviceHealth
}

DriverHealthState is used to store health information of all devices of a driver.

type DriverState

type DriverState struct {
	Devices []Device
}

DriverState is used to store per-device claim info state in a checkpoint +k8s:deepcopy-gen=true

func (*DriverState) DeepCopy

func (in *DriverState) DeepCopy() *DriverState

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DriverState.

func (*DriverState) DeepCopyInto

func (in *DriverState) DeepCopyInto(out *DriverState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Source Files

checkpoint.go checkpointer.go state.go zz_generated.deepcopy.go

Version
v1.34.0-rc.0
Published
Aug 6, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
10 minutes ago

Tools for package owners.