Skip to content

Commit 800ac16

Browse files
[Feat][kubectl-plugin] Add instructions for static shell completion (#2384)
1 parent cf4a877 commit 800ac16

File tree

2 files changed

+14
-42
lines changed

2 files changed

+14
-42
lines changed

kubectl-plugin/README.md

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,25 @@
22

33
Kubectl plugin/extension for Kuberay CLI that provides the ability to manage ray resources.
44

5-
## Installation
6-
7-
<!-- 1. Check [release page](https://github.com/ray-project/kuberay/releases) and download the necessary binaries. -->
8-
1. Run `go build cmd/kubectl-ray.go`
9-
2. Move the binary, which will be named `kubectl-ray` to your `PATH`
10-
115
## Prerequisites
126

137
1. Make sure there is a Kubernetes cluster running with KubeRay installed.
148
2. Make sure `kubectl` has the right context.
159

16-
## Usage
17-
18-
### Retrieve Ray Clusters
19-
20-
Usage:
21-
ray cluster get [flags]
22-
23-
Aliases:
24-
get, list
25-
26-
Description:
27-
Retrieves the ray cluster information.
10+
## Installation
2811

29-
```
30-
$ kubectl ray cluster get
31-
NAME NAMESPACE DESIRED WORKERS AVAILABLE WORKERS CPUS GPUS TPUS MEMORY AGE
32-
random-kuberay-cluster default 1 1 5 1 0 24Gi 13d
33-
```
12+
### Compiling from source
3413

35-
### Retrieve Ray Cluster Head Logs
14+
1. Run `go build cmd/kubectl-ray.go`
15+
2. Move the binary, which will be named `kubectl-ray` to your `PATH`
3616

37-
Usage:
38-
log (RAY_CLUSTER_NAME) [--out-dir directory] [--node-type all|head|worker]
39-
**Currently only `head` is supported**
17+
### Using Krew
4018

41-
Aliases:
42-
log, logs
19+
1. Install [Krew](https://krew.sigs.k8s.io/docs/user-guide/setup/install/).
20+
2. (TODO: Replace this step with the installation command).
4321

44-
Description:
45-
Retrieves ray cluster head pod logs and all the logs under `/tmp/ray/session_latest/logs/`
22+
## Shell Completion
4623

47-
```
48-
$ kubectl ray cluster logs --out-dir temp-dir
49-
...
50-
$ ls temp-dir/
51-
stable-diffusion-cluster-head-hqcxt
52-
$ ls temp-dir/stable-diffusion-cluster-head-hqcxt
53-
agent-424238335.err dashboard_agent.log gcs_server.err monitor.err old raylet.out stdout.log
54-
agent-424238335.out debug_state.txt gcs_server.out monitor.log ray_client_server.err runtime_env_agent.err
55-
dashboard.err debug_state_gcs.txt log_monitor.err monitor.out ray_client_server.out runtime_env_agent.log
56-
dashboard.log events log_monitor.log nsight raylet.err runtime_env_agent.out
57-
```
24+
1. Install [kubectl plugin-completion](https://github.com/marckhouzam/kubectl-plugin_completion) plugin.
25+
2. Run `kubectl plugin-completion generate`.
26+
3. Add `$HOME/.kubectl-plugin-completion` to `PATH` in your shell profile.

kubectl-plugin/pkg/cmd/ray.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func NewRayCommand(streams genericiooptions.IOStreams) *cobra.Command {
1919
Run: func(cmd *cobra.Command, args []string) {
2020
cmd.HelpFunc()(cmd, args)
2121
},
22+
CompletionOptions: cobra.CompletionOptions{
23+
DisableDefaultCmd: true,
24+
},
2225
}
2326

2427
cmd.AddCommand(cluster.NewClusterCommand(streams))

0 commit comments

Comments
 (0)