-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Cache authz decisions within the scope of validating policy admission. #116443
Cache authz decisions within the scope of validating policy admission. #116443
Conversation
@benluddy: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
/triage accepted |
cd07895
to
7cb063c
Compare
7cb063c
to
c72b2cf
Compare
c72b2cf
to
5c6fb31
Compare
/cc @alexzielenski Do you have bandwidth for a review pass? |
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 except for the minor comment about serializableAttributes
.
...ng/src/k8s.io/apiserver/pkg/admission/plugin/validatingadmissionpolicy/caching_authorizer.go
Outdated
Show resolved
Hide resolved
@@ -3022,3 +3027,167 @@ func toHasLengthOf(n int) func(warnings []admissionregistrationv1alpha1.Expressi | |||
} | |||
} | |||
} | |||
|
|||
func TestAuthorizationDecisionCaching(t *testing.T) { |
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 test is cool
5c6fb31
to
520c173
Compare
...ng/src/k8s.io/apiserver/pkg/admission/plugin/validatingadmissionpolicy/caching_authorizer.go
Show resolved
Hide resolved
This avoids the surprise of identical authorization checks within a policy evaluating to different decisions during the same admission pass, and reduces the overhead of repeatedly referencing the same authorization check.
520c173
to
f1700e4
Compare
/lgtm |
LGTM label has been added. Git tree hash: 004e2499d5691592b8ea39d486c8110de7481bd5
|
/assign @jpbetz @alexzielenski Thanks for the speedy review. Can you approve on behalf of |
/approve I appreciate the high quality test coverage here, it gave me added confidence that this is working as intended. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexzielenski, benluddy, jpbetz 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 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Identical checks should produce identical decisions when referenced more than once in a policy expression, or by more than one expression in a policy.
#116054 (comment)
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: