-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Temporary implementation of count metrics for PodSecurityPolicy #57346
Temporary implementation of count metrics for PodSecurityPolicy #57346
Conversation
/lgtm |
/assign @liggitt For PSP approval. |
Sorry, those bazel failures were me (kubernetes/test-infra#5990). Working on a fix. |
func (c *podSecurityPolicyPlugin) Admit(a admission.Attributes) error { | ||
func (c *podSecurityPolicyPlugin) Admit(a admission.Attributes) (err error) { | ||
defer func() { | ||
ObserveAdmit(err != nil, a) |
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 doesn't look correct. Just considering the final return of this function, won't this give your the wrong value for rejected?
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 guess maybe I don't understand what the final value is. I'm expecting err to be a particular instance that may or may not be the one returned, so the final return value isn't reflected in the value of err at the point at which you're called.
I'm not new to golang and I'd say that if I don't know the answer right off, this code is rather confusing.
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.
The named return value is always going to be the final return (as long as it's not shadowed), but since err
is often shadowed I can see how this would be confusing. I'll wrap an internal admit to make it more clear.
Thanks, that helps. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, sttts, tallclair Associated issue: #55030 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Oh, and if you catch it before it merges, a squash. |
ab810c7
to
d0d6bf4
Compare
Squashed. Reapplying LGTM. |
/retest |
/retest |
[MILESTONENOTIFIER] Milestone Pull Request Needs Approval @deads2k @jpbetz @sttts @tallclair @kubernetes/sig-auth-misc Action required: This pull request must have the Pull Request Labels
|
/retest Review the full test history for this PR. |
1 similar comment
/retest Review the full test history for this PR. |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
What this PR does / why we need it:
Alternative proposal to #57173
Which issue(s) this PR fixes:
Fixes #55030
Special notes for your reviewer:
Most of the diff is tests & boiler plate. Most prod code changes are contained in metrics.go, with a small hook in admission.go.
This deviates from the metrics in HEAD, but some amount of drift between 1.8 and 1.9 is inevitable, due to the admission refactorings that went into 1.9.
Release note: