-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup job also deletes stale Boskos clusters (#570)
* add function for deleting old clusters * update README * Update based on PR comments * Update scripts/library.sh Co-Authored-By: chaodaiG <[email protected]> * fix bad merge * Update based on PR comments
- Loading branch information
1 parent
44d8507
commit 7912912
Showing
7 changed files
with
95 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,26 @@ | ||
# Resources Clean Up Tool | ||
|
||
This tool is designed to clean up stale resources from gcr, for now it only deletes old images created during testing. | ||
This tool is designed to clean up stale test resources. For now it deletes GCR images and GKE clusters created during testing. | ||
|
||
## Basic Usage | ||
|
||
Directly invoke [cleanup.sh](cleanup.sh) script with certain flags. There is no-op if invoking or sourcing this script without arguments. | ||
Directly invoke [cleanup.sh](cleanup.sh) script with certain flags, but don't source this script. | ||
|
||
By default the current gcloud credentials are used to delete the images. If necessary, use the flag `--service-account _key-file.json_` to specify a service account that will be performing the access to the gcr. | ||
|
||
### Clean up old images from multiple gcrs | ||
Projects to be cleaned up are expected to be defined in a `resources.yaml` file. To remove old images and clusters from them, call [cleanup.sh](cleanup.sh) with following flags: | ||
|
||
Projects to be cleaned up are expected to be defined in a `resources.yaml` file. To remove old images from them, call [cleanup.sh](cleanup.sh) with action "delete-old-gcr-images" and following flags: | ||
- "--project-resource-yaml" as path of `resources.yaml` file - Mandatory | ||
- "--re-project-name" for regex matching projects names - Optional, defaults to `knative-boskos-[a-zA-Z0-9]+` | ||
- "--days-to-keep" - Optional, default `365` | ||
- "--days-to-keep-images" - Optional, defaults to `365` as 1 year | ||
- "--hours-to-keep-clusters" - Optional, defaults to `720` as 30 days | ||
- "--dry-run" - Optional, performs dryrun for all gcloud functions, defaults to false | ||
|
||
Example: | ||
|
||
```./cleanup.sh "delete-old-gcr-images" --project-resource-yaml "ci/prow/boskos/resources.yaml" --days-to-keep 90``` | ||
|
||
### Clean up old images from a specific gcr | ||
|
||
Cleaning up from a specific gcr is supported, except for some special ones (_knative-release_ and _knative-nightly_). Call [cleanup.sh](cleanup.sh) with action "delete-old-images-from-gcr" and following flags: | ||
- "--gcr-to-cleanup" as name of gcr, e.g. "gcr.io/foo" - Mandatory | ||
- "--days-to-keep" - Optional, default `365` | ||
|
||
Example: | ||
|
||
```./cleanup.sh "delete-old-images-from-gcr" --gcr-to-cleanup "gcr.io/foo" --days-to-keep 90``` | ||
```./cleanup.sh --project-resource-yaml "ci/prow/boskos/resources.yaml" --days-to-keep-images 90 --days-to-keep-clusters 24``` | ||
This command deletes test images older than 90 days and test clusters created more than 24 hours ago. | ||
|
||
## Prow Job | ||
|
||
There is a weekly prow job that triggers this tool runs at 11:00/12:00PM(Day light saving) PST every Monday. This tool scans all gcr projects defined in [ci/prow/boskos/resources.yaml](/ci/prow/boskos/resources.yaml) and deletes images older than 90 days. | ||
There is a weekly prow job that triggers this tool runs at 11:00/12:00PM(Day light saving) PST every Monday. This tool scans all gcr projects defined in [ci/prow/boskos/resources.yaml](/ci/prow/boskos/resources.yaml) and deletes images older than 90 days and clusters older than 24 hours. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters