Skip to content

Commit abafd17

Browse files
authored
Add kubectl plugin with basic command and deprecate cli (#2243)
1 parent 0c99b42 commit abafd17

File tree

7 files changed

+650
-0
lines changed

7 files changed

+650
-0
lines changed

kubectl-plugin/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Kuberay Kubectl Plugin
2+
3+
Kubectl plugin/extension for Kuberay CLI that provides the ability to manage ray resources.
4+
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+
11+
## Prerequisites
12+
13+
1. Make sure there is a Kubernetes cluster running with KubeRay installed.
14+
2. Make sure `kubectl` has the right context.
15+
16+
## Usage
17+
18+
### Retrieve Ray Clusters
19+
20+
Usage:
21+
ray cluster get [flags]
22+
23+
Aliases:
24+
get, list
25+
26+
Flags:
27+
-A, --all-namespaces If present, list the requested clusters across all namespaces. Namespace in current context is ignored even if specified with --namespace.
28+
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
29+
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
30+
--as-uid string UID to impersonate for the operation.
31+
--cache-dir string Default cache directory
32+
--certificate-authority string Path to a cert file for the certificate authority
33+
--client-certificate string Path to a client certificate file for TLS
34+
--client-key string Path to a client key file for TLS
35+
--cluster string The name of the kubeconfig cluster to use
36+
--context string The name of the kubeconfig context to use
37+
--disable-compression If true, opt-out of response compression for all requests to the server
38+
-h, --help help for get
39+
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
40+
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
41+
-n, --namespace string If present, the namespace scope for this CLI request
42+
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
43+
-s, --server string The address and port of the Kubernetes API server
44+
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
45+
--token string Bearer token for authentication to the API server
46+
--user string The name of the kubeconfig user to use

kubectl-plugin/cmd/kubectl-ray.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package main
2+
3+
import (
4+
flag "github.com/spf13/pflag"
5+
6+
"os"
7+
8+
cmd "github.com/ray-project/kuberay/kubectl-plugin/pkg/cmd"
9+
)
10+
11+
func main() {
12+
flags := flag.NewFlagSet("kubectl-ray", flag.ExitOnError)
13+
flag.CommandLine = flags
14+
15+
root := cmd.NewRayCommand()
16+
if err := root.Execute(); err != nil {
17+
os.Exit(1)
18+
}
19+
}

kubectl-plugin/go.mod

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
module github.com/ray-project/kuberay/kubectl-plugin
2+
3+
go 1.22.0
4+
5+
toolchain go1.22.5
6+
7+
require (
8+
github.com/gosuri/uitable v0.0.4
9+
github.com/spf13/cobra v1.8.1
10+
github.com/spf13/pflag v1.0.5
11+
github.com/stretchr/testify v1.8.4
12+
k8s.io/apimachinery v0.30.2
13+
k8s.io/cli-runtime v0.30.2
14+
k8s.io/client-go v0.30.2
15+
k8s.io/kubectl v0.30.2
16+
)
17+
18+
require (
19+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
20+
github.com/MakeNowJust/heredoc v1.0.0 // indirect
21+
github.com/chai2010/gettext-go v1.0.2 // indirect
22+
github.com/davecgh/go-spew v1.1.1 // indirect
23+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
24+
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
25+
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
26+
github.com/fatih/color v1.17.0 // indirect
27+
github.com/go-errors/errors v1.4.2 // indirect
28+
github.com/go-logr/logr v1.4.1 // indirect
29+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
30+
github.com/go-openapi/jsonreference v0.20.2 // indirect
31+
github.com/go-openapi/swag v0.22.3 // indirect
32+
github.com/gogo/protobuf v1.3.2 // indirect
33+
github.com/golang/protobuf v1.5.4 // indirect
34+
github.com/google/btree v1.0.1 // indirect
35+
github.com/google/gnostic-models v0.6.8 // indirect
36+
github.com/google/gofuzz v1.2.0 // indirect
37+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
38+
github.com/google/uuid v1.3.0 // indirect
39+
github.com/gorilla/websocket v1.5.0 // indirect
40+
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
41+
github.com/imdario/mergo v0.3.6 // indirect
42+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
43+
github.com/josharian/intern v1.0.0 // indirect
44+
github.com/json-iterator/go v1.1.12 // indirect
45+
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
46+
github.com/mailru/easyjson v0.7.7 // indirect
47+
github.com/mattn/go-colorable v0.1.13 // indirect
48+
github.com/mattn/go-isatty v0.0.20 // indirect
49+
github.com/mattn/go-runewidth v0.0.15 // indirect
50+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
51+
github.com/moby/spdystream v0.2.0 // indirect
52+
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
53+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
54+
github.com/modern-go/reflect2 v1.0.2 // indirect
55+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
56+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
57+
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
58+
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
59+
github.com/pkg/errors v0.9.1 // indirect
60+
github.com/pmezard/go-difflib v1.0.0 // indirect
61+
github.com/rivo/uniseg v0.2.0 // indirect
62+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
63+
github.com/xlab/treeprint v1.2.0 // indirect
64+
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
65+
golang.org/x/net v0.23.0 // indirect
66+
golang.org/x/oauth2 v0.10.0 // indirect
67+
golang.org/x/sync v0.6.0 // indirect
68+
golang.org/x/sys v0.18.0 // indirect
69+
golang.org/x/term v0.18.0 // indirect
70+
golang.org/x/text v0.14.0 // indirect
71+
golang.org/x/time v0.3.0 // indirect
72+
google.golang.org/appengine v1.6.7 // indirect
73+
google.golang.org/protobuf v1.33.0 // indirect
74+
gopkg.in/inf.v0 v0.9.1 // indirect
75+
gopkg.in/yaml.v2 v2.4.0 // indirect
76+
gopkg.in/yaml.v3 v3.0.1 // indirect
77+
k8s.io/api v0.30.2 // indirect
78+
k8s.io/component-base v0.30.2 // indirect
79+
k8s.io/klog/v2 v2.120.1 // indirect
80+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
81+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
82+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
83+
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
84+
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
85+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
86+
sigs.k8s.io/yaml v1.3.0 // indirect
87+
)

0 commit comments

Comments
 (0)