Clean up regionΒΆ

  1. Make sure that there are no more resources running in the Kubernetes cluster. The fastest way to check is by either querying core.projects on the database or by using croud projects list --region {region} --sudo.

    SELECT * FROM core.projects
    WHERE region = '{region}' AND is_deleted = FALSE;
    

    Warning

    If there are still projects, make sure they are deleted using croud first! This will ensure that there are no dangling resources in the database thereafter.

  2. Remove all available products of the specific region by connecting to Brain and running the DELETE statement:

    DELETE FROM core.product_availability
    WHERE region = '{region}';
    
  3. Remove the region by connecting to Brain and running the DELETE statement after making sure that there are no more projects in this region:

    DELETE FROM core.regions
    WHERE name = '{region}';
    
  4. In case the region (Kubernetes cluster) is part of the Crate.io infrastructure, tear it down.

  5. Remove related secrets from Vault:

    $ REGION="{region}"
    $ CUSTOMER_ID="{customer}"
    $ ENV="ext"
    
    $ vault kv get "crate/infra/pillar/application/cloud_app/$ENV/service-principals/$REGION"
    $ vault kv delete "crate/infra/pillar/application/cloud_app/$ENV/service-principals/$REGION"
    
    $ vault kv get "/crate/apps/$ENV/cloud-agent/basicauth/$REGION"
    $ vault kv delete "/crate/apps/$ENV/cloud-agent/basicauth/$REGION"
    
    $ vault kv get "/crate/infra/pillar/application/cratedb/$ENV/external-dns/$REGION"
    $ vault kv delete "/crate/infra/pillar/application/cratedb/$ENV/external-dns/$REGION"
    
    $ vault kv get "/crate/infra/pillar/common/docker/registries/cr8cloud/$REGION"
    $ vault kv delete "/crate/infra/pillar/common/docker/registries/cr8cloud/$REGION"
    
    $ vault kv get "/crate/infra/pillar/customer/$CUSTOMER_ID/$REGION"
    $ vault kv delete "/crate/infra/pillar/customer/$CUSTOMER_ID/$REGION"
    
    $ vault kv get "/crate/infra/pillar/application/cratedb/$ENV/keystore/$REGION"
    $ vault kv delete "/crate/infra/pillar/application/cratedb/$ENV/keystore/$REGION"
    
  6. Remove related keys from Vault:

    Path: /crate/infra/pillar/cr8/spn Key: docker-cloud-$ENV-${REGION//./-}

  7. Go to AWS Route53 and delete all A and TXT records created by K8s services

  8. Destroy the Terraform state of the region in the crate/salt repo and remove the module from regions.tf and outputs.tf.

    $ cd terraform/cratedb-cloud/
    $ terraform destroy -target module.{region}
    $ vim regions.tf  # remove region
    $ vim outputs.tf  # remove outputs