Merge pull request #1012 from mrlihanbo/update-annotation
support update object annotations
This commit is contained in:
commit
3b52b0df91
|
@ -8,8 +8,11 @@ func MergeAnnotation(obj *unstructured.Unstructured, annotationKey string, annot
|
||||||
if objectAnnotation == nil {
|
if objectAnnotation == nil {
|
||||||
objectAnnotation = make(map[string]string, 1)
|
objectAnnotation = make(map[string]string, 1)
|
||||||
}
|
}
|
||||||
objectAnnotation[annotationKey] = annotationValue
|
|
||||||
obj.SetAnnotations(objectAnnotation)
|
if _, exist := objectAnnotation[annotationKey]; !exist {
|
||||||
|
objectAnnotation[annotationKey] = annotationValue
|
||||||
|
obj.SetAnnotations(objectAnnotation)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeAnnotations merges the annotations from 'src' to 'dst'.
|
// MergeAnnotations merges the annotations from 'src' to 'dst'.
|
||||||
|
|
Loading…
Reference in New Issue