Commit Graph

98 Commits

Author SHA1 Message Date
Richard Marshall
fe8ba8e44b Log loader errors during resource accumulation 2019-08-15 07:59:55 -07:00
jingfangliu
33fff655db move strategic merge patch transformer to a builtin transformer 2019-07-11 13:39:30 -07:00
Seth Pollack
2126b6cf23 use ObjectMeta instead of name and namespace fields 2019-06-29 23:30:50 -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
Jeffrey Regan
cc531af665 Deprecate 'bases:' field. 2019-06-18 10:36:58 -07:00
Jian Qiu
7e12918f75 Keep var refernce in resources 2019-06-12 10:51:19 +08:00
Jeffrey Regan
c63ebbdfc4 Preserve order when merging. 2019-06-06 20:01:39 -07:00
Jeffrey Regan
81c98c855f Convert inventory transformer to plugin, reduce k8sdeps. 2019-06-02 10:49:01 -07:00
Jeffrey Regan
fd2248e7c2 Move hashing transformer out of k8sdeps. 2019-05-29 13:51:41 -07:00
jregan
47c965481f Reduce k8ds deps 2019-05-27 15:37:03 -07:00
Jeffrey Regan
79906d73d0 Add builtin namespace transformer plugin 2019-05-21 13:56:36 -07:00
Jeffrey Regan
f621543d9c Cleanup kusttarget. 2019-05-21 11:40:23 -07:00
jregan
a352ff3923 True and false are mysterious. 2019-05-21 10:58:43 -07:00
Jeffrey Regan
0df5883853 Add builtin JSON patch transformer 2019-05-20 15:38:46 -07:00
jregan
aafc23a615 Add annotation transformer. 2019-05-19 19:04:29 -07:00
jregan
45901219b7 Add builtin label transformer. 2019-05-19 18:20:18 -07:00
Jeffrey Regan
621bb7c6c5 Add builtin NameTransformer plugin. 2019-05-16 12:34:08 -07:00
Jeffrey Regan
939de0cdbe Dogfood the plugin framework.
This PR:

* provides a code generator that converts
  kustomize Go plugins to normal code, i.e.
  the plugin appears as
    t := builtin.NewImageTagTransformer()
  instead of
    p := plugin.Open("imagetagtransformer.so")
    s := p.Lookup(someSymbol)
    t, ok = s.(Transformer)

* converts the main processing thread in
  kusttarget.go to use those factory calls to run
  builtin generators and transformer before
  calling user-supplied plugins,

* as an example, provides an imagetag transformer
  plugin, converting a legacy transformer to
  builtin plugin form with its own isolated test.
  This test can be expanded by moving more code
  into it, but that can be done in a later PR.

Writing core functionality as plugins assures a
maintained plugin authoring and testing framework,
assures modularity, provides meaningful plugin
examples, and gives us a means to make informed
choices on which kustomize packages to publish
(and which to move to internal/).  The code
generator allows all this without losing "go get
sigs.k8s.io/kustomize" functionality.

TODO:

  1) Convert remaining legacy transformers to
     plugins (patch SMP/JSON, name prefix/suffix,
     labels/annos) with their own tests.  The
     generators are already done; this PR wires
     them up, and all tests & examples pass.

  2) Push code down into the plugins, as the first
     pass at conversion writes plugins as thin
     layers over calls into code under the mess
     that is pkg/.  Once this is done, we can
     reasonably move all the packages that aren't
     imported by plugins to internal/.

This PR could be split in two, one to merge the
the generator, and the second to merge the
ImageTagTransformer plugin and its wiring into the
main flow.

The latter PR could then serve as an example for
converting the remaining transformers.
2019-05-16 10:07:28 -07:00
Jeffrey Regan
529db0493b Introduce envs field. 2019-05-06 14:35:48 -07:00
rohitsardesai83
b67d713bc0 Remove dependency on ghodss/yaml 2019-04-25 23:47:01 +05:30
Kubernetes Prow Robot
38ec207609 Merge pull request #1004 from Liujingfang1/prune
change field name: prune -> inventory
2019-04-22 15:14:07 -07:00
Jingfang Liu
b4fc1e4357 change field name: prune -> inventory 2019-04-22 11:25:14 -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
9a85071085 Delete kustomizationerror.
Do a longstanding TODO to remove kustomizationerror.

It wasn't used much, and it wasn't used consistently,
because it's complicated to decided when it's worth
proceeding to accumulate errors when one already knows
that one has a fatal error in the kustomization.  Its
use was blocking refactoring for simplicity and making
tests harder to write.

Removing it lets us reinstate the cyclomatic complexity
check in KustTarget.

Also added more info to the affected error messages.
2019-04-21 16:10:58 -07:00
Kubernetes Prow Robot
ee68a9c450 Merge pull request #957 from monopole/justTheFactsMaam
Define a plugin compiler.
2019-04-08 18:33:04 -07:00
jregan
175c754f61 Define a plugin compiler. 2019-04-08 18:05:31 -07:00
Jingfang Liu
826affb8dd generate configmap for pruning 2019-04-08 14:10:49 -07:00
jregan
ffc16d51e0 Add secret generator. 2019-04-06 18:38:22 -07:00
jregan
b32e041bfe Remove some duped code. 2019-04-06 16:14:12 -07:00
Kubernetes Prow Robot
38029d1836 Merge pull request #951 from Liujingfang1/generatorplugins
add support for generator go-plugins
2019-04-06 13:40:26 -07:00
jregan
16fe7ced6a Cleanup plugin builds. 2019-04-06 13:16:46 -07:00
Jingfang Liu
7493732176 add generator plugins 2019-04-05 13:51:56 -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
Jeffrey Regan
9a12b55139 Move accumulator code to its own package. 2019-03-26 09:53:52 -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
jregan
103c1b3a4f Put goplugins behind flag. 2019-03-17 13:39:48 -07:00
Yujun Zhang
3e85c4589b Load default config for image transformer 2019-03-17 16:43:31 +08:00
jregan
c06b95077d Secret/configmap factory cleanup. 2019-03-15 09:25:59 -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
Alexander Brand
242b9209d8 Improve error msg returned when no kustomization file is found
Signed-off-by: Alexander Brand <alexbrand09@gmail.com>
2019-02-07 17:09:57 -05:00
Jingfang Liu
e905704b0c allow apiVersion and Kind to be empty or specific values 2019-02-04 13:08:09 -08:00
Jingfang Liu
84057436d6 Combine generatorArgs and generatorOptions into options of Resource 2019-01-31 15:32:32 -08:00
Kubernetes Prow Robot
0bd2a1e232 Merge pull request #722 from Liujingfang1/removeDeprecates
remove patches and imageTags from kustomization.yaml
2019-01-25 14:41:06 -08:00
Jingfang Liu
c461f1f766 remove patches and imageTags from kustomization.yaml 2019-01-25 14:26:17 -08:00
Jingfang Liu
f7a59178a8 support different filenames for kustomization file 2019-01-24 15:08:28 -08:00
Kubernetes Prow Robot
2c1be17fe7 Merge pull request #704 from narg95/feature/add-image-transformer
Add image transformer
2019-01-18 09:17:06 -08:00
Nestor
6d56c1750f fix issues from code review 2019-01-17 15:50:34 +01:00
Jingfang Liu
f7c34ccb52 Remove filesystem from ConfigMapGenerator and SecretGenerator 2019-01-16 13:33:06 -08:00