redpanda icon indicating copy to clipboard operation
redpanda copied to clipboard

rpk/container: Add status command

Open JFlath opened this issue 3 years ago • 2 comments

Add a status command to get current running containers and exportable broker list.

Use same status on rpk container start for consistency

Cover letter

When doing quick testing of different configurations, it can be helpful to spin up and shut down many container based clusters. At present the only way to find any running cluster is to go directly to Docker, and this means you miss out on the convenient preformatted export command.

This PR adds a simple rpk container status to display info about the running containers (if any) and the export command you get on start.

Fixes #4074

Backport Required

  • [x] not a bug fix
  • [ ] issue does not exist in previous branches
  • [ ] papercut/not impactful enough to backport
  • [ ] v22.2.x
  • [ ] v22.1.x
  • [ ] v21.11.x

UX changes

This changes the output of rpk container start. This is theoretically breaking if users depend on parsing this, however this isn't expected to be a command used in production usecases.

Release notes

  • none

JFlath avatar Sep 30 '22 12:09 JFlath

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 30 '22 12:09 CLAassistant

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Sep 30 '22 12:09 CLAassistant

The CI failure is the rpk container smoke test, fix is in: https://github.com/redpanda-data/vtools/pull/1153

Reason is that we are changing the output format and our test grep that format to get the kafka addresses:

Previously:

#  Old Format:
#
#  NODE ID  ADDRESS          
#  0       127.0.0.1:44657  
#  2       127.0.0.1:37703  
#  1       127.0.0.1:44131  

$ rpk container start -v --image 'localhost/redpanda:dev' -n 3 --retries 30 | grep "        127.0.0.1:" | awk '{print $2}' | tr -d " \t"
127.0.0.1:44657  
127.0.0.1:37703  
127.0.0.1:44131  

Now

# New Format:
# 
#  NODE-ID  STATUS   KAFKA-ADDRESS    ADMIN-ADDRESS    
#  0        running  127.0.0.1:44773  127.0.0.1:46579  
#  1        running  127.0.0.1:33525  127.0.0.1:36925  
#  2        running  127.0.0.1:45867  127.0.0.1:39233  

$ rpk container start -v --image 'localhost/redpanda:dev' -n 3 --retries 30 | grep " 127.0.0.1:" | awk '{print $3}' | tr -d " \t"
127.0.0.1:44773  
127.0.0.1:33525  
127.0.0.1:45867  

r-vasquez avatar Nov 29 '22 15:11 r-vasquez

Are we going to release this in 23.1 or in the next 22.3.x? asking because we will need to change https://docs.redpanda.com/docs/platform/quickstart/quick-start-macos/#run-a-redpanda-cluster once we merge this.

r-vasquez avatar Dec 13 '22 16:12 r-vasquez

I think we can wait until 23.1.x

twmb avatar Dec 13 '22 16:12 twmb

Doc Issue: https://github.com/redpanda-data/documentation/issues/938

r-vasquez avatar Dec 13 '22 16:12 r-vasquez