Delete task pods upon successful completion

This commit is contained in:
Mehran Kholdi 2020-04-24 21:32:44 +04:30
parent 4ec6acf731
commit c500df8ca2
2 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,7 @@ rules:
verbs: ["get"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1

View File

@ -63,3 +63,4 @@ def run_on_node(fn, node):
wait_for(is_finished, "task to finish")
if task_pod.obj["status"]["phase"] != "Succeeded":
raise Exception(f"Task {name} failed")
task_pod.delete()