outposts: check if traefik CRD exists before attempting to delete

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-08 21:59:13 +02:00
parent d751a7fc4c
commit 5ac6a6910e
1 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,12 @@ class KubernetesObjectReconciler(Generic[T]):
def down(self):
"""Delete object if found"""
# Call self.get_reference_object to check if we even need to do anything
try:
self.get_reference_object()
except Disabled:
self.logger.debug("Object not required")
return
try:
current = self.retrieve()
self.delete(current)