Skip to content

[UX-54] rpk: deprecate rpk redpanda admin command#30332

Open
r-vasquez wants to merge 5 commits intoredpanda-data:devfrom
r-vasquez:deprecate-redpanda-admin
Open

[UX-54] rpk: deprecate rpk redpanda admin command#30332
r-vasquez wants to merge 5 commits intoredpanda-data:devfrom
r-vasquez:deprecate-redpanda-admin

Conversation

@r-vasquez
Copy link
Copy Markdown
Contributor

@r-vasquez r-vasquez commented Apr 29, 2026

Deprecates the rpk redpanda admin command tree by folding its functionality into rpk cluster subcommands. The old commands stay as hidden, deprecated shims that print a migration pointer and delegate to the new code; the whole rpk redpanda admin tree is hidden from help output.

Command migrations:

  • rpk redpanda admin brokers decommissionrpk cluster brokers decommission
  • rpk redpanda admin brokers decommission-statusrpk cluster brokers decommission-status
  • rpk redpanda admin brokers recommissionrpk cluster brokers recommission
  • rpk redpanda admin brokers listrpk cluster info -b --detailed --include-decommissioned
  • rpk redpanda admin config printrpk cluster config list --node-id <ID>
  • rpk redpanda admin config log-level setrpk cluster loggers set
  • rpk redpanda admin partitions listrpk cluster partitions list --node-ids <ID>

New under rpk cluster:

  • rpk cluster brokers subcommand group (decommission, decommission-status, recommission)
  • rpk cluster loggers subcommand group (list, set)
  • rpk cluster info --detailed and --include-decommissioned flags
  • rpk cluster config list --node-id flag

Examples

Brokers section enriched with Admin API metadata + disk space:

$ rpk cluster info -b --detailed
BROKERS
=======
ID    HOST        PORT  CORES  MEMBERSHIP  IS-ALIVE  VERSION  UUID
0*    172.24.1.2  9092  4      active      true      26.2.0   9eeddf3a-...
DISK SPACE
==========
NODE-ID  PATH                    FREE    TOTAL    USED%
0        /var/lib/redpanda/data  76.8GB  105.1GB  26.9%

Route the cluster config request to a specific broker:

$ rpk cluster config list --node-id 1 --filter='^kafka_'
PROPERTY                  VALUE
kafka_batch_max_bytes     1048576
kafka_connections_max     ...

Set a logger on a specific broker:

$ rpk cluster loggers set raft --level=debug --node-id=0
SUCCESS
raft

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v26.1.x
  • v25.3.x
  • v25.2.x

Release Notes

Improvements

  • rpk redpanda admin is deprecated and folded into rpk cluster. Use rpk cluster brokers for decommission/recommission, rpk cluster info -b --detailed to list brokers, rpk cluster config list --node-id <ID> to query a specific broker's view of the cluster config, rpk cluster loggers {list,set} to manage broker log levels, and rpk cluster partitions list --node-ids <ID> to filter partitions by broker.

Copilot AI review requested due to automatic review settings April 29, 2026 04:44
@r-vasquez r-vasquez requested review from a team and kbatuigas as code owners April 29, 2026 04:44
@r-vasquez r-vasquez requested review from graham-rp and removed request for a team April 29, 2026 04:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR deprecates the rpk redpanda admin command tree by hiding it and turning its leaf commands into deprecated shims that delegate to newly introduced rpk cluster subcommands (brokers, loggers, enhanced info, and per-broker config routing).

Changes:

  • Hide and deprecate rpk redpanda admin and its subtrees; leaf commands delegate to rpk cluster equivalents via cobraext.DeprecateCmd.
  • Add rpk cluster brokers and rpk cluster loggers command groups, and extend rpk cluster info with broker detail/disk-space and decommissioned-node output.
  • Add --node-id routing support to rpk cluster config list and introduce/relocate tests for the moved functionality.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/go/rpk/pkg/cli/redpanda/redpanda.go Marks admin as deprecated in the redpanda command tree (comment + ordering).
