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

fix issue in converting aws volume id from mount paths #36840

Merged
merged 2 commits into from
Nov 18, 2016

Conversation

jingxu97
Copy link
Contributor

@jingxu97 jingxu97 commented Nov 15, 2016

This PR is to fix the issue in converting aws volume id from mount
paths. Currently there are three aws volume id formats supported. The
following lists example of those three formats and their corresponding
global mount paths:

  1. aws:///vol-123456
    (/var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/aws/vol-123456)
  2. aws://us-east-1/vol-123456
    (/var/lib/kubelet/plugins/kubernetes.io/mounts/aws/us-est-1/vol-123455)
  3. vol-123456
    (/var/lib/kubelet/plugins/kubernetes.io/mounts/aws/us-est-1/vol-123455)

For the first two cases, we need to check the mount path and convert
them back to the original format.

This PR fixes #36269

Fix issue in converting AWS volume ID from mount paths

This change is Reviewable

@jingxu97 jingxu97 added sig/storage Categorizes an issue or PR as relevant to SIG Storage. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Nov 15, 2016
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Nov 15, 2016
@@ -192,11 +192,11 @@ func (rc *reconciler) reconcile() {
if rc.actualStateOfWorld.VolumeNodeExists(
volumeToAttach.VolumeName, volumeToAttach.NodeName) {
// Volume/Node exists, touch it to reset detachRequestedTime
glog.V(1).Infof("Volume %q/Node %q is attached--touching.", volumeToAttach.VolumeName, volumeToAttach.NodeName)
glog.V(5).Infof("Volume %q/Node %q is attached--touching.", volumeToAttach.VolumeName, volumeToAttach.NodeName)
Copy link
Member

Choose a reason for hiding this comment

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

Why lower the priority on these messages? Are they happening very frequently?

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, it prints out log for every reconciler loop

// aws://us-east-1/vol-1234 (../aws-ebs/mounts/aws/us-east-1/vol-1234)
// vol-1234 (../aws-ebs/mounts/vol-1234)
// This code is for dealing with the first two cases.
if strings.HasPrefix(volumeID, "aws/") {
Copy link
Member

Choose a reason for hiding this comment

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

Having code to work around an AWS issue in common util/mount is pretty bad. Is there any way this can be isolated to the aws ebs volume plugin?

} else {
volumeID = strings.Replace(volumeID, "aws/", "aws:///", 1)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should put this only into the AWS provider?

@jingxu97
Copy link
Contributor Author

@justinsb @saad-ali addressed the comment, PTAL. Thanks!

@k8s-ci-robot
Copy link
Contributor

Jenkins Kubemark GCE e2e failed for commit 5a64cd6. Full PR test history.

The magic incantation to run this job again is @k8s-bot kubemark e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GKE smoke e2e failed for commit 5a64cd6. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GCE e2e failed for commit 5a64cd6. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCE e2e failed for commit 5a64cd6. Full PR test history.

The magic incantation to run this job again is @k8s-bot cvm gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCE etcd3 e2e failed for commit 5a64cd6. Full PR test history.

The magic incantation to run this job again is @k8s-bot gce etcd3 e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GKE smoke e2e failed for commit 5a64cd6. Full PR test history.

The magic incantation to run this job again is @k8s-bot cvm gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

sourceName = strings.Replace(volumeID, "aws/", "aws:///", 1)
}
glog.V(4).Info("Convert aws volume name from %q to %q ", volumeID, sourceName)
}
Copy link
Member

Choose a reason for hiding this comment

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

This looks right.

If I'm going to nit-pick, it might be safer to split the string, and then glog.Warning if it doesn't match one of the forms we expect.

i.e. we expect either aws/vol-12345678 or aws/us-east-1b/vol-12345678, but we should log if it doesn't look like that.

Bonus: code might be easier to understand also!

glog.Errorf("Failed to get volume id from mount %s - %v", mountPath, err)
return "", err
}
return volumeID, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should return a struct with the mount information. I see there's another overload which returns the ref count, so it's difficult to know exactly where this is used by pure grep. But this is my go-to trick (when in doubt, create a type!); not sure it's needed.

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 plan to change the function name to avoid the confusion in another PR.

@justinsb
Copy link
Member

I think this looks right; I'll try to test on AWS this evening (once tests are green I guess). @jingxu97 any hints on how to trigger the code path?

@jingxu97
Copy link
Contributor Author

@k8s-bot verify test this

@k8s-ci-robot
Copy link
Contributor

Jenkins verification failed for commit 5349593fb2ba20ea3662be1ee7f9683a7e10f6bb. Full PR test history.

The magic incantation to run this job again is @k8s-bot verify test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

Copy link
Member

@justinsb justinsb left a comment

Choose a reason for hiding this comment

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

One question, but otherwise LGTM

sourceName = awsURLNamePrefix + "" + "/" + volName // empty zone label
}
if length == 3 {
sourceName = awsURLNamePrefix + "/" + names[1] + volName // names[1] is the zone label
Copy link
Member

Choose a reason for hiding this comment

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

Are we missing a '/' here? i.e. awsURLNamePrefix + "/" + names[1] + "/" + volName ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks for the review!

This PR is to fix the issue in converting aws volume id from mount
paths. Currently there are three aws volume id formats supported. The
following lists example of those three formats and their corresponding
global mount paths:
1. aws:///vol-123456
(/var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/aws/vol-123456)
2. aws://us-east-1/vol-123456
(/var/lib/kubelet/plugins/kubernetes.io/mounts/aws/us-est-1/vol-123455)
3. vol-123456
(/var/lib/kubelet/plugins/kubernetes.io/mounts/aws/us-est-1/vol-123455)

For the first two cases, we need to check the mount path and convert
them back to the original format.
@jingxu97 jingxu97 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 17, 2016
@k8s-github-robot k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Nov 17, 2016
@jingxu97 jingxu97 added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 18, 2016
@dims
Copy link
Member

dims commented Nov 18, 2016

@saad-ali : can you please reapply lgtm? looks like the bot did not pick up your last "/lgtm"

@jingxu97 jingxu97 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 95ab806 into kubernetes:master Nov 18, 2016
@justinsb
Copy link
Member

@jingxu97 are you going to cherry-pick this to 1.4 or have you done so? Would be great...

@jingxu97
Copy link
Contributor Author

@justinsb Sure, it is here #37302

@Raffo
Copy link
Contributor

Raffo commented Nov 23, 2016

@jingxu97 Any information regarding when the next 1.4 release will be?

@jingxu97
Copy link
Contributor Author

jingxu97 commented Nov 24, 2016 via email

@sharms
Copy link

sharms commented Dec 7, 2016

Any chance this can be pushed out? Currently those running 1.4 release don't unmount AWS volumes which is a tough scenario for operations.

@mrook
Copy link

mrook commented Dec 8, 2016

Yeah we'd love to see 1.4.7 with the fix pushed, we're fighting this issue on a production cluster ATM.

@jingxu97
Copy link
Contributor Author

jingxu97 commented Dec 8, 2016 via email

dims pushed a commit to dims/kubernetes that referenced this pull request Feb 8, 2018
Automatic merge from submit-queue

fix issue in converting aws volume id from mount paths

This PR is to fix the issue in converting aws volume id from mount
paths. Currently there are three aws volume id formats supported. The
following lists example of those three formats and their corresponding
global mount paths:
1. aws:///vol-123456
(/var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/aws/vol-123456)
2. aws://us-east-1/vol-123456
(/var/lib/kubelet/plugins/kubernetes.io/mounts/aws/us-est-1/vol-123455)
3. vol-123456
(/var/lib/kubelet/plugins/kubernetes.io/mounts/aws/us-est-1/vol-123455)

For the first two cases, we need to check the mount path and convert
them back to the original format.

This PR fixes kubernetes#36269
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EBS volume unmounting is stalling