Skip to content

Commit

Permalink
Throw an error if legacySortOptions is set and sortOrder is not legacy
Browse files Browse the repository at this point in the history
Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
  • Loading branch information
yanniszark committed Jun 30, 2021
1 parent df6d041 commit 324895e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/internal/target/kusttarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ func (kt *KustTarget) AccumulateTarget() (
// (or empty if the Component does not have a parent).
func (kt *KustTarget) accumulateTarget(ra *accumulator.ResAccumulator) (
resRa *accumulator.ResAccumulator, err error) {
if kt.Kustomization().LegacySortOptions != nil &&
kt.Kustomization().SortOrder != nil &&
*kt.Kustomization().SortOrder != types.LegacySortOrder {
return nil, errors.Errorf("'legacySortOptions' can't be set if 'sortOrder' is '%s'", types.LegacySortOrder)
}
ra, err = kt.accumulateResources(ra, kt.kustomization.Resources)
if err != nil {
return nil, errors.Wrap(err, "accumulating resources")
Expand Down

0 comments on commit 324895e

Please sign in to comment.