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 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.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
3 hours ago

Tools for package owners.