# Delete a Service

The Service Deletion process is a critical and irreversible operation that results in the complete removal of a service from your Kubernetes environment. This operation will permanently delete all resources, configurations, and associated components of your service. Please read this documentation thoroughly before proceeding, as this action cannot be undone once initiated.

### Who Can Delete a Service?

To maintain security and prevent accidental deletions, service deletion permissions are strictly controlled:

* **Super Admin**: Can delete across all workspaces.
* **Workspace Owner**: Has full permissions to delete any service within their workspace.
* **Service Owner**: Does not have the permission to delete any services.

### Critical Disclaimer – Proceed with Caution

**IMPORTANT**: Service deletion is an irreversible process. Once initiated, the following components will be permanently removed:

#### ArgoCD Application

* All ArgoCD resources associated with your service.
* Continuous Deployment configurations.
* Application synchronization settings.
* ArgoCD project configurations specific to your service.

#### Kubernetes Resources

* All deployments, pods, and containers running your service
* Service configurations and endpoints
* Configmap and Secrets associated with your service
* Any persistent volumes or volume claims
* Service-specific network policies
* Resource quotas and limits

#### DNS Configuration

* CNAME records pointing to your service.

#### Git Repository Resources

* Service manifest files inside the designated repository.
* All deployment configurations across different environments.
* Service-specific configuration files.
* Environment variables and settings.
* Infrastructure as Code (IaC) definitions for your service.

#### Additional Impact

* All running instances of your service will be terminated
* Active connections to your service will be disrupted
* Service monitoring and logging configurations will be removed
* Access to service metrics and historical data will be lost
* Integration points with other services may be affected

### Deletion Process Flow

1. **Preparing Deletion Context**
   * System validates authorization
   * Confirms service exists and is eligible for deletion
   * Creates deletion audit trail
2. **Delete Service from ArgoCD**
   * Removes service from ArgoCD management
   * Terminates continuous deployment pipeline
   * Cleans up ArgoCD application configurations
3. **Delete Service from K8s Cluster**
   * Removes all Kubernetes resources
   * Terminates running pods and containers
   * Cleans up associated configurations
4. **Delete CNAME Record**
   * Removes DNS entries
   * Updates routing configurations
   * Cleans up service discovery settings
5. **Delete Service Folder from Git**
   * Removes service manifest folder
   * Deletes all deployment configurations
   * Cleans up environment-specific settings
6. **Finalize Deletion**
   * Verifies complete removal of all components
   * Updates system records
   * Finalizes audit logging

### Pre-Deletion Checklist

Before proceeding with service deletion, ensure you have:

1. Backed up any critical data or configurations
2. Documented service dependencies and integration points
3. Notified relevant stakeholders
4. Verified that no critical business processes depend on this service
5. Created backup copies of service manifests if needed for future reference

### Irreversibility Warning

This operation cannot be undone. Once you confirm the deletion:

* There is no rollback mechanism
* Deleted resources cannot be recovered
* Service restoration would require complete redeployment
* Historical data and configurations will be permanently lost

### Audit and Compliance

All service deletion actions are logged for audit purposes, including:

* Timestamp of deletion
* User who initiated the deletion
* Complete inventory of deleted resources
* Verification of deletion completion
