Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpk: brokers list exposing Host/Port/Rack/UUID #23595

Merged

Conversation

daisukebe
Copy link
Contributor

@daisukebe daisukebe commented Oct 2, 2024

Relevant to redpanda-data/common-go#27.

rpk redpanda admin brokers list now exposes additional fields that makes troubleshooting easier.

Before:

NODE-ID  NUM-CORES  MEMBERSHIP-STATUS  IS-ALIVE  BROKER-VERSION
0        2          active             true      v24.2.3 - be49068f63acc31d34b9d186cdfa62087fd99222
1        2          active             true      v24.2.3 - be49068f63acc31d34b9d186cdfa62087fd99222
2        2          active             true      v24.2.3 - be49068f63acc31d34b9d186cdfa62087fd99222

After:

ID    HOST       PORT   RACK  CORES  MEMBERSHIP  IS-ALIVE  VERSION  UUID
0     localhost  33146  a     2      active      true      24.2.3   e4ff0f11-6fc2-4df1-b129-bbf2630e7c18
1     localhost  33147  -     2      active      true      24.2.3   8b4649c4-7a92-4818-a93e-a3a244fad6e5
3     localhost  33148  -     2      active      true      24.2.3   b00efb2e-6beb-46b1-86f8-6fa2566bfa9b

It uses the fairly new /v1/broker_uuids endpoint for the UUID field. If a cluster doesn't support the endpoint, the command just hide the column.

If multiple node UUIDs being found for a node ID, the command prints all with a comma separated fashion in the same row. It could happen when a new node joins the cluster using the same node ID, e.g. being hard-corded in redpanda.yaml. This is not encouraged though.

ID    HOST       PORT   RACK  CORES  MEMBERSHIP  IS-ALIVE  VERSION  UUID
0     localhost  33146  a     2      active      true      24.2.3   e4ff0f11-6fc2-4df1-b129-bbf2630e7c18
1     localhost  33147  -     2      active      true      24.2.3   8b4649c4-7a92-4818-a93e-a3a244fad6e5
3     localhost  33148  -     2      active      true      24.2.3   b00efb2e-6beb-46b1-86f8-6fa2566bfa9b, 88fc966d-1b6c-470b-beb7-fa3ba162f998

With the new --include-decommissioned flag, it can list all decommissioned brokers along with its ID and UUID. This is useful when we deal with the node_id_overrides feature, #22972

ID    HOST       PORT   RACK  CORES  MEMBERSHIP  IS-ALIVE  VERSION  UUID
0     localhost  33146  a     2      active      true      24.2.3   e4ff0f11-6fc2-4df1-b129-bbf2630e7c18
1     localhost  33147  -     2      active      true      24.2.3   8b4649c4-7a92-4818-a93e-a3a244fad6e5
3     localhost  33148  -     2      active      true      24.2.3   b00efb2e-6beb-46b1-86f8-6fa2566bfa9b, 88fc966d-1b6c-470b-beb7-fa3ba162f998
2     -          -      -     -      -           -         -        d671a64b-02c2-4bbf-8437-73deac4db43a

Added a detailed help text too.

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
  • v24.2.x
  • v24.1.x
  • v23.3.x

Release Notes

Improvements

  • rpk: redpanda admin brokers list exposes Host/Port/Rack/UUID additionally

@oleiman
Copy link
Member

oleiman commented Oct 3, 2024

/ci-repeat 1
skip-units
skip-redpanda-build

@daisukebe daisukebe force-pushed the rpk-expand-admin-brokers-list branch from 81eba0e to 2d1d078 Compare October 4, 2024 00:57
@daisukebe
Copy link
Contributor Author

daisukebe commented Oct 4, 2024

Rebased. In 2d1d078, I have made the following changes.

  • Accepted help text suggestions
  • Returning - when rack is not configured
  • Added the --all flag to show decommissioned node ID & UUID, which is helpful when we deal with the node_id_overrides feature, CORE-7000: Node ID/UUID Override #22972

e.g. node 2 is a decommissioned host.

ID    HOST       PORT   RACK  CORES  MEMBERSHIP  IS-ALIVE  VERSION  UUID
0     localhost  33146  a     2      active      true      v24.2.3  e4ff0f11-6fc2-4df1-b129-bbf2630e7c18
1     localhost  33147  -     2      active      true      v24.2.3  8b4649c4-7a92-4818-a93e-a3a244fad6e5
3     localhost  33148  -     2      active      true      v24.2.3  b00efb2e-6beb-46b1-86f8-6fa2566bfa9b
2     -          -      -     -      -           -         -        d671a64b-02c2-4bbf-8437-73deac4db43a

@daisukebe daisukebe force-pushed the rpk-expand-admin-brokers-list branch from 2d1d078 to 81224a0 Compare October 4, 2024 01:38
@daisukebe
Copy link
Contributor Author

Nit change; I should have considered the case where /v1/broker_uuids isn't supposed when --all is used.

@daisukebe
Copy link
Contributor Author

/ci-repeat 1
skip-units
skip-redpanda-build

Copy link
Contributor

@r-vasquez r-vasquez left a comment

Choose a reason for hiding this comment

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

LGTM, 2 minor comments/questions.

Thanks for this and for the detailed description of the command and the changes

src/go/rpk/pkg/cli/redpanda/admin/brokers/list.go Outdated Show resolved Hide resolved
src/go/rpk/pkg/cli/redpanda/admin/brokers/list.go Outdated Show resolved Hide resolved
@daisukebe daisukebe force-pushed the rpk-expand-admin-brokers-list branch from 81224a0 to bf93c5d Compare October 8, 2024 04:26
@daisukebe
Copy link
Contributor Author

In bf93c5d, I've made the following changes:

  • Use redpanda.Version to extract the broker version
  • Return hyphen when UUID is not found
  • Change the flag from --all to --include-decommissioned / -d to make it more explicit

@daisukebe daisukebe requested a review from r-vasquez October 8, 2024 04:34
@daisukebe daisukebe force-pushed the rpk-expand-admin-brokers-list branch from bf93c5d to 0739f23 Compare October 8, 2024 08:00
@daisukebe
Copy link
Contributor Author

Sorry, did another rebase; merged checkEmpty and formatVersion to one func formatOutput.

Copy link
Contributor

@r-vasquez r-vasquez left a comment

Choose a reason for hiding this comment

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

LGTM, just one small left over in the docs from the flag name change. Thanks!

src/go/rpk/pkg/cli/redpanda/admin/brokers/list.go Outdated Show resolved Hide resolved
Expose each broker's host, port, rack, and UUID
in the 'rpk redpanda admin brokers list' command.
Also add a new flag '--include-decommissioned'
to list decommissioned brokers with their UUIDs.
@daisukebe daisukebe force-pushed the rpk-expand-admin-brokers-list branch from 78a3cf6 to 08e30aa Compare October 8, 2024 16:20
@daisukebe daisukebe requested a review from r-vasquez October 8, 2024 22:29
Copy link
Contributor

@r-vasquez r-vasquez left a comment

Choose a reason for hiding this comment

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

Thanks!

@r-vasquez r-vasquez merged commit 52f7e48 into redpanda-data:dev Oct 8, 2024
24 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v24.2.x

@vbotbuildovich
Copy link
Collaborator

/backport v24.1.x

@vbotbuildovich
Copy link
Collaborator

Failed to create a backport PR to v24.1.x branch. I tried:

git remote add upstream https://github.com/redpanda-data/redpanda.git
git fetch --all
git checkout -b backport-pr-23595-v24.1.x-693 remotes/upstream/v24.1.x
git cherry-pick -x 08e30aa37d

Workflow run logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants