Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d7103187
Unverified
Commit
d7103187
authored
Mar 19, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 19, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75054 from leakingtapan/ebs-wait
Remove the condition for only wait for KMS key is used
parents
6f93f87a
ac6d32a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
aws.go
pkg/cloudprovider/providers/aws/aws.go
+10
-12
aws_test.go
pkg/cloudprovider/providers/aws/aws_test.go
+7
-0
No files found.
pkg/cloudprovider/providers/aws/aws.go
View file @
d7103187
...
@@ -2327,19 +2327,17 @@ func (c *Cloud) CreateDisk(volumeOptions *VolumeOptions) (KubernetesVolumeID, er
...
@@ -2327,19 +2327,17 @@ func (c *Cloud) CreateDisk(volumeOptions *VolumeOptions) (KubernetesVolumeID, er
}
}
volumeName
:=
KubernetesVolumeID
(
"aws://"
+
aws
.
StringValue
(
response
.
AvailabilityZone
)
+
"/"
+
string
(
awsID
))
volumeName
:=
KubernetesVolumeID
(
"aws://"
+
aws
.
StringValue
(
response
.
AvailabilityZone
)
+
"/"
+
string
(
awsID
))
// AWS has a bad habbit of reporting success when creating a volume with
err
=
c
.
waitUntilVolumeAvailable
(
volumeName
)
// encryption keys that either don't exists or have wrong permissions.
if
err
!=
nil
{
// Such volume lives for couple of seconds and then it's silently deleted
// AWS has a bad habbit of reporting success when creating a volume with
// by AWS. There is no other check to ensure that given KMS key is correct,
// encryption keys that either don't exists or have wrong permissions.
// because Kubernetes may have limited permissions to the key.
// Such volume lives for couple of seconds and then it's silently deleted
if
len
(
volumeOptions
.
KmsKeyID
)
>
0
{
// by AWS. There is no other check to ensure that given KMS key is correct,
err
:=
c
.
waitUntilVolumeAvailable
(
volumeName
)
// because Kubernetes may have limited permissions to the key.
if
err
!=
nil
{
if
isAWSErrorVolumeNotFound
(
err
)
{
if
isAWSErrorVolumeNotFound
(
err
)
{
err
=
fmt
.
Errorf
(
"failed to create encrypted volume: the volume disappeared after creation, most likely due to inaccessible KMS encryption key"
)
err
=
fmt
.
Errorf
(
"failed to create encrypted volume: the volume disappeared after creation, most likely due to inaccessible KMS encryption key"
)
}
return
""
,
err
}
}
return
""
,
err
}
}
return
volumeName
,
nil
return
volumeName
,
nil
...
...
pkg/cloudprovider/providers/aws/aws_test.go
View file @
d7103187
...
@@ -1793,12 +1793,19 @@ func TestCreateDisk(t *testing.T) {
...
@@ -1793,12 +1793,19 @@ func TestCreateDisk(t *testing.T) {
}},
}},
},
},
}
}
volume
:=
&
ec2
.
Volume
{
volume
:=
&
ec2
.
Volume
{
AvailabilityZone
:
aws
.
String
(
"us-east-1a"
),
AvailabilityZone
:
aws
.
String
(
"us-east-1a"
),
VolumeId
:
aws
.
String
(
"vol-volumeId0"
),
VolumeId
:
aws
.
String
(
"vol-volumeId0"
),
State
:
aws
.
String
(
"available"
),
}
}
awsServices
.
ec2
.
(
*
MockedFakeEC2
)
.
On
(
"CreateVolume"
,
request
)
.
Return
(
volume
,
nil
)
awsServices
.
ec2
.
(
*
MockedFakeEC2
)
.
On
(
"CreateVolume"
,
request
)
.
Return
(
volume
,
nil
)
describeVolumesRequest
:=
&
ec2
.
DescribeVolumesInput
{
VolumeIds
:
[]
*
string
{
aws
.
String
(
"vol-volumeId0"
)},
}
awsServices
.
ec2
.
(
*
MockedFakeEC2
)
.
On
(
"DescribeVolumes"
,
describeVolumesRequest
)
.
Return
([]
*
ec2
.
Volume
{
volume
},
nil
)
volumeID
,
err
:=
c
.
CreateDisk
(
volumeOptions
)
volumeID
,
err
:=
c
.
CreateDisk
(
volumeOptions
)
assert
.
Nil
(
t
,
err
,
"Error creating disk: %v"
,
err
)
assert
.
Nil
(
t
,
err
,
"Error creating disk: %v"
,
err
)
assert
.
Equal
(
t
,
volumeID
,
KubernetesVolumeID
(
"aws://us-east-1a/vol-volumeId0"
))
assert
.
Equal
(
t
,
volumeID
,
KubernetesVolumeID
(
"aws://us-east-1a/vol-volumeId0"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment