-
Notifications
You must be signed in to change notification settings - Fork 72
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
feat(kafka acl): add convenience commands #1179
Conversation
Separate PR: |
6243f78
to
a1214dc
Compare
one = 'service account ID to be used as principal' | ||
|
||
[kafka.acl.common.flag.topicPrefix.description] | ||
one = 'prefix topic name to define ACL rules for' |
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.
one = 'prefix topic name to define ACL rules for' | |
one = 'The prefix topic name to define ACL rules for' |
All ACL rules are aligned with the Kafka specification/patterns for consuming and producing content. For redability I would suggest to define ACL objects close to each other/in the group. Add them into array and then have single method that tries to execute based on that array in the loop. That will allow us to swap easily to batch API when available with single like of code. |
9199834
to
8cfc1b8
Compare
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.
Reverified some mixture of flags and permissions
@rkpattnaik780 could you go through the outstanding/unresolved feedback items and create issues for them to be followed up on? |
Getting an i18n error: $ rhoas kafka acl grant-permissions --service-account srvc1 --consumer --group "*" --topic-prefix "*" --topic "*"
panic: template: :1: unexpected "}" in operand
goroutine 1 [running]:
github.com/nicksnyder/go-i18n/v2/i18n.(*Localizer).MustLocalize(0xc0001ab800, 0xc0000bdbc8, 0x1deeb56, 0x8)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/nicksnyder/go-i18n/[email protected]/i18n/localizer.go:211 +0x7c
github.com/redhat-developer/app-services-cli/pkg/localize/goi18n.(*Goi18n).MustLocalize(0xc00059ad70, 0x1e37997, 0x32, 0xc000010f98, 0x1, 0x1, 0x8, 0x1acb800)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/localize/goi18n/go_i18n.go:85 +0x165
github.com/redhat-developer/app-services-cli/pkg/localize/goi18n.(*Goi18n).MustLocalizeError(0xc00059ad70, 0x1e37997, 0x32, 0xc000010f98, 0x1, 0x1, 0xc00021a400, 0xc0000bdcf8)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/localize/goi18n/go_i18n.go:95 +0x67
github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant.validateFlagInputCombination(0xc00025bad0, 0xc0001dfa20, 0x0)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant/grant.go:298 +0x2c3
github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant.NewGrantPermissionsACLCommand.func1(0xc000264000, 0xc000352510, 0x0, 0x9, 0x0, 0x0)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant/grant.go:70 +0x98
github.com/spf13/cobra.(*Command).execute(0xc000264000, 0xc000352480, 0x9, 0x9, 0xc000264000, 0xc000352480)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc00054bb80, 0x20454d4, 0x3, 0xc00054bb80)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/spf13/[email protected]/command.go:902
main.main()
/home/ephelan/code/github.com/redhat-developer/app-services-cli/cmd/rhoas/main.go:43 +0x29d |
Getting another i18n error when combining $ rhoas kafka acl grant-permissions --service-account srvc1 --consumer --group "*" --topic "*" --group-prefix "*"
panic: template: :1: unexpected "}" in operand
goroutine 1 [running]:
github.com/nicksnyder/go-i18n/v2/i18n.(*Localizer).MustLocalize(0xc000209d60, 0xc0004afbc8, 0x1deeb56, 0x8)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/nicksnyder/go-i18n/[email protected]/i18n/localizer.go:211 +0x7c
github.com/redhat-developer/app-services-cli/pkg/localize/goi18n.(*Goi18n).MustLocalize(0xc0000aaf50, 0x1e37997, 0x32, 0xc000465520, 0x1, 0x1, 0x8, 0x1acb800)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/localize/goi18n/go_i18n.go:85 +0x165
github.com/redhat-developer/app-services-cli/pkg/localize/goi18n.(*Goi18n).MustLocalizeError(0xc0000aaf50, 0x1e37997, 0x32, 0xc000465520, 0x1, 0x1, 0xc0001a0800, 0xc0004afcf8)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/localize/goi18n/go_i18n.go:95 +0x67
github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant.validateFlagInputCombination(0xc0004084e0, 0xc000271ad0, 0x0)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant/grant.go:305 +0x1ed
github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant.NewGrantPermissionsACLCommand.func1(0xc00040e000, 0xc0004de5a0, 0x0, 0x9, 0x0, 0x0)
/home/ephelan/code/github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/acl/grant/grant.go:70 +0x98
github.com/spf13/cobra.(*Command).execute(0xc00040e000, 0xc0004de510, 0x9, 0x9, 0xc00040e000, 0xc0004de510)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc000375180, 0x20454d4, 0x3, 0xc000375180)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/home/ephelan/.gvm/pkgsets/go1.16.4/global/pkg/mod/github.com/spf13/[email protected]/command.go:902
main.main()
/home/ephelan/code/github.com/redhat-developer/app-services-cli/cmd/rhoas/main.go:43 +0x29d |
$ rhoas kafka acl grant-permissions --service-account srvc1 --consumer --topic-prefix "*" --group-prefix "*"
❌ Undefined response type. Run the command in verbose mode using the -v flag to see more information I'm seeing this error again, perhaps @wtrocki's changes were lost from the most recent commit which @rkpattnaik780 did not have locally? |
I've fixed it now. |
|
||
[kafka.acl.grantPermissions.group.error.notAllowed] | ||
one = 'group flag is allowed only when consumer ACLs are to be added' |
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.
Not sure about this message. What that means?
|
but current message is ok as well |
Verification Steps
rhoas kafka acl grant-permissions --producer --user user_name --topic "*"
should create ACL rules allowing user to write to all topics in the instance.rhoas kafka acl grant-permissions --consumer --user user_name --topic-prefix "abc"
should create ACL rules allowing user to consume from all topics starting with "abc".Type of change
Checklist