Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate fn wrap, xargs, sink, source commands #4097

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/config/internal/commands/cmdwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package commands

import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -47,6 +48,7 @@ Environment Variables:

`,
RunE: r.runE,
PreRunE: r.preRunE,
SilenceUsage: true,
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
Args: cobra.MinimumNArgs(1),
Expand Down Expand Up @@ -78,6 +80,12 @@ func WrapCommand() *cobra.Command {
return GetWrapRunner().Command
}

func (r *WrapRunner) preRunE(_ *cobra.Command, _ []string) error {
_, err := fmt.Fprintln(os.Stderr, `Command "wrap" is deprecated, this will no longer be available in kustomize v5.
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
return err
}

func (r *WrapRunner) runE(c *cobra.Command, args []string) error {
if r.getEnv == nil {
r.getEnv = os.Getenv
Expand Down
7 changes: 7 additions & 0 deletions cmd/config/internal/commands/cmdxargs.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ $ kyaml cat pkg/ --function-config config.yaml --wrap-kind ResourceList | kyaml

`,
RunE: r.runE,
PreRunE: r.preRunE,
SilenceUsage: true,
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
Args: cobra.MinimumNArgs(1),
Expand All @@ -84,6 +85,12 @@ func XArgsCommand() *cobra.Command {
return GetXArgsRunner().Command
}

func (r *XArgsRunner) preRunE(_ *cobra.Command, _ []string) error {
_, err := fmt.Fprintln(os.Stderr, `Command "xargs" is deprecated, this will no longer be available in kustomize v5.
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
return err
}

func (r *XArgsRunner) runE(c *cobra.Command, _ []string) error {
if len(r.Args) == 0 {
r.Args = os.Args
Expand Down
10 changes: 10 additions & 0 deletions cmd/config/internal/commands/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
package commands

import (
"fmt"
"os"

"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands"
"sigs.k8s.io/kustomize/cmd/config/runner"
Expand All @@ -20,6 +23,7 @@ func GetSinkRunner(name string) *SinkRunner {
Long: commands.SinkLong,
Example: commands.SinkExamples,
RunE: r.runE,
PreRunE: r.preRunE,
Args: cobra.MaximumNArgs(1),
}
runner.FixDocs(name, c)
Expand All @@ -36,6 +40,12 @@ type SinkRunner struct {
Command *cobra.Command
}

func (r *SinkRunner) preRunE(c *cobra.Command, args []string) error {
_, err := fmt.Fprintln(os.Stderr, `Command "sink" is deprecated, this will no longer be available in kustomize v5.
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
return err
}

func (r *SinkRunner) runE(c *cobra.Command, args []string) error {
var outputs []kio.Writer
if len(args) == 1 {
Expand Down
8 changes: 8 additions & 0 deletions cmd/config/internal/commands/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package commands

import (
"fmt"
"os"

"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands"
Expand All @@ -22,6 +23,7 @@ func GetSourceRunner(name string) *SourceRunner {
Long: commands.SourceLong,
Example: commands.SourceExamples,
RunE: r.runE,
PreRunE: r.preRunE,
}
runner.FixDocs(name, c)
c.Flags().StringVar(&r.WrapKind, "wrap-kind", kio.ResourceListKind,
Expand All @@ -47,6 +49,12 @@ type SourceRunner struct {
Command *cobra.Command
}

func (r *SourceRunner) preRunE(c *cobra.Command, args []string) error {
_, err := fmt.Fprintln(os.Stderr, `Command "source" is deprecated, this will no longer be available in kustomize v5.
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
return err
}

func (r *SourceRunner) runE(c *cobra.Command, args []string) error {
// if there is a function-config specified, emit it
var functionConfig *yaml.RNode
Expand Down