-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Allow multiple providers for authorizationMode #42557
Allow multiple providers for authorizationMode #42557
Conversation
Hi @xilabao. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
ping @errordeveloper |
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 nit only, please fix that and add a test for it
return field.ErrorList{field.Invalid(fldPath, authzMode, "invalid authorization mode")} | ||
func ValidateAuthorizationModes(authzModes []string, fldPath *field.Path) field.ErrorList { | ||
allErrs := field.ErrorList{} | ||
for _, authzMode := range authzModes { |
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 make sure here that you can't set it to RBAC,RBAC,ABAC,ABAC
or the like. Duplicate values aren't allowed
Thanks for your patience! There's have been a lot going on before and during KubeCon etc. and with the v1.6 release. Hope you understand. However, now the code freeze is lifted so we can go on with v1.7 things 👍 |
f38d197
to
b1cfe6b
Compare
Done. @luxas |
} | ||
} | ||
|
||
found := make(map[string]bool) |
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'd prefer if you moved this map above the first for loop to avoid having two
Also we use map[string]bool{}
most often instead of make, but I have no super strong opinions
for _, authzMode := range authzModes { | ||
if found[authzMode] { | ||
allErrs = append(allErrs, field.Invalid(fldPath, authzMode, "duplicate authorization mode")) | ||
break |
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 think this should be continue
since we want to spot all duplicates
b1cfe6b
to
5cd950b
Compare
@luxas PTAL |
/lgtm Thanks for following this up @xilabao! |
please fix the small test failure though... |
5cd950b
to
68f69b2
Compare
ping @luxas |
@k8s-bot test this |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: luxas, xilabao
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue |
fixes kubernetes/kubeadm#177