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: add Redpanda Cloud support to rpk cluster storage mount/unmount commands #24134

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

r-vasquez
Copy link
Contributor

@r-vasquez r-vasquez commented Nov 14, 2024

This PR introduces the ability for rpk to execute the following rpk cluster storage commands against Redpanda Cloud Clusters:

  • mount
  • unmount
  • list-mount
  • status-mount
  • cancel-mount
  • list-mountable

Examples:

Unmount

$ rpk cluster storage unmount test
Topic unmounting from your Redpanda Cluster topic "foo" has started with 
Migration ID 8.

To check the status run 'rpk cluster storage status-mount 8.

Mount

$ rpk cluster storage mount foo
Topic mount from Tiered Storage topic "foo" to your Redpanda Cluster topic "foo"
has started with Migration ID 9.

To check the status run 'rpk cluster storage status-mount 9.

list-mount

$ rpk cluster storage list-mount    
ID    STATE      MIGRATION   TOPICS
3     CANCELLED  TYPE_MOUNT  bar
6     PREPARING  TYPE_MOUNT  test

list-mountable

$ rpk cluster storage list-mountable 
TOPIC  NAMESPACE  LOCATION
foo    kafka      foo/0bf30e1d-70fb-4e38-b394-a68bb092e794/95

status-mount

$ rpk cluster storage status-mount 3
ID    STATE      MIGRATION   TOPICS
3     CANCELLED  TYPE_MOUNT  bar

cancel-mount

$ rpk cluster storage cancel-mount 10
Successfully canceled the operation with ID 10

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

  • none

The new dependency version soft-deprecates the
v1alpha2 services.
Downloading using go get is not recommended per
golangci-lint docs
Now we will be able to run mount/unmount commands
against Redpanda Cloud clusters using the
dataplane API.
@r-vasquez
Copy link
Contributor Author

/dt

@vbotbuildovich
Copy link
Collaborator

We should default to filter `all`, otherwise we
won't print any operation unless a filter is
provided.
@r-vasquez r-vasquez marked this pull request as ready for review November 15, 2024 20:24
Copy link
Contributor

@gene-redpanda gene-redpanda left a comment

Choose a reason for hiding this comment

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

LGTM

resp, err := cl.CloudStorage.ListMountTasks(cmd.Context(), connect.NewRequest(&dataplanev1alpha2.ListMountTasksRequest{}))
out.MaybeDie(err, "unable to list mount/unmount operations: %v", err)

if resp != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this conditional needed? MaybeDie exits on error. Can this return nil, nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure, I was overly paranoid here to avoid a panic. resp is a connect wrapper of the response and I'm not sure if an empty list will produce an empty resp.

And I prefer being a little bit paranoid as we don't control the result at all. Happy to remove it if we are 100% sure this doesn't return nil, nil

@r-vasquez r-vasquez merged commit 17cd70d into redpanda-data:dev Nov 18, 2024
25 checks passed
@r-vasquez
Copy link
Contributor Author

/backport v24.3.x

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