Skip to content

Commit e1f38b4

Browse files
authored
refactor(cli): remove kubeconfig port, add doctor llm-help, update debug docs (#252)
1 parent f0f80ae commit e1f38b4

32 files changed

Lines changed: 984 additions & 981 deletions

File tree

.agents/skills/debug-navigator-cluster/SKILL.md

Lines changed: 134 additions & 188 deletions
Large diffs are not rendered by default.

.agents/skills/openshell-cli/SKILL.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,11 @@ openshell gateway destroy # Destroy permanently
497497
# Deploy to remote host
498498
openshell gateway start --remote user@host --ssh-key ~/.ssh/id_rsa --name remote-cluster
499499

500-
# Set up kubectl access
501-
openshell gateway tunnel --name remote-cluster
500+
# View gateway container logs
501+
openshell doctor logs --name remote-cluster
502+
503+
# Run kubectl inside the remote gateway container
504+
openshell doctor exec --name remote-cluster -- kubectl get pods -A
502505

503506
# Get cluster info
504507
openshell gateway info --name remote-cluster

.agents/skills/openshell-cli/cli-reference.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ openshell
2929
│ ├── stop [opts]
3030
│ ├── destroy [opts]
3131
│ ├── info [--name]
32-
│ ├── tunnel [opts]
3332
│ └── select [name]
3433
├── status
3534
├── inference
@@ -62,6 +61,9 @@ openshell
6261
│ ├── list [opts]
6362
│ ├── update <name> --type [opts]
6463
│ └── delete <name>...
64+
├── doctor
65+
│ ├── logs [--name] [-n] [--tail] [--remote] [--ssh-key]
66+
│ └── exec [--name] [--remote] [--ssh-key] -- <command...>
6567
├── term
6668
├── completions <shell>
6769
└── ssh-proxy [opts]
@@ -82,9 +84,6 @@ Provision or start a cluster (local or remote).
8284
| `--ssh-key <PATH>` | none | SSH private key for remote deployment |
8385
| `--port <PORT>` | 8080 | Host port mapped to gateway |
8486
| `--gateway-host <HOST>` | none | Override gateway host in metadata |
85-
| `--kube-port [PORT]` | none | Expose K8s control plane on host port |
86-
| `--update-kube-config` | false | Write kubeconfig into `~/.kube/config` |
87-
| `--get-kubeconfig` | false | Print kubeconfig to stdout |
8887
| `--recreate` | false | Destroy and recreate from scratch if a gateway already exists (skips interactive prompt) |
8988

9089
### `openshell gateway stop`
@@ -103,26 +102,47 @@ Destroy a cluster and all its state. Same flags as `stop`.
103102

104103
### `openshell gateway info`
105104

106-
Show deployment details: endpoint, kubeconfig path, kube port, remote host.
105+
Show deployment details: endpoint and remote host.
107106

108107
| Flag | Description |
109108
|------|-------------|
110109
| `--name <NAME>` | Cluster name (defaults to active) |
111110

112-
### `openshell gateway tunnel`
111+
### `openshell gateway select [name]`
113112

114-
Print or start an SSH tunnel for kubectl access to a remote cluster.
113+
Set the active gateway. Writes to `~/.config/openshell/active_gateway`. When called without arguments, lists all provisioned gateways with the active one marked with `*`.
115114

116-
| Flag | Description |
117-
|------|-------------|
118-
| `--name <NAME>` | Cluster name (defaults to active) |
119-
| `--remote <USER@HOST>` | SSH destination |
120-
| `--ssh-key <PATH>` | SSH private key |
121-
| `--print-command` | Only print the SSH command, don't execute |
115+
---
122116

123-
### `openshell gateway select [name]`
117+
## Doctor Commands
124118

125-
Set the active gateway. Writes to `~/.config/openshell/active_gateway`. When called without arguments, lists all provisioned gateways with the active one marked with `*`.
119+
### `openshell doctor logs`
120+
121+
Fetch logs from the gateway Docker container.
122+
123+
| Flag | Default | Description |
124+
|------|---------|-------------|
125+
| `--name <NAME>` | active gateway | Gateway name |
126+
| `-n, --lines <N>` | all | Number of log lines to return |
127+
| `--tail` | false | Stream live logs (follow mode) |
128+
| `--remote <USER@HOST>` | auto-resolved | SSH destination for remote gateways |
129+
| `--ssh-key <PATH>` | none | SSH private key for remote gateways |
130+
131+
### `openshell doctor exec -- <COMMAND...>`
132+
133+
Run a command inside the gateway container with KUBECONFIG pre-configured.
134+
Launches an interactive `docker exec` session (tunnelled over SSH for remote gateways).
135+
136+
| Flag | Default | Description |
137+
|------|---------|-------------|
138+
| `--name <NAME>` | active gateway | Gateway name |
139+
| `--remote <USER@HOST>` | auto-resolved | SSH destination for remote gateways |
140+
| `--ssh-key <PATH>` | none | SSH private key for remote gateways |
141+
142+
Examples:
143+
- `openshell doctor exec -- kubectl get pods -A`
144+
- `openshell doctor exec -- k9s`
145+
- `openshell doctor exec -- sh` (interactive shell)
126146

127147
---
128148

.claude/agent-memory/arch-doc-writer/MEMORY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
## Bootstrap Crate Details
3636
- `docker.rs`: `ensure_container()` sets ~12 env vars (REGISTRY_*, IMAGE_*, PUSH_IMAGE_REFS, etc.)
37-
- `runtime.rs`: Polling params: kubeconfig 30x2s, health 180x2s, mTLS 90x2s
38-
- `metadata.rs`: Metadata at `clusters/{name}_metadata.json` (flat), kubeconfig/mTLS at `clusters/{name}/` (nested)
37+
- `runtime.rs`: Polling params: health 180x2s, mTLS 90x2s
38+
- `metadata.rs`: Metadata at `gateways/{name}/metadata.json` (nested), mTLS at `gateways/{name}/mtls/` (nested)
3939
- `push.rs`: Uses `ctr` (not `k3s ctr`) with k3s containerd socket, `k8s.io` namespace
4040
- IMPORTANT: `ClusterHandle::destroy()` does NOT remove metadata; only CLI `cluster_admin_destroy()` in run.rs does
4141
- `ensure_image()`: Local-only refs (no `/`) get error with build instructions, not a Docker Hub pull attempt

.env.example

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,3 @@
2020
# Host port mapped to the k3s NodePort (30051) where the OpenShell gateway
2121
# listens. The CLI connects here. Must be unique per cluster.
2222
#GATEWAY_PORT=8080
23-
24-
# Expose the Kubernetes control plane on this host port (maps to 6443
25-
# inside the container). Leave unset to skip the binding — this is the
26-
# default and allows multiple clusters to coexist without port conflicts.
27-
# Set this only when you need direct kubectl access to the cluster.
28-
#KUBE_PORT=6443

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ openshell --help
5151
openshell sandbox create -- codex
5252
```
5353

54+
### Cluster debugging helpers
55+
56+
Two additional scripts in `scripts/bin/` provide gateway-aware wrappers for cluster debugging:
57+
58+
| Script | What it does |
59+
|--------|-------------|
60+
| `kubectl` | Runs `kubectl` inside the active gateway's k3s container via `openshell doctor exec` |
61+
| `k9s` | Runs `k9s` inside the active gateway's k3s container via `openshell doctor exec` |
62+
63+
These work for both local and remote gateways (SSH is handled automatically). Examples:
64+
65+
```bash
66+
kubectl get pods -A
67+
kubectl logs -n navigator statefulset/navigator
68+
k9s
69+
k9s -n navigator
70+
```
71+
5472
## Main Tasks
5573

5674
These are the primary `mise` tasks for day-to-day development:

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

architecture/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ For more detail, see [Policy Language](security-policy.md).
232232

233233
The CLI is the primary way users interact with the platform. It provides commands organized into four groups:
234234

235-
- **Gateway management** (`openshell gateway`): Deploy, stop, destroy, and inspect clusters. Supports both local and remote (SSH) targets. Includes a tunnel command for accessing the Kubernetes API on remote clusters.
235+
- **Gateway management** (`openshell gateway`): Deploy, stop, destroy, and inspect clusters. Supports both local and remote (SSH) targets.
236236
- **Sandbox management** (`openshell sandbox`): Create sandboxes (with optional file upload and provider auto-discovery), connect to sandboxes via SSH, and delete sandboxes.
237237
- **Top-level commands**: `openshell status` (cluster health), `openshell logs` (sandbox logs), `openshell forward` (port forwarding), `openshell policy` (sandbox policy management).
238238
- **Provider management** (`openshell provider`): Create, update, list, and delete external service credentials.

architecture/build-containers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ After building, the script:
359359
1. Resolves the local registry address (defaults to `127.0.0.1:5000/navigator`). In CI, uses `$CI_REGISTRY_IMAGE`.
360360
2. Ensures a local Docker registry container (`navigator-local-registry`) is running on port 5000 (creates one if needed).
361361
3. Pushes prebuilt local component images (server, sandbox) to the local registry via `cluster-push-component.sh`.
362-
4. Runs `nav gateway start --name <CLUSTER_NAME> --update-kube-config` to create or update the cluster container.
362+
4. Runs `nav gateway start --name <CLUSTER_NAME>` to create or update the cluster container.
363363

364364
### Environment Variables
365365

architecture/gateway-deploy-connect.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ openshell/
9797
clusters/
9898
<name>_metadata.json # ClusterMetadata JSON
9999
<name>/
100-
kubeconfig # rewritten kubeconfig for kubectl
101100
mtls/ # mTLS bundle (when TLS enabled)
102101
ca.crt # cluster CA certificate
103102
tls.crt # client certificate

0 commit comments

Comments
 (0)