mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #83301 from justinsb/e2e_tag_volume_we_create
e2e: on aws, tag volumes we want the cluster to mount
This commit is contained in:
commit
820b796c66
@ -100,6 +100,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
|
||||
|
Loading…
Reference in New Issue
Block a user