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 rpk cluster quotas import #21311

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

r-vasquez
Copy link
Contributor

@r-vasquez r-vasquez commented Jul 9, 2024

This PR introduces a new command: rpk cluster quotas import

Usage:

import uses a string source that should be formatted as the output of rpk cluster quotas describe --format <json/yaml>. It accepts either the string, or a file containing the json (or yaml) representation of the import source:

$ rpk cluster quotas import --from {quotas:[...]}

$ rpk cluster quotas import --from /path/to/file

The command issues an alterQuotas request, deleting the old quotas, hence, a confirmation prompt is needed:

$ rpk cluster quotas import --from /tmp/foo.json
ENTITY                 QUOTA-TYPE          OLD-VALUE  NEW-VALUE
client-id=<default>    consumer_byte_rate  3333       -
client-id-prefix=bar-  consumer_byte_rate  32333123   23123123
? Confirm client quotas import above? Yes
Successfully imported the client quotas

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

Release Notes

Features

  • rpk: introduce a command to import cluster client quotas: rpk cluster quotas import.

This type should be singular since it represent a
single key:value pair of a quota value.
@Deflaimun
Copy link
Contributor

From a user perspective I would prefer to see what's the acceptable schema in this help text.

However I can understand from a development/design perspective that the schema can change and the source will be the command that generates it.

Considering the above, can we include the acceptable schema in this help text? If not, it's fine. I defer to you guys what's the best approach.

Feediver1
Feediver1 previously approved these changes Jul 10, 2024
Copy link

@Feediver1 Feediver1 left a comment

Choose a reason for hiding this comment

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

Left some updates for active voice/clarity.

@r-vasquez
Copy link
Contributor Author

Force Push:

After internal discussion:

  • Replace --source to --from
  • Now --from accepts either a json, yaml or a file, rpk will identify which one to use and @ is not needed.
  • Added the schema of the import string to the help text
  • Doc changes.

This new command will let user to import quotas
from other clusters by using the same format
of `rpk cluster quotas describe --format <json/yaml>`

rpk will read and issue the alterClusterQuota
request.
@r-vasquez r-vasquez merged commit 4a06aa5 into redpanda-data:dev Jul 12, 2024
23 checks passed
@r-vasquez r-vasquez deleted the rpk-quotas-import branch September 9, 2024 17:43
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.

5 participants