Skip to content

Commit

Permalink
exit on failed to get enough configmap (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudifsd authored and Anbang-Hu committed Jan 3, 2020
1 parent f150c0a commit 237bcbe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/docker-images/init-container/runtime/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"network": 2,
"k8s_api": 3,
"port": 4,
"wait_sync_fail": 5,
}

def find_free_port(min=40000, max=49999):
Expand Down Expand Up @@ -138,12 +139,16 @@ def main(args):
label_selector=labels,
)

logging.debug("Got %d config maps, expected %d", len(resp.items), expected_num)
logger.debug("Got %d config maps, expected %d", len(resp.items), expected_num)
if len(resp.items) == expected_num:
items = resp.items
break
time.sleep(1)

if len(items) != expected_num:
logger.error("timeout in waiting other's configmap, maybe because resource not enough")
sys.exit(ERROR_EXIT_CODE["wait_sync_fail"])

# SD stands for service discovery
envs = {
"DLWS_SD_SELF_IP": ip,
Expand Down

0 comments on commit 237bcbe

Please sign in to comment.