Skip to content

Commit

Permalink
deprecate some cfg commands
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Jul 19, 2021
1 parent f4e6816 commit a3d60c3
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cmd/config/internal/commands/annotate.go
Expand Up @@ -27,6 +27,9 @@ func NewAnnotateRunner(parent string) *AnnotateRunner {
Long: commands.AnnotateLong,
Example: commands.AnnotateExamples,
RunE: r.runE,
Deprecated:
"use the `commonAnnotations` field in your kustomization file\n" +
"or a KRM function such as https://catalog.kpt.dev/set-annotations/v0.1/ instead.",
}
runner.FixDocs(parent, c)
r.Command = c
Expand Down
15 changes: 12 additions & 3 deletions cmd/config/internal/commands/annotate_test.go
Expand Up @@ -501,7 +501,10 @@ func TestAnnotateSubPackages(t *testing.T) {
name: "annotate-recurse-subpackages",
dataset: "dataset-without-setters",
args: []string{"--kv", "foo=bar", "-R"},
expected: `${baseDir}/
expected: `Command "annotate" is deprecated, use the ` + "`commonAnnotations`" +
` field in your kustomization file
or a KRM function such as https:/catalog.kpt.dev/set-annotations/v0.1/ instead.
${baseDir}/
added annotations in the package
${baseDir}/mysql/
Expand All @@ -516,7 +519,10 @@ added annotations in the package
dataset: "dataset-without-setters",
packagePath: "mysql",
args: []string{"--kv", "foo=bar"},
expected: `${baseDir}/mysql/
expected: `Command "annotate" is deprecated, use the ` + "`commonAnnotations`" +
` field in your kustomization file
or a KRM function such as https:/catalog.kpt.dev/set-annotations/v0.1/ instead.
${baseDir}/mysql/
added annotations in the package
`,
},
Expand All @@ -525,7 +531,10 @@ added annotations in the package
dataset: "dataset-without-setters",
packagePath: "mysql/storage",
args: []string{"--kv", "foo=bar"},
expected: `${baseDir}/mysql/storage/
expected: `Command "annotate" is deprecated, use the ` + "`commonAnnotations`" +
` field in your kustomization file
or a KRM function such as https:/catalog.kpt.dev/set-annotations/v0.1/ instead.
${baseDir}/mysql/storage/
added annotations in the package
`,
},
Expand Down
2 changes: 2 additions & 0 deletions cmd/config/internal/commands/cmdcreatesetter.go
Expand Up @@ -32,6 +32,8 @@ func NewCreateSetterRunner(parent string) *CreateSetterRunner {
Example: commands.CreateSetterExamples,
PreRunE: r.preRunE,
RunE: r.runE,
Deprecated: "setter commands will no longer be available in kustomize v5.\n" +
"See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.",
}
set.Flags().StringVar(&r.FieldValue, "value", "",
"optional flag, alternative to specifying the value as an argument. e.g. used to specify values that start with '-'")
Expand Down
16 changes: 12 additions & 4 deletions cmd/config/internal/commands/cmdcreatesetter_test.go
Expand Up @@ -799,7 +799,9 @@ func TestCreateSetterSubPackages(t *testing.T) {
name: "create-setter-recurse-subpackages",
dataset: "dataset-without-setters",
args: []string{"namespace", "myspace", "-R"},
expected: `${baseDir}/mysql/
expected: `Command "create-setter" is deprecated, setter commands will no longer be available in kustomize v5.
See discussion in https:/github.com/kubernetes-sigs/kustomize/issues/3953.
${baseDir}/mysql/
created setter "namespace"
${baseDir}/mysql/storage/
Expand All @@ -811,7 +813,9 @@ created setter "namespace"
dataset: "dataset-without-setters",
packagePath: "mysql",
args: []string{"namespace", "myspace"},
expected: `${baseDir}/mysql/
expected: `Command "create-setter" is deprecated, setter commands will no longer be available in kustomize v5.
See discussion in https:/github.com/kubernetes-sigs/kustomize/issues/3953.
${baseDir}/mysql/
created setter "namespace"
`,
},
Expand All @@ -820,7 +824,9 @@ created setter "namespace"
dataset: "dataset-without-setters",
packagePath: "mysql/storage",
args: []string{"namespace", "myspace"},
expected: `${baseDir}/mysql/storage/
expected: `Command "create-setter" is deprecated, setter commands will no longer be available in kustomize v5.
See discussion in https:/github.com/kubernetes-sigs/kustomize/issues/3953.
${baseDir}/mysql/storage/
created setter "namespace"
`,
},
Expand All @@ -829,7 +835,9 @@ created setter "namespace"
dataset: "dataset-with-setters",
packagePath: "mysql",
args: []string{"namespace", "myspace", "-R"},
expected: `${baseDir}/mysql/
expected: `Command "create-setter" is deprecated, setter commands will no longer be available in kustomize v5.
See discussion in https:/github.com/kubernetes-sigs/kustomize/issues/3953.
${baseDir}/mysql/
setter with name "namespace" already exists, if you want to modify it, please delete the existing setter and recreate it
${baseDir}/mysql/nosetters/
Expand Down
2 changes: 2 additions & 0 deletions cmd/config/internal/commands/cmdcreatesubstitution.go
Expand Up @@ -23,6 +23,8 @@ func NewCreateSubstitutionRunner(parent string) *CreateSubstitutionRunner {
Args: cobra.ExactArgs(2),
PreRun: r.preRun,
RunE: r.runE,
Deprecated: "imperative substitutions will no longer be available in kustomize v5.\n" +
"See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.",
}
cs.Flags().StringVar(&r.CreateSubstitution.FieldName, "field", "",
"name of the field to set -- e.g. --field image")
Expand Down
2 changes: 2 additions & 0 deletions cmd/config/internal/commands/cmdinit.go
Expand Up @@ -26,6 +26,8 @@ func GetInitRunner(name string) *InitRunner {
Long: commands.InitLong,
Example: commands.InitExamples,
RunE: r.runE,
Deprecated: "setter commands and substitutions will no longer be available in kustomize v5.\n" +
"See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.",
}
runner.FixDocs(name, c)
r.Command = c
Expand Down
2 changes: 2 additions & 0 deletions cmd/config/internal/commands/cmdlistsetters.go
Expand Up @@ -31,6 +31,8 @@ func NewListSettersRunner(parent string) *ListSettersRunner {
Example: commands.ListSettersExamples,
PreRunE: r.preRunE,
RunE: r.runE,
Deprecated: "setter commands will no longer be available in kustomize v5.\n" +
"See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.",
}
c.Flags().BoolVar(&r.Markdown, "markdown", false,
"output as github markdown")
Expand Down
2 changes: 2 additions & 0 deletions cmd/config/internal/commands/cmdset.go
Expand Up @@ -27,6 +27,8 @@ func NewSetRunner(parent string) *SetRunner {
Example: commands.SetExamples,
PreRunE: r.preRunE,
RunE: r.runE,
Deprecated: "setter commands will no longer be available in kustomize v5.\n" +
"See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.",
}
runner.FixDocs(parent, c)
r.Command = c
Expand Down
2 changes: 2 additions & 0 deletions cmd/config/internal/commands/fmt.go
Expand Up @@ -25,6 +25,8 @@ func GetFmtRunner(name string) *FmtRunner {
Example: commands.FmtExamples,
RunE: r.runE,
PreRunE: r.preRunE,
Deprecated: "imperative formatting will no longer be available in kustomize v5.\n" +
"Declare a formatting transformer in your kustomization instead.",
}
runner.FixDocs(name, c)
c.Flags().StringVar(&r.FilenamePattern, "pattern", filters.DefaultFilenamePattern,
Expand Down
1 change: 1 addition & 0 deletions cmd/config/internal/commands/merge.go
Expand Up @@ -19,6 +19,7 @@ func GetMergeRunner(name string) *MergeRunner {
Long: commands.MergeLong,
Example: commands.MergeExamples,
RunE: r.runE,
Deprecated: "this will no longer be available in kustomize v5.",
}
runner.FixDocs(name, c)
r.Command = c
Expand Down
1 change: 1 addition & 0 deletions cmd/config/internal/commands/merge3.go
Expand Up @@ -18,6 +18,7 @@ func GetMerge3Runner(name string) *Merge3Runner {
Long: commands.Merge3Long,
Example: commands.Merge3Examples,
RunE: r.runE,
Deprecated: "this will no longer be available in kustomize v5.",
}
runner.FixDocs(name, c)
c.Flags().StringVar(&r.ancestor, "ancestor", "",
Expand Down

0 comments on commit a3d60c3

Please sign in to comment.