Skip to content

[WIP] #4296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

apostasie
Copy link
Contributor

@apostasie apostasie commented May 26, 2025

<!> Work in progress <!>

Currently, we store several important pieces of information inside annotations (and also labels).
Concretely: labels (and annotations) are used as a state storage system.
That information is currently retrieved directly from the container state annotations map, or the container labels, leading to a situation where individual code component are parsing or serializing the labels on their own.

This is problematic, as changing anything in how the data is being stored requires many changes in different places.
Generally speaking, we use the annotation/label storage as an API, leaking the storage specifics and limitations into unrelated abstractions, instead of providing a clean high-level API to interact with that stored data.

As fixing #3663 will require significant changes in the serialized format, including handling of backward compatibility for existing labels, it feels necessary to shake this up and rewrite it.

This is unfortunately going to be massive - and highly impactful.
I am going to try and split this in as many simple atomic PR as possible.

This first PR is focused on:

  • remove the internalLabels struct used in create, and replace it with a public Annotations struct
  • adopt some of the marshaling/unmarshaling logic currently spread over the codebase and hide it away inside Annotations
  • replace any direct access to the state.Annotations map, by access to the Annotations struct

If we are OK with the direction this is going to, subsequent PRs will focus on:

  • migrating away from Labels to Annotations were appropriate (this is currently a TODO in the codebase)
  • cleanup more of the parsing/serializing logic and hide it into Annotations
  • change the serialization format for a number of elements (Networks, IPAddress, etc) so that we can fix Supports multiple IP address assignment for nerdctl run and nerdctl compose up #3663
  • cleanup Create, which is currently baroque at over 1000+ lines

Signed-off-by: apostasie <[email protected]>
@apostasie apostasie closed this May 26, 2025
@apostasie apostasie reopened this May 26, 2025
@apostasie apostasie force-pushed the 2025-05-last-mile-after-a-year branch from 6dbeb25 to a745709 Compare May 26, 2025 23:35
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.

Supports multiple IP address assignment for nerdctl run and nerdctl compose up
1 participant