-
Notifications
You must be signed in to change notification settings - Fork 44
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
pkg/securitycontextconstraints/sccadmission: simplify retrieving SCCs #108
pkg/securitycontextconstraints/sccadmission: simplify retrieving SCCs #108
Conversation
/hold |
holding for final review |
} | ||
if len(sccs) == 0 { | ||
return nil, "", nil, admission.NewForbidden(a, fmt.Errorf("no SecurityContextConstraints found in cluster")) | ||
} | ||
return nil, "", nil, admission.NewForbidden(a, fmt.Errorf("no SecurityContextConstraints found in namespace %s", a.GetNamespace())) |
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 error might be misleading in this case, as we're not really searching in the namespace but rather we list everything available to the cluster. Wouldn't this error (deleted above) be more appropriate?
return nil, "", nil, admission.NewForbidden(a, fmt.Errorf("no SecurityContextConstraints found in cluster"))
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.
great suggestion, fixed 👍
5770582
to
806f568
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liouk, s-urbaniak The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
@s-urbaniak: all tests passed! Full PR test history. Your PR dashboard. 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. |
This is scavanging a small portion of #107 where
FindApplicableSCCs
is invoked with the requested namespace but without a user. Hence, the current logic returns all SCCs. This indirection makes the current code hard to read.This PR suggests to simplify it and list all SCCs instead which is the same logic.
/cc @stlaz