Skip to content

Implement an OCI garbage collector #1639

Open
@LucaSeri

Description

Feature request summary

OCI image packages are stored as layers in the kraftkit runtime directory.

Due to how images are constructed, a layer might be used in more than one package. E.g. two packages might be using the same kernel with a different rootfs. To optimize this, the kernel is not packaged twice, it instead lives in its own layer that is only referenced by the two packages.

The issue occurs when we want to remove a package from our OCI store, as there is currently no reference counting mechanism. This means that we have to pick between two not so great options:

  • remove all the dependencies, potentially breaking other packages
  • remove no dependencies, causing the cache to grow indefinitely (albeit, slowly)

This issue tracks implementing a better garbage collection mechanism to only remove the necessary dependencies.

This involves changes to the DeleteIndex method of the different OCI handlers, e.g.:
https://github.com/unikraft/kraftkit/blob/staging/oci/handler/directory.go#L1087

Describe alternatives

No response

Related architectures

None

Related platforms

None

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    area/ociIssue or PR is related to OCI package managementkind/enhancementNew feature or requestpriority/lowNice to have issues thatare not urgent, but can be nagging.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions