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

Remember likely bad device names for an hour #1889

Merged

Conversation

ConnorJC3
Copy link
Contributor

@ConnorJC3 ConnorJC3 commented Jan 9, 2024

Is this a bug fix or adding new feature?

Bug fix

What is this PR about? / Why do we need it?

Despite our best efforts, it is difficult to conclusively determine a safe block device name to use, and sometimes we get it wrong.

After thorough testing with the AMI from #1674, it was discovered that AMIs can include block device mappings (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#ami-block-device-mapping) that behave unintuitively: block device names used by AMIs do NOT appear in the block device mappings returned by DescribeInstances

This leaves us with two options:

  1. Call DescribeImages for every attachment operation to check for block device mappings on the AMI.
    This was discarded because it requires spending a massive amount of additional API calls across all users for a relatively niche case. It also doesn't solve the next iteration of this problem if there's another block device name constraint we don't know about or is added.

  2. Remember block device names that are likely to be duds, and don't reuse them
    This is the solution this PR implements. When an AttachDisk returns a 'block device name is in use' error, a map is updated that remembers the bad device name for that instance for a period of time (currently, an instance is remembered as long as it has had an attach in the last hour).

What testing is done?

CI/Manual/Added new unit test cases

Signed-off-by: Connor Catlett <conncatl@amazon.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 9, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 9, 2024
Copy link

github-actions bot commented Jan 9, 2024

Code Coverage Diff

This PR does not change the code coverage

pkg/cloud/cloud.go Show resolved Hide resolved
pkg/cloud/cloud.go Show resolved Hide resolved
pkg/cloud/cloud.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 16, 2024
Copy link
Contributor

@AndrewSirenko AndrewSirenko left a comment

Choose a reason for hiding this comment

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

/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 17, 2024
Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

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

Given this PR is not a one way door and generically applies a band-aid over all "bad device name" issues, I'm inclined to proceed with the changes as written.

Iterative improvements and re-factoring discussions can be continued in follow-up PRs. Will hold off on applying approve label so that Connor can resolve any outstanding concerns and merge when ready.

/lgtm

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ConnorJC3

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 Jan 18, 2024
@k8s-ci-robot k8s-ci-robot merged commit 80d1adf into kubernetes-sigs:master Jan 18, 2024
19 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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants