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

feat: organize node expand logics #1008

Merged

Conversation

mowangdk
Copy link
Contributor

@mowangdk mowangdk commented Mar 28, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

  1. Add check if block device size is as expect
  2. remove filesystem resize check

Which issue(s) this PR fixes:

Fixes # None

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?


Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 28, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mowangdk

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2024
@mowangdk mowangdk force-pushed the feature/check_resize_disk_size branch from 0623c19 to 8c047de Compare March 28, 2024 06:48
@k8s-ci-robot k8s-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 Mar 28, 2024
@mowangdk mowangdk force-pushed the feature/check_resize_disk_size branch from 8c047de to f59692a Compare March 28, 2024 07:23
Copy link
Contributor

@huww98 huww98 left a comment

Choose a reason for hiding this comment

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

This is a good step forward. But I think it is even better just pass the required size to resizefs, and let it check and report error.

In case user manually resize the disk to larger size, and set PVC capacity to a smaller one, should we occupy the whole disk? (I think no, we should only occupy what is declared)

volExpandBytes := int64(req.GetCapacityRange().GetRequiredBytes())
requestGB := float64((volExpandBytes + 1024*1024*1024 - 1) / (1024 * 1024 * 1024))
volExpandBytes := float64(req.GetCapacityRange().GetRequiredBytes())
requestGB := math.Floor(volExpandBytes / float64(1024*1024*1024))
Copy link
Contributor

@huww98 huww98 Mar 28, 2024

Choose a reason for hiding this comment

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

Do all calculation with int64 and bytes? to avoid any potential issue with floating point precision lost. Just be consistent with ControllerExpandVolume

Copy link
Contributor Author

Choose a reason for hiding this comment

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

volExpandBytes variable here is only use to generate requestGB, I think it would be fine.

// After calling openapi to expansion cloud disk, the size of the underlying block device may not change. need to retry
log.Errorf("NodeExpandVolume:: Actual block size: %s is smaller than expected block size: %s, need to retry waiting", deviceCapacity, requestGB)
return nil, status.Errorf(codes.Aborted, "deviceCapacity: %v, requestGB: %v not in range", deviceCapacity, requestGB)
}
log.Infof(
"NodeExpandVolume:: filesystem resize context device capacity: %v, before resize fs capacity: %v resize fs capacity: %v, requestGB: %v. file system lose percent: %v",
deviceCapacity, beforeResizeDiskCapacity, diskCapacity, requestGB, GlobalConfigVar.FilesystemLosePercent)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove all codes about FilesystemLosePercent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I don't think It serves its purpose.

@huww98
Copy link
Contributor

huww98 commented Mar 28, 2024

Please also update the PR title and commit message.

@mowangdk mowangdk force-pushed the feature/check_resize_disk_size branch from f59692a to a292e2b Compare March 28, 2024 09:19
@mowangdk mowangdk changed the title feat: check volume needs resize feat: organize node expand logics Mar 28, 2024
@mowangdk mowangdk force-pushed the feature/check_resize_disk_size branch from a292e2b to 809f5ed Compare March 28, 2024 09:36
@mowangdk mowangdk force-pushed the feature/check_resize_disk_size branch from 809f5ed to 377c9e9 Compare March 29, 2024 07:54
@mowangdk mowangdk merged commit 5d0bcbf into kubernetes-sigs:master Mar 29, 2024
5 of 6 checks passed
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. kind/feature Categorizes issue or PR as related to a new feature. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants