Skip to content

Commit

Permalink
Merge pull request #1939 from XiShanYongYe-Chang/automated-cherry-pic…
Browse files Browse the repository at this point in the history
…k-of-#1921-upstream-release-1.2

Automated cherry pick of #1921: fix add annotation when annotation is nil
  • Loading branch information
karmada-bot authored Jun 1, 2022
2 parents f1141ac + 3aed07e commit 0f71dd2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/registry/search/storage/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func addAnnotationWithClusterName(resourceObjects []runtime.Object, clusterName
resource := resourceObjects[index].(*unstructured.Unstructured)

annotations := resource.GetAnnotations()
if annotations == nil {
annotations = make(map[string]string)
}
annotations["cluster.karmada.io/name"] = clusterName

resource.SetAnnotations(annotations)
Expand Down

0 comments on commit 0f71dd2

Please sign in to comment.