Skip to content

add containerd annotation support for checkpoint metadata parsing#96

Open
slashexx wants to merge 1 commit intocheckpoint-restore:mainfrom
slashexx:ft/containerdcompat
Open

add containerd annotation support for checkpoint metadata parsing#96
slashexx wants to merge 1 commit intocheckpoint-restore:mainfrom
slashexx:ft/containerdcompat

Conversation

@slashexx
Copy link
Copy Markdown

@slashexx slashexx commented Mar 24, 2026

Fixes #95

This PR adds a conditional check to check for containerd annotations and properly parse containerd annotations.

Previously, the operator used to silently skip containerd checkpointing by hitting a JSON unmarshal error on the empty io.kubernetes.cri-o.Labels annotations.

Annotation difference :

CRI-O stores metadata as a JSON blob inside a single annotation, which must be unmarshalled: so io.kubernetes.cri-o.Labels has JSON containing io.kubernetes.pod.namespace, io.kubernetes.pod.name, io.kubernetes.container.name etc.

On the other hand, containerd stores metadata as flat, individual annotations, in contrast to the single one. (io.kubernetes.cri.sandbox-namespace, io.kubernetes.cri.sandbox-name, io.kubernetes.cri.container-name)

For reference, I took a look at the source code https://github.com/cri-o/cri-o/blob/main/internal/annotations/annotations.go and here : https://github.com/containerd/containerd/blob/main/internal/cri/annotations/annotations.go

Before the fix
image

After fix
Screenshot 2026-04-15 at 11 23 45 PM

@slashexx
Copy link
Copy Markdown
Author

@adrianreber ptal !

@slashexx
Copy link
Copy Markdown
Author

@adrianreber @rst0git gentle ping, ptal once :)

@slashexx
Copy link
Copy Markdown
Author

@adrianreber @rst0git gentle pinging once again

@adrianreber
Copy link
Copy Markdown
Member

Does this work? Which annotations are used by containerd and which by CRI-O. Please mention that in the commit message and PR description. This sounds like you are just avoiding a crash, but isn't everything functioning correctly?

@slashexx
Copy link
Copy Markdown
Author

@adrianreber yes I have tested this myself. The operator was parsing containerd metadata and applied policies correctly. I will add the annotation difference that I worked upon mostly.

This sounds like you are just avoiding a crash, but isn't everything functioning correctly?

To answer your question, if I understood it correctly, there was no crash in the first place. It was just silently failing to parse metadata and hence no retention policies were being applied.

Check for containerd annotations (io.kubernetes.cri.sandbox-namespace,
io.kubernetes.cri.sandbox-name, io.kubernetes.cri.container-name)
before falling through to the CRI-O parsing path.

Signed-off-by: slashexx <dhruvpuri.35@gmail.com>
@slashexx slashexx force-pushed the ft/containerdcompat branch from e6b3fb6 to 07f143d Compare April 15, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] the operator fails to parse checkpoint metadata on containerd based clusters

2 participants