Skip to content

Commit

Permalink
fix(negative): ApiException during node_exec.launch_pod
Browse files Browse the repository at this point in the history
Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang authored and yangchiu committed Mar 8, 2024
1 parent b4c333f commit bbcd707
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions e2e/libs/node_exec/node_exec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time

from kubernetes import client
from kubernetes.client.rest import ApiException
from kubernetes.stream import stream

from node_exec.constant import DEFAULT_POD_INTERVAL
Expand Down Expand Up @@ -91,13 +92,17 @@ def issue_cmd(self, node_name, cmd):

def launch_pod(self, node_name):
if node_name in self.node_exec_pod:
for i in range(DEFAULT_POD_TIMEOUT):
pod = self.core_api.read_namespaced_pod(
name=node_name,
namespace=self.namespace
)
if pod is not None and pod.status.phase == 'Running':
break
for _ in range(DEFAULT_POD_TIMEOUT):
try:
pod = self.core_api.read_namespaced_pod(
name=node_name,
namespace=self.namespace
)
if pod is not None and pod.status.phase == 'Running':
break
except ApiException as e:
assert e.status == 404

time.sleep(DEFAULT_POD_INTERVAL)
return pod
else:
Expand Down

0 comments on commit bbcd707

Please sign in to comment.