@@ -589,7 +589,7 @@ func (r *AWSMachineReconciler) reconcileNormal(_ context.Context, machineScope *
589
589
}
590
590
591
591
if instance != nil {
592
- r .ensureStorageTags (ec2svc , instance , machineScope .AWSMachine )
592
+ r .ensureStorageTags (ec2svc , instance , machineScope .AWSMachine , machineScope . AdditionalTags () )
593
593
}
594
594
595
595
if err := r .reconcileLBAttachment (machineScope , elbScope , instance ); err != nil {
@@ -1111,20 +1111,20 @@ func (r *AWSMachineReconciler) indexAWSMachineByInstanceID(o client.Object) []st
1111
1111
return nil
1112
1112
}
1113
1113
1114
- func (r * AWSMachineReconciler ) ensureStorageTags (ec2svc services.EC2Interface , instance * infrav1.Instance , machine * infrav1.AWSMachine ) {
1114
+ func (r * AWSMachineReconciler ) ensureStorageTags (ec2svc services.EC2Interface , instance * infrav1.Instance , machine * infrav1.AWSMachine , additionalTags map [ string ] string ) {
1115
1115
annotations , err := r .machineAnnotationJSON (machine , VolumeTagsLastAppliedAnnotation )
1116
1116
if err != nil {
1117
1117
r .Log .Error (err , "Failed to fetch the annotations for volume tags" )
1118
1118
}
1119
1119
for _ , volumeID := range instance .VolumeIDs {
1120
1120
if subAnnotation , ok := annotations [volumeID ].(map [string ]interface {}); ok {
1121
- newAnnotation , err := r .ensureVolumeTags (ec2svc , aws .String (volumeID ), subAnnotation , machine . Spec . AdditionalTags )
1121
+ newAnnotation , err := r .ensureVolumeTags (ec2svc , aws .String (volumeID ), subAnnotation , additionalTags )
1122
1122
if err != nil {
1123
1123
r .Log .Error (err , "Failed to fetch the changed volume tags in EC2 instance" )
1124
1124
}
1125
1125
annotations [volumeID ] = newAnnotation
1126
1126
} else {
1127
- newAnnotation , err := r .ensureVolumeTags (ec2svc , aws .String (volumeID ), make (map [string ]interface {}), machine . Spec . AdditionalTags )
1127
+ newAnnotation , err := r .ensureVolumeTags (ec2svc , aws .String (volumeID ), make (map [string ]interface {}), additionalTags )
1128
1128
if err != nil {
1129
1129
r .Log .Error (err , "Failed to fetch the changed volume tags in EC2 instance" )
1130
1130
}
0 commit comments