Skip to content

Commit

Permalink
allow general name and kind changes via an options field in patches
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Mar 10, 2021
1 parent bab8c34 commit f96ac2d
Show file tree
Hide file tree
Showing 17 changed files with 283 additions and 144 deletions.
7 changes: 7 additions & 0 deletions api/builtins/PatchTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/internal/accumulator/resaccumulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func TestResolveVarsWithNoambiguation(t *testing.T) {
"metadata": map[string]interface{}{
"name": "sub-backendOne",
"annotations": map[string]interface{}{
"config.kubernetes.io/previousKinds": "Service",
"config.kubernetes.io/previousNames": "backendOne",
"config.kubernetes.io/previousNamespaces": "default",
"config.kubernetes.io/prefixes": "sub-",
Expand Down
8 changes: 5 additions & 3 deletions api/internal/target/kusttarget_configplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,16 @@ var transformerConfigurators = map[builtinhelpers.BuiltinPluginType]func(
return
}
var c struct {
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Patch string `json:"patch,omitempty" yaml:"patch,omitempty"`
Target *types.Selector `json:"target,omitempty" yaml:"target,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Patch string `json:"patch,omitempty" yaml:"patch,omitempty"`
Target *types.Selector `json:"target,omitempty" yaml:"target,omitempty"`
Options map[string]bool `json:"options,omitempty" yaml:"options,omitempty"`
}
for _, pc := range kt.kustomization.Patches {
c.Target = pc.Target
c.Patch = pc.Patch
c.Path = pc.Path
c.Options = pc.Options
p := f()
err = kt.configureBuiltinPlugin(p, c, bpt)
if err != nil {
Expand Down
Loading

0 comments on commit f96ac2d

Please sign in to comment.