@@ -773,12 +773,10 @@ func (d *driver) CreateStorage(cr *imageregistryv1.Config) error {
773
773
774
774
// at this stage we are not keeping user tags in sync. as per enhancement proposal
775
775
// we only set user provided tags when we created the bucket.
776
- tagsInSpec := make (map [string ]* struct {})
777
776
if infra .Status .PlatformStatus .AWS != nil && len (infra .Status .PlatformStatus .AWS .ResourceTags ) != 0 {
778
- klog .V (5 ).Infof ("infra.Spec has %d user provided tags" , len (infra .Status .PlatformStatus .AWS .ResourceTags ))
777
+ klog .V (5 ).Infof ("infra.Status has %d user provided tags" , len (infra .Status .PlatformStatus .AWS .ResourceTags ))
779
778
for _ , tag := range infra .Status .PlatformStatus .AWS .ResourceTags {
780
- klog .Infof ("user provided bucket tag in infra.Spec: %s: %s" , tag .Key , tag .Value )
781
- tagsInSpec [tag .Key ] = nil
779
+ klog .Infof ("user provided bucket tag in infra.Status: %s: %s" , tag .Key , tag .Value )
782
780
tagset = append (tagset , & s3.Tag {
783
781
Key : aws .String (tag .Key ),
784
782
Value : aws .String (tag .Value ),
@@ -1001,10 +999,10 @@ func sharedCredentialsDataFromStaticCreds(accessKey, accessSecret string) []byte
1001
999
}
1002
1000
1003
1001
// PutStorageTags is for adding/overwriting tags of the S3 bucket
1004
- // which name is obtained using the ID() method.
1005
- func (d * driver ) PutStorageTags (tagList map [string ]string ) error {
1006
- if len (tagList ) == 0 {
1007
- klog .Info ("TagSet is empty, no action taken" )
1002
+ // which name is obtained using this driver's ID() method.
1003
+ func (d * driver ) PutStorageTags (tagMap map [string ]string ) error {
1004
+ if len (tagMap ) == 0 {
1005
+ klog .Info ("Tags is empty, no action taken" )
1008
1006
return nil
1009
1007
}
1010
1008
@@ -1013,9 +1011,9 @@ func (d *driver) PutStorageTags(tagList map[string]string) error {
1013
1011
return err
1014
1012
}
1015
1013
1016
- tagset := make ([]* s3.Tag , 0 , len (tagList ))
1017
- for key , value := range tagList {
1018
- tagset = append (tagset , & s3.Tag {
1014
+ tags := make ([]* s3.Tag , 0 , len (tagMap ))
1015
+ for key , value := range tagMap {
1016
+ tags = append (tags , & s3.Tag {
1019
1017
Key : aws .String (key ),
1020
1018
Value : aws .String (value ),
1021
1019
})
@@ -1024,7 +1022,7 @@ func (d *driver) PutStorageTags(tagList map[string]string) error {
1024
1022
_ , err = svc .PutBucketTaggingWithContext (d .Context , & s3.PutBucketTaggingInput {
1025
1023
Bucket : aws .String (d .ID ()),
1026
1024
Tagging : & s3.Tagging {
1027
- TagSet : tagset ,
1025
+ TagSet : tags ,
1028
1026
},
1029
1027
})
1030
1028
if err != nil {
@@ -1065,10 +1063,10 @@ func (d *driver) GetStorageTags() (map[string]string, error) {
1065
1063
return nil , fmt .Errorf ("failed to fetch s3 bucket tags: %s" , errMsg )
1066
1064
}
1067
1065
1068
- tagList := make (map [string ]string )
1069
- for _ , tags := range output .TagSet {
1070
- tagList [aws .StringValue (tags .Key )] = aws .StringValue (tags .Value )
1066
+ tags := make (map [string ]string )
1067
+ for _ , tag := range output .TagSet {
1068
+ tags [aws .StringValue (tag .Key )] = aws .StringValue (tag .Value )
1071
1069
}
1072
1070
1073
- return tagList , nil
1071
+ return tags , nil
1074
1072
}
0 commit comments