CORD-3054 delete steps for k8s synchronizer
Change-Id: I95d61ae5837892e3d7783791506d9ba6d7babcb4
diff --git a/xos/synchronizer/steps/sync_trustdomain.py b/xos/synchronizer/steps/sync_trustdomain.py
index 90b6afd..5a326fa 100644
--- a/xos/synchronizer/steps/sync_trustdomain.py
+++ b/xos/synchronizer/steps/sync_trustdomain.py
@@ -88,7 +88,12 @@
o.backend_handle = ns.metadata.self_link
o.save(update_fields=["backend_handle"])
- def delete_record(self, port):
- # TODO(smbaker): Implement delete step
- pass
+ def delete_record(self, o):
+ namespace = self.get_namespace(o)
+ if not namespace:
+ log.info("Kubernetes trust domain does not exist; Nothing to delete.", o=o)
+ return
+ delete_options = self.kubernetes_client.V1DeleteOptions()
+ self.v1core.delete_namespace(o.name, delete_options)
+ log.info("Deleted trust domain from kubernetes", handle=o.backend_handle)