Commit Graph

34 Commits

Author SHA1 Message Date
Stephen Kitt
bf485f66d3 Revert "Switch to json-patch v5"
This reverts commit b692e49b1e.

The json-patch bump in k/k was reverted, so the corresponding bump in
kustomize should be reverted too.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-12-07 18:40:29 +01:00
Arthur Outhenin-Chalandre
790ca0e7b6 helm: add kube-version and api-versions on CLI args
It makes sense to add that as a CLI args since you could use one single
kustomization file/helm chart for multiple clusters. Also it's easier to
have those on the CLI if the user has some kind of tooling that will end
up calling kustomize and that could pass those (i.e.: ArgoCD is doing
that for Helm so it could do that for Kustomize as well that will end up
calling Helm as well).

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@ledger.fr>
2023-11-02 16:46:41 +01:00
Ardika Bagus
cc35d3c4e5 fix: fix while using local charts with version
fix https://github.com/kubernetes-sigs/kustomize/issues/5163

Signed-off-by: Ardika Bagus <me@ardikabs.com>
2023-11-02 06:22:11 +07:00
Dustin Lish
a0f131cf86 Fix using same helm chart with different versions (#4999)
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue #4813

* Use if/else for readability, add version check to absChartHome
2023-11-02 06:22:11 +07:00
Jan-Otto Kröpke
d64ac13447 kustomize: Add support for OCI based helm repos (#5167)
* kustomize: Add support for OCI based helm repos

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* Update api/internal/builtins/HelmChartInflationGenerator.go

* Update plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go

* go fmt

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* s/expectedHelmExternalDns/expectedHelmExternalDNS

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* commit

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* commit with content

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* Apply suggestions from maintainer

* go work sync

* added test

---------

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
2023-10-17 21:24:00 +02:00
yugo kobayashi
59696d1ace fix a patch files accept multiple patches (#5194)
* fix a patch files accept multiple patches

* fix comments and variable name

* add error handling when using not allowed multiple strategic-merge patches

* fix error message of Multiple Strategic-Merge Patch file

* refactor transformStrategicMerge()

* add TODO comment and test for Multiple JSON patch Yaml documents are not allowed

* refactoring PatchTransformer

* add multiple patch test for PatchTransformer package

* improve error message to PatchTransformer

* refactor const and error message check

* fix some error messages
2023-09-15 16:20:13 -07:00
Stephen Kitt
b692e49b1e Switch to json-patch v5
json-patch was bumped to v5 in k/k as a result of
https://github.com/kubernetes/kubernetes/pull/118384; this aligns with
that, but switches to the v5 module, which is documented as
gopkg.in/evanphx/json-patch.v5.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-08-26 08:42:07 +02:00
Natasha Sarkar
3d6f40bd5e Revert "Fix using same helm chart with different versions (#4999)"
This reverts commit 0f244a4a07.
2023-05-09 13:16:22 -05:00
Dustin Lish
0f244a4a07 Fix using same helm chart with different versions (#4999)
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue #4813

* Use if/else for readability, add version check to absChartHome
2023-04-24 15:09:02 -07:00
Kubernetes Prow Robot
5dff9df1f7 Merge pull request #5099 from justinsb/dont_swallow_helm_errors
Don't swallow helm execution errors
2023-03-20 12:35:09 -07:00
justinsb
c151147258 Don't swallow helm execution errors
These are otherwise hard to debug.
2023-03-20 19:14:07 +00:00
justinsb
317fcadccb Fix unused error value
The linter was complaining about err being unchecked.
2023-03-20 19:11:11 +00:00
Katrina Verey
8338873e56 Changes from local test run 2023-03-13 18:40:16 -04:00
Natasha Sarkar
1957d5c746 support for more helm template args (#4926)
* support for more helm template args

* move templateArgs and unit tests to api/types

* undo package name change

* use our own simple helm chart instead of forking one

* add argument to AsHelmArgs

* code review

* lint errors
2023-02-01 10:19:05 -08:00
Anna Song
fb294921f5 Localize helm fields (#4978)
* Localize helm fields

* Address readability feedback

* Handle edge cases

* Improve readability

Split copyChartHome and use existence to prevent repeated copying.
2023-01-26 12:56:26 -08:00
Cailyn
8ab4b8d167 remove direct dependency on github/pkg/errors (#4970) 2023-01-13 10:52:25 -08:00
Katrina Verey
2b38c12c83 Add uncommitted plugin change and missing makefile dep 2023-01-13 12:53:35 -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
a612cd2b7e Fix pluginator incompatibility with nolint lines 2022-11-30 11:22:10 -05:00
yugo kobayashi
3e6ede9645 fix_failed_lint_on_master 2022-11-04 07:12:46 +00:00
sun min
f9d553689e update dependencies of libs using go workspace mode 2022-11-02 13:44:23 +08: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
Katrina Verey
55a37de686 Fix other linters on modified lines 2022-08-10 19:34:25 -04:00
Katrina Verey
f6b72077c8 Stop using deprecated ioutil functions 2022-08-10 18:22:46 -04:00
Katrina Verey
0c37ee89af Option to customize NamespaceTransfomer role binding subject handling 2022-07-27 23:12:55 -04:00
Katrina Verey
0c6e827ab8 Option to customize NamespaceTransformer overwrite behaviour (#4708)
* Option to customize NamespaceTransformer overwrite behaviour

* Code review feedback
2022-07-14 12:00:58 -07:00
koba1t
8c8a2125b7 update all go.mod to go1.18 2022-06-29 05:14:33 +09:00
Anna Song
3fdf88d10e Allow tests to only run locally (#4664)
* Allow tests to only run locally

Allow tests that are flaky or currently unsupported on the server to run locally

* Address feedback
2022-06-08 10:04:23 -07:00
Anna Song
c0dc68d6e7 Add url tests
Write comprehensive suite of integration tests for remote resources, as specified by Issue #4588
2022-05-03 13:53:03 -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
roopeshvs
d1d578c392 support for multiple replacements in a single file 2022-03-04 12:46:45 +05:30
Katrina Verey
a86723c3a3 Fix regression 4388 2022-02-02 12:36:03 -05:00
Julian
3dbc88bf94 Refactor the PrefixSuffixTransformer into separate prefix- and suffix transformers (#4318)
* 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
2021-12-22 12:01:06 -08:00
Yuwen Ma
a1c5d79d94 Move api/builtin to internal 2021-11-22 15:54:18 -08:00