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

disk: refactor create disk #1083

Merged
merged 5 commits into from
Jul 26, 2024

Conversation

huww98
Copy link
Contributor

@huww98 huww98 commented Jun 12, 2024

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?

The client token generation algorithm changed. There is a very small chance that a duplicated disk will be created for a PVC.

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


@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 12, 2024
@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jun 12, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 12, 2024
@huww98
Copy link
Contributor Author

huww98 commented Jun 12, 2024

I will try to add unit test later

@huww98 huww98 force-pushed the disk-create-refactor branch 3 times, most recently from dd89342 to b9fed08 Compare June 14, 2024 08:57
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 14, 2024
@huww98 huww98 marked this pull request as ready for review June 14, 2024 08:58
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 14, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 19, 2024
@k8s-ci-robot
Copy link
Contributor

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.

huww98 added 5 commits July 19, 2024 19:43
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.
@huww98 huww98 force-pushed the disk-create-refactor branch from b9fed08 to 6993a6c Compare July 19, 2024 11:44
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 19, 2024
@mowangdk
Copy link
Contributor

/lgtm
/approve

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

[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 /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 Jul 26, 2024
@k8s-ci-robot k8s-ci-robot merged commit e91fb46 into kubernetes-sigs:master Jul 26, 2024
9 checks passed
@huww98 huww98 deleted the disk-create-refactor branch November 20, 2024 09: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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants