Skip to content

Commit

Permalink
Merge pull request kubernetes#85929 from rifelpet/automated-cherry-pi…
Browse files Browse the repository at this point in the history
…ck-of-#83301-origin-release-1.16

Automated cherry pick of kubernetes#83301: e2e: on aws, tag volumes we want the cluster to mount
  • Loading branch information
k8s-ci-robot authored Jan 10, 2020
2 parents 75d6079 + e1f7972 commit 7d00ada
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/e2e/framework/providers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,29 @@ func (p *Provider) CreatePD(zone string) (string, error) {
request.AvailabilityZone = aws.String(zone)
request.Size = aws.Int64(10)
request.VolumeType = aws.String(awscloud.DefaultVolumeType)

// We need to tag the volume so that locked-down IAM configurations can still mount it
if framework.TestContext.CloudConfig.ClusterTag != "" {
clusterID := framework.TestContext.CloudConfig.ClusterTag

legacyTag := &ec2.Tag{
Key: aws.String(awscloud.TagNameKubernetesClusterLegacy),
Value: aws.String(clusterID),
}

newTag := &ec2.Tag{
Key: aws.String(awscloud.TagNameKubernetesClusterPrefix + clusterID),
Value: aws.String(awscloud.ResourceLifecycleOwned),
}

tagSpecification := &ec2.TagSpecification{
ResourceType: aws.String(ec2.ResourceTypeVolume),
Tags: []*ec2.Tag{legacyTag, newTag},
}

request.TagSpecifications = append(request.TagSpecifications, tagSpecification)
}

response, err := client.CreateVolume(request)
if err != nil {
return "", err
Expand Down

0 comments on commit 7d00ada

Please sign in to comment.