Documentation ¶
Overview ¶
This script cleans up orphaned GKE clusters and Konnect runtime groups that were created by the e2e tests (caued by e.g. unexpected crash that didn't allow a test's teardown to be completed correctly). It's meant to be installed as a cronjob and run repeatedly throughout the day to catch any orphaned resources: however tests should be trying to delete the resources they create themselves.
A cluster is considered orphaned when all conditions are satisfied: 1. Its name begins with a predefined prefix (`gke-e2e-`). 2. It was created more than 1h ago.
A runtime group is considered orphaned when all conditions are satisfied: 1. It has a label `created_in_tests` with value `true`. 2. It was created more than 1h ago.
Usage: `go run ./hack/cleanup [mode]` Where `mode` is one of: - `all` (default): clean up both GKE clusters and Konnect runtime groups - `gke`: clean up only GKE clusters - `konnect`: clean up only Konnect runtime groups