Skip to content

Commit

Permalink
Merge pull request #3187 from nojnhuh/fix-tag-delete
Browse files Browse the repository at this point in the history
fix tag delete following resource create
  • Loading branch information
k8s-ci-robot authored Feb 28, 2023
2 parents f2bbf36 + 7c92038 commit 7bc81c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions azure/services/tags/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ func (s *Service) Reconcile(ctx context.Context) error {
return errors.Wrap(err, "cannot update tags")
}
}

// We also need to update the annotation if anything changed.
if err := s.Scope.UpdateAnnotationJSON(tagsSpec.Annotation, newAnnotation); err != nil {
return err
}
log.V(2).Info("successfully updated tags")
}

// We also need to update the annotation even if nothing changed to
// ensure it's set immediately following resource creation.
if err := s.Scope.UpdateAnnotationJSON(tagsSpec.Annotation, newAnnotation); err != nil {
return err
}
}
return nil
}
Expand Down
1 change: 1 addition & 0 deletions azure/services/tags/tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func TestReconcileTags(t *testing.T) {
},
}}, nil)
s.AnnotationJSON("my-annotation").Return(map[string]interface{}{"key": "value"}, nil)
s.UpdateAnnotationJSON("my-annotation", map[string]interface{}{"key": "value"})
},
},
}
Expand Down

0 comments on commit 7bc81c1

Please sign in to comment.