vmware-archive / buildkit-cli-for-kubectl

BuildKit CLI for kubectl is a tool for building container images with your Kubernetes cluster
Other
499 stars 41 forks source link

Implement prune UX #100

Open dhiltgen opened 2 years ago

dhiltgen commented 2 years ago

Describe the problem/challenge you have

We do not currently expose a prune CLI UX to be able to clean up old images/layers in the builder which can lead to disk space pressure on the kubernetes nodes.

A simple workaround is to delete and recreate the pods, but prune should be exposed to give users better control over the age of expiry to keep useful layers around while removing others unused layers.

Description of the solution you'd like

Implement something equivalent to https://github.com/docker/buildx/blob/master/docs/reference/buildx_prune.md

Design/Architecture Details

The UX maps ~1:1 to the API so it should be fairly straight forward. Send the prune request to all builders in a multi-node setup.

When implemented, integration test coverage should also be added to exercise the implementation and ensure things are properly wired up.

Environment Details:

NA

Vote on this request

This is an invitation to the community to vote on issues. Use the "smiley face" up to the right of this comment to vote.

hbermu commented 1 year ago

Hi @dhiltgen,

I'm just on the same situation, but I don't understand which pods you delete to clean all. With nerdctl https://github.com/containerd/nerdctl I can see the absurd number of images on the buildkit namespace:

./nerdctl namespace ls
NAME           CONTAINERS    IMAGES    VOLUMES    LABELS
buildkitnew    0             609       0              
k8s.io         47            58        0              

Thanks for you report, I wish we have something to solve this.