Closed aojea closed 3 years ago
/assign @creydr
/assign
@aojea I added a unit test for the SetAnnotationsOnPod
method. According to the testresults it keeps existing annotations and adds the new ones.
If my reading is correct, this will wipe out existing annotations on the pod and add only the new one
my reading was not correct :sweat_smile: Thanks @creydr for checking and verifying it
There is already an object in ovn-kube that allows to patch the Pod keeping current annotations and, updating or adding the new annotation if necessary.
https://github.com/ovn-org/ovn-kubernetes/blob/227539ee442e84f504c3d545cb26bbdce65bee6f/go-controller/pkg/kube/annotator.go#L96-L103
However, it is only used in one place
https://github.com/ovn-org/ovn-kubernetes/blob/227539ee442e84f504c3d545cb26bbdce65bee6f/go-controller/pkg/node/node_smartnic.go#L157
Other places are calling
SetAnnotationsOnPod
directly:that creates a merge patch with the annotations passed as paremeter https://github.com/ovn-org/ovn-kubernetes/blob/227539ee442e84f504c3d545cb26bbdce65bee6f/go-controller/pkg/kube/kube.go#L69
If my reading is correct, this will wipe out existing annotations on the pod and add only the new one
The goal is:
SetAnnotationsOnPod