Skip to content

policy: extract namespace only once on repository insert/delete #39771

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

tklauser
Copy link
Member

The (*rule).key.resource.Namespace method used to get the namespace for accessing (*Repository).rulesByNamespace implies strings.Cut on the ResourceID for each call.

Cache the namespace value to improve repository insert/delete time a bit by avoiding these repeated strings.Cut calls.

The (*rule).key.resource.Namespace method used to get the namespace for
accessing (*Repository).rulesByNamespace implies strings.Cut on the
ResourceID for each call.

Cache the namespace value to improve repository insert/delete time a
bit by avoiding these repeated strings.Cut calls.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser requested a review from a team as a code owner May 28, 2025 14:25
@tklauser tklauser added the sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. label May 28, 2025
@tklauser tklauser requested a review from doniacld May 28, 2025 14:25
@tklauser tklauser added the release-note/misc This PR makes changes that have no direct user impact. label May 28, 2025
@tklauser
Copy link
Member Author

/test

@tklauser tklauser enabled auto-merge May 28, 2025 14:26
@tklauser tklauser changed the title policy: only extract namespace once on repository insert/delete policy: extract namespace only once on repository insert/delete May 28, 2025
@tklauser tklauser added this pull request to the merge queue May 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 28, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 28, 2025
@tklauser tklauser added this pull request to the merge queue May 28, 2025
Merged via the queue into main with commit b54bb9d May 28, 2025
315 of 319 checks passed
@tklauser tklauser deleted the pr/tklauser/policy-repo-add-del-namspace branch May 28, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants