Fix: Use Foreground deletion
Armada intends to use `propagationPolicy: Foreground` when deleting resources. However, the empty V1DeleteOptions object in the body of the delete API call takes priority over the propogation_policy specified as a query param, resulting in the per-resouce default. For Job and CronJob resources, the default is Orphan, and for others it is Background. This change includes the desired propogation_policy in V1DeleteOptions. Reference: https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#setting-the-cascading-deletion-policy Change-Id: Iffee12b426ba1e7741eb5bd687ca1b2c11cb071d
This commit is contained in:
parent
430586927c
commit
6a9b3bf9c9
|
@ -153,18 +153,15 @@ class K8s(object):
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
'Watching to delete %s %s, Wait timeout=%s',
|
'Watching to delete %s %s, Wait timeout=%s',
|
||||||
object_type_description, name, timeout)
|
object_type_description, name, timeout)
|
||||||
body = client.V1DeleteOptions()
|
body = client.V1DeleteOptions(
|
||||||
|
propagation_policy=propagation_policy)
|
||||||
w = watch.Watch()
|
w = watch.Watch()
|
||||||
issue_delete = True
|
issue_delete = True
|
||||||
found_events = False
|
found_events = False
|
||||||
for event in w.stream(list_func, namespace=namespace,
|
for event in w.stream(list_func, namespace=namespace,
|
||||||
timeout_seconds=timeout):
|
timeout_seconds=timeout):
|
||||||
if issue_delete:
|
if issue_delete:
|
||||||
delete_func(
|
delete_func(name=name, namespace=namespace, body=body)
|
||||||
name=name,
|
|
||||||
namespace=namespace,
|
|
||||||
body=body,
|
|
||||||
propagation_policy=propagation_policy)
|
|
||||||
issue_delete = False
|
issue_delete = False
|
||||||
|
|
||||||
event_type = event['type'].upper()
|
event_type = event['type'].upper()
|
||||||
|
|
Loading…
Reference in New Issue