src/go/rpk/pkg/cli/redpanda/admin/admin.go Hides/deprecates the entire rpk redpanda admin subtree with a migration pointer.
src/go/rpk/pkg/cli/redpanda/admin/brokers/* Converts brokers subcommands into deprecated shims and delegates list output to cluster code.
src/go/rpk/pkg/cli/redpanda/admin/config/config.go Hides/deprecates config subtree; routes log-level to new cluster loggers set.
src/go/rpk/pkg/cli/redpanda/admin/partitions/partitions.go Hides/deprecates partitions subtree; leaf delegates to cluster partitions list.
src/go/rpk/pkg/cli/cluster/cluster.go Registers new cluster brokers and cluster loggers command groups.
src/go/rpk/pkg/cli/cluster/info.go Enhances broker output with optional Admin API enrichment + disk space; adds shim helper for old brokers list.
src/go/rpk/pkg/cli/cluster/config/list.go Adds --node-id to route config requests to a specific broker (non-cloud only).
src/go/rpk/pkg/cli/cluster/loggers/* Introduces rpk cluster loggers {list,set} implementation and tests.
src/go/rpk/pkg/cli/cluster/brokers/* Introduces rpk cluster brokers {decommission,decommission-status,recommission} and tests.
BUILD files (various) Rewires Bazel deps and moves/removes old test targets in deprecated areas.

Comment thread src/go/rpk/pkg/cli/cluster/info.go
Comment thread src/go/rpk/pkg/cli/cluster/brokers/recommission.go Outdated
Comment thread src/go/rpk/pkg/cli/redpanda/admin/brokers/brokers.go
Comment thread src/go/rpk/pkg/cli/redpanda/admin/brokers/list.go
Comment thread src/go/rpk/pkg/cli/redpanda/admin/config/config.go
Comment thread src/go/rpk/pkg/cli/cluster/info.go
Comment thread src/go/rpk/pkg/cli/cluster/info.go
Move decommission, decommission-status, and
recommission from `rpk redpanda admin brokers`
to a new `rpk cluster brokers` group.
Cluster-level operations belong under
`rpk cluster`; the admin tree overlaps
conceptually with cluster commands and is
being deprecated.

The old commands remain functional as thin
shims that delegate to the new package, are
hidden from help, and print a deprecation
notice pointing at the new location.
Add --detailed and --include-decommissioned to
`rpk cluster info` so it covers everything the
deprecated `rpk redpanda admin brokers list`
provides: cores, membership, liveness, version,
broker UUID, per-broker disk space, and
decommissioned-by-UUID rows.

With parity in place, the old command becomes
a true delegating shim: its body is replaced
with a thin wrapper that calls the new
`cluster.RunBrokerInfo` helper, eliminating
the duplicated rendering logic.

Admin API failures fall back silently to the
basic broker view; the underlying error is
logged via zap and surfaces under -v.
Add --node-id to `rpk cluster config list` so
the cluster configuration request can be
routed to a specific broker instead of any
broker. Useful for diagnosing brokers that
appear out of sync with the controller.

`rpk redpanda admin config print --host` is
now hidden and deprecated; it points users
at the new flag. Its --host semantics are
preserved unchanged.
Move log level management from `rpk redpanda
admin config log-level set` into a new `rpk
cluster loggers` group with `list` and `set`
subcommands. The old `--help-loggers` flag
becomes the standalone `list` command.

Replace the confusing `--host` flag (which
accepted either a hostname or an admin index)
with `--node-id`. On `set`, --node-id is now
required via cobra; on `list` it is optional
and routes to any broker when unset.

The legacy `rpk redpanda admin config
log-level` parent and its `set` child are
hidden and deprecated; the inner set body is
now `loggers.NewSetCommand(fs, p)` so the
old helpers and tests are gone.
Hide the `rpk redpanda admin` parent and its
brokers/config/partitions intermediate
parents so the tree no longer surfaces in
help output, and add a top-level deprecation
message that points at the new `rpk cluster`
locations.
@r-vasquez r-vasquez force-pushed the deprecate-redpanda-admin branch from 239636a to 505ef9b Compare April 29, 2026 18:33
@r-vasquez
Copy link
Copy Markdown
Contributor Author

Force push:

  • Addresses the PR review from copilot which included some typos that were present in the old code.
  • Fixes a backwards compat issue that I introduced by removing the --host flag, the old commands should still support it until we fully deprecate.

@vbotbuildovich
Copy link
Copy Markdown
Collaborator

CI test results

test results on build#83830
test_status test_class test_method test_arguments test_kind job_url passed reason test_history
FLAKY(PASS) WriteCachingFailureInjectionE2ETest test_crash_all {"use_transactions": false} integration https://buildkite.com/redpanda/redpanda/builds/83830#019dda8c-6565-4415-bbd4-c3eedeec19da 8/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.0971, p0=0.2528, reject_threshold=0.0100. adj_baseline=0.2640, p1=0.4839, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=WriteCachingFailureInjectionE2ETest&test_method=test_crash_all

Copy link
Copy Markdown
Contributor

@c-julin c-julin left a comment

Choose a reason for hiding this comment

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

Looks like new cluster info flags which are nice, you can ignore my comments its very minor

if err != nil {
log.Errorf("unable to retrieve node UUIDs: %v", err)
}
if len(uuids) > 0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor nit: you can return early here

for id := range info.byNodeID {
ids = append(ids, id)
}
sort.Slice(ids, func(i, j int) bool { return ids[i] < ids[j] })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there is now slices.Sort

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.

4 participants