Deletes a specified Kubernetes resource in the designated namespace from the specified cluster.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| kind | string | The kind of the resource | |
| name | string | The name of the resource | |
| token | string | An optional OIDC token that will be used to authenticate to the Kubernetes cluster | |
| namespace | string | The namespace of the resource | |
| apiVersion | string | The apiVersion of the resource | |
| clusterName | string | The name of the Kubernetes cluster to use (from app-config) |
Output Schema
Usage Examples
Delete a preview Deployment when a pull request closes
Removes an ephemeral Deployment created for a pull request preview environment. Run this after fetch:template when cleaning up PR resources.
steps:
- id: fetch-skeleton
action: fetch:template
input:
url: https://github.com/acme/templates/service-skeleton/archive/main.zip
targetPath: .
values:
serviceName: ${{ parameters.serviceName }}
owner: ${{ parameters.owner }}
- id: delete-preview-deployment
action: kube:delete
input:
apiVersion: apps/v1
kind: Deployment
name: ${{ parameters.serviceName }}-pr-${{ parameters.prNumber }}
namespace: preview-pr-${{ parameters.prNumber }}
clusterName: dev-clusterRemove a stale ConfigMap in staging
Deletes a ConfigMap so that a fresh one can be recreated during deployment. Use this after fetch:template when rotating configuration.
steps:
- id: fetch-config
action: fetch:template
input:
url: https://github.com/acme/platform-config/archive/main.zip
targetPath: .
values:
env: ${{ parameters.env }}
app: ${{ parameters.app }}
- id: delete-staging-configmap
action: kube:delete
input:
apiVersion: v1
kind: ConfigMap
name: app-config
namespace: ${{ parameters.env }} # e.g. stagingClean up a completed Job in the CI namespace
Deletes a completed or failed Job so a pipeline can recreate it with the correct spec. Run this after fetch:template in CI workflows that manage database migrations.
steps:
- id: fetch-migration-spec
action: fetch:template
input:
url: https://github.com/acme/db-migrations/archive/main.zip
targetPath: .
values:
releaseTag: ${{ parameters.releaseTag }}
- id: delete-ci-job
action: kube:delete
input:
apiVersion: batch/v1
kind: Job
name: db-migration-${{ parameters.releaseTag }}
namespace: ci
clusterName: build-cluster
token: ${{ parameters.kubeOidcToken }}Delete an obsolete Ingress in production cluster
Removes an Ingress that is no longer needed after cutover to a new domain or service. Use this after fetch:template when finalizing a migration.
steps:
- id: fetch-routing
action: fetch:template
input:
url: https://github.com/acme/networking/ingress-ops/archive/main.zip
targetPath: .
values:
app: web-frontend
env: prod
- id: delete-prod-ingress
action: kube:delete
input:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: web-frontend
namespace: prod
clusterName: prod-east-1Remove an HPA before switching to cluster autoscaler
Deletes a HorizontalPodAutoscaler to avoid conflicts with new scaling policies. Run this after fetch:template when decommissioning per workload autoscaling.
steps:
- id: fetch-hpa-state
action: fetch:template
input:
url: https://github.com/acme/ops/hpa-maintenance/archive/main.zip
targetPath: .
values:
serviceName: ${{ parameters.serviceName }}
team: ${{ parameters.team }}
- id: delete-hpa
action: kube:delete
input:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
name: ${{ parameters.serviceName }}
namespace: team-a
clusterName: dev-eu