@@ -183,6 +183,11 @@ func (s *objectSyncer) syncObjectSpec(log *zap.SugaredLogger, source, dest syncS
183183 lastKnownSourceState .SetAPIVersion (sourceObjCopy .GetAPIVersion ())
184184 lastKnownSourceState .SetKind (sourceObjCopy .GetKind ())
185185
186+ // update annotations (this is important if the admin later flipped the enableClusterPaths
187+ // option in the PublishedResource)
188+ sourceKey := newObjectKey (source .object , source .clusterName , source .clusterPath )
189+ ensureAnnotations (sourceObjCopy , sourceKey .Annotations ())
190+
186191 // now we can diff the two versions and create a patch
187192 rawPatch , err := s .createMergePatch (lastKnownSourceState , sourceObjCopy )
188193 if err != nil {
@@ -276,6 +281,9 @@ func (s *objectSyncer) ensureDestinationObject(log *zap.SugaredLogger, source, d
276281 sourceObjKey := newObjectKey (source .object , source .clusterName , source .clusterPath )
277282 ensureLabels (destObj , sourceObjKey .Labels ())
278283
284+ // put optional additional annotations on the new object
285+ ensureAnnotations (destObj , sourceObjKey .Annotations ())
286+
279287 // finally, we can create the destination object
280288 objectLog := log .With ("dest-object" , newObjectKey (destObj , dest .clusterName , logicalcluster .None ))
281289 objectLog .Debugw ("Creating destination object…" )
@@ -318,6 +326,7 @@ func (s *objectSyncer) adoptExistingDestinationObject(log *zap.SugaredLogger, de
318326 // the destination object from another source object, which would then lead to the two source objects
319327 // "fighting" about the one destination object.
320328 ensureLabels (existingDestObj , sourceKey .Labels ())
329+ ensureAnnotations (existingDestObj , sourceKey .Annotations ())
321330
322331 if err := dest .client .Update (dest .ctx , existingDestObj ); err != nil {
323332 return fmt .Errorf ("failed to upsert current destination object labels: %w" , err )
0 commit comments