Skip to content
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

Reduce use of memory in authorizer codepaths #18129

Merged
merged 2 commits into from
Jan 19, 2018

Conversation

simo5
Copy link
Contributor

@simo5 simo5 commented Jan 16, 2018

Fixes: #13316

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 16, 2018
@simo5
Copy link
Contributor Author

simo5 commented Jan 16, 2018

note that of the three problems reported in #13316 one is gone (the code is gone), one is addressed here (hopefully) and one is unfixable, as we use the kube authorizer interfaces which require we copy stuff into the struct @liggitt wasn't happy about.

@LiGgit @deads2k PTAL

@liggitt
Copy link
Contributor

liggitt commented Jan 16, 2018

request info should not need normalization... I think we can directly compare

@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 16, 2018
@@ -42,10 +42,10 @@ func (a *personalSARRequestInfoResolver) NewRequestInfo(req *http.Request) (*req
case len(requestInfo.Subresource) != 0:
return requestInfo, nil

case strings.ToLower(requestInfo.Verb) != "create":
case strings.EqualFold(requestInfo.Verb, "create") != true:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!= true ?

@enj
Copy link
Contributor

enj commented Jan 16, 2018

request info should not need normalization... I think we can directly compare

@deads2k I vaguely remember reviewing this code. I believe we no longer need the normalization because RBAC is fully case sensitive?

@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 16, 2018
@simo5 simo5 changed the title Use EqualFold instead of ToLower to reduce memory copies Reduce use of memory in authorizer codepaths Jan 16, 2018
RequestInfo always have lowercase strings in it, so no need to
lower case or casefold compare anything.

Signed-off-by: Simo Sorce <[email protected]>
This will allow later to change upstream to use a pointer receiver
for this interface so that copies will stop happening.

Signed-off-by: Simo Sorce <[email protected]>
@simo5
Copy link
Contributor Author

simo5 commented Jan 16, 2018

/retest

@simo5
Copy link
Contributor Author

simo5 commented Jan 16, 2018

A related PR is here kubernetes/kubernetes#58356
There is no dependency on it, but things should improve once a rebase will pick that one up, assuming upstream will approve.

@simo5
Copy link
Contributor Author

simo5 commented Jan 16, 2018

Flake #17556

@simo5
Copy link
Contributor Author

simo5 commented Jan 16, 2018

/retest

1 similar comment
@simo5
Copy link
Contributor Author

simo5 commented Jan 17, 2018

/retest

@simo5
Copy link
Contributor Author

simo5 commented Jan 17, 2018

@deads2k PTAL PR is ready to go

@simo5
Copy link
Contributor Author

simo5 commented Jan 17, 2018

/assign @deads2k

@deads2k
Copy link
Contributor

deads2k commented Jan 18, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 18, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, simo5

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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 18, 2018
@openshift-merge-robot
Copy link
Contributor

/test all [submit-queue is verifying that this PR is safe to merge]

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 19, 2018

@simo5: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_conformance_gce 9f63fe3 link /test extended_conformance_gce

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.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 18129, 18152, 17403, 18020, 18165).

@openshift-merge-robot openshift-merge-robot merged commit 077a715 into openshift:master Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants