Commit Graph

206 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
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
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
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
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
9c36ac28fa Improve comments in name transform code. 2019-06-10 16:58:16 -07:00
jregan
0e4f9acb6e Rename ErrorIfNotEqual to ErrorIfNotEqualSets 2019-06-06 20:20:48 -07:00
Jeffrey Regan
4162dbc2d8 Maintain resources in order loaded. 2019-06-06 15:55:57 -07:00
Tom Wieczorek
03e518f0ea Merge branch 'master' into transformer-no-create-arrays 2019-05-29 12:18:59 +02:00
wlezzar
e6d1de0d72 fix commonLabels spec for volumeClaimTemplates 2019-05-28 22:27:28 +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
Jian Qiu
8f413f523c Add name reference of storageClass 2019-05-22 14:43:15 +08:00
Jeffrey Regan
79906d73d0 Add builtin namespace transformer plugin 2019-05-21 13:56:36 -07:00
Jian Qiu
5e33ac4a09 Allow nil label and annotaion
This fix is to allow value of lable or annoation to be nil
2019-05-21 13:55:19 +08:00
Jeffrey Regan
9a4cb6c991 Delete unused code. 2019-05-13 12:15:30 -07:00
Jingfang Liu
61d46c26b8 fix the boilerplate copyright header (#1064) 2019-05-10 10:20:20 -07:00
rohitsardesai83
b67d713bc0 Remove dependency on ghodss/yaml 2019-04-25 23:47:01 +05:30
Jeffrey Regan
8991bcb399 Collect existing internal pkgs under one roof. 2019-04-23 11:53:50 -07:00
Kubernetes Prow Robot
ed146f656e Merge pull request #988 from mengqiy/nscluster
fix namespace transformer for cluster-scoped resources
2019-04-18 11:16:04 -07:00
Mengqi Yu
bcb697eb0b fix namespace transformer for cluster-scoped resources 2019-04-18 11:03:19 -07:00
Alastair Firth
5be42092af Vars should expand in ingress/spec/tls/secretName
https://github.com/kubernetes-sigs/kustomize/issues/799
2019-04-16 23:36:05 +02:00
Jingfang Liu
826affb8dd generate configmap for pruning 2019-04-08 14:10:49 -07:00
jregan
b32e041bfe Remove some duped code. 2019-04-06 16:14:12 -07:00
Jingfang Liu
4f1a2350ce add transformer plugins 2019-04-05 10:16:10 -07:00
jregan
440d036176 some transformer plugins 2019-04-04 13:23:41 -07:00
Yujun Zhang
2490e605c3 Updates in image transformer (#911)
- Decouple `mutateImage` from `updateContainers` to be reused as `mutateFunc`
- Ignore default image transform error for CRD which may contain non-array type `containers` field

Related to #890, #904, fixes #890
2019-03-29 13:11:07 -07:00
Michael Heyvaert
4848987a1f fix configmap/secret name references for cronjobs with projected volumes 2019-03-29 09:00:00 +01:00
Jeffrey Regan
267eec5509 Fix 918 2019-03-26 10:47:31 -07:00
Jingfang Liu
bfc3655bad skip adding namespace when the object is empty 2019-03-19 15:34:29 -07:00
Kubernetes Prow Robot
2c0c0c9497 Merge pull request #841 from yujunz/transformers/image
Support custom configuration for image transformer
2019-03-19 14:08:22 -07:00
Kubernetes Prow Robot
f09bbff35c Merge pull request #884 from vreon/fix-varrefs
Fix incorrect and missing varReferences
2019-03-17 06:12:56 -07:00
Yujun Zhang
7130e3ff1d Leave defautconfig empty for images
`containers` and `initContainers` of *ANY* kind in *ANY*
path are builtin supported in code
2019-03-17 16:43:31 +08:00
Yujun Zhang
abf538d80d Keep backward compatibility for image transformer 2019-03-17 16:43:31 +08:00
Yujun Zhang
f311ba8d4f Support custom config for image transformer 2019-03-17 16:43:31 +08:00
Yujun Zhang
3e85c4589b Load default config for image transformer 2019-03-17 16:43:31 +08:00
Yujun Zhang
d0cf047381 Convert image transformer test to a more readable format 2019-03-17 16:41:42 +08:00
Jesse Dubay
31091a8df2 Fix missing varrefs for CronJob, Job, ReplicaSet 2019-03-16 19:15:56 -07:00
Jesse Dubay
e207ae4c01 Fix incorrect default varrefs for CronJob volumeMounts 2019-03-16 19:12:58 -07:00
Jesse Dubay
3011f18047 Sort default varReference config by kind, path 2019-03-16 19:11:42 -07:00
Yordi Pauptit
62d3200e4f fix typo in namereference where serviceaccount name would not resolve 2019-03-14 09:36:21 +01:00
Yordi Pauptit
f7cd44be42 add job initcontainer to varreference config 2019-03-11 15:13:58 +01:00
mnatsu31
559efd6477 Fix typo in namereference path for cronjobs initContainers. 2019-03-08 13:20:34 +09:00