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

Fix data size validations #3492

Merged
merged 1 commit into from
Dec 2, 2018
Merged

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Nov 30, 2018

Which issue this PR fixes: fixes #3468

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 30, 2018
@ElvinEfendi
Copy link
Member

Why don't you just do following?

var sizeUnitRegex = regexp.MustCompile(`^[0-9]+[kKmMgG]$`)

...

return sizeUnitRegex.MatchString(s)

@aledbf
Copy link
Member Author

aledbf commented Nov 30, 2018

@ElvinEfendi because that regex does not support passing just numbers "10000"

@ElvinEfendi
Copy link
Member

Why not? you can use the following regexp:

^[0-9]+[kKmMgG]{0,1}$

@ElvinEfendi
Copy link
Member

also from http://nginx.org/en/docs/syntax.html

Sizes can be specified in bytes, kilobytes (suffixes k and K) or megabytes (suffixes m and M), for example, “1024”, “8k”, “1m”.

why are we adding support for g?

@aledbf
Copy link
Member Author

aledbf commented Nov 30, 2018

why are we adding support for g?

Please check #3468

@ElvinEfendi
Copy link
Member

I've seen that but the documentation does not say it supports g.

@aledbf
Copy link
Member Author

aledbf commented Nov 30, 2018

I've seen that but the documentation does not say it supports g.

Agree but it works 🤔

@ElvinEfendi
Copy link
Member

I think we should revert https://github.com/kubernetes/ingress-nginx/pull/3409/files instead of adding g support for this.

Otherwise by merging this PR as is, we would be keeping incorrect behaviour which is worse than incomplete.

@ElvinEfendi
Copy link
Member

/lgtm

We can do #3492 (comment) in another PR.

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, ElvinEfendi

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 ccd7b89 into kubernetes:master Dec 2, 2018
@aledbf aledbf deleted the fix-units branch December 6, 2018 10:46
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. 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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

options using byte-size unit "g" not honored after upgrading to 0.21.0
3 participants