-
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
Avoid overflow by calling AsInt64 instead of Value() in volume plugin code #67969
Conversation
@kubernetes/sig-storage-pr-reviews |
|
} | ||
|
||
if volSizeBytes < eightGig { | ||
volSizeGB = int64(util.RoundUpSize(eightGig, oneGig)) | ||
if volSizeGB < 8 { |
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.
should we return error when volSizeGB == 0?
if volSizeGB == 0 {
return nil, fmt.Errorf("invalid volume size of 0 specified")
}
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.
the check is unnecessary because kubernetes will validate it when the pvc is created
The PersistentVolumeClaim "myclaim" is invalid: spec.resources[storage]: Invalid value: "0": must be greater than zero
/retest |
1 similar comment
/retest |
@wongma7: PR needs rebase. 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. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closed this PR. In response to this:
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. |
/reopen |
@gnufied: Reopened this PR. In response to this:
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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wongma7 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@wongma7: The following tests 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. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closed this PR. In response to this:
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. |
What this PR does / why we need it: It is possible for a PVC.spec.resources.requests.storage to have a value greater than 2^63-1 depending on the unit used, e.g.
73786976299133170k
can be found there. In a lot of places we call PVC.spec.resources.requests.stolrage.Value(), which may overflow. To avoid this, I've madeRoundUpSize
unexported and only exported functions likeRoundUpToGiB
which returns an error. As well, some volume plugins use int/int32 so there are functions for those specific cases (This continues work in #66464)BEFORE: (73786976299133170k overflows to 68719477GiB and reaches the API???)
Warning VolumeResizeFailed 18m volume_expand Error expanding volume "default/myclaim" of plugin kubernetes.io/aws-ebs : AWS modifyVolume failed for vol-02b56e31b121d0b0b with InvalidParameterValue: Volume of 68719477GiB is too large for volume type gp2; maximum is 16384GiB
AFTER: (73786976299133170k is detected as too big and the request doesn't reach API)
Warning VolumeResizeFailed 8s volume_expand Error expanding volume "default/myclaim" of plugin kubernetes.io/aws-ebs : quantity {{73786976299133170 3} {} 73786976299133170k DecimalSI} is too great, overflows int64
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Release note: