Ramiro Algozino
24ea1b951a
fix(kustomize): call json6902 only when needed
...
Call json6902 transformer only when there are patches to apply.
Addresses #5956
2025-10-02 19:51:09 +02:00
Adoram Shoval
9043c223d4
feat: add PatchArgs API type to populate patch options
...
This commit converts the Options section of a patch into an object instead of map.
This allows better clarification of the available options.
2025-08-08 07:34:20 -04:00
Julio Chana
31b37540e3
fix: Allow patches with empty files with multiple newlines or comments ( #5771 )
...
* fix: Add test, when an empty patch file is given, it should not fail
* fix: Add code so there's no error given if an empty file is given as a patch
* chore: Generate plugin with pluginator
* chore: fix tests
Signed-off-by: Julio Chana <julio.chana@lokalise.com >
* Add t.helper() at start of test function
Signed-off-by: Julio Chana <julio.chana@lokalise.com >
---------
Signed-off-by: Julio Chana <julio.chana@lokalise.com >
2025-03-16 19:15:48 -07:00
Stephen Kitt
bcf100f592
Use canonical json-patch v4 import
...
The canonical import for json-patch v4 is
gopkg.in/evanphx/json-patch.v4 (see
https://github.com/evanphx/json-patch/blob/master/README.md#get-it for
reference).
Using the v4-specific path should also reduce the risk of unwanted v5
upgrade attempts (see
https://github.com/kubernetes/kubernetes/pull/120327 for context).
Signed-off-by: Stephen Kitt <skitt@redhat.com >
2024-02-16 12:23:04 +01:00
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
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
Katrina Verey
a612cd2b7e
Fix pluginator incompatibility with nolint lines
2022-11-30 11:22:10 -05:00
Julian van den Berkmortel
b6cb6c8ae9
fix build annotations getting lost after applying JSON 6902 patch
2021-11-10 23:02:42 +01:00
monopole
82abd7e9ea
Simplify kind and name change code.
2021-05-09 16:20:39 -07:00
Ma Xinjian
677ec868e0
Fix golint warning
...
golint warning: if block ends with a return statement, so drop this else and outdent its block
Signed-off-by: Ma Xinjian <maxj.fnst@fujitsu.com >
2021-04-30 09:22:57 +08:00
Natasha Sarkar
f96ac2d61e
allow general name and kind changes via an options field in patches
2021-03-10 14:58:58 -08:00
Natasha Sarkar
f71854a0c8
Refactored resource to store all previous names and namespaces
2021-02-03 12:01:09 -08:00
Natasha Sarkar
bd4580d73a
Manage name changes (prefix/suffix) via YAML annotations rather than via in-memory-only fields.
2021-01-11 13:08:45 -08:00
monopole
614e853db3
Confine calls to ApplyToJSON.
2021-01-07 20:31:10 -08:00
jregan
4a55a07c14
Patchtransformers - drop copied code, improve deletion handling.
2020-11-30 11:58:43 -08:00
Natasha Sarkar
7c8c827a88
added IsEmpty() method
2020-09-30 12:17:14 -07:00
Natasha Sarkar
c93274c224
changed way to test for empty resource
2020-09-29 17:33:12 -07:00
Natasha Sarkar
f5feffbd23
fix for the patchdelete test
2020-09-28 13:28:06 -07:00
Natasha Sarkar
e17bab7e55
updated to include namespace
2020-09-28 11:01:01 -07:00
Natasha Sarkar
bd534441ce
fixed issue 2896
2020-09-28 11:01:01 -07:00
Donny Xia
31b395a33f
handle the "$patch: delete" in patch transformer
2020-09-21 11:46:39 -07:00
jregan
33e68c0f97
Removing YAMLSupport==false code path.
...
This continues work on the master and v3.8.* branches
to eliminate apimachinery dependence.
2020-07-10 19:06:26 -07:00
jregan
d3a7335bbc
Switch namespace and patch transformers to kyaml.
2020-07-04 16:21:01 -07:00
jregan
e783af2881
Delegate to Kunstructured.
2020-06-19 15:06:13 -07:00
Jeffrey Regan
9c75afca58
PatchTransfomer readability mods.
2020-04-15 18:48:59 -07:00
Morten Torkildsen
ef592606a0
Update PatchTransformer to use kyaml filters
2020-04-13 21:25:02 -07:00
Jeffrey Regan
46524d3b6a
Introduce API module.
2019-10-21 13:30:31 -07:00
jregan
3af5a8afea
Make resource, resmap public.
2019-10-20 10:51:20 -07:00
Jeffrey Regan
e5c8b5ec8f
Start api directory, which will become a module.
2019-10-17 14:01:20 -07:00
jregan
07d2500ee3
Make types package public.
2019-10-16 16:41:43 -07:00
Jeffrey Regan
41a008e9a3
Start pluglib, a set of public, plugin specific functions.
2019-10-14 19:43:55 -07:00
Jeffrey Regan
baa0296a12
Reduce size of pgmconfig package
2019-10-03 18:22:05 -07:00
Jeffrey Regan
def4f04572
Depend on new pluginator location.
2019-09-24 16:43:53 -07:00
jingfangliu
8c53d77111
update edit fix to convert the old patches to patchesStrategicMerge
2019-07-23 10:38:48 -07:00
jingfangliu
ed0cfc685b
add test for extended patch with overlapping patches
2019-07-16 15:16:00 -07:00
jingfangliu
3c05e2d664
add extended patch transformer
2019-07-12 14:34:08 -07:00