cleanup

command
v2.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

README

Cleanup Script

This script cleans up orphaned resources created by CI tests.

Konnect Control Planes Cleanup

The script will delete Konnect Control Planes that meet all of the following conditions:

  1. Has one of these labels:
    • operator-test-id (used by integration tests)
    • k8s-kind:KonnectGatewayControlPlane (automatically added by Kong Operator)
  2. Was created more than 1 hour ago

Warning: All Control Planes managed by Kong Operator (with label k8s-kind:KonnectGatewayControlPlane) in the configured Konnect organization will be pruned by this script.

Usage

go run ./hack/cleanup [mode]

Where mode is one of:

  • all (default): clean up both GKE clusters and Konnect control planes
  • gke: clean up only GKE clusters
  • konnect: clean up only Konnect control planes

Environment Variables

  • KONG_TEST_KONNECT_ACCESS_TOKEN: Konnect API access token
  • KONG_TEST_KONNECT_SERVER_URL: Konnect API server URL

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 control plane 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 control planes - `gke`: clean up only GKE clusters - `konnect`: clean up only Konnect control planes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL