From 2c62d22d8846b89a25ab2f4be61db0eb9dbe0036 Mon Sep 17 00:00:00 2001 From: Natasha Sarkar Date: Thu, 8 Jul 2021 11:09:16 -0700 Subject: [PATCH] deprecate some cfg commands --- cmd/config/internal/commands/annotate.go | 3 +++ cmd/config/internal/commands/cmdcreatesetter.go | 4 ++++ cmd/config/internal/commands/cmdcreatesubstitution.go | 2 ++ cmd/config/internal/commands/cmdinit.go | 4 ++++ cmd/config/internal/commands/cmdlistsetters.go | 4 ++++ cmd/config/internal/commands/cmdset.go | 4 ++++ cmd/config/internal/commands/fmt.go | 2 ++ cmd/config/internal/commands/merge.go | 1 + cmd/config/internal/commands/merge3.go | 1 + 9 files changed, 25 insertions(+) diff --git a/cmd/config/internal/commands/annotate.go b/cmd/config/internal/commands/annotate.go index 93db621db8e..8e5ec2384ab 100644 --- a/cmd/config/internal/commands/annotate.go +++ b/cmd/config/internal/commands/annotate.go @@ -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 diff --git a/cmd/config/internal/commands/cmdcreatesetter.go b/cmd/config/internal/commands/cmdcreatesetter.go index eca08277501..f167a0ecf61 100644 --- a/cmd/config/internal/commands/cmdcreatesetter.go +++ b/cmd/config/internal/commands/cmdcreatesetter.go @@ -32,6 +32,10 @@ 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" + + "Instead, use `patches`, `replacements`, or a setter-related KRM function\n" + + "such as apply-setters or create-setters available at https://catalog.kpt.dev/.\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 '-'") diff --git a/cmd/config/internal/commands/cmdcreatesubstitution.go b/cmd/config/internal/commands/cmdcreatesubstitution.go index 3532136a68d..bd03ea9c01a 100644 --- a/cmd/config/internal/commands/cmdcreatesubstitution.go +++ b/cmd/config/internal/commands/cmdcreatesubstitution.go @@ -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") diff --git a/cmd/config/internal/commands/cmdinit.go b/cmd/config/internal/commands/cmdinit.go index f8b4346588b..2f1781d63a0 100644 --- a/cmd/config/internal/commands/cmdinit.go +++ b/cmd/config/internal/commands/cmdinit.go @@ -26,6 +26,10 @@ 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" + + "Instead, use `patches`, `replacements`, or a setter-related KRM function\n" + + "such as apply-setters or create-setters available at https://catalog.kpt.dev/.\n" + + "See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.", } runner.FixDocs(name, c) r.Command = c diff --git a/cmd/config/internal/commands/cmdlistsetters.go b/cmd/config/internal/commands/cmdlistsetters.go index 9f2bb0fe8fb..2813b2517f6 100644 --- a/cmd/config/internal/commands/cmdlistsetters.go +++ b/cmd/config/internal/commands/cmdlistsetters.go @@ -31,6 +31,10 @@ 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" + + "Instead, use `patches`, `replacements`, or a setter-related KRM function\n" + + "such as apply-setters or create-setters available at https://catalog.kpt.dev/.\n" + + "See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.", } c.Flags().BoolVar(&r.Markdown, "markdown", false, "output as github markdown") diff --git a/cmd/config/internal/commands/cmdset.go b/cmd/config/internal/commands/cmdset.go index 90c834d4db9..248edf579fe 100644 --- a/cmd/config/internal/commands/cmdset.go +++ b/cmd/config/internal/commands/cmdset.go @@ -27,6 +27,10 @@ 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" + + "Instead, use `patches`, `replacements`, or a setter-related KRM function\n" + + "such as apply-setters or create-setters available at https://catalog.kpt.dev/.\n" + + "See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.", } runner.FixDocs(parent, c) r.Command = c diff --git a/cmd/config/internal/commands/fmt.go b/cmd/config/internal/commands/fmt.go index c820332b7e5..2ab3d4eb209 100644 --- a/cmd/config/internal/commands/fmt.go +++ b/cmd/config/internal/commands/fmt.go @@ -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, diff --git a/cmd/config/internal/commands/merge.go b/cmd/config/internal/commands/merge.go index dd65b50e992..70540fc8362 100644 --- a/cmd/config/internal/commands/merge.go +++ b/cmd/config/internal/commands/merge.go @@ -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 diff --git a/cmd/config/internal/commands/merge3.go b/cmd/config/internal/commands/merge3.go index 5c48efc4e85..dea4dcc852e 100644 --- a/cmd/config/internal/commands/merge3.go +++ b/cmd/config/internal/commands/merge3.go @@ -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", "",