Move inventory annotation addition

This commit is contained in:
Sean Sullivan 2021-08-17 11:09:58 -07:00
parent b146dfa233
commit aa79285f4b
2 changed files with 4 additions and 2 deletions

View File

@ -75,6 +75,10 @@ func (a *Applier) prepareObjects(localInv inventory.InventoryInfo, localObjs []*
if err := inventory.ValidateNoInventory(localObjs); err != nil {
return nil, nil, err
}
// Add the inventory annotation to the resources being applied.
for _, localObj := range localObjs {
inventory.AddInventoryIDAnnotation(localObj, localInv)
}
// If the inventory uses the Name strategy and an inventory ID is provided,
// verify that the existing inventory object (if there is one) has an ID
// label that matches.

View File

@ -140,8 +140,6 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
taskContext.CaptureResourceFailure(id)
continue
}
// add the inventory annotation to the resource being applied.
inventory.AddInventoryIDAnnotation(obj, a.InvInfo)
ao.SetObjects([]*resource.Info{info})
klog.V(5).Infof("applying %s/%s...", info.Namespace, info.Name)
err = ao.Run()