Commit Graph

249 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
c23039c07a Merge pull request #1379 from keleustes/namespace
Update Namespace and Name simultaneously
2019-07-23 14:10:14 -07:00
Kubernetes Prow Robot
5747c417c4 Merge pull request #1363 from Liujingfang1/patch
update edit fix to convert the old patches to patchesStrategicMerge
2019-07-23 13:16:14 -07:00
jingfangliu
8c53d77111 update edit fix to convert the old patches to patchesStrategicMerge 2019-07-23 10:38:48 -07:00
Jerome Brette
01667cabde Update Namespace and Name simultaneously (2/2)
Add tests combining prefixsuffix and namespace transformers.
2019-07-23 11:04:59 -05:00
Jerome Brette
99eb08eb1e Add Namespace to var definition to allow disambiguation 2019-07-19 12:08:38 -05:00
Jerome Brette
0bec7b996b Code review implementation for namespace needed in vars 2019-07-18 19:20:10 -05:00
Jerome Brette
dd5674fe6b ResId.Equals usable for VariableRef.
- Namespace need objRef field in variable declaration
- Add namespace conflict test for variables

The replacement of ResId.GkvnEquals reference by ResId.Equals
highligthed the fact it is no possible yet when looking for
variable targets because the namespace field is not allowed yet.
This commit adds two tests to the namespaces_test.go regarding
that use case.
2019-07-18 19:20:10 -05:00
Jerome Brette
b43bd5440d Update Issue 1264 Reproduction Test 2019-07-16 18:17:33 -05:00
Kubernetes Prow Robot
878960d7b1 Merge pull request #1355 from Liujingfang1/patch
enable extended patch transformer and add tests
2019-07-16 15:58:34 -07:00
jingfangliu
ed0cfc685b add test for extended patch with overlapping patches 2019-07-16 15:16:00 -07:00
Jerome Brette
e5ebca6604 Test tracking issue "patchesStrategicMerge elements can be dropped"
- Issue 1354
- $patch: delete is ignored or not depending of the include order
  in the kustomization.yaml
2019-07-15 19:02:52 -05:00
jingfangliu
f5fc9acb84 fix local test failures 2019-07-15 18:59:16 -05:00
jingfangliu
6f74419628 fix local test failures 2019-07-15 16:34:13 -07:00
jingfangliu
a85f297f31 enable extended patch transformer and add tests 2019-07-15 15:45:08 -07:00
Kubernetes Prow Robot
7872405379 Merge pull request #1336 from richardmarshall/fix_test_flags
Remove go testing flags from kustomize help
2019-07-15 13:13:24 -07:00
jingfangliu
eeed1954fb include nameprefix and namesuffix to find matched reference for cluster level kinds 2019-07-12 10:27:02 -07:00
jingfangliu
33fff655db move strategic merge patch transformer to a builtin transformer 2019-07-11 13:39:30 -07:00
Jingfang Liu
31ab347da2 refactor the strategic merge patch transformer toward moving it to a plugin (#1340) 2019-07-11 10:22:56 -07:00
Richard Marshall
095333ffb1 Update references to NewEnvForTest 2019-07-10 20:43:50 -07:00
jingfangliu
49b32473ca fix the regression on merging configmap with different namespace 2019-07-09 13:39:19 -07:00
Jeff Regan
60a990d660 Merge pull request #1297 from arrikto/feature-complex-overlay-composition
Add complex overlay composition test
2019-07-02 13:41:52 -07:00
Ioannis Androulidakis
5ad012e6d9 Add complex overlay composition test
Signed-off-by: Ioannis Androulidakis <ioannis@arrikto.com>
Signed-off-by: Alex Pyrgiotis <apyrgio@arrikto.com>
2019-07-02 19:26:04 +03:00
Jeffrey Regan
8a454de8f9 Fix 1281 2019-07-01 18:09:48 -07:00
Jeffrey Regan
701d2c9597 Add a test combining imagetag and jsonpatch 2019-07-01 17:58:46 -07:00
jregan
8b373ab587 Add more json transformer examples. 2019-07-01 08:52:55 -07:00
Alex Pyrgiotis
79d0de7000 Update the diamond composition test case
Refactor the existing base, so that one of the overlays patches an
already present field of the base resource. Previously, all overlays
added a new field in the base deployment, which made this case easier to
solve, with a merge of the produced YAMLs from each overlay.

Also, fix a typo in the comments.

Signed-off-by: Alex Pyrgiotis <apyrgio@arrikto.com>
Signed-off-by: Ioannis Androulidakis <ioannis@arrikto.com>
2019-07-01 14:57:59 +00:00
jregan
5de0673db1 Push json transform code down to plugin. 2019-06-30 17:30:52 -07:00
jregan
116b37813a stackedOverlays 2019-06-30 08:45:37 -07:00
jregan
f62af4ebf3 Define some constants in a test for later reuse. 2019-06-30 08:42:15 -07:00
jregan
0554da9d6e Switch to apps/v1 in various tests. 2019-06-30 07:45:29 -07:00
Jeff Regan
fa1fd9fbd7 Merge pull request #1283 from arrikto/feature-diamond-composition-test
Add diamond composition test with multiple patches
2019-06-30 06:56:56 -07:00
Seth Pollack
2126b6cf23 use ObjectMeta instead of name and namespace fields 2019-06-29 23:30:50 -04:00
Ioannis Androulidakis
2b052fdd55 Add diamond composition test with multiple patches
The purpose of this commit is to demonstrate a composition use case,
that combines multiple overlays that patch the same base resource.

Signed-off-by: Ioannis Androulidakis <ioannis@arrikto.com>
Signed-off-by: Alex Pyrgiotis <apyrgio@arrikto.com>
2019-06-29 22:05:30 +03:00
Jeffrey Regan
0ceefcf39d Repo bug 1044 2019-06-28 11:29:48 -07:00
Jeffrey Regan
a60d99fdc9 Fix 972 2019-06-27 17:37:12 -07:00
Jeffrey Regan
3cef37bdb2 Add diamond base test. 2019-06-27 16:10:58 -07:00
jregan
cc0fffc67b Fix some random Go nits. 2019-06-25 20:46:56 -07:00
Jerome Brette
2bba0a6aa3 Support for ConfigMap generator with identical names in different namespaces.
- Attempt to account, at build time, for subsequent kubectl apply behavior.
  (empty or no namespace means default).
- Account for the fact that not all objects have a namespace.
- Add new Equal method to ResId address merge name conflict
- Add GroupByName to resources by namespaces to resolve filenames conflict
- Added corresponding unit tests.
- Change the fail test for issue #1155
2019-06-25 13:39:32 -05:00
Seth Pollack
9cc2c90a4b allow reuse of plugins 2019-06-24 21:09:13 -04: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
jregan
a722cca80a Remove SopsEncodedSecretsPlugin 2019-06-23 09:46:45 -07:00
Jeffrey Regan
3eedc40595 More var test coverage. 2019-06-21 13:53:58 -07:00
Jerome Brette
e3a46cb6ce Leverage new variables during testing
Extract the HTTP port (int) from the container section end
use it in the service definition.

Also enable variable replacement for Service object.
2019-06-18 18:37:20 -05:00
Jeffrey Regan
cc531af665 Deprecate 'bases:' field. 2019-06-18 10:36:58 -07:00
Richard Vodden
000f81b21c Added test to verify usage of multiline strip chomp in configMapGenerator 2019-06-18 17:19:11 +01:00
Jeffrey Regan
57eecd7497 Fix test broken by the change in ordering. 2019-06-18 07:30:29 -07:00
Jeff Regan
7ce6181bce Merge pull request #610 from twz123/transformer-no-create-arrays
Proposal: Make transformer configs array-aware
2019-06-17 16:22:09 -07:00
Jeffrey Regan
0b555e1b2c Modify tests to present expected data in unsorted order.
Modify all `build` tests to use the raw,
non-sorted output of build.  This makes every test
provide coverage for how kustomize re-orders (or
doesn't reorder) resources during processing.

Going forward, the ordering of resources in
_expected_ output should match the depth-first
ordering specified in the `resources:` field used
in the test's kustomization file.

The only exception to this rule would be tests
that actually confirmed some other output
ordering, e.g. the test of the
`LegacyOrderTransformer` plugin.

Fixes #756
Related #821
2019-06-17 16:02:23 -07:00
Damien Robichaud
8d4b6452d4 Make the replica transformer kind aware.
The previous implementation had a bug and poorly handled
types that should not have a `spec: replica:` field.

Documentation is updated to reflect the change in behavior,
and better highlights the cases where a patch should be
used instead of this shorthand.
2019-06-17 11:33:31 -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