{"id":38022412,"url":"https://github.com/att-cloudnative-labs/kubesweeper","last_synced_at":"2026-01-16T19:30:10.035Z","repository":{"id":41543576,"uuid":"178292081","full_name":"att-cloudnative-labs/kubesweeper","owner":"att-cloudnative-labs","description":"Removes unnecessary Kubernetes resources based on a configurable pod restart threshold.","archived":false,"fork":false,"pushed_at":"2020-01-09T18:18:32.000Z","size":157,"stargazers_count":19,"open_issues_count":8,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T21:40:26.265Z","etag":null,"topics":["docker","go","golang","helm","knative","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/att-cloudnative-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-28T22:32:15.000Z","updated_at":"2022-07-03T20:53:01.000Z","dependencies_parsed_at":"2022-09-06T09:21:45.264Z","dependency_job_id":null,"html_url":"https://github.com/att-cloudnative-labs/kubesweeper","commit_stats":null,"previous_names":["att-cloudnative-labs/kythera-k8s-deployment-crawler"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/att-cloudnative-labs/kubesweeper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/att-cloudnative-labs%2Fkubesweeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/att-cloudnative-labs%2Fkubesweeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/att-cloudnative-labs%2Fkubesweeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/att-cloudnative-labs%2Fkubesweeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/att-cloudnative-labs","download_url":"https://codeload.github.com/att-cloudnative-labs/kubesweeper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/att-cloudnative-labs%2Fkubesweeper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","go","golang","helm","knative","kubernetes"],"created_at":"2026-01-16T19:30:08.860Z","updated_at":"2026-01-16T19:30:09.996Z","avatar_url":"https://github.com/att-cloudnative-labs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubesweeper\n\nAutomatically iterates through resources in a lab Kubernetes cluster and acts according to [certain conditions outlined here](#configuration-defaults). As of now, Kubesweeper will delete ```Deployments``` and their associated resources if the waiting reason and/or pod restart count and/or deployment age dictates. Additionally, you can use configurable Boolean environment variables to choose to delete associated ```Services```, ```Ingresses```, and ```HorizontalPodAutoscalers```. \n\nIf your lab Kubernetes clusters are filling up with non-Running pods, then Kubesweeper's automatic deletion\ncan assist. Future iterations of this project can involve other actions based on crawling through Kubernetes cluster resources, such as generating reports per namespace without actually deleting. \n\nPlease note that Kubesweeper is intended for use in lab—not production, customer-facing—clusters. Any automated cleanup in such an environment is unadvisable, at least for Kubesweeper.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://travis-ci.org/att-cloudnative-labs/kubesweeper.svg?branch=master\"\u003e\t\n  \u003ca href=\"https://goreportcard.com/report/github.com/att-cloudnative-labs/kubesweeper\" alt=\"Go Report Card\"\u003e\n    \u003cimg src=\"https://goreportcard.com/badge/github.com/att-cloudnative-labs/kubesweeper\"\u003e\n  \u003c/a\u003e\t\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/graphs/contributors\" alt=\"Contributors\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/contributors/att-cloudnative-labs/kubesweeper.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/commits/master\" alt=\"Commits\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/commit-activity/m/att-cloudnative-labs/kubesweeper.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/pulls\" alt=\"Open pull requests\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/issues-pr-raw/att-cloudnative-labs/kubesweeper.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/pulls\" alt=\"Closed pull requests\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/github/issues-pr-closed-raw/att-cloudnative-labs/kubesweeper.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/issues\" alt=\"Issues\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/issues-raw/att-cloudnative-labs/kubesweeper.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/stargazers\" alt=\"Stars\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/stars/att-cloudnative-labs/kubesweeper.svg?style=social\"\u003e\n\t\u003c/a\u003e\t\n\t\u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/watchers\" alt=\"Watchers\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/watchers/att-cloudnative-labs/kubesweeper.svg?style=social\"\u003e\n\t\u003c/a\u003e\t\n\t\u003ca href=\"https://github.com/att-cloudnative-labs/kubesweeper/network/members\" alt=\"Forks\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/forks/att-cloudnative-labs/kubesweeper.svg?style=social\"\u003e\n\t\u003c/a\u003e\t\n\u003c/p\u003e\n\n## Deployment as a Kubernetes CronJob\nIf the desired cluster does not have Knative installed, then Kubesweeper can be installed as a Kubernetes CronJob.\n\n1. Build Docker image\n```bash\n$ docker build -t kubesweeper .\n```\n2. Create Kubernetes resources from ```install``` directory\n```bash\n$ kubectl apply -f install/\n```\n\nNote that step 2 must be run in the context of the Kubernetes cluster. After that command is run, the appropriate Kubernetes resources will be created from the .yaml files in ```install```.\n\n## Deployment as a Knative CronJobSource\nIf you wish to deploy Kubesweeper on Knative as a CronJobSource, you can use Helm. For information on installing Helm, please refer to the [Helm quickstart guide](https://helm.sh/docs/using_helm/). After installing Helm, the following steps can be manually run:\n\n1. Build Docker image\n```bash\n$ docker build -t kubesweeper .\n```\n2. Run Helm template to install Kubesweeper\n```bash\n$ helm template kubesweeper --set image=\u003cKUBESWEEPER_IMAGE\u003e | kubectl create -f -\n```\n\nIn lieu of step 2, a Makefile can be used to pull values from ```~/install/helm/kubesweeper/values.yaml```:\n\n```bash\n$ make\n```\n\n## Configuration Defaults\n\nUnder the ```configs``` folder, the ```config.yaml``` has the following default configurations:\n\n* Pod waiting reasons\n  * CrashLoopBackOff\n  * ImagePullBackOff\n  * ErrImagePull\n  * Completed\n  * Failed\n* Pod restart threshold *(in other words, if pod restarts exceed this number, then delete)*\n  * 100\n    * If the pod restart threshold is at least this number *and* has a pod waiting reason of ```CrashLoopBackOff```, then Kubesweeper will delete the associated resources\n* Deployment age threshold *(in other words, if the deployment creation date is before this number of days, then delete)*\n  * 90\n  \nYou are able to configure these values to your choosing.\n\nHelm function configurations can be found in ```~/install/helm/kubesweeper/values.yaml```.\n\n* name\n  * Name to use for deployment\n* image\n  * Image used in deployment\n* cron\n  * Cron expression used to schedule Kubesweeper\n    * Any valid cron expression can be used\n* namespace\n  * Namespace job will be deployed in\n\n## Contributing\n\n1. [Fork Kubesweeper](https://github.com/att-cloudnative-labs/kubesweeper/fork)\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request\n\n## Additional info\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/att-cloudnative-labs\" alt=\"AT\u0026T Cloud Native Labs\"\u003e\n    \u003cimg src=\"./images/cloud_native_labs.png\" height=\"50%\" width=\"50%\"\u003e\n  \u003c/a\u003e\t\n\u003c/p\u003e\n\nMaintained and in-use by the Platform Team @ AT\u0026T Entertainment Cloud Native Labs.\n\nDistributed under the AT\u0026T MIT license. See ``LICENSE`` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatt-cloudnative-labs%2Fkubesweeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatt-cloudnative-labs%2Fkubesweeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatt-cloudnative-labs%2Fkubesweeper/lists"}