Skip to content

feat(kubectl-ate): implement kubectl ate top workers command (#515) - #516

Merged
Haven Xia (HavenXia) merged 1 commit into
agent-substrate:mainfrom
baizhenyu:worker-top
Jul 24, 2026
Merged

feat(kubectl-ate): implement kubectl ate top workers command (#515)#516
Haven Xia (HavenXia) merged 1 commit into
agent-substrate:mainfrom
baizhenyu:worker-top

Conversation

@baizhenyu

@baizhenyu Tim Bai (baizhenyu) commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Feature Implementation

This PR implements the kubectl ate top workers command in kubectl-ate to display real-time CPU and Memory resource utilization for worker pods.

Changes Included:

  • Command Structure: Added top.go and top_workers.go under cmd/kubectl-ate/internal/cmd/.
  • Supported Flags:
    • -n, --namespace <ns>: Scope output to a specific Kubernetes namespace.
    • -a, --atespace <space>: Filter worker pods hosting actors in a specific atespace.
    • -l, --selector <labels>: Filter by worker pool labels.
    • -o, --output table|json|yaml: Output format option.
  • Metrics Client: Added NewMetricsClientset to connect to K8s metrics.k8s.io/v1beta1.
  • Data Join & Fallback: Joined Substrate ListWorkers gRPC RPC with K8s PodMetrics, gracefully displaying metrics unavailable if metrics-server is missing/unavailable.
  • Printer & Unit Tests: Implemented table, JSON, and YAML printers and comprehensive unit tests.

Closes #515

Comment thread cmd/kubectl-ate/internal/cmd/top_workers.go Outdated
Comment thread cmd/kubectl-ate/internal/cmd/top_workers.go Outdated
Comment thread cmd/kubectl-ate/internal/printer/printer.go
assignedActor := "<none>"
if wass := w.GetAssignment(); wass != nil && wass.GetActor() != nil {
status = "ASSIGNED"
if wass.GetActorTemplate() != nil && wass.GetActorTemplate().GetNamespace() != "" {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think in this system anywhere a worker has assignment - the actor and actorTemplate is impossible to be empty at the same time. So the rest else if and else are never reached.

Julian Gutierrez Oschmann (@juli4n) is that correct?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the confirmation. I just cleaned up the unreachable cases.

…ubstrate#515)

Implement 'kubectl ate top workers' command in kubectl-ate to display live CPU and Memory resource utilization for Substrate worker pods.

- Add top parent command and top workers subcommand with flags:
  - -n, --namespace: Scope to specific K8s namespace
  - -a, --atespace: Filter by assigned actor atespace
  - -l, --selector: Filter by worker pool labels
  - -o, --output: Output format (table, json, yaml)
- Integrate Kubernetes Metrics API (metrics.k8s.io/v1beta1)
- Join Substrate ListWorkers RPC responses with K8s PodMetrics
- Handle metrics-server unavailability gracefully
- Add comprehensive printer and CLI unit tests

Closes agent-substrate#515
@HavenXia
Haven Xia (HavenXia) merged commit 6afafed into agent-substrate:main Jul 24, 2026
11 checks passed
@baizhenyu
Tim Bai (baizhenyu) deleted the worker-top branch July 24, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Implement 'kubectl ate top workers' command for real-time worker pod resource utilization

3 participants