Skip to content

Commit

Permalink
Support multiple clusters in sync_tron_from_k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
jfongatyelp committed Jul 13, 2024
1 parent bff89ee commit 165ba1b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/sync_tron_state_from_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ def limit_size_with_hash(name: str, limit: int = 63, suffix: int = 4) -> str:

def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--kubeconfig-path", dest="kubeconfig_path", help="KUBECONFIG path")
parser.add_argument(
"--kubeconfig-path",
dest="kubeconfig_path",
help="KUBECONFIG path; multiple can be specified to find pods in multiple clusters",
nargs="+",
)
parser.add_argument(
"--do-work",
dest="do_work",
Expand Down Expand Up @@ -214,7 +219,9 @@ def update_tron_from_pods(
jobs = get_tron_state_from_api(args.tron_url, args.num_runs)
log.debug(f"Found {len(jobs)} jobs.")

pods = fetch_pods(args.kubeconfig_path)
pods = {}
for kubeconfig in args.kubeconfig_path:
pods.update(fetch_pods(kubeconfig))
log.debug(f"Found {len(pods.keys())} pods.")

update_tron_from_pods(jobs, pods, args.tronctl_wrapper, args.do_work)

0 comments on commit 165ba1b

Please sign in to comment.