Commit Graph

58 Commits

Author SHA1 Message Date
Jerome Brette
d783bbc0bc DeepEqual method seems cleaner than adding Defaulting before every
reflect.DeepEqual call
2019-07-25 03:52:25 +00:00
Jerome Brette
b7405f3872 Test new types.Var.DeepEqual method. 2019-07-25 03:50:28 +00:00
Jerome Brette
abc419b5f9 Add Absorb method to VarSet and DeepEqual to Var 2019-07-25 03:42:40 +00: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
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
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
798b61c8ef Add copy method to VarSet 2019-06-07 13:22:07 -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
Jeffrey Regan
bcc7412ef2 Make kusttestharness shareable. 2019-05-07 14:23:33 -07:00
Jeffrey Regan
8991bcb399 Collect existing internal pkgs under one roof. 2019-04-23 11:53:50 -07:00
jregan
76a3179868 Simplify plugin loader code.
* use one place to build plugin file names,
 * use one loader instance,
 * test for plugin enabled flag in just one place to
   avoid errors and reduce if statements,
 * don't return private objects,
 * factor goplugin loading to a method,
 * fix a related test that was commented out.
2019-04-22 10:13:40 -07:00
jregan
16fe7ced6a Cleanup plugin builds. 2019-04-06 13:16:46 -07:00
Jingfang Liu
4f1a2350ce add transformer plugins 2019-04-05 10:16:10 -07:00
Jeffrey Regan
48717f3f30 Switch to black box testing of KustTarget and Resource 2019-02-11 16:40:09 -08:00
jregan
1a03dcabde Test missing file report 2019-02-10 15:37:11 -08:00
Kubernetes Prow Robot
713c06354f Merge pull request #748 from Liujingfang1/version
add group name as kustomize.config.k8s.io
2019-02-01 13:54:36 -08:00
Jingfang Liu
84057436d6 Combine generatorArgs and generatorOptions into options of Resource 2019-01-31 15:32:32 -08:00
Jingfang Liu
199763dec8 add group name to kustomize.config.k8s.io 2019-01-30 09:48:12 -08:00
Jingfang Liu
2fa4a34589 replace commands/envcommand by DataSource in SecretGenerator 2019-01-16 11:17:34 -08:00
jregan
50a8b27854 Introduce ResAccumulator. 2019-01-04 15:26:07 -08:00
jregan
4583c4a9de More custom transform coverage. 2018-12-28 06:38:05 -08:00
jregan
037f898f81 Make KustTarget test harness to reduce boilerplate. 2018-12-24 11:38:49 -08:00
Jingfang Liu
1cd99ab68e change current version from v1 to v1beta1 2018-12-20 15:32:06 -08:00
Jeffrey Regan
47a04f2648 More fully in-memory integration tests. 2018-12-18 10:26:19 -08:00
jregan
0665371590 Forbid Var name collisions in a kustomization stack 2018-12-17 15:19:58 -08:00
Jeffrey Regan
ecb83c6ae1 Add KustTarget.getAllVars Test 2018-12-17 14:54:55 -08:00
jregan
243cbae411 Convert file system based test to in-memory. 2018-12-17 12:45:50 -08:00
Jingfang Liu
b6b2fb9c62 add apiVersiond and kind in tests to reduce test noise 2018-12-14 14:58:13 -08:00
Jeffrey Regan
352ec69556 Allow directory substrings in cycle check. 2018-12-13 15:57:49 -08:00
Jeffrey Regan
e9b19281b2 Add some resId tests to support refactor. 2018-12-13 14:19:04 -08:00
k8s-ci-robot
621ed52bab Merge pull request #556 from zoncoen/name-suffix-2
Add nameSuffix field to kustomization.yaml
2018-11-20 08:50:22 -08:00
zoncoen
04a030bcf0 enable nameSuffix field of kustomization.yaml 2018-11-19 12:09:47 +09:00
Jingfang Liu
25415c5501 Remove -t flag in build and add configurations field in kustomization.yaml 2018-11-16 13:44:18 -08:00
Jeffrey Regan
a8fbe35ecf Rename disableHash to disableNameSuffixHash 2018-10-30 11:36:00 -07:00
Jingfang Liu
1020167e22 Revert "Skip adding nameprefix to namespace" 2018-10-26 14:42:27 -07:00
Benjamin Elder
76ba38cec5 make k8sdeps.NewFactory() importable 2018-10-25 17:21:58 -07:00
Jingfang Liu
23963e854a skip hash transformer when DisableHash is set to true 2018-10-19 14:44:23 -07:00
Jingfang Liu
90d03b0afe Skip adding nameprefix to namespace 2018-10-18 13:52:11 -07:00
Jingfang Liu
d33d154e14 split k8sdeps package into sub packages 2018-10-11 11:30:46 -07:00
Jingfang Liu
c33a97fcf2 move transformerconfig package to transformers/config 2018-10-10 15:12:32 -07:00
Jingfang Liu
2953dad221 add MakeHashTransformer in TransformerFactory; remove hash interface 2018-10-10 14:05:13 -07:00
Jeffrey Regan
2283c06971 Consolidate transformer config creation to factory. 2018-10-10 12:33:19 -07:00
Jingfang Liu
96091dfcf5 remove decoder interface since it is only used inside k8sdeps 2018-10-10 11:08:23 -07:00
Jingfang Liu
f783486057 hide core/v1 behind interface 2018-10-09 15:50:52 -07:00
Jeff Regan
30814302af Fix some minor naming mistakes. (#434)
* Fix some minor naming mistakes.

* Fix some minor naming mistakes.
2018-10-08 15:58:44 -07:00
Jingfang Liu
78de5374ed hide patch transformer behind interface 2018-10-08 15:15:03 -07:00
jregan
4eb2757847 Further isolate unstructured with factories. 2018-10-08 11:52:38 -07:00