Commit Graph

20 Commits

Author SHA1 Message Date
Katrina Verey
d70315fed6 Remove Inventory field from Kustomization
This field has not done anything since v3.5.5. It was missed in the cleanup in https://github.com/kubernetes-sigs/kustomize/pull/2421
2023-01-12 19:11:44 -05:00
Yannis Zarkadas
a502717460 Make ordering configurable (#4019)
* api: Add new types for customizeable resource ordering

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Implement SortOrderTransformer plugin

Implement the SortOrderTransformer plugin. This plugin allows the user
to customize the order that kustomize will output resources in.

The API for the plugin is the following:

sortOptions:
  order: legacy | fifo
  legacySortOptions:
    orderFirst:
    - {GVK}
    orderLast:
    - {GVK}

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Add boilerplate and generate code for new SortOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* build: Add option to denote if the reorder flag was set by the user

We want to take different actions if the reorder flag was set by the
user or filled by the default value. Thus, we propagate this information
from build to the krusty options.

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* api/krusty: Ensure sort ordering works with CLI flag and kustomization

Sort order can be defined in two places:
- (new) kustomization file
- (old) CLI flag
We want the kustomization file to take precedence over the CLI flag.

Eventually, we may want to move away from having a CLI flag altogether:
https://github.com/kubernetes-sigs/kustomize/issues/3947

Case 1: Sort order set in kustomization file AND in CLI flag.
Print a warning and let the kustomization file take precedence.

Case 2: Sort order set in CLI flag only or not at all.
Follow the CLI flag (defaults to legacy) and reorder at the end.

Case 3: Sort order set in kustomization file only.
Simply build the kustomization.

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* krusty: Add e2e test for SortOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Purge LegacyOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* Update go.work.sum

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* review: Make review changes

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
2022-12-02 13:59:53 -08:00
Katrina Verey
3255c73c71 Loader FS and empty env fix 2021-03-24 18:44:29 -07:00
Natasha Sarkar
f96ac2d61e allow general name and kind changes via an options field in patches 2021-03-10 14:58:58 -08:00
monopole
839fd2b971 Remove branching on kyaml enablement 2021-03-09 14:29:27 -08:00
monopole
003b4946a2 Delete --enable_kyaml flag. 2021-02-12 09:26:36 -08:00
monopole
8c6a9f6495 Move plugin lister to avoid import cycle. 2021-01-07 18:46:04 -08:00
jregan
24c4c66403 Close 3343 2020-12-26 10:43:58 -08:00
jregan
1426137883 Isolate scalar quoting oddities to one test set.
The apimachinery code path, in its final marshalling
for output, calls Marshall

  https://github.com/go-yaml/yaml/blob/v2/yaml.go#L199

This code path (via apimachinery Unstructured types)
has no JSON schema tags

  https://yaml.org/spec/1.2/spec.html#id2803311

so it adds quotes to values that smell like
booleans and ints (e.g. `false` becomes `"false"`).

The kyaml code path, OTOH, uses such tags,
so generally does not quote ints and booleans.

This PR isolates this difference in behavior to
one set of tests (using data fields in configmaps
in api/krusty/configmaps_test.go) so that
they don't confuse other tests that cover
completely different behaviors.
2020-12-23 17:08:25 -08:00
jregan
735befef19 Add kunstruct impl of Get/SetDataMap, replace Resource.Merge 2020-12-21 07:22:03 -08:00
Natasha Sarkar
deb2b21cbe added allowresourceidchanges bool to options struct 2020-12-02 18:02:09 -08:00
jregan
e91cdb5eba Checkpoint 2020-08-23 19:46:08 -07:00
jregan
f051acb83c Clean up option construction. 2020-08-23 12:06:48 -07:00
Jingfang Liu
4b117c4736 support option for adding managed-by label 2020-06-08 13:08:10 -07:00
jregan
077c7b2d20 Improve config package names and reduce API exposure. 2019-11-03 16:39:44 -08:00
jregan
4c15c42447 Remove error return from constructor. 2019-11-03 06:37:04 -08:00
Jeffrey Regan
a45eca7e22 move load restrictions 2019-11-02 10:34:33 -07:00
Jeffrey Regan
69d1699963 Move plugin config to main config package. 2019-11-01 16:31:00 -07:00
Jeffrey Regan
4716cb026f Simplify building api. 2019-10-28 13:36:14 -07:00
jregan
6d30bc5c35 Make krusty package - high-level CLI-like package. 2019-10-27 08:19:56 -07:00