Olares/cli
2025-07-29 00:23:11 +08:00
..
apis/kubekey cli: change the module name of the cli (#1431) 2025-06-11 23:06:24 +08:00
clients cli: change the module name of the cli (#1431) 2025-06-11 23:06:24 +08:00
cmd feat: add vendor type to olares-cli/olaresd (#1592) 2025-07-23 00:55:01 +08:00
controllers cli: change the module name of the cli (#1431) 2025-06-11 23:06:24 +08:00
pkg feat: upgrade Kubernetes to v1.33.3 (#1629) 2025-07-29 00:23:11 +08:00
version feat(cli): download wizard from different vendor path (#1609) 2025-07-24 15:55:21 +08:00
.goreleaser.yaml feat(cli): download wizard from different vendor path (#1609) 2025-07-24 15:55:21 +08:00
generate_vfs.go refactor: integrate CLI's code & CI into main repo (#1343) 2025-05-26 17:21:25 +08:00
go.mod feat: upgrade containerd to v2.1.3 (#1603) 2025-07-24 00:50:35 +08:00
go.sum fix(cli): bump helm version to v3.18.4 (#1554) 2025-07-16 19:04:30 +08:00
README.md docs: add readmes for Olares components (#1522) 2025-07-08 21:34:05 +08:00

Olares CLI

This directory contains the code for olares-cli, the official command-line interface for administering an Olares cluster. It provides a modular, pipeline-based architecture for orchestrating complex system operations. See the full Olares CLI Documentation for command reference and tutorials.

Key responsibilities include:

  • Cluster management: Installing, upgrading, restarting, and maintaining an Olares cluster.
  • Node management: Adding to or removing nodes from an Olares cluster.

Execution Model

For most of the commands, olares-cli is executed through a four-tier hierarchy:

Pipeline ➜ Module ➜ Task ➜ Action

Example: install-olares Pipeline

Pipeline: Install Olares
├── ...other modules
└── Module: Bootstrap OS
    ├── ...other tasks
    ├── Task: Check Prerequisites
    │   └── Action: run-precheck.sh
    └── Task: Configure System
        └── Action: apply-sysctl

Repository layout

cli/
├── cmd/                  # Cobra command definitions
│   ├── main.go           # CLI entry point
│   └── ctl/
│       ├── root.go
│       ├── os/           # OS-level maintenance commands
│       ├── node/         # Cluster node operations
│       └── gpu/          # GPU management
└── pkg/
    ├── core/
    │   ├── action/       # Re-usable action primitives
    │   ├── module/       # Module abstractions
    │   ├── pipeline/     # Pipeline abstractions
    │   └── task/         # Task abstractions
    └── pipelines/        # Pre-built pipelines
    │   ├── ...           # actual modules and tasks for various commands and components

Build from source

Prerequisites

  • Go 1.24+
  • GoReleaser (optional, for cross-compiling and packaging)

Sample commands

# Clone the repo and enter the CLI folder
cd cli

# 1) Build for the host OS/ARCH
go build -o olares-cli ./cmd/main.go

# 2) Cross-compile for Linux amd64 (from macOS, for example)
GOOS=linux GOARCH=amd64 go build -o olares-cli ./cmd/main.go

# 3) Produce multi-platform artifacts (tar.gz, checksums, etc.)
goreleaser release --snapshot --clean

Development workflow

Add a new command

  1. Create the command file in cmd/ctl/<category>/.
  2. Define a pipeline in pkg/pipelines/.
  3. Implement modules & tasks inside the relevant pkg/ sub-packages.

Test your build

  1. Upload the self-built olares-cli binary to a machine that's running Olares.
  2. Replace the existing olares-cli binary on the machine using sudo cp -f olares-cli /usr/local/bin.
  3. Execute arbitrary commands using olares-cli