Skip to content

PR Environments

Cleaning up zombies

Sometimes the .github/workflows/pr-k8s-delete.yml GitHub workflow fails to run for various reasons when a PR gets merged or closed, and the indevets-sandbox Kubernetes namespace can end up with “zombie” instances still running.

Periodically, someone should look through all the active deployments to identify ones that don’t correlate with a PR that is still open and manually delete them:

  1. Open a shell with KUBECONFIG configured to connect to the current IndeVets cluster
  2. Paste this function into your shell:

        #kubectl delete deployment,replicaset,ingress,all,secret -l "app.kubernetes.io/instance=pr-572"
    delete-pr-env() {
        helm -n indevets-sandbox uninstall "pr-${1}"
        kubectl -n indevets-sandbox  delete secret "pr-${1}-tls"
    }
    
  3. Run the function for each zombie PR environment you find:

    delete-pr-env 1234