# Resolving cleanup issues

This page explains how to resolve issues with Cloud Service Mesh managed control plane
when using the `TRAFFIC_DIRECTOR` implementation.

## Clean up synthetic services

When using the `TRAFFIC_DIRECTOR` control plane implementation, Cloud Service Mesh
creates synthetic Kubernetes services to support subset. These services are
labeled with `istio.io/owned-by:gsmconfig.gke.io`.

When you unregister a cluster from a Google Cloud fleet, Cloud Service Mesh
might not be able to remove these synthetic Kubernetes services.

To mitigate this issue, you can manually remove synthetic Kubernetes services in
all namespaces by running the following command:

```bash
kubectl delete service -l istio.io/owned-by=gsmconfig.gke.io -A
```

## Clean up network endpoint groups annotations

When using the `TRAFFIC_DIRECTOR` control plane implementation, Cloud Service Mesh
creates network endpoint groups by adding `cloud.google.com/neg` annotations to
services for load balancing.

When you unregister a cluster from a Google Cloud fleet, Cloud Service Mesh
might not be able to remove these annotations to clean up the network endpoint
groups.

To mitigate this issue, you can manually remove the `cloud.google.com/neg`
annotations from services in all namespaces.

```bash
service_names=($(kubectl get service -A -o jsonpath='{.items[*].metadata.name}'))
for service in "${service_names[@]}"; do
  kubectl annotate service $service -A cloud.google.com/neg-
done
```