* 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>
* Refactor prefix filter into its own filter, decoupled from the prefixsuffix filter
* Refactor prefix transformer into its own transformer, decoupled from the prefixsuffix transformer
* Refactor suffix filter into its own filter, decoupled from the prefixsuffix filter
* Refactor suffix transformer into its own transformer, decoupled from the prefixsuffix transformer
* Add a default nameSuffix field spec in addition to the namePrefix
* Remove the PrefixSuffixTransformer from the list of builtin transformers
* Add a multi-transformer to builtinhelpers.TransformFactories
* Remove the implementation of the prefixsuffixtransformer.PrefixSuffixTransformer
* Resolve style and format related feedback from the pull request
* Add test to test the legacy PrefixSuffixTransformer for BC purposes
This commit adds functionality for a user to specify that `helm` should
include CRDs when inflating a Helm Chart.
As of Helm v3, the `install-crd` hook is no more, with
`CustomResourceDefinitions` existing in the root of the chart, under the
`crds` directory.
When calling `helm template`, `helm` does not output these CRDs unless
the user passes the `--include-crds` flag to the command.
With this commit, users can set `includeCRDs: true` as part of their helm
chart definition in `kustomize.yaml` to have these included as part of
the output.
Signed-off-by: Devon Mizelle <devon.mizelle@onepeloton.com>
This PR
- defines a patch conflict detector interface,
- extracts implementations of the interface from the
merginator code, making the merginator code
independent of --enable_kyaml.
- injects those implementations into kustomize
as a function of --enable_kyaml.
So, instead of using different merginators to combine
resmaps, this pr allows the use of a single patch merge
code path that uses different conflict detectors.
So instead of debating how to merge, we're now only
considering whether to warn on conflict detection
in one transformer.
This PR is in service of #3304, eliminating seven
instances where --enable_kyaml was consulted. These
were cases where conflict detection wasn't an issue
(but merging patches was).