Repository navigation
feat(checkpoint)!: checkpoint v2 with driver extensions - #8
fishmans-agent wants to merge 9 commits into
Conversation
The GPU kubelet plugin of dra-driver-nvidia-gpu persists more than v1 could hold: per group timeSliceApplied and mpsApplied (unset means the checkpoint predates them), the PCI bus ID of vfio devices and of the parent of a MIG device, and the ShareID and Metadata of the kubelet device. Add them to the v1 types and read them from the legacy format. Tests read checkpoints written by the plugin's checkpointmanager code, in the V1+V2 and V1-only layouts. Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
The ComputeDomain kubelet plugin of dra-driver-nvidia-gpu persists the IMEX channel and daemon devices with their IDs, the ComputeDomain and config type of each group, and PrepareAborted claims with the time they were aborted. Add them to the v1 types. Read all three layouts the plugin ever wrote: V1+V2, V1 only, and the 25.3.0-rc.2 one, whose v1 claims are lists of device groups with the kubelet proto device. Tests read checkpoints written by the plugin's checkpointmanager code. Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
v2 is the core checkpoint the store will write: claims by UID with their status and Prepare/Unprepare lifecycle, the kubelet device reference, CDI container edits (KEP 4381), ShareID (5075) and device metadata with its attributes (5304) and network data (4817). Every core field maps to a KEP of the set; apiVersion, driverName and the extension reference are the envelope. Driver-only state is not part of the core. A driver extension stores it as opaque JSON payloads at node, claim and device level, named and versioned by ExtensionRef. The payloads are runtime.RawExtension, so the generated deepcopy needs no driver code. Register v2 next to v1 in the scheme and generate its deepcopy. Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
ConvertFromV1 keeps the core fields and moves the vendor sections of v1,
which have no KEP, verbatim into the driver payloads with their v1 JSON
keys: the node gets {"partitioning"}, a claim {"nvidia"}, a device
{"partition", "amd", "nvidia"}. That shape is version 1 of every driver
extension, so v1 files from dra-lib v0.1.0 convert without loss. Empty
sections give no payload; a v1 file without vendor state converts to a
core-only v2 checkpoint.
v1 stays decode-only; nothing writes it again.
Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
|
@fishmans-agent: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fishmans-agent The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
The store now writes api/checkpoint/v2 and is generic over a driver extension: Store[N, C, D] keeps the KEP-set core plus the driver's typed node, claim and device state. The extension, passed in Options at store creation, has a name, its own schema version, a Codec per level (JSONCodec is the default), forward-only migrations, optional legacy readers and an optional Validate. Payloads are stored per level, so a claim's driver state is dropped with its core claim. A store without an extension (None types) keeps only the core. Reading is forward-only: a v1 file is converted with ConvertFromV1, its vendor sections becoming payloads of extension version 1, and the migrations bring them to the extension's version; the next Write writes v2. Legacy checkpointmanager files go through the extension's legacy readers first, then the built-in reader through v1. Anything the store cannot read completely is refused and the file left alone: an unknown core version, a newer extension version, another extension, payloads without an extension reference or in a core-only store, a payload at a level without a codec, duplicate claim UIDs. testdata/v2-from-v1-checkpoint.json pins what the v1 fixture is written as. The fuzz targets and benchmarks move to v2; FuzzDecodeV1 is FuzzDecode, reading both versions. Decoding stays non-strict. BREAKING CHANGE: NewStore, Options, Read, Write and Update are generic and return or take a Checkpoint[N, C, D] with the v2 core. Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
checkpointtest.FuzzExtension fuzzes a driver's Extension from its own fixtures: each codec must not panic and must round-trip what it decodes, the migrations from every older version must not panic and must keep the number of device payloads, and the legacy readers must not panic and must return state the codecs encode and round-trip. FuzzTestExtension runs it on an example extension with a migration and a legacy reader; CI fuzzes it like the store targets. Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
Changelog, README and the v1 package doc describe the v2 core, the typed driver extension, the forward-only reading of v1 files and the checkpointtest helper. Strict decoding stays off and is noted as an open question. Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
Drivers move their checkpointmanager layouts into Extension.Legacy. The checksum check is shared, so dra-lib exports it instead of each driver copying it. Signed-off-by: Reza Jelveh <fishmangit@dynamia.ai>
944681f to
f584adc
Compare
|
@FouoF @moezdil I feel like the previous version might have been merged a bit prematurely. @archlitchi pointed me to the upstream nvidia driver which made me reconsider the checkpoint a bit. I versioned it at v2 because we already merged it in the other repos, but since they are not yet released i could leave it at v1 and skip the migration. fundamentally, currently driver specific state lives in the dra-lib which means other driver extensions influence the dra-lib releases which is not something we want. |
|
@Shouren i address the issues needed for upstream nvidia dra here |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds checkpoint API v2 and makes the store generic over a driver extension.
api/checkpoint/v2): only fields backed by DRA KEPs 4381, 4817, 5075 and 5304: claims with status and prepare state (PrepareStarted,PrepareCompleted,PrepareAborted,abortedAt), the kubelet device reference withshareIDandmetadata, CDI container edits, andnodeBootID.Store[N, C, D]takes anExtensionwith a name, its own schema version, a codec per level (JSONCodecby default), forward-only migrations, optional legacy readers and an optionalValidate. A store without an extension keeps only the core.v2.ConvertFromV1): the vendor sections become payloads of extension version 1, keeping their v1 JSON. The next write is v2; nothing writes v1 again. A newer core or extension version, another extension, or payloads the store cannot decode are refused, and the file is left alone.VerifyLegacyChecksumsis exported for them.checkpointtest.FuzzExtensionlets drivers fuzz their codecs, migrations and legacy readers from their own fixtures. A v1 fixture pins the v1 → v2 conversion.Needed for kubernetes-sigs/dra-driver-nvidia-gpu#1666. Supersedes #3.
Which issue(s) this PR fixes:
None.
Special notes for your reviewer:
Strict: false, andJSONCodecignores unknown fields), pending a benchmark. Newer schemas are still refused by the version checks.Does this PR introduce a user-facing change?:
AI Disclosure: Prepared with an AI assistant, reviewed by me.