Skip to main content

Removing an unneeded namespace

When you have finished with a namespace, please clean it up (i.e. remove it).

This helps to keep the cloud platform repositories well-organised, and speeds up deployments and changes to the cluster (because the build process doesn’t have to spend time managing unnecessary resources). It also deletes the associated AWS resources, and helps to keep our hosting costs down.

Preparation

If you have any ECR resources in your namespace which still contain images, Concourse will fail when trying to delete the registry. You can either delete the images manually, or prepare the ECR for deletion by:

  • Set the deletion_protection = false argument in your ECR module code.
  • Raise a PR to apply this configuration change to your ECR resource.
  • Merge the PR, and proceed with the namespace deletion process.

IMPORTANT: It is your responsibility as namespace/PR owner to ensure that no other environments depend upon access to your ECR resources.

To delete a namespace and all its associated AWS resources, simply raise a PR which deletes the associated folder from the cloud-platform-environments.

So, if your namespace is called mynamespace, then you need to raise a PR deleting the folder:

 namespaces/live.cloud-platform.service.justice.gov.uk/mynamespace

…and all its contents, from the cloud-platform-environments repository.

Merging this PR will trigger the destroy-deleted-namespaces Pipeline, which will delete all of your non production (with namespace annotation “cloud-platform.justice.gov.uk/is-production = false”) namespace’s AWS resources, followed by the namespace itself, for production namespaces cloud-platform team will get an alert to manually delete the namespace.

NB: If you have set up a CI/CD pipeline, which deploys into your namespace, then this should be deleted first, so that anything you delete later is not immediately recreated by your build pipeline.

This page was last reviewed on 17 October 2024. It needs to be reviewed again on 17 January 2025 by the page owner #cloud-platform .
This page was set to be reviewed before 17 January 2025 by the page owner #cloud-platform. This might mean the content is out of date.