-
Notifications
You must be signed in to change notification settings - Fork 242
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
disk: refactor create disk #1083
disk: refactor create disk #1083
Conversation
Skipping CI for Draft Pull Request. |
I will try to add unit test later |
dd89342
to
b9fed08
Compare
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-sigs/prow repository. |
Because it is also indistinguishable from DescribeDisks.
We will not forget something when adding new category.
Use hash of diskName as client token to ensure only one disk is created for one PVC. If we see IdempotentParameterMismatch, fall back to DescribeDisks to fetch existing disk. When CreateDisk fails, it records the client token only for some case, but we don't know which. If we use a new token for retry, we are risking creating duplicated disks. If we reuse the same token. the retry may fail for IdempotentParameterMismatch. So fetching the existing disk and checking it ourselves seems to be the only choice.
This protection is fragile, it cannot suvive CSI restart, and breaks the detection of inconsistent create parameters between two requests with the same name.
b9fed08
to
6993a6c
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: huww98, 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
disk: aggregate category metadata into one file
We will not forget something when adding new category.
disk: refactor create disk
Use hash of diskName as client token to ensure only one disk is created for one PVC.
If we see IdempotentParameterMismatch, fall back to DescribeDisks to fetch existing disk.
When CreateDisk fails, it records the client token only for some case, but we don't know which.
If we use a new token for retry, we are risking creating duplicated disks.
If we reuse the same token. the retry may fail for IdempotentParameterMismatch.
So fetching the existing disk and checking it ourselves seems to be the only choice.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Replaces #876
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: