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

allow kb granularity for lua shared dicts #6750

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

timmysilv
Copy link
Contributor

@timmysilv timmysilv commented Jan 13, 2021

What this PR does / why we need it:

Lua shared dicts can be configured via Configmaps, but it enforces a megabyte granularity. This PR adds regex parsing to allow an appended "k" or "m" (case-insensitive) to specify the size unit of the shared dict. If no unit is specified, it will default to the old behaviour of using megabytes. If for example a user wanted to add many shared dicts of only 16k size, this PR would make sure they don't all use the previous minimum size of 1MB, which could become a considerable memory optimization.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Which issue/s this PR fixes

How Has This Been Tested?

  • I updated old tests for this feature to conform to the new unit formatting I set
  • I wrote new unit tests for the utility functions I introduced

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PS: I changed TemplateWriter to Writer because my go-lint plugin told me to.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 13, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @timmysilv. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 13, 2021
@aledbf
Copy link
Member

aledbf commented Jan 13, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 13, 2021
@aledbf
Copy link
Member

aledbf commented Jan 13, 2021

/assign @ElvinEfendi

func dictStrToKb(sizeStr string) int {
sizeMatch := dictSizeRegex.FindStringSubmatch(sizeStr)
if sizeMatch == nil {
return -1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use the convention of a negative return value implying an error here. If there is a preferred format, let me know. It just seemed most minimal and intuitive to me when making this.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 13, 2021
@timmysilv
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 13, 2021
@rikatz
Copy link
Contributor

rikatz commented May 30, 2021

/assing @moonming

If you can please take a look, will appreciate that

@rikatz rikatz changed the base branch from master to dev-v1 July 16, 2021 12:44
@rikatz rikatz changed the base branch from dev-v1 to main July 27, 2021 15:31
Copy link
Contributor

@rikatz rikatz left a comment

Choose a reason for hiding this comment

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

Left some minor/nit things.

I'm curious about why aren't we converting Kb to Mb as *1024 and instead using 1000, but maybe I'm missing something.

I'll leave the approval here, and ask someone else just to make a final review.

Thanks!

internal/ingress/controller/template/configmap.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2021
@rikatz
Copy link
Contributor

rikatz commented Jul 27, 2021

/cc @tao12345666333 @strongjz @cpanato

@tao12345666333
Copy link
Member

I will review this tomorrow (here is 11:50 pm 😄

@tao12345666333
Copy link
Member

/assign

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. area/helm Issues or PRs related to helm charts size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 27, 2021
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jul 27, 2021

@timmysilv: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Rerun command
pull-ingress-nginx-e2e-helm-chart 0bc069c1af6c5fa45138c171b3645e41d1f32a9a link /test pull-ingress-nginx-e2e-helm-chart
pull-ingress-nginx-chart-lint 0bc069c1af6c5fa45138c171b3645e41d1f32a9a link /test pull-ingress-nginx-chart-lint

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.

Update internal/ingress/controller/template/configmap.go

Co-authored-by: Ricardo Katz <[email protected]>
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 27, 2021
@timmysilv
Copy link
Contributor Author

totally should have been 1024 and not 1000, thanks for pointing it out!

@timmysilv
Copy link
Contributor Author

/retest

@rikatz
Copy link
Contributor

rikatz commented Aug 12, 2021

/lgtm
Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 12, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rikatz, timmysilv

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

@k8s-ci-robot k8s-ci-robot merged commit b591ada into kubernetes:main Aug 12, 2021
rchshld pushed a commit to joomcode/ingress-nginx that referenced this pull request May 19, 2023
Update internal/ingress/controller/template/configmap.go

Co-authored-by: Ricardo Katz <[email protected]>

Co-authored-by: Ricardo Katz <[email protected]>
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. area/docs area/helm Issues or PRs related to helm charts cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants