Skip to content

Commit

Permalink
[Feat][kubectl-plugin] Add instructions for static shell completion (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MortalHappiness committed Sep 17, 2024
1 parent cf4a877 commit 800ac16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 42 deletions.
53 changes: 11 additions & 42 deletions kubectl-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,25 @@

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

## Installation

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

## Prerequisites

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

## Usage

### Retrieve Ray Clusters

Usage:
ray cluster get [flags]

Aliases:
get, list

Description:
Retrieves the ray cluster information.
## Installation

```
$ kubectl ray cluster get
NAME NAMESPACE DESIRED WORKERS AVAILABLE WORKERS CPUS GPUS TPUS MEMORY AGE
random-kuberay-cluster default 1 1 5 1 0 24Gi 13d
```
### Compiling from source

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

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

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

Description:
Retrieves ray cluster head pod logs and all the logs under `/tmp/ray/session_latest/logs/`
## Shell Completion

```
$ kubectl ray cluster logs --out-dir temp-dir
...
$ ls temp-dir/
stable-diffusion-cluster-head-hqcxt
$ ls temp-dir/stable-diffusion-cluster-head-hqcxt
agent-424238335.err dashboard_agent.log gcs_server.err monitor.err old raylet.out stdout.log
agent-424238335.out debug_state.txt gcs_server.out monitor.log ray_client_server.err runtime_env_agent.err
dashboard.err debug_state_gcs.txt log_monitor.err monitor.out ray_client_server.out runtime_env_agent.log
dashboard.log events log_monitor.log nsight raylet.err runtime_env_agent.out
```
1. Install [kubectl plugin-completion](https://github.com/marckhouzam/kubectl-plugin_completion) plugin.
2. Run `kubectl plugin-completion generate`.
3. Add `$HOME/.kubectl-plugin-completion` to `PATH` in your shell profile.
3 changes: 3 additions & 0 deletions kubectl-plugin/pkg/cmd/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ func NewRayCommand(streams genericiooptions.IOStreams) *cobra.Command {
Run: func(cmd *cobra.Command, args []string) {
cmd.HelpFunc()(cmd, args)
},
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: true,
},
}

cmd.AddCommand(cluster.NewClusterCommand(streams))
Expand Down

0 comments on commit 800ac16

Please sign in to comment.