Skip to content

ArctiqTeam/openshift-project-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

openshift-project-cleaner

Cleanup OpenShift3 projects

Deletes all non-crucial OpenShift cluster projects, by

  1. logging in to what should be a system:admin or cluster-admin user
  2. gets list of projects and filters out the important ones

specifically: openshift-infra, openshift-node, openshift, logging, kube-system, kube-service-catalog, kube-public, openshift-template-service-broker, default, management-infra, openshift-ansible-service-broker, dashai, peometheus-metrics

  1. outputs the projects to be deleted to ansible debug output
  2. deletes said projects

This is useful for cleaning up lab environments or anywhere that the non-core projects need to be cleared away.

Be aware that while this playbook isn't built to be purely idempotent, if there are no extraneous groups in the cluster, then the delete step fails, as there are no namespaces to delete.

HOW TO USE:

  1. git clone this repo to a master server in the cluster.

  2. setup the hosts.inv inventory file with a single master IP address and the remote username for ansible-ssh-ing.

Note That this playbook assumes the remote user has a kube/config in place so that the remote user gets system:admin.

  1. run the playbook from an ansible master and watch it complete.

ansible-playbook -i hosts.inv clean.yml

Releases

No releases published

Packages

No packages published