-
Notifications
You must be signed in to change notification settings - Fork 10
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
CLI-979 Refactor ccloud kafka acl
parameter names to match those of REST
#943
Conversation
…ing REST Proxy API
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.
Some questions about some of the fields, in particular Principal vs. ServiceAccountId, but otherwise this is mostly good
internal/pkg/acl/acl.go
Outdated
@@ -345,8 +345,8 @@ func PrintACLsFromKafkaRestResponseWithMap(cmd *cobra.Command, aclGetResp kafkar | |||
cmd.Flags().StringP(output.FlagName, output.ShortHandFlag, output.DefaultValue, output.Usage) | |||
} | |||
|
|||
aclListFields := []string{"UserId", "ServiceAccountId", "Permission", "Operation", "Resource", "Name", "Type"} | |||
aclListStructuredRenames := []string{"user_id", "service_account_id", "permission", "operation", "resource", "name", "type"} | |||
aclListFields := []string{"Principal", "ServiceAccountId", "Permission", "Operation", "ResourceType", "ResourceName", "PatternType"} |
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.
Oh, why do we have both Principal and ServiceAccountId here?
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.
principal is like 'User: 12345' and service account is 'sa-12345'
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.
So does the REST Proxy API also have a service account ID field / service account resource ID field? Or are you saying that this is just an extra field that we show in the CLI, even though the REST Proxy API doesn't use it?
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.
No the acl data doesn't have a sa id field. we're doing a map lookup using the principal to get the corresponding sa id.
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.
@MuweiHe I commented about this below, but we should check if ACLs can only be created on a per SA basis, or if they can also be made on a per User basis.
But either way, I think you're using the integer ID to do the map lookup to get the resource ID for the service account. Since we're trying to deprecate the integer ID, we should just replace the integer ID with the resource ID in the principal column. I.e. Something like this:
Principal:
User:sa-123
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.
@mtodzo ACLs only make sense when created for a sa to my understanding 'cause saID is a required param, and admin users should already have access to resources thus don't need acls. Right now the backend service are using the numeric ID principal like 'User:123' to manage acls. So for now I can do a look up from 'User:123' to 'sa-123' and put that under the Principal column. Is that ok?
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.
We should update the --service-account flag as well to be --principal. Also, we should figure out whether ACLs can be configured for users (see #929 (comment))
like in {"Principal", "ServiceAccountId", "Permission", "Operation", "ResourceType", "ResourceName", "PatternType"} The first column is like 'User: 1234' the second 'sa-12345'. So do we remove the first column and rename the second to be principal? |
Yeah, except it should probably include the principal prefix, so it would be User:sa-12345 ... maybe check with Ethan, but yeah the 1234 in User:1234 is the numeric ID that we don't want to show. |
8abee17
to
9167a84
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.
I left a question, but, this looks good to me overall. I would like @mtodzo to give the final +1 though since he is most familiar with the REST interface. Thank you!
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.
few comments, but after those looks good!
User:0 | ALLOW | DESCRIBE | TOPIC | 'test-topic' | LITERAL | ||
Principal | Permission | Operation | ResourceType | ResourceName | PatternType | ||
+-----------+------------+-----------+--------------+--------------+-------------+ | ||
User: | ALLOW | READ | TOPIC | 'test-topic' | LITERAL |
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.
is this expected to be empty? User:
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.
This file is not used anywhere... I might have changed it to be safe.
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.
Should we delete it if it's not used anywhere?
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.
lgtm!
Checklist
[CRUCIAL] Is the change for CP or CCloud functionalities that are already live in prod?
Did you add/update any commands that accept secrets as args/flags?
What
Change ccloud kafka acl flag names to match the REST Proxy params
Changes would be: {"ServiceAccountId", "Permission", "Operation", "Resource", "Name", "Type"} --> {"Principal", "Permission", "Operation", "ResourceType", "ResourceName", "PatternType"}
Note: this is a breaking change that would ship in ccloud v2.0
References
Test&Review