Docker buildx rm always deletes buildkit Kubernetes deployments · Issue #794 · docker/buildx (original) (raw)

Hello,

We are currently using buildx with the Kubernetes driver to execute image builds on Kubernetes pods. We are managing the deployments separately and we are using the --name flag to register these deployments into the buildx context.
Our issue is that when we remove the buildx context with docker buildx rm, it also deletes the Kubernetes deployments, which we don't want to do in our case.

For people that are managing a shared pool of buildkit pods and run builds from multiple buildx clients, the current behaviour does not look very safe given that no one can remove the buildx context from their machine without deleting the entire pool of pods. It would be nice to specify at the creation that a buildx context is using already existing Kubernetes deployments, and not delete those deployments when deleting the buildx context.

However, I can understand that changing the current behaviour might be tricky. If that is not possible, a flag like --do-not-delete-deployments to pass to docker buildx rm would allow us to delete our buildx contexts safely.

If the idea looks good for you, we are happy to provides help implementing this feature into buildkit.