Commit Graph

23 Commits

Author SHA1 Message Date
jingfangliu
35481ec6d9 add inline patch support for Strategic Merge Patch and JSON patch 2019-07-29 14:10:57 -07:00
jingfangliu
8c53d77111 update edit fix to convert the old patches to patchesStrategicMerge 2019-07-23 10:38:48 -07:00
jingfangliu
a85f297f31 enable extended patch transformer and add tests 2019-07-15 15:45:08 -07:00
jingfangliu
33fff655db move strategic merge patch transformer to a builtin transformer 2019-07-11 13:39:30 -07:00
Jeffrey Regan
8a454de8f9 Fix 1281 2019-07-01 18:09:48 -07:00
jregan
5de0673db1 Push json transform code down to plugin. 2019-06-30 17:30:52 -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
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
jregan
11bb176a3f Push suffix/prefix code to plugin. 2019-06-11 19:37:06 -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
Jeffrey Regan
fd2248e7c2 Move hashing transformer out of k8sdeps. 2019-05-29 13:51:41 -07:00
Jeff Regan
f864c912ad Merge pull request #1101 from monopole/breakDeps
Break a bad dep.
2019-05-22 07:48:51 -07:00
Jeffrey Regan
b28aaae66b Break a bad dep. 2019-05-22 07:39:36 -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
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
jregan
5653ae69e4 One plugin per dir. 2019-05-19 17:32:02 -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