Delete and tear down a deployment
Delete an agent deployment and tear down its Kubernetes resources.
Deletes the deployment’s Kubernetes resources first, then marks the record as
DELETED; the underlying Helm release is subsequently uninstalled
asynchronously by FluxCD once the resource is removed. If the Kubernetes teardown
fails, the record is left unchanged and the call errors, so the delete can be
safely retried. Rejects the call with a client error if the deployment is already
in a terminal state (DELETED, CANCELLED, or SUPERSEDED) — a SUPERSEDED
record shares its Helm release with the deployment that replaced it, so deleting
it would tear down the live release. Returns 404 if no deployment with this ID
exists for the caller’s account. This removes a running deployment, not the image
build behind it, which is managed separately through the agentex builds API.
Delete and tear down a deployment
import os
from scale_gp_beta import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
agentex_cloud_deploy = client.deploy.delete(
"deployment_id",
)
print(agentex_cloud_deploy.id){
"id": "id",
"account_id": "account_id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"environment_config": "environment_config",
"manifest_file": "manifest_file",
"namespace": "namespace",
"status": "status",
"build_id": "build_id",
"deploy_events": [
{
"message": "message",
"reason": "reason",
"timestamp": "2019-12-27T18:11:19.117Z",
"type": "type"
}
],
"expires_at": "2019-12-27T18:11:19.117Z",
"helm_release_name": "helm_release_name",
"object": "agentex_cloud_deploy",
"preview_label": "preview_label"
}Returns Examples
{
"id": "id",
"account_id": "account_id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"environment_config": "environment_config",
"manifest_file": "manifest_file",
"namespace": "namespace",
"status": "status",
"build_id": "build_id",
"deploy_events": [
{
"message": "message",
"reason": "reason",
"timestamp": "2019-12-27T18:11:19.117Z",
"type": "type"
}
],
"expires_at": "2019-12-27T18:11:19.117Z",
"helm_release_name": "helm_release_name",
"object": "agentex_cloud_deploy",
"preview_label": "preview_label"
}