Skip to content

Commit 9772e2e

Browse files
committed
update: fix cmdLong and add useage
- we have 3 ways to run it 1. kubectl odh XXXX : download pre-build binary and rename it 2. odh-cli XXXX : download pre-build binary and use it directly 3. podman run XXXX : pull pre-build image and run inside container Signed-off-by: Wen Zhou <wenzhou@redhat.com>
1 parent eb3f135 commit 9772e2e

File tree

9 files changed

+99
-36
lines changed

9 files changed

+99
-36
lines changed

.goreleaser.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
version: 2
22

3-
project_name: kubectl-odh
3+
project_name: odh-cli
44

55
before:
66
hooks:
77
- go mod tidy
88

99
builds:
10-
- id: kubectl-odh
10+
- id: odh-cli
1111
main: ./cmd/main.go
12-
binary: kubectl-odh
12+
binary: odh-cli
1313
env:
1414
- CGO_ENABLED=0
1515
goos:

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,40 @@ CLI tool for ODH/RHOAI (Red Hat OpenShift AI) for interacting with ODH/RHOAI dep
99

1010
## Quick Start
1111

12+
### Using Pre-built Binary
13+
14+
Download the latest release from [GitHub Releases](https://github.com/opendatahub-io/odh-cli/releases):
15+
16+
```bash
17+
# Download and extract (example for Linux amd64)
18+
curl -LO https://github.com/opendatahub-io/odh-cli/releases/latest/download/odh-cli_linux_amd64.tar.gz
19+
tar -xzf odh-cli_linux_amd64.tar.gz
20+
21+
# Make it avaiable on PATH
22+
sudo mv odh-cli /usr/local/bin/
23+
24+
# Verify installation
25+
odh-cli version
26+
27+
# Run commands
28+
odh-cli lint --target-version 3.3.0
29+
```
30+
31+
**As kubectl Plugin (optional):**
32+
33+
To use as `kubectl odh`, rename or symlink the binary after download it:
34+
35+
```bash
36+
# Option 1: Rename
37+
sudo mv odh-cli /usr/local/bin/kubectl-odh
38+
39+
# Option 2: Symlink (keeps both names available)
40+
sudo ln -s /usr/local/bin/odh-cli /usr/local/bin/kubectl-odh
41+
42+
# Now use with kubectl
43+
kubectl odh lint --target-version 3.3.0
44+
```
45+
1246
### Using Containers
1347

1448
Run the CLI using the pre-built container image. Set your container runtime (podman or docker):

cmd/backup/backup.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ const cmdLong = `
2020
Backs up OpenShift AI workloads (notebooks, etc.) and their dependencies
2121
(ConfigMaps, Secrets, PVCs) to a directory structure.
2222
23+
INVOCATION:
24+
The examples below use 'odh-cli'. Depending on your setup, substitute with:
25+
- Container: podman|docker run <image> backup ...
26+
- kubectl plugin: kubectl odh backup ...
27+
- Direct binary: odh-cli backup ...
28+
2329
The backup command:
2430
- Discovers workload resources based on --includes/--exclude filters
2531
- For each workload, identifies and backs up referenced dependencies

cmd/lint/lint.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ const (
1919
const cmdLong = `
2020
Validates the current OpenShift AI installation or assesses upgrade readiness.
2121
22+
INVOCATION:
23+
The examples below use 'odh-cli'. Depending on your setup, substitute with:
24+
- Container: podman|docker run <image> lint ...
25+
- kubectl plugin: kubectl odh lint ...
26+
- Direct binary: odh-cli lint ...
27+
2228
LINT MODE (without --target-version):
2329
Validates the current cluster state and reports configuration issues.
2430
@@ -38,32 +44,32 @@ Each issue is reported with:
3844
3945
Examples:
4046
# Validate current cluster state
41-
kubectl odh lint
47+
odh-cli lint
4248
4349
# Assess upgrade readiness for version 3.0
44-
kubectl odh lint --target-version 3.0
50+
odh-cli lint --target-version 3.0
4551
4652
# Validate with JSON output
47-
kubectl odh lint -o json
53+
odh-cli lint -o json
4854
4955
# Validate only component checks
50-
kubectl odh lint --checks "components"
56+
odh-cli lint --checks "components"
5157
`
5258
const cmdExample = `
5359
# Validate current cluster state
54-
kubectl odh lint
60+
odh-cli lint
5561
5662
# Assess upgrade readiness for version 3.0
57-
kubectl odh lint --target-version 3.0
63+
odh-cli lint --target-version 3.0
5864
5965
# Output results in JSON format
60-
kubectl odh lint -o json
66+
odh-cli lint -o json
6167
6268
# Run only dashboard-related checks
63-
kubectl odh lint --checks "*dashboard*"
69+
odh-cli lint --checks "*dashboard*"
6470
6571
# Check upgrade readiness to version 3.1
66-
kubectl odh lint --target-version 3.1
72+
odh-cli lint --target-version 3.1
6773
`
6874

6975
// AddCommand adds the lint command to the root command.

cmd/migrate/list/list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ migrations without version filtering, or --target-version to filter by applicabi
2626

2727
const cmdExample = `
2828
# List applicable migrations for version 3.0
29-
kubectl odh migrate list --target-version 3.0.0
29+
odh-cli migrate list --target-version 3.0.0
3030
3131
# List all migrations without version filtering
32-
kubectl odh migrate list --all
32+
odh-cli migrate list --all
3333
3434
# List with JSON output
35-
kubectl odh migrate list --target-version 3.0.0 -o json
35+
odh-cli migrate list --target-version 3.0.0 -o json
3636
`
3737

3838
// AddCommand adds the list subcommand to the migrate command.

cmd/migrate/migrate.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ const (
1919
const cmdLong = `
2020
The migrate command manages cluster migrations for OpenShift AI components.
2121
22+
INVOCATION:
23+
The examples below use 'odh-cli'. Depending on your setup, substitute with:
24+
- Container: podman|docker run <image> migrate ...
25+
- kubectl plugin: kubectl odh migrate ...
26+
- Direct binary: odh-cli migrate ...
27+
2228
Use 'migrate list' to see available migrations filtered by version compatibility.
2329
Use 'migrate prepare' to backup resources before migration.
2430
Use 'migrate run' to execute one or more migrations sequentially.
@@ -35,22 +41,22 @@ Available subcommands:
3541

3642
const cmdExample = `
3743
# List available migrations for version 3.0
38-
kubectl odh migrate list --target-version 3.0.0
44+
odh-cli migrate list --target-version 3.0.0
3945
4046
# List all migrations including non-applicable ones
41-
kubectl odh migrate list --all
47+
odh-cli migrate list --all
4248
4349
# Prepare for migration (creates backups)
44-
kubectl odh migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0
50+
odh-cli migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0
4551
4652
# Run a migration with confirmation prompts
47-
kubectl odh migrate run --migration kueue.rhbok.migrate --target-version 3.0.0
53+
odh-cli migrate run --migration kueue.rhbok.migrate --target-version 3.0.0
4854
4955
# Run migration in dry-run mode (preview changes only)
50-
kubectl odh migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --dry-run
56+
odh-cli migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --dry-run
5157
5258
# Run multiple migrations sequentially
53-
kubectl odh migrate run --migration kueue.rhbok.migrate --migration other.migration --target-version 3.0.0 --yes
59+
odh-cli migrate run --migration kueue.rhbok.migrate --migration other.migration --target-version 3.0.0 --yes
5460
`
5561

5662
// AddCommand adds the migrate command to the root command.

cmd/migrate/prepare/prepare.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ Use --output-dir to specify where backups should be written.
3030

3131
const cmdExample = `
3232
# Prepare for a single migration (creates timestamped backup directory)
33-
kubectl odh migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0
33+
odh-cli migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0
3434
3535
# Prepare with custom backup directory
36-
kubectl odh migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0 --output-dir /path/to/backups
36+
odh-cli migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0 --output-dir /path/to/backups
3737
3838
# Preview what would be backed up (dry-run mode)
39-
kubectl odh migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0 --dry-run
39+
odh-cli migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0 --dry-run
4040
4141
# Prepare without confirmation prompts
42-
kubectl odh migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0 --yes
42+
odh-cli migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0 --yes
4343
4444
# Prepare multiple migrations sequentially
45-
kubectl odh migrate prepare -m kueue.rhbok.migrate -m other.migration --target-version 3.0.0
45+
odh-cli migrate prepare -m kueue.rhbok.migrate -m other.migration --target-version 3.0.0
4646
`
4747

4848
// AddCommand adds the prepare subcommand to the migrate command.

cmd/migrate/run/run.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ Use 'migrate prepare' to backup resources before running migrations.
2626

2727
const cmdExample = `
2828
# Run a single migration with confirmation prompts
29-
kubectl odh migrate run --migration kueue.rhbok.migrate --target-version 3.0.0
29+
odh-cli migrate run --migration kueue.rhbok.migrate --target-version 3.0.0
3030
3131
# Run migration in dry-run mode (verbose is automatically enabled)
32-
kubectl odh migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --dry-run
32+
odh-cli migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --dry-run
3333
3434
# Run migration without confirmation prompts
35-
kubectl odh migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --yes
35+
odh-cli migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --yes
3636
3737
# Run multiple migrations sequentially
38-
kubectl odh migrate run -m kueue.rhbok.migrate -m other.migration --target-version 3.0.0
38+
odh-cli migrate run -m kueue.rhbok.migrate -m other.migration --target-version 3.0.0
3939
4040
# Typical workflow: prepare first, then run
41-
kubectl odh migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0
42-
kubectl odh migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --yes
41+
odh-cli migrate prepare --migration kueue.rhbok.migrate --target-version 3.0.0
42+
odh-cli migrate run --migration kueue.rhbok.migrate --target-version 3.0.0 --yes
4343
`
4444

4545
// AddCommand adds the run subcommand to the migrate command.

docs/usage.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,23 @@ go run github.com/opendatahub-io/odh-cli/cmd@latest \
3535

3636
## As kubectl Plugin
3737

38-
Install the `kubectl-odh` binary to your PATH:
38+
To use as a kubectl plugin, rename or symlink the `odh-cli` binary:
3939

4040
```bash
41-
# Download from releases
42-
# Place in PATH as kubectl-odh
41+
# Download from GitHub releases
42+
curl -LO https://github.com/opendatahub-io/odh-cli/releases/latest/download/odh-cli_linux_amd64.tar.gz
43+
tar -xzf odh-cli_linux_amd64.tar.gz
44+
45+
# Option 1: Rename to kubectl-odh for kubectl to auto discovery
46+
sudo mv odh-cli /usr/local/bin/kubectl-odh
47+
48+
# Option 2: Symlink (keeps both names available)
49+
sudo mv odh-cli /usr/local/bin/
50+
sudo ln -s /usr/local/bin/odh-cli /usr/local/bin/kubectl-odh
51+
4352
# Use with kubectl
4453
kubectl odh lint --target-version 3.3.0
45-
kubectl odh version
54+
55+
# or just use directly
56+
odh-cli lint --target-version 3.3.0
4657
```

0 commit comments

Comments
 (0)