Skip to content

Commit d4d11c6

Browse files
committed
add: list raycluster function cli
1 parent 568bde6 commit d4d11c6

File tree

1 file changed

+31
-0
lines changed
  • src/codeflare_sdk/cli/commands

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import click
2+
from kubernetes import client, config
3+
4+
from codeflare_sdk.cluster.cluster import (
5+
list_clusters_all_namespaces,
6+
list_all_clusters,
7+
get_current_namespace,
8+
)
9+
from codeflare_sdk.cli.cli_utils import load_auth
10+
11+
12+
@click.group()
13+
def cli():
14+
"""List a specified resource"""
15+
pass
16+
17+
18+
@cli.command()
19+
@click.option("--namespace")
20+
@click.option("--all", is_flag=True)
21+
@click.pass_context
22+
def rayclusters(ctx, namespace, all):
23+
"""List all rayclusters in a specified namespace"""
24+
if all and namespace:
25+
click.echo("--all and --namespace are mutually exclusive")
26+
return
27+
namespace = namespace or "default"
28+
if not all:
29+
list_all_clusters(namespace)
30+
return
31+
list_clusters_all_namespaces()

0 commit comments

Comments
 (0)