ahrtr / etcd-defrag

An easier to use and smarter etcd defragmentation tool
MIT License
85 stars 9 forks source link

Feat/docker builds #18

Closed clementnuss closed 1 year ago

clementnuss commented 1 year ago

I've added simple docker builds using ko-build/ko, I think it would quite useful to have docker images available.

let me know if you want me to adapt the README.

also, if this gets merged, I'll create another PR with a Kubernetes CronJob using the docker image to defragment my etcd clusters.

thanks for the tool by the way! really useful :)

ahrtr commented 1 year ago

Thank you for the PR. This tool doesn't have an official image registry for now. github registry has some limitation, might not be a good default choice.

So I'd like to leave users to build & push the image themselves. But of course, if you want to improve the existing release script to include the functionality of building & pushing image, then I am happy to accept it. But the functionality should can be enabled/disabled by flags (e.g. --build-image, --push-image), and should be disabled by default.

clementnuss commented 1 year ago

I see your point. I think would go another way however, for simplicity reasons: I would fork that repo and release a docker container under postfinance/etcd-defrag if that's ok for you. I would then update my fork based on yours from times to times.

This makes it quite easy to keep up-to-date containers. modifying the build script comes with the challenge that I'd need to export an access token and to build locally, something I don't want to do.

clementnuss commented 1 year ago

or I could also modify the gh-action in the same way as I did in this other project I'm maintaining: https://github.com/postfinance/kubelet-csr-approver/blob/main/.github/workflows/publish.yaml#L129

that way there would be container images published to ghcr.io and docker.io. both come with some limitations, but with two approaches I would find it acceptable.

also, having the container named ahrtr/etcd-defrag would probably increase the adoption of this tool, it then makes it really simple to create a Kubernetes CronJob and to defragment in-cluster

ahrtr commented 1 year ago

Re-read the https://github.com/features/packages#pricing, it seems that the 1GB limitation of "Data transfer out outside of Actions" is only for private repositories, and public repositories (such as ahrtr/etcd-defrag) do not have such limitation. If it's true, it might be OK to use github package registry.

ahrtr commented 1 year ago

Overall looks good to me, could you please squash the commits into one?

ahrtr commented 1 year ago

Could you please also update https://github.com/ahrtr/etcd-defrag#container-image?

ahrtr commented 1 year ago

Could you please also update https://github.com/ahrtr/etcd-defrag#container-image?

Never mind, we can take care of it in a separate PR. I can also take care of it.

ahrtr commented 1 year ago

I will create a new tag & publish a new release after merging this PR.