Merge pull request #1759 from duanmengkk/master
fixed a panic which due to nil annotation during promote resources to Karmada
This commit is contained in:
commit
da78076e26
|
@ -378,6 +378,9 @@ func preprocessResource(obj *unstructured.Unstructured) error {
|
|||
// addOverwriteAnnotation add annotation "work.karmada.io/conflict-resolution" to the resource
|
||||
func addOverwriteAnnotation(obj *unstructured.Unstructured) {
|
||||
annotations := obj.DeepCopy().GetAnnotations()
|
||||
if annotations == nil {
|
||||
annotations = map[string]string{}
|
||||
}
|
||||
if _, exist := annotations[workv1alpha2.ResourceConflictResolutionAnnotation]; !exist {
|
||||
annotations[workv1alpha2.ResourceConflictResolutionAnnotation] = workv1alpha2.ResourceConflictResolutionOverwrite
|
||||
obj.SetAnnotations(annotations)
|
||||
|
|
Loading…
Reference in New Issue