Commit Graph

118 Commits

Author SHA1 Message Date
koba1t
6489e35b7c improve error messages 2023-01-07 03:30:16 +09:00
yugo kobayashi
5fed0f76c8 refactor Unmarshal Kustomization struct code 2022-12-13 21:04:50 +00:00
yugo kobayashi
faddb49c89 remove FixKustomizationPreUnmarshalling 2022-12-13 18:50:25 +00:00
Natasha Sarkar
2db573b6a0 drop support for legacy patches (#4911)
* drop support for legacy patches

* fix CI
2022-12-07 18:06:24 -08: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
Kubernetes Prow Robot
b20e611413 Merge pull request #4723 from koba1t/emit_a_warning_when_deprecated_fields_are_used
Emit a warning on build when deprecated fields are used
2022-11-16 08:32:50 -08:00
Kubernetes Prow Robot
7ee6dd551d Merge pull request #4733 from koba1t/feat/add_edit-fix_for_patchesStrategicMerge_to_patches
add `edit fix` for patchesStrategicMerge to patches
2022-10-21 14:57:57 -07:00
Lars Kellogg-Stedman
38da7ca15c Add support for helm --no-hooks flag
This commit adds the `skipHooks` option to the helm chart support in order
to  expose the --no-hooks flag introduced to Helm in [1].

Using Kustomize to inflate a Helm chart would in some situations result in
different results than using `helm install`. This is because `helm
template`, by default, will render chart tests in the `templates/test`
directory, which can lead to undesired resources in the output.

See [2] for additional discussion.

[1]: https://github.com/helm/helm/pull/6444
[2]: https://github.com/helm/helm/issues/6443

Signed-off-by: Lars Kellogg-Stedman <lars@oddbit.com>
2022-10-07 17:14:06 -04:00
yugo kobayashi
401cf9579c update golangci-lint v1.49.0 2022-09-22 13:24:40 +00:00
yugo kobayashi
21ee7f7125 Emit a warning when deprecated fields are used 2022-09-01 23:02:50 +00:00
yugo kobayashi
032bf3338e update checker code in patchStrategicMerge 2022-08-28 17:20:21 +00:00
yugo kobayashi
bb7ebe029c support file path patch to patchesStrategicMerge 2022-08-06 20:28:48 +00:00
yugo kobayashi
64f42ea45f add edit-fix for patchesStrategicMerge to patches 2022-08-06 20:28:48 +00:00
Agustina Barbetta
5948f6aa63 [Address #3937] Add labels to template/metadata if includeTemplates is true (#4209)
* add labels in template/metadata by default

* update comment

* fix kustomization labels test

* Add spec/template/metadata/labels when includeTemplate is true

* remove unnecessary test changes

* add error wrap

* Revert "add error wrap"

This reverts commit 0a203df83edb90a400b35d5521487b984619e919.

* add error wrap at template fieldSpec merge
2022-05-05 11:24:22 -07:00
Dipto Chakrabarty
a464ed0c59 add tagsuffix to take image tag suffix (#4364)
* add tagsuffix to take image tag suffix

* add comments to warn about specifications

* add test and error handle

* fix indent

* update comment

* fix merge errors and return updates

* update image update and fix example

* fix yamls formats

remove tabs in yamls

fix space in image name

tag error in name

* fix spacing issue

format of yaml

set example as above

* spacing of spec in testing templates

* change to switch case
2022-04-14 10:00:47 -07:00
Katrina Verey
0fa010c7e7 Add missing boilerplate 2022-04-04 14:24:04 -04:00
Katrina Verey
71bf0d5d14 Update full linter list and enable some easily resolved new ones 2022-03-31 11:37:26 -04:00
Katrina Verey
14947e449b Address new linter complaints 2022-03-31 11:37:26 -04:00
Dingzhu Lurong
b1086ac49b fix broken link 2022-03-09 16:00:59 +08:00
Natasha Sarkar
bcebad1664 new command kustomize edit add buildmetadata (#4413)
* new command kustomize edit add buildmetadata

* new commands kustomize edit set buildmetadata and kustomize edit remove buildmetadata
2022-01-26 15:34:50 -08:00
natasha41575
9577d61167 move origin to be an attribute of KustTarget 2022-01-19 17:26:19 -08:00
natasha41575
2c23b960ff set transformer annotation when the option is specified 2022-01-19 17:17:47 -08:00
natasha41575
2554d690c8 deprecate enable-managedby-label flag in favor of a field 2022-01-19 16:53:27 -08:00
natasha41575
a8f58b4080 collect origin data only when the option is set 2021-12-13 11:38:03 -08:00
natasha41575
d8f406d06f add omitempty tag to replacement sources and targets 2021-11-08 12:33:30 -08:00
Natasha Sarkar
1e1b9b484a exec function working dir is the kustomization that referenced it (#4125)
* exec function working dir is the kustomization that referenced it

* suggested changes

* more code review

* use a field instead of an annotation

* more code review
2021-08-19 20:15:24 -07:00
Natasha Sarkar
3350c7213c option for origin data as annotation 2021-08-12 20:09:41 -07:00
Natasha Sarkar
9a27a9f19f replace genargs with two separate annotations 2021-07-29 15:46:09 -07:00
Natasha Sarkar
91f74e8d16 replace Resource.options with annotations (#4061) 2021-07-23 18:19:05 -07:00
Khris Richardson
727e24f365 append AsCurrentUser to FnPluginLoadingOptions 2021-06-15 12:29:59 -07:00
Natasha Sarkar
7458a53a73 copy method for selector 2021-06-08 11:18:38 -07:00
Natasha Sarkar
cf6e6ca4db omitempty for replacement type 2021-06-08 11:18:27 -07:00
Jeff Regan
d9435bd1b1 Merge pull request #3898 from dmizelle/add-helm-include-crds
Add includeCRDs Field to HelmChart
2021-05-27 16:04:07 -07:00
Natasha Sarkar
5a2a7709a4 add IAMPolicyGenerator 2021-05-26 16:54:38 -07:00
Devon Mizelle
73da51d0ac Apply suggestions from code review
Co-authored-by: Steven E. Harris <seh@panix.com>
2021-05-17 12:18:33 -04:00
Devon Mizelle
df10d5a17d Add includeCRDs Field to HelmChart
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>
2021-05-14 16:46:30 -04:00
Kubernetes Prow Robot
b8e7cf04b6 Merge pull request #3832 from cehoffman/helm-chart-namespace
Add ability to set target namespace for helm chart template
2021-05-11 13:09:13 -07:00
monopole
c8dddac5b9 Move resid package from api to kyaml 2021-04-30 20:39:32 -07:00
monopole
c828b1e49a Use resid.ResId in replacements. 2021-04-23 09:30:05 -07:00
Chris Hoffman
53f78260a9 Add ability to set target namespace for helm chart template 2021-04-22 18:31:26 -05:00
Jeff Regan
06add3ab35 Merge pull request #3737 from natasha41575/ReplacementTransformer
replacement transformer that uses the new replacement filter
2021-04-22 11:22:51 -07:00
Kubernetes Prow Robot
21e65990c1 Merge pull request #3795 from jlandowner/master
Support immutable attribute on generators
2021-04-15 22:36:22 -07:00
Natasha Sarkar
038bc7713b add replacement transformer 2021-04-15 14:12:33 -07:00
jlandowner
82ff64c374 Support immutable attribute on generators 2021-04-13 01:02:58 +00:00
monopole
240cda089a Add flag --enable-helm 2021-04-12 13:40:21 -07:00
monopole
3af1ae4159 Enhance test harness. 2021-04-11 18:14:30 -07:00
Natasha Sarkar
a40c74e545 use field options to refine replacements 2021-04-09 11:15:49 -07:00
Natasha Sarkar
0fe3f303e8 add use of rejects field in replacement filter 2021-04-07 16:00:18 -07:00
Natasha Sarkar
94c45e0f9f add more tests for replacement filter 2021-04-02 11:30:10 -07:00
Kubernetes Prow Robot
ca527a8e4c Merge pull request #3735 from natasha41575/ReplacementFilter
add replacement filter to support replacmenttransformer
2021-03-31 18:03:21 -07:00