mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +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 {
|
||||
CapacityGB int
|
||||
Tags *map[string]string
|
||||
Tags map[string]string
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
// apply tags
|
||||
if volumeOptions.Tags != nil {
|
||||
if err := s.createTags(awsID, *volumeOptions.Tags); err != nil {
|
||||
tags := make(map[string]string)
|
||||
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
|
||||
_, delerr := s.DeleteDisk(volumeName)
|
||||
if delerr != nil {
|
||||
|
@ -148,7 +148,7 @@ func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner) (strin
|
||||
requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
|
||||
volumeOptions := &aws.VolumeOptions{
|
||||
CapacityGB: requestGB,
|
||||
Tags: &tags,
|
||||
Tags: tags,
|
||||
}
|
||||
|
||||
name, err := cloud.CreateDisk(volumeOptions)
|
||||
|
Loading…
Reference in New Issue
Block a user