From c879e531f9915ca6e5642302bf1b50e7734430da Mon Sep 17 00:00:00 2001 From: Tomas Smetana Date: Thu, 8 Feb 2018 13:51:53 +0100 Subject: [PATCH] AWS: Do not ignore errors from EC2::DescribeVolumee in DetachDisk The DetachDisk method of AWS cloudprovider indirectly calls EC2::DescribeVolume AWS API function to check if the volume being detached is really attached to the specified node. The AWS API call may fail and return error which is logged however the DetachDisk then finishes successfully. This may cause the AWS volumes to remain attached to the instances forever because the attach/detach controller will mark the volume as attached. The PV controller will never be able to delete those disks and they need to be detached manually. This patch ensures on error from DescribeVolume is propagated to attach/detach controller and the detach operation is re-tried. --- pkg/cloudprovider/providers/aws/aws.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index f2275acd915..7d652beaa6d 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -2013,7 +2013,7 @@ func (c *Cloud) AttachDisk(diskName KubernetesVolumeID, nodeName types.NodeName, // DetachDisk implements Volumes.DetachDisk func (c *Cloud) DetachDisk(diskName KubernetesVolumeID, nodeName types.NodeName) (string, error) { diskInfo, attached, err := c.checkIfAttachedToNode(diskName, nodeName) - if diskInfo == nil { + if err != nil { return "", err }