kyaml/fn/framework ensures the annotation output format matches the input

If the input only contains legacy format anntations (path, index, id), the
output will be the same.
This commit is contained in:
Mengqi Yu
2021-11-17 14:06:20 -08:00
parent 2f115223cc
commit 5caed5b90a
5 changed files with 186 additions and 218 deletions

View File

@@ -116,8 +116,21 @@ func Execute(p ResourceListProcessor, rlSource *kio.ByteReadWriter) error {
}
rl.FunctionConfig = rlSource.FunctionConfig
// We store the original
nodeAnnos, err := kio.StoreInternalAnnotations(rl.Items)
if err != nil {
return err
}
retErr := p.Process(&rl)
// If either the internal annotations for path, index, and id OR the legacy
// annotations for path, index, and id are changed, we have to update the other.
err = kio.ReconcileInternalAnnotations(rl.Items, nodeAnnos)
if err != nil {
return err
}
// Write the results
// Set the ResourceList.results for validating functions
if len(rl.Results) > 0 {