-
Notifications
You must be signed in to change notification settings - Fork 195
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
Consider supporting groups instead of single users only and create their tests #351
base: sig-auth-acceptance
Are you sure you want to change the base?
Consider supporting groups instead of single users only and create their tests #351
Conversation
This is an open source project, remove any references to trackers that are not in this repo. If they contain additional context, move it to the GitHub issue you are fixing. |
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.
good job
if len(configGroups) == 0 { | ||
return true | ||
} | ||
configGroupSet := make(map[string]struct{}) |
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.
A set is a great solution for this. You are always on the safe side that it scales up.
But the configGroupSet
slice will never change, and we are initializing it on every request at least once.
We would need to move it out and initialize the configGroupSet
in the constructor NewStaticAuthorizer
.
The issue is, that the config given to the user to configure it is a slice of strings. This should stay as is, but for working with it we need to turn this into a Set of strings. So you would need to create as struct StaticAuthorizationOptions
that contains a slice of strings and can be used by the user and you need to modify the existing StaticAuthorizationConfig
to have a Set of strings.
If you create a Set and you don't use the k8s utility package and you do it by hand, it is also good to create struct{}{}
as a global variable with a name like noop
and reference it, that way you don't initialize it for every entry.
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 you would need to create as struct StaticAuthorizationOptions that contains a slice of strings and can be used by the user
for this part, I already have a struct type called UserConfig is this not the same as the struct you're asking me to create ?
this PR to cover issue: 333