Skip to content

feat(cli): add the describe command - #327

Draft
rogirun wants to merge 2 commits into
feat/cli-describe-rendererfrom
feat/cli-describe-command
Draft

rogirun wants to merge 2 commits into
feat/cli-describe-rendererfrom
feat/cli-describe-command

Conversation

@rogirun

@rogirun rogirun commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Wires up kli describe TYPE/NAME. Argument parsing is shared with get, so both accept the same forms; describe additionally requires the NAME. Pods are listed once from the object's own namespace and scoped by ownership before the definition's selectors place them.

Part of a seven-PR stack implementing kli describe (#206). Targets feat/cli-describe-renderer, which must merge first.

Related issue(s)

Refs #206

Checklist

  • All commits are signed off with DCO (git commit -s)
  • New/modified files have SPDX license and copyright headers
  • Documentation updated (if applicable)
  • Tests pass (make check)
  • No proprietary or internal information included

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added the kli describe command for inspecting workloads and their associated pods.
    • Supports flexible resource type and name formats, namespace-aware resources, and cluster-scoped resources.
    • Added JSON output for machine-readable workload details.
    • Added configurable pod limits, with all pods shown by default.
    • Displays workload information, attributes, and relevant pod details.
  • Bug Fixes

    • Provides clear errors for missing resources, unsupported types, invalid output formats, access issues, and retrieval failures.

@rogirun
rogirun force-pushed the feat/cli-describe-command branch from be80669 to 1ec50de Compare September 6, 2026 12:59
@rogirun
rogirun force-pushed the feat/cli-describe-renderer branch 2 times, most recently from 061c0fc to 4203a4c Compare September 7, 2026 10:43
@rogirun
rogirun force-pushed the feat/cli-describe-command branch from 1ec50de to 8209d30 Compare September 7, 2026 10:43
@rogirun
rogirun force-pushed the feat/cli-describe-renderer branch from 4203a4c to bb6fd11 Compare September 7, 2026 12:20
@rogirun
rogirun force-pushed the feat/cli-describe-command branch from 8209d30 to 3daa6b6 Compare September 7, 2026 12:20
@rogirun
rogirun force-pushed the feat/cli-describe-renderer branch from bb6fd11 to 02777e5 Compare September 15, 2026 07:57
kli describe TYPE/NAME reads one workload in full: the component tree with its
live pods, the normalized phase, and the requested resources per component. It
is the describe half of the kubectl-style get/describe split, and the entry
point an agent uses when it needs the whole picture of one workload.

Argument parsing is shared with get, so both commands accept TYPE/NAME and the
two-token TYPE NAME form and reject the same mistakes; describe additionally
requires the NAME, and says so naming both forms rather than only the one the
caller did not use. Phase 1 keeps the kind mandatory, and the parsing leaves
the bare-NAME slot open for the cross-kind search that follows.

Pods are listed once from the object's own namespace and scoped by ownership
before the definition's selectors place them, so a neighbouring workload of the
same type never appears in the tree. -o wide is rejected at parse time: one
workload has no extra columns to widen into.

Refs #206

Signed-off-by: Roee Gil <roee.gil@run.ai>
@rogirun
rogirun force-pushed the feat/cli-describe-command branch from 3daa6b6 to dd684d5 Compare September 16, 2026 09:20
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Enterprise

Run ID: 0210b711-1e4c-4f97-9eef-91665ab37657

📥 Commits

Reviewing files that changed from the base of the PR and between 86e7758 and dd684d5.

📒 Files selected for processing (3)
  • cli/cmd/describe.go
  • cli/cmd/describe_test.go
  • cli/cmd/root.go

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The pull request adds and registers kli describe. The command resolves workload types, retrieves workloads and pods, supports table, JSON, and YAML output, applies pod limits, and returns specific errors. Tests cover argument forms, rendering, filtering, output, and failures.

Changes

Describe command

Layer / File(s) Summary
Command implementation
cli/cmd/describe.go, cli/cmd/root.go
The new command parses workload arguments and options, retrieves workload and pod data, resolves the workload view, renders output, and handles retrieval failures. The root command registers describe.
Test harness and rendering coverage
cli/cmd/describe_test.go
Tests add dynamic cluster fixtures and verify complete rendering and filtering to pods owned by the selected workload.
Input, output, and pod-limit validation
cli/cmd/describe_test.go
Tests cover supported argument forms, required names, distinct failures, supported output formats, direct JSON output, pod limits, and default rendering behavior.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~30 minutes

Change: Feature · Unblocks: 2 PRs

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant DescribeCommand
  participant KubernetesCluster
  participant WorkloadRenderer
  User->>DescribeCommand: Run describe TYPE/NAME
  DescribeCommand->>KubernetesCluster: Retrieve workload and pods
  KubernetesCluster-->>DescribeCommand: Return workload and attributed pods
  DescribeCommand->>WorkloadRenderer: Resolve and render workload view
  WorkloadRenderer-->>User: Output table, JSON, or YAML
Loading

Suggested reviewers: aviadhayumi

Merge Risk: ⚪ Minimal · up to dd684

No merge-blocking behavior regression is established by the available evidence.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.82% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the CLI describe command.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-describe-command

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


Comment @coderabbitai help to get the list of available commands.

A negative value collided with the ShowAllPods sentinel, so a typo such as
--pod-limit -10 showed every pod instead of failing. Also correct the pod
list comment, which did not hold for a cluster-scoped root.

Signed-off-by: Roee Gil <roee.gil@run.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant