{"id":18581945,"url":"https://github.com/coder/gke-disk-cleanup","last_synced_at":"2026-03-15T11:02:36.698Z","repository":{"id":65978619,"uuid":"473549693","full_name":"coder/gke-disk-cleanup","owner":"coder","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-01T09:55:24.000Z","size":83,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-09T07:30:24.996Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/coder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-24T10:04:31.000Z","updated_at":"2025-03-03T05:34:24.000Z","dependencies_parsed_at":"2023-02-19T19:15:32.222Z","dependency_job_id":null,"html_url":"https://github.com/coder/gke-disk-cleanup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fgke-disk-cleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fgke-disk-cleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fgke-disk-cleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fgke-disk-cleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coder","download_url":"https://codeload.github.com/coder/gke-disk-cleanup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244160064,"owners_count":20408022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-07T00:08:31.074Z","updated_at":"2026-03-15T11:02:31.677Z","avatar_url":"https://github.com/coder.png","language":"Go","readme":"# `gke-disk-cleanup`\n\nThis is a small utility to aid in cleaning up unused disks in a GKE environment.\n\n## Usage\n\n```shell\nUsage:\n  gke-disk-cleanup [command]\n\nAvailable Commands:\n  cleanup     cleanup disks in gcloud\n  help        Help about any command\n  mark        mark disks for later deletion\n\nFlags:\n      --dry-run             only log the actions that would be taken (default true)\n  -h, --help                help for gke-disk-cleanup\n      --project-id string   google project id (default \"default\")\n      --verbose             verbose output\n      --zone string         google compute zone (default \"us-east1-a\")\n```\n\n`gke-disk-cleanup` operates in two phases:\n\n### `mark` phase\n\nIn the `mark` phase, disks in the specified project and zone are marked with a label `marked-for-deletion:true` based on their last attached timestamp.\nIf the label `marked-for-deletion:true` is already present and the disk was attached within the specified cutoff period, the label value is updated to `marked-for-deletion:false`.\nIf the label `marked-for-deletion` is present with any value other than `true`, no further action will be taken.\n\n**Note:** by default:\n\n- Disks that have not been attached in the last 30 days will be marked. This is configurable with the `--cutoff` parameter.\n- Only disks with the label `goog-gke-volume` are considered. To change this, use the `--filter` argument. See the [gcloud documentation](https://cloud.google.com/sdk/gcloud/reference/topic/filters) for more information on this topic.\n- Nothing will happen unless you explicitly pass the option `--dry-run=false`.\n\n### `cleanup` phase\n\nIn the `cleanup` phase, disks in the project and zone with the label `marked-for-deletion:true` will be snapshotted and deleted. Snapshot creation can be suppressed with the option `--do-snapshot=false`.\n\n**Note:** by default, the `cleanup` command will do nothing unless you pass the option `--dry-run=false`.\n\n## Getting Started\n\n1. Ensure you have application default credentials available: `gcloud auth application-default login`\n1. Ensure you have `go` installed.\n1. Clone the git repository, navigate to it, and run `make build`.\n1. Run `./gke-disk-cleanup --help` to see the available options.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder%2Fgke-disk-cleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoder%2Fgke-disk-cleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder%2Fgke-disk-cleanup/lists"}