Skip to content

Commit

Permalink
add resource finalizer step in AccumulateResource
Browse files Browse the repository at this point in the history
  • Loading branch information
koba1t committed Nov 29, 2023
1 parent 1a91e8d commit 09b3195
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions api/internal/target/kusttarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ func (kt *KustTarget) AccumulateResource(path string) (rm resmap.ResMap, err err
if err := kt.accumulateResource(ra, path); err != nil {
return nil, fmt.Errorf("failed to accumulateResource: %w", err)
}

// The following steps must be done last, not as part of the recursion implicit in AccumulateTarget.
if err := kt.addHashesToNames(ra); err != nil {
return nil, errors.Wrap(err)
}
// Given that names have changed (prefixs/suffixes added), fix all the back references to those names.
if err := ra.FixBackReferences(); err != nil {
return nil, errors.Wrap(err)
}
// With all the back references fixed, it's OK to resolve Vars.
if err := ra.ResolveVars(); err != nil {
return nil, fmt.Errorf("failed to apply 'vars': %w", err)
}
if err := kt.IgnoreLocal(ra); err != nil {
return nil, errors.Wrap(err)
}

return ra.ResMap(), nil
}

Expand Down

0 comments on commit 09b3195

Please sign in to comment.