26 Commits

Author SHA1 Message Date
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
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
Cailyn
8ab4b8d167 remove direct dependency on github/pkg/errors (#4970) 2023-01-13 10:52:25 -08: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
614e853db3 Confine calls to ApplyToJSON. 2021-01-07 20:31:10 -08:00
Donny Xia
ff276af317 use same logic with path transformer 2020-11-03 17:14:08 -08: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
Morten Torkildsen
d051588789 Add json6902 patch filter based on kyaml libraries 2020-04-06 18:59:10 -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
Jeffrey Regan
0fe95a2f74 Add another resmap test. 2019-07-01 11:17:46 -07:00
jregan
5de0673db1 Push json transform code down to plugin. 2019-06-30 17:30:52 -07:00
jregan
a7df00c07a Starting v3 release for plugin developers.
[doc]: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

Per this Go modules [doc] a repo or branch that's
already tagged v2 or higher should increment the major
version (e.g. go to v3) when releasing their first Go
module-based packages.

At the moment, the kustomize repo has these top level
packages in the sigs.k8s.io/kustomize module:

 - `cmd` - holds main program for kustomize

	 Conceivably someone can depend on this
	 package for integration tests.

 - `internal` - intentionally unreleased subpackages

 - `k8sdeps` - an adapter wrapping k8s dependencies

	 This exists only for use in pre-Go-modules kustomize-into-kubectl
	 integration and won't live much longer (as everything involved is
	 switching to Go modules).

 - `pkg` - kustomize packages for export

	 This should shrink in later versions, since
	 the surface area is too large, containing
	 sub-packages that should be in 'internal'.

 - `plugin` - holds main programs for plugins

This PR changes the top level go.mod file from

```
module sigs.k8s.io/kustomize
```

to

```
module sigs.k8s.io/kustomize/v3
```

and adjusts all import statements to
reflect the change.
2019-06-23 15:05:59 -07:00
Jeffrey Regan
4bc31f4b2a Move pluginator to cmd directory. 2019-06-18 10:16:46 -07:00
Jeffrey Regan
3a01a63a01 Simplify code base.
- In ResMap, drop concept of internal Id to Resource
   map.  The ResMap is now (just) a list, allowing only
   very particular edits.

 - Resources should now be maintained in the order
   loaded.  A later PR can adjust tests to remove the
   internal legacy sorting, and confirm order-out is
   predictable from order-in.  The PR would suppress
   the sort in tests, and reorder the output to make
   all tests pass again, and confirm that the new order
   matched depth-first input traversal.  The FromMap
   fixture function was removed from all test inputs to
   establish a predictable input order.

 - Resources now have two 'Ids', OriginalId and
   CurrentId.  The former is fixed as
   GVK-name-namespace at load time, the latter changes
   during transformations.  The latter can be used to
   narrow name references when the former maps to
   multiple resources.  We allow bases to be loaded
   more than once in a build (a diamond pattern), so
   the OriginalId is not unique across the resources
   set.  The CurrentId is (and must be) unique, but is
   constantly mutating.  Failing to make this
   distinction clear, and attempting to maintain a
   mapping from a single mutating Id to a resource was
   making the code too complex.

 - Drop prefix/suffix from ResId - the ResId is now
   immutable.  A later PR can remove the distinction
   with ItemId.

 - This PR increases coverage of ResMap is since this
   is a large refactor.  Higher level tests didn't need
   much change outside reordering of results at the
   resource level.
2019-06-17 10:50:45 -07:00
Jeffrey Regan
b28aaae66b Break a bad dep. 2019-05-22 07:39:36 -07:00
Jeffrey Regan
0df5883853 Add builtin JSON patch transformer 2019-05-20 15:38:46 -07:00