Delete from production

Overview

To delete a project from a production environment you need to consider at least the following additional requirements:

  • The k5-delete task run must be created by calling the REST API directly

This guide explains the basic workflow for this deletion and shows examples of how these requirements can be implemented. However, it does not provide a production-ready workflow, but is a useful example that you can adapt to your specific security and automation requirements.

For this explanation, the following scenario is assumed:

You have an OpenShift project (k5-project) in your production cluster. Your project is deployed in this k5-project.

The following steps outline the process:

  • Check prerequisites

  • Create the k5-delete task run

Check prerequisites

Before you begin, ensure that the following tasks are complete:

  • Obtain an OpenShift account with sufficient permissions

Attention: Creating the k5-delete task run for project deletion via a REST API call requires the Project Administrator role for the project for which you are creating the pipeline.

Create the k5-delete task run

The project will be deleted by executing a k5-delete task run on the production cluster.

You can find the URL of the Swagger UI for this API on the Solution Envoy for your target k5-project under Infrastructure on the production cluster. If {Destination Domain} denotes the cluster domain, the URL is usually as follows:

https://{Destination Project}.{Destination Domain}/swagger/-/swagger-ui.html?urls.primaryName=pipeline-manager#/task-controller

To create the k5-delete task, make a POST request on the production cluster using, for example, the cURL command line tool as shown in the following example:

$ TOKEN=$(oc whoami -t)
$ URL="https://{Destination Project}.{Destination Domain}/-/pipelines/v1/tasks/delete?cleanupPipelineResources={cleanupPipelineResources}"
$ curl -k \
    -X POST \
    -d @- \
    -H "Authorization: Bearer $TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
     $URL <<'EOF'
{
    "solutionAcronym": "{project Acronym}",
}
EOF
Note: In this example, replace the placeholder variables {..} as follows:
  • {Destination Project} : k5-project to which the project should be deployed

  • {Destination Domain} : URL of the domain of the production cluster

  • {cleanupPipelineResources} Optional boolean flag (default: false), indicates whether to clean up used pipeline resources or not (this does not include Kafka and database resources)

  • {Solution Acronym} : project's acronym in capital letters

Expect an HTTP 200/OK message returning the k5-delete task run name.