Delete a hub#
If you’d like to delete a hub, there are a few steps that we need to take:
1. Manage existing data#
The existing data should either be migrated to another place or should be deleted, depending on what has been agreed to with the Community Representative.
If the data should be migrated from the hub before decommissioning, then make sure that a 2i2c Engineer has access to the destination in order to complete the data migration.
The sub-sections below cover both scenarios.
1.1. Migrate data#
1.1.1 Backup the hub database#
jupyterhub.sqlite database off the hub.
1.1.2. Backup the home directory contents.#
Especially if we think that users will want this information in the future (or if we plan to re-deploy a hub elsewhere).
1.2. Delete data#
Delete user home directories using the
deployer exec homescommand.
deployer exec homes $CLUSTER_NAME $HUB_NAME
This should get you a shell with the home directories of all the users on the given hub. Delete all user home directories with:
# list the folders before running the command to delete them all
ls -lh /home
# this can take tens of minutes
rm -rf /home/*
2. Delete the OAuth application#
GitHub OAuth application#
For each hub that uses the JupyterHub GitHubOAuthenticator, we create a GitHub OAuth Application. You should be able to see the list of applications created under the
2i2c GitHub org and delete the one created for the hub that’s being decommissioned.
The naming convention followed when creating these apps is:
CILogon OAuth application#
Similarly, for each hub that uses CILogon, we dynamically create an OAuth client application in CILogon using the
deployer cilogon-client create command.
deployer cilogon-client delete command to delete this CILogon client when a hub is removed:
You’ll need to get all clients with:
deployer cilogon-client get-all
And then identify the client of the hub and delete based on its id with:
deployer cilogon-client delete --client-id cilogon:/client_id/<id> $CLUSTER_NAME $HUB_NAME
This will clean up some of the hub values related to auth and must be done prior to removing the hub files.
4. Remove the hub values file#
If the hub remains listed in its cluster’s
cluster.yaml file, the hub could be
redeployed by any merged PR triggering our CI/CD pipeline.
Open a decommissioning PR that removes the appropriate hub entry from the
config/clusters/$CLUSTER_NAME/cluster.yaml file and associated
*.values.yaml files no longer referenced in the
You can continue with the steps below before the PR is merged, but be ready to re-do them if the CI/CD pipeline was triggered before the decommissioning PR was merged.
4. Delete the Helm release and namespace#
In the appropriate cluster, run:
deployer use-cluster-credentials $CLUSTER_NAME
helm --namespace=$HUB_NAME delete $HUB_NAME
kubectl delete namespace $HUB_NAME