diff --git a/cmd/config/internal/commands/merge3.go b/cmd/config/internal/commands/merge3.go index ad71dca83..405638463 100644 --- a/cmd/config/internal/commands/merge3.go +++ b/cmd/config/internal/commands/merge3.go @@ -5,7 +5,7 @@ package commands import ( "github.com/spf13/cobra" - "sigs.k8s.io/kustomize/cmd/config/cmddocs/commands" + "sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands" "sigs.k8s.io/kustomize/kyaml/kio/filters" ) @@ -36,17 +36,17 @@ func Merge3Command(name string) *cobra.Command { // Merge3Runner contains the run function type Merge3Runner struct { - Command *cobra.Command - ancestor string - fromDir string - toDir string + Command *cobra.Command + ancestor string + fromDir string + toDir string } func (r *Merge3Runner) runE(c *cobra.Command, args []string) error { err := filters.Merge3{ OriginalPath: r.ancestor, - UpdatedPath: r.fromDir, - DestPath: r.toDir, + UpdatedPath: r.fromDir, + DestPath: r.toDir, }.Merge() if err != nil { return err diff --git a/cmd/config/internal/commands/merge3_test.go b/cmd/config/internal/commands/merge3_test.go index 7b28d1513..de33ce7d3 100644 --- a/cmd/config/internal/commands/merge3_test.go +++ b/cmd/config/internal/commands/merge3_test.go @@ -1,7 +1,8 @@ // Copyright 2019 The Kubernetes Authors. // SPDX-License-Identifier: Apache-2.0 -package commands +package commands_test + import ( "io/ioutil" @@ -233,4 +234,4 @@ spec: if !assert.Empty(t, diffs.List()) { t.FailNow() } -} \ No newline at end of file +} diff --git a/cmd/config/internal/generateddocs/commands/docs.go b/cmd/config/internal/generateddocs/commands/docs.go index ef0013e83..ae10bdc21 100644 --- a/cmd/config/internal/generateddocs/commands/docs.go +++ b/cmd/config/internal/generateddocs/commands/docs.go @@ -136,6 +136,25 @@ For information on merge rules, run: var MergeExamples = ` cat resources_and_patches.yaml | kustomize config merge > merged_resources.yaml` +var Merge3Short = `[Alpha] Merge diff of Resource configuration files into a destination (3-way)` +var Merge3Long = ` +[Alpha] Merge diff of Resource configuration files into a destination (3-way) + +Merge3 performs a 3-way merge by applying the diff between 2 sets of Resources to a 3rd set. + +Merge3 may be for rebasing changes to a forked set of configuration -- e.g. compute the difference between the original +set of Resources that was forked and an updated set of those Resources, then apply that difference to the fork. + +If a field value differs between the ORIGINAL_DIR and UPDATED_DIR, the value from the UPDATED_DIR is taken and applied +to the Resource in the DEST_DIR. + +For information on merge rules, run: + + kustomize config docs-merge3 +` +var Merge3Examples = ` + kustomize config merge3 --ancestor a/ --from b/ --to c/` + var RunFnsShort = `[Alpha] Reoncile config functions to Resources.` var RunFnsLong = ` [Alpha] Reconcile config functions to Resources.