GoogleCloudPlatform / gcr-cleaner

Delete untagged image refs in Google Container Registry or Artifact Registry
Apache License 2.0
805 stars 112 forks source link

Support running inside a Kubernetes CronJob #14

Closed Sytten closed 4 years ago

Sytten commented 4 years ago

I think it would be valuable to create another entrypoint to directly run the cleaner with the specified parameters so it is possible to run inside GKE directly.

sethvargo commented 4 years ago

Do you have an example?

Sytten commented 4 years ago

I mean, basically it would be a docker image that launches the cleaner with something like: ./gcp-cleaner --repo gcr.io/repo/test --allow-tagged

sethvargo commented 4 years ago

I guess I'm confused? Is there a reason the existing image at gcr.io/gcr-cleaner/gcr-cleaner doesn't work for this use case?

Sytten commented 4 years ago

The current image is running a web server and waits for a request right? Inside a CronJob you would directly execute the cleaning. Otherwise you need to keep a pod alive and do CronJob to ping it.

sethvargo commented 4 years ago

Ah I see. So you basically want two different binaries:

Is that correct?

Sytten commented 4 years ago

Exactly! It would be nice to have a docker image for each too. And the second (gcrcleaner-runner) could allow an override of CMD parameters so the k8s deployment can specify the flags.

sethvargo commented 4 years ago

I think I'll likely update the existing binary to support to commands server and run with appropriate flags.

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.