-
Notifications
You must be signed in to change notification settings - Fork 66
feat(kafka acl): add instance-id flag and use all alias #1217
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,10 +10,10 @@ By default, every users and service account have limited access to their Kafka i | |
| [kafka.acl.cmd.example] | ||
| one = ''' | ||
| # Grant access to principal for consuming messages from all topics | ||
| $ rhoas kafka acl grant-permissions --consumer --user user_name --topic "*" --group "*" | ||
| $ rhoas kafka acl grant-permissions --consumer --user user_name --topic all --group all | ||
|
|
||
| # Grant access to principal for producing messages to all topics | ||
| $ rhoas kafka acl grant-permissions --producer --user user_name --topic "*" | ||
| $ rhoas kafka acl grant-permissions --producer --user user_name --topic all | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have an example for both?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure myself. @rkpattnaik780 feel free to make call
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't prefer having asterisk as an example. |
||
|
|
||
| # List ACL rules for a Kafka instance | ||
| $ rhoas kafka acl list | ||
|
|
@@ -44,10 +44,13 @@ one = 'This command creates ACL rules that grant the specified user access to pr | |
| [kafka.acl.grantPermissions.cmd.example] | ||
| one = ''' | ||
| # Grant access to principal for consuming messages from all topics | ||
| $ rhoas kafka acl grant-permissions --consumer --user user_name --topic "*" --group "*" | ||
| $ rhoas kafka acl grant-permissions --consumer --user user_name --topic all --group all | ||
|
|
||
| # Grant access to principal for consuming messages from all topics in a specified instance | ||
| $ rhoas kafka acl grant-permissions --consumer --user user_name --topic all --group all --instance-id c5hv7iru4an1g84pogp0 | ||
|
|
||
| # Grant access to principal for producing messages to all topics | ||
| $ rhoas kafka acl grant-permissions --producer --user user_name --topic "*" | ||
| $ rhoas kafka acl grant-permissions --producer --user user_name --topic all | ||
|
|
||
| # Grant access to principal for consuming messages from topics starting with "abc" | ||
| $ rhoas kafka acl grant-permissions --consumer --user user_name --topic-prefix "abc" --group my-group | ||
|
|
@@ -56,13 +59,13 @@ $ rhoas kafka acl grant-permissions --consumer --user user_name --topic-prefix " | |
| $ rhoas kafka acl grant-permissions --producer --user user_name --topic-prefix "abc" | ||
|
|
||
| # Grant access to all users for consuming messages from topic "my-topic" | ||
| $ rhoas kafka acl grant-permissions --consumer --user "*" --topic my-topic --group my-group | ||
| $ rhoas kafka acl grant-permissions --consumer --user all --topic my-topic --group my-group | ||
|
|
||
| # Grant access to all users for producing messages to topic "my-topic" | ||
| $ rhoas kafka acl grant-permissions --producer --user "*" --topic my-topic | ||
| $ rhoas kafka acl grant-permissions --producer --user all --topic my-topic | ||
|
|
||
| # Grant access to principal for produce and consume messages from all topics | ||
| $ rhoas kafka acl grant-permissions --producer --consumer --user user_name --topic "*" --group "*" | ||
| $ rhoas kafka acl grant-permissions --producer --consumer --user user_name --topic all --group all | ||
| ''' | ||
|
|
||
| [kafka.acl.grantPermissions.error.bothPrincipalsSelected] | ||
|
|
@@ -93,6 +96,9 @@ one = 'Prefix name for topics to be selected' | |
| [kafka.acl.common.flag.groupPrefix.description] | ||
| one = 'Prefix name for groups to be selected' | ||
|
|
||
| [kafka.acl.common.flag.instance.id] | ||
| one = 'ID of the Kafka instance to be used. By default, uses the currently selected instance' | ||
|
|
||
| [kafka.acl.grantPermissions.flag.producer.description] | ||
| one = 'Add ACL rules that grant the specified principal access to produce messages to topics' | ||
|
|
||
|
|
@@ -112,8 +118,11 @@ The instances are displayed by default in a table, but can also be displayed as | |
|
|
||
| [kafka.acl.list.cmd.example] | ||
| one = ''' | ||
| # Display Kafka ACL rules for the instance | ||
| # Display Kafka ACL rules for the Kafka instance | ||
| $ rhoas kafka acl list | ||
|
|
||
| # Display Kafka ACL rules for a specific Kafka instance | ||
| $ rhoas kafka acl list --instance-id c5hv7iru4an1g84pogp0 | ||
| ''' | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would your thoughts be if we make this a persistent flag at the
aclcommand level? This would save having to add it to every acl subcommand.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create persistent flag without redefiniing it to set
opts.kafkaIDin the cmd?That will probably require some packaged scoped variable that all commands will read?
Not sure if there is clever way that is as clean as defining that flag in every command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we could have something similar for registry commands as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually @wtrocki is probably correct, we would need to have the value set in memory via a pointer like the debug flag for this work.
Feel free to explore the idea, but it may not be worth it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we can apply instance-id to numerous commands as in #685 so we can think about this clever way and then change it across CLI. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skipping, to be addressed along with 685
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@craicoverflow , filtering by id column seems to be unsupported in Admin API. Should we raise it to admin api team, this would enable completions at multiple places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean, why does the admin API require ID filtering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant for auto completions of
--instance-idThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the control plane API?
You could fetch all IDs and cache them. I don't think we need to have filtering in the API for it for this one use case.