nerc-project / operations

Issues related to the operation of the NERC OpenShift environment
1 stars 0 forks source link

Clean up of the following OpenShift AI based Course resources #571

Closed Milstein closed 1 month ago

Milstein commented 1 month ago
schwesig commented 1 month ago

Runbook: Clean RHODS-Notebooks After Classes

Goal:

  1. Stop all notebooks
  2. Delete all resources and services
  3. Set quotas/limits to 0
  4. Archive project

Basics: Refer to this guide for detailed instructions.

Steps:

  1. Log in to your terminal:

    oc login --token=sha256~<your token> --server=https://api.shift.nerc.mghpcc.org:6443
  2. Switch to your project:

    oc project <namespace>
  3. Confirm the project:

    oc project
  4. List all resources:

    oc get all
    oc get all -oname
  5. Check quotas:

    oc get quota
    oc describe quota <your_project_quota_name>
  6. Check for labels:

    oc get all --show-labels
  7. Delete notebooks (preferably via the NERC web console by the owner/PI):

    oc delete notebook --all -n <namespace>

    WARNING: --all deletes everything. Ensure you are in the correct project/namespace. Use -n <namespace> to specify.

    To delete resources with labels (preferred) and don't want to use --all:

    oc delete all -l <label>
  8. Full erase command (use with caution):

    oc delete pod,deployment,pvc,route,service,build,buildconfig,statefulset,replicaset,cronjob,imagestream,revision,configuration,notebook,service.serving,route.serving -n <namespace> --all
  9. Verify resources:

    oc get all -oname
    oc describe quota <your_project_quota_name>
  10. Reduce project limits in ColdFront.

  11. Verify resources again:

    oc get all -oname
    oc describe quota <your_project_quota_name>

Use these code snippets for rhods-Notebooks:

oc project rhods-notebooks
oc delete notebook --all -n rhods-notebooks
oc delete pod,deployment,pvc,route,service,build,buildconfig,statefulset,replicaset,cronjob,imagestream,revision,configuration,notebook,service.serving,route.serving -n rhods-notebooks --all