Commit Graph

105 Commits

Author SHA1 Message Date
Niklas Wagner
278dd6e55d fix: performance recession when propagating namespace to helm (#5971)
* fix: performance recession when propagating namespace to helm

* fix: handle passing namespace downstream more elegant

* Revert "fix: handle passing namespace downstream more elegant"

This reverts commit 976a7cf2aa.

* Revert "fix: performance recession when propagating namespace to helm"

This reverts commit c7612d1dba.

* fix: use annotation to identify helm chart generated resources

* fix: deduplicate code

* fix: missing import in NamespaceTransformer.go

* ci: allow manual trigger of pipeline in fork

* Revert "ci: allow manual trigger of pipeline in fork"

This reverts commit 8948788fe2.

* fix: test cases

* chore: fix code comment was on wrong line

* chore: fix code comment was on wrong line pt2
2025-09-29 14:08:19 -07:00
yugo kobayashi
87d0629bd1 update go 1.24.6 (#5959)
* update go 1.24.6

* fix non-constant format string error

* update golang.org/x/tools@v0.36.0 and github.com/golangci/golangci-lint@v1.64.8 to pass execute golangci-lint

* add a verpose diff output to prow test

* remove pluginator binary version from generated files
2025-08-17 13:05:12 -07:00
isarns
e6266d4559 refactor: fix test with not 'items:' 2024-09-09 13:26:33 +03:00
isarns
77daec89b8 refactor: inlineAnyEmbeddedLists 2024-08-13 14:35:46 +03:00
isarns
a1fd6efe5d feat: annotation to disable list conversion 2024-08-11 17:44:44 +03:00
Yusuke Abe
ed09399cd1 fix: return error instead of log.Fatalf() (#5625)
* fix: return error instead of log.Fatalf()

* chore: add meaningful message to error output

* chore: add meaningful message to fatal function
2024-04-18 03:56:51 -07:00
Jonathan King
b3d1df2644 Fix name in a configMapRef missing hash #5047 (#5236)
* Add regression tests

* Update PrefixesSuffixesEquals function

* Try empty prefix/suffix but fall back on duplicates

* Run gofmt

* Remove newline

* Revert unnecessary gofmt change

* Add comment
2024-04-02 12:44:11 -07:00
Karl Isenberg
43868688d5 Use require for Error and NoError
Assert keeps going after failure, but require immediately fails
the tests, making it easier to find the output related to the test
failure, rather than having to comb through a bunch of subsequent
assertion failures. For equality tests, we may or may not want to
continue, but for error checks we almost always want to immediately
fail the test. Exceptions can be changed as-needed.
2024-03-20 13:19:18 -07:00
Matthew Hughes
8aafbacd17 Fix null YAML values being replaced by "null"
Related issues:

* https://github.com/kubernetes-sigs/kustomize/issues/5031
* https://github.com/kubernetes-sigs/kustomize/issues/5171

After noting this behaviour was not present in
d89b448c74 a `git bisect` pointed to the
change 1b7db20504. The issue with that
change is that upon seeing a `null` node it would replace it with a node
whose value was equivalent but without a `!!null` tag. This meant that
one application of a patch would have the desired approach: the result
would be `null` in the output, but on a second application of a similar
patch the field would be rendered as `"null"`.

To avoid this, define a new attribute on `RNode`s that is checked before
clearing any node we should keep. The added
`TestApplySmPatch_Idempotency` test verifies this behaviour.

See also https://github.com/kubernetes-sigs/kustomize/pull/5365 for an
alternative approach
2024-03-09 17:31:35 +00:00
chansuke
e002b49244 hotfix: return error instead of log at FromMapAndOption (#5381)
* hotfix: return error instead of log at `FromMapAndOption`

* chore: show error message

* hotfix: use correct function

* hotix: use `t.Helper()` and fix `t *testing.T order

* hotfix: wrapt the error of `FromMapAndOption`

* hotfix: meaningful message for an error

* hotfix: summarize in one line

* hotfix: fix the abandoned error and show meaningful message

* hotfix: start with helper function

* Keep TODO comment
2023-10-27 23:01:47 +02:00
Varsha Prasad Narsing
7911b2c001 [refactor]: Internalize loader api
This PR intends to move the loader api to
internal. Only the necessary methods which
are needed for the api have been put into
`pkg/loader.go`.

Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
2023-09-28 10:49:45 -04:00
Kubernetes Prow Robot
8f75682b9c Merge pull request #4834 from elisshafer/generators/retain_disable_suffix_hash
api/resource: retain disableNameSuffixHash on merge and replace
2023-01-24 09:50:19 -08:00
Katrina Verey
7e000aa820 Remove manipulation of .git suffix, which is just a conventional part of the directory name 2023-01-17 23:04:16 -05:00
Eli Shafer
487703ee8f api/resource: retain disableNameSuffixHash on merge. 2022-12-07 22:18:37 -08:00
Yunchi Luo
e62480d11c Rewrite remoteload_test integration tests (#4783)
* Better error message when git clone fails

* support file:// URLs

* rewrite remoteload_test

* lint and test fix

* fixes for kverey's comments

* document file:// remote load

* replace assert with require where appropriate

* add tests for file:// without git suffix

* fixes plus pr review from natasha

* fixes for review, lint

* revert changes to error handling

* fix skipped test
2022-09-19 09:13:18 -07:00
Katrina Verey
04e1663b70 appendCsVAnnotation must mutate the annotations RNode in place
Otherwise, it is incompatible with filters like fieldSpec.Filter that recurse through a tree of RNodes. In the case of the bug this commit fixes, the leaf RNode is a metadata.annotation value field, and appendCsvAnnotation is called immediately before updating that leaf's value. If appendCsvAnnotation replaces the entire metadata.annotation RNode on the resource, the leaf RNode that gets updated is no longer attached to the resource.

Alternatively, `func (f Filter) setScalar` could be updated to change
the value of the leaf RNode BEFORE calling appendCsvAnnotation. However,
the modification of the entire metadata segment of the RNode in a
function that nominally just edits an annotation feels like a
side-effect prone to creating other difficult-to-debug situations,
beyond this ordering dependency.
2022-07-11 19:58:49 -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
Rafael Leal
97de780feb Fix error during expansion of !!merge <<: anchor tags (#4383)
* WIP

* Fix merge corner cases

* Add test for explicit !!merge tag

* Fix tests

* Cleanup

* Cleanup

* Fix deanchoring lists

* Add test case for keeping comments

* Add MapEntrySetter and fix json marshalling after deanchoring

* Keep duplicated keys

* Move MergeTag definition to yaml alias

* Remove go-spew from api

* Add support for sequence nodes on merge tags

* Add docstring to MapEntrySetter.Key

* Add docstring to MapEntrySetter struct

* Add tests to MapEntrySetter

* Fix duplicate merge key

* Revert whitespace changes on forked go-yaml

* Remove AssocMapEntry function

* Refactoring merge order

* Return errors on VisitFields and PipeE

* Add tests for each non-conforming map merges
2022-03-23 09:36:17 -07:00
natasha41575
2c23b960ff set transformer annotation when the option is specified 2022-01-19 17:17:47 -08:00
natasha41575
4f21d60045 helper methods, types, and unit tests for transformer annotations 2021-12-29 15:27:34 -08:00
Natasha Sarkar
964bb38ba2 add origin annotation for resources generated by generators (#4341)
* add origin annotation for resources generated by builtin and custom generators

* decouple origin data from generator data and account for inline generators
2021-12-23 10:40:29 -08:00
natasha41575
6dfc238aa2 improve gvk and resid strings for error messages 2021-12-22 11:39:07 -08:00
natasha41575
a8f58b4080 collect origin data only when the option is set 2021-12-13 11:38:03 -08:00
Mengqi Yu
bd7bad19a1 add to BuildAnnotations 2021-11-19 12:13:12 -08:00
natasha41575
b4a69f08c0 provide utility helpers for preserving internal annotations 2021-10-29 12:30:55 -07:00
Jeff Regan
dd579c905d Merge pull request #4180 from yuwenma/fix-4124
[Fix 4124]  Skip local resource until all transformations have completed.
2021-09-24 08:05:19 -07:00
Jeff Regan
22b735885a Merge pull request #4190 from natasha41575/MigrateIndexPathIdAnnotations
Migrate index path id annotations
2021-09-24 08:00:15 -07:00
monopole
dce4ea5846 Add AnchorsAweigh option to ByteReader to toggle YAML alias/anchor expansion 2021-09-22 12:44:08 -07:00
Natasha Sarkar
67a5f6d68f support krm spec v1 and legacy path, index, and id annotations 2021-09-17 17:10:10 -07:00
Yuwen Ma
f4382738ab [fix 4124] Skip local resource until all transformations have completed.
Resources annotated as "local-config" are expected to be ignored. This skip local resource happens in "accumulateResources" which happens before any transformation operations.
However, the local resource may be needed in transformations.
Thus, this change removes the "drop local resource" logic from accumulateResources and removes these local resource after all transformation operations and var operations are done.

Note:
None of the existing ResMap functions can drop the resource slice easily: "Clear" will ruin the resource order, "AppendAll" only adds non-existing resource, "AbsorbAll" only add or modify but not delete.
Thus, we introduce a new func "Intersection" for resourceAccumulator that specificaly removes the resource by ID and keep the original order.
2021-09-16 11:15:05 -07:00
monopole
e17a007719 Clean up factor_test before adding DeAnchor call 2021-09-15 17:26:50 -07:00
Jeff Regan
6c4e8019f8 Merge pull request #4094 from brianpursley/merge3-test
Add unit tests to cover existing behavior of three way merge and strategic merge patch
2021-08-19 07:41:18 -07:00
Natasha Sarkar
3350c7213c option for origin data as annotation 2021-08-12 20:09:41 -07:00
brianpursley
aabbea3e78 Add unit tests for current behavior of strategic merge patch 2021-08-02 20:36:55 -04:00
Natasha Sarkar
9a27a9f19f replace genargs with two separate annotations 2021-07-29 15:46:09 -07:00
Natasha Sarkar
97e7cb1512 remove annotations added by the kyaml reader 2021-07-27 17:56:58 -07:00
Natasha Sarkar
91f74e8d16 replace Resource.options with annotations (#4061) 2021-07-23 18:19:05 -07:00
Natasha Sarkar
a84badb834 replace Resource.refBy with annotations 2021-07-07 15:22:36 -07:00
Francesc Campoy
7fae7d1bd6 Move api/filesys to kyaml/filesys (#3997)
* Move api/filesys to kyaml/filesys

* Add deprecated version of api/filesys with aliases to new code

* Use new kyaml/filesys package and update dependencies

* Migrate to kyaml/filesys and update dependencies

* Skip tests that break on Windows
2021-06-16 11:42:00 -07:00
monopole
86dd74fd62 Gather some string slice utils. 2021-06-10 13:34:20 -07:00
Natasha Sarkar
6adefe4562 replacements should be able to use previous IDs 2021-06-03 12:14:27 -07:00
Donny Xia
23544e0431 code review 2021-06-01 16:25:41 -07:00
Donny Xia
b1fda3d62e add an option to include local configs 2021-06-01 13:38:36 -07:00
monopole
5c4e363f11 Remove delegation to RNode in Resource. 2021-05-11 10:49:17 -07:00
monopole
01ddeb476d Introduce resmap.ApplyFilter. 2021-05-10 20:47:57 -07:00
monopole
82abd7e9ea Simplify kind and name change code. 2021-05-09 16:20:39 -07:00
monopole
660847225d Simplify gvk, speed up cluster-scoped checks. 2021-05-02 13:17:33 -07:00
monopole
c8dddac5b9 Move resid package from api to kyaml 2021-04-30 20:39:32 -07:00
Natasha Sarkar
038bc7713b add replacement transformer 2021-04-15 14:12:33 -07:00