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

Mark a volume as uncertain-attached after detach error #120595

Merged
merged 1 commit into from
Oct 8, 2023

Conversation

jsafrane
Copy link
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

A volume that failed Detach() should not be marked as attached, CSI external-attacher is probably still trying to detach it.

Mark it uncertain instead and wait for Detach() to succeed. I updated an existing unit test for it.

Which issue(s) this PR fixes:

Fixes #120571

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fixed attaching volumes after detach errors. Now volumes that failed to detach are not treated as attached, Kubernetes will make sure they are fully attached before they can be used by pods.

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


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/storage Categorizes an issue or PR as relevant to SIG Storage. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 12, 2023
@jsafrane
Copy link
Member Author

cc @jingxu97 @gnufied @msau42

Volume that failed Detach() should not be marked as attached, CSI
external-attacher is probably still trying to detach it.

Mark it uncertain instead and wait for Detach() to succeed.
@xing-yang
Copy link
Contributor

/assign @jingxu97

@jingxu97
Copy link
Contributor

jingxu97 commented Oct 5, 2023

I was mainly checking the case mentioned here, to make sure it won't cause issue like volume is never reported as attached again.

Since uncertain should always trigger attach operation, which will make a call of AddVolumeToReportAsAttached, I don't think there is an issue. Overall I think it is safer to mark volume as uncertain when there is a failure, especially when we don't know it is transient or not.

Thanks @jsafrane for the great analysis of this tricky issue and provide the fix.

@jingxu97
Copy link
Contributor

jingxu97 commented Oct 5, 2023

/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 Oct 5, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3221fd9de0bb548b316747c7d6c5b8aa20d3e42e

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jingxu97, jsafrane, kvaps

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

@pacoxu
Copy link
Member

pacoxu commented Oct 8, 2023

/retest-required

@k8s-ci-robot k8s-ci-robot merged commit d3559bf into kubernetes:master Oct 8, 2023
18 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.29 milestone Oct 8, 2023
@jsafrane
Copy link
Member Author

jsafrane commented Oct 9, 2023

/priority important-soon
/triage accepted

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Oct 9, 2023
@k8s-ci-robot k8s-ci-robot removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 9, 2023
k8s-ci-robot added a commit that referenced this pull request Oct 12, 2023
…0595-upstream-release-1.26

Automated cherry pick of #120595: Mark a volume as uncertain-attached after detach error
k8s-ci-robot added a commit that referenced this pull request Oct 12, 2023
…0595-upstream-release-1.27

Automated cherry pick of #120595: Mark a volume as uncertain-attached after detach error
k8s-ci-robot added a commit that referenced this pull request Oct 12, 2023
…0595-upstream-release-1.28

Automated cherry pick of #120595: Mark a volume as uncertain-attached after detach error
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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Pods are stuck ContainerCreating after volume detach error and KCM restart
6 participants