mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #22793 from justinsb/fix_22792
Auto commit by PR queue bot
This commit is contained in:
commit
45064e19d1
@ -161,7 +161,7 @@ type EC2Metadata interface {
|
|||||||
|
|
||||||
type VolumeOptions struct {
|
type VolumeOptions struct {
|
||||||
CapacityGB int
|
CapacityGB int
|
||||||
Tags *map[string]string
|
Tags map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Volumes is an interface for managing cloud-provisioned volumes
|
// Volumes is an interface for managing cloud-provisioned volumes
|
||||||
@ -1387,8 +1387,17 @@ func (s *AWSCloud) CreateDisk(volumeOptions *VolumeOptions) (string, error) {
|
|||||||
volumeName := "aws://" + az + "/" + awsID
|
volumeName := "aws://" + az + "/" + awsID
|
||||||
|
|
||||||
// apply tags
|
// apply tags
|
||||||
if volumeOptions.Tags != nil {
|
tags := make(map[string]string)
|
||||||
if err := s.createTags(awsID, *volumeOptions.Tags); err != nil {
|
for k, v := range volumeOptions.Tags {
|
||||||
|
tags[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.getClusterName() != "" {
|
||||||
|
tags[TagNameKubernetesCluster] = s.getClusterName()
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(tags) != 0 {
|
||||||
|
if err := s.createTags(awsID, tags); err != nil {
|
||||||
// delete the volume and hope it succeeds
|
// delete the volume and hope it succeeds
|
||||||
_, delerr := s.DeleteDisk(volumeName)
|
_, delerr := s.DeleteDisk(volumeName)
|
||||||
if delerr != nil {
|
if delerr != nil {
|
||||||
|
@ -148,7 +148,7 @@ func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner) (strin
|
|||||||
requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
|
requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
|
||||||
volumeOptions := &aws.VolumeOptions{
|
volumeOptions := &aws.VolumeOptions{
|
||||||
CapacityGB: requestGB,
|
CapacityGB: requestGB,
|
||||||
Tags: &tags,
|
Tags: tags,
|
||||||
}
|
}
|
||||||
|
|
||||||
name, err := cloud.CreateDisk(volumeOptions)
|
name, err := cloud.CreateDisk(volumeOptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user