Commit Graph

723 Commits

Author SHA1 Message Date
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
Jeff Regan
7dd02c1766 Merge pull request #1111 from keleustes/master
Improvment var and varRefs handling
2019-06-18 14:17:27 -07:00
Ian Howell
ed03818e20 This commit enhances the UnstructAdapter
* Added support for arbitrary data types rather than just strings
* Added support for integer index-able arrays
* Improve code coverage for kunstruct
  - kunstruct around 90%
  - helper at 100%
* Update expansion.Expand method to preserve the original type of the variable
* Ensure the int field such .spec.replicas can be used
  as a source in a first Deployment or as destination of a variable (in the
  second Deployment variable).
2019-06-18 13:43:01 -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
Jeffrey Regan
8d9897d5a5 Add the rmBuilder test helper. 2019-06-13 16:15:43 -07:00
jregan
755dd3d024 Add some utilities. 2019-06-12 20:43:39 -07:00
Jeffrey Regan
5e054c9d31 Add originalName field to resource. 2019-06-12 16:30:03 -07:00
Jeff Regan
4bb4a85037 Merge pull request #1149 from qiujian16/var-reference
Keep var refernce in resources
2019-06-12 09:50:06 -07:00
Jian Qiu
7e12918f75 Keep var refernce in resources 2019-06-12 10:51:19 +08:00
jregan
11bb176a3f Push suffix/prefix code to plugin. 2019-06-11 19:37:06 -07:00
jregan
49d94f5318 Rename the prefix/suffix transformer. 2019-06-11 17:47:23 -07:00
Jeffrey Regan
0fa2d9c32c Add --reorder flag. 2019-06-11 12:52:53 -07:00
Jeffrey Regan
9c36ac28fa Improve comments in name transform code. 2019-06-10 16:58:16 -07:00
Kubernetes Prow Robot
e1e622d985 Merge pull request #1165 from monopole/hoser
Add test for ordered transformers.
2019-06-07 18:09:06 -07:00
Jeffrey Regan
6d309b52a5 Introduce stacked transformers. 2019-06-07 16:16:58 -07:00
Jeffrey Regan
52faa01ecf Cover #1155 with a test. 2019-06-07 16:11:54 -07:00
Jeffrey Regan
449175e3a6 Add a sorting plugin. 2019-06-07 15:06:12 -07:00
Jeffrey Regan
798b61c8ef Add copy method to VarSet 2019-06-07 13:22:07 -07:00
Jeffrey Regan
d9b0c4c84c Add copy method to VarSet 2019-06-07 13:01:34 -07:00
jregan
0e4f9acb6e Rename ErrorIfNotEqual to ErrorIfNotEqualSets 2019-06-06 20:20:48 -07:00
Jeffrey Regan
c63ebbdfc4 Preserve order when merging. 2019-06-06 20:01:39 -07:00
Jeffrey Regan
4162dbc2d8 Maintain resources in order loaded. 2019-06-06 15:55:57 -07:00
jingfangliu
0375137296 fix the bug for patching CRDs 2019-06-04 10:20:24 -07:00
Jeffrey Regan
81c98c855f Convert inventory transformer to plugin, reduce k8sdeps. 2019-06-02 10:49:01 -07:00
Damien Robichaud
d4842ebd90 Cleanup the replica plugin implementation. 2019-05-31 13:28:51 -07:00
Damien Robichaud
5000a2e503 Implement replica transformer as patch alternative 2019-05-31 13:10:34 -07:00
Kubernetes Prow Robot
c4f79eff51 Merge pull request #1141 from monopole/releaseNotes
Update 2.1 release notes.
2019-05-30 17:02:23 -07:00
jregan
1dd448e65c Update 2.1 release notes before release. 2019-05-30 15:33:30 -07:00
Jeff Regan
ab3fed06c7 Merge pull request #1112 from Liujingfang1/validator
add validation transformer
2019-05-30 13:38:18 -07:00
Jingfang Liu
b4dbac1b84 add validation transformer 2019-05-30 10:10:16 -07:00
Jeffrey Regan
fd2248e7c2 Move hashing transformer out of k8sdeps. 2019-05-29 13:51:41 -07:00
Tom Wieczorek
03e518f0ea Merge branch 'master' into transformer-no-create-arrays 2019-05-29 12:18:59 +02:00
jregan
ee728d58f5 Move hashing code out of k8sdeps. 2019-05-28 21:46:46 -07:00
Jeff Regan
6be6ade6d7 Merge pull request #1131 from monopole/updateMinecraft
Update minecraft version in example.
2019-05-28 18:40:13 -07:00
Jeffrey Regan
ca478016c9 Update minecraft version in example. 2019-05-28 18:32:23 -07:00
Jeffrey Regan
a7a2589e81 Fix yaml in generator examples. 2019-05-28 18:21:07 -07:00
wlezzar
e6d1de0d72 fix commonLabels spec for volumeClaimTemplates 2019-05-28 22:27:28 +02:00
Tom Wieczorek
c9a5c03eaa Convert legacy file based test to in-memory 2019-05-28 11:27:21 +02:00
Tom Wieczorek
c2eda0a172 Merge branch 'master' into transformer-no-create-arrays 2019-05-28 11:27:04 +02:00
Tom Wieczorek
c470982ce5 Make transformer configs array-aware
If path segments end with the special marker `[]` in transformer configs, this
indicates that the respective path segment is supposed to be an array. That
information may be used to suppress the meaningless creation of non-existent
paths that should be arrays, not objects.
2019-05-28 11:26:33 +02:00
Jian Qiu
68f6b0be6e Add Webhookconfiguration in default name references 2019-05-28 14:02:32 +08:00
jregan
47c965481f Reduce k8ds deps 2019-05-27 15:37:03 -07:00
Jeffrey Regan
6a10654618 Delete the KV plugin code. 2019-05-24 16:49:16 -07:00
Jeff Regan
e4205c125c Merge pull request #1104 from mgoltzsche/master
Order ValidatingWebhookConfig last.
2019-05-23 09:43:22 -07:00