deis / builder

Git server and application builder for Deis Workflow
https://deis.com
MIT License
40 stars 41 forks source link

fix(boot.go,pkg/*): implement a deleted app cleaner #186

Closed arschles closed 8 years ago

arschles commented 8 years ago

Overview

This PR introduces a background goroutine that polls the Kubernetes API for the list of namespaces and compares those names with those in its local git folder. The cleaner then deletes all directories that exist locally but not in the namespace list.

Testing Instructions

To test, follow these steps:

  1. Create an app and git push to it from repository A
  2. deis apps:destroy -a your_app
  3. Wait at least the polling interval (the default is 1 second)
  4. Re-create an app of the same name from repository B (so that the deis tool creates the same remote in repo B). Make sure repository B has a different set of refs from A
  5. git push from repo B

The push should be successful and the app should run properly.

Still TODO:

Notes:

Fixes #167

bacongobbler commented 8 years ago

Seeing my logs being spewed full of messages:

Cleaner found no git directories to delete
Cleaner found no git directories to delete
Cleaner found no git directories to delete
Cleaner found no git directories to delete
Cleaner found no git directories to delete
Cleaner found no git directories to delete
Cleaner found no git directories to delete
Cleaner found no git directories to delete
Cleaner found no git directories to delete

Then I realized that debug is turned on by default. Works for me!

arschles commented 8 years ago

Note that I've manually tested this and verified it works on GKE

mboersma commented 8 years ago

Tested locally on a kube-solo cluster according to the above instructions. Everything went swimmingly. :+1:

smothiki commented 8 years ago

Tested Just now working

gerred commented 8 years ago

Tested on GKE as well. :+1:

bacongobbler commented 8 years ago

LGTM x 4

krancour commented 8 years ago

Any thoughts of a similar host-level trashman? Unused / old Docker images can fill up a disk. We should look into running something like Sherdock in a daemonset in the future.

arschles commented 8 years ago

@krancour not sure what you mean by host-level trashman. Can you file an issue with details? If it's something to clean up docker images I'm all for it, but the Sherdock readme doesn't provide much detail.