mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 10:18:13 +00:00 
			
		
		
		
	More migrations from genericclioptions to genericiooptions
This commit is contained in:
		| @@ -21,7 +21,6 @@ import ( | ||||
| 	"io" | ||||
| 	"os" | ||||
|  | ||||
| 	"k8s.io/cli-runtime/pkg/genericclioptions" | ||||
| 	"k8s.io/kubectl/pkg/cmd" | ||||
| 	cmdsanity "k8s.io/kubectl/pkg/cmd/util/sanity" | ||||
| ) | ||||
| @@ -29,7 +28,7 @@ import ( | ||||
| func main() { | ||||
| 	var errorCount int | ||||
|  | ||||
| 	kubectl := cmd.NewKubectlCommand(cmd.KubectlOptions{IOStreams: genericclioptions.IOStreams{In: os.Stdin, Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 	kubectl := cmd.NewKubectlCommand(cmd.KubectlOptions{IOStreams: genericiooptions.IOStreams{In: os.Stdin, Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 	errors := cmdsanity.RunCmdChecks(kubectl, cmdsanity.AllCmdChecks, []string{}) | ||||
| 	for _, err := range errors { | ||||
| 		errorCount++ | ||||
|   | ||||
| @@ -23,7 +23,6 @@ import ( | ||||
| 	"os" | ||||
|  | ||||
| 	"github.com/spf13/cobra/doc" | ||||
| 	"k8s.io/cli-runtime/pkg/genericclioptions" | ||||
| 	"k8s.io/kubectl/pkg/cmd" | ||||
| 	"k8s.io/kubernetes/cmd/genutils" | ||||
| ) | ||||
| @@ -47,6 +46,6 @@ func main() { | ||||
| 	// Set environment variables used by kubectl so the output is consistent, | ||||
| 	// regardless of where we run. | ||||
| 	os.Setenv("HOME", "/home/username") | ||||
| 	kubectl := cmd.NewKubectlCommand(cmd.KubectlOptions{IOStreams: genericclioptions.IOStreams{In: bytes.NewReader(nil), Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 	kubectl := cmd.NewKubectlCommand(cmd.KubectlOptions{IOStreams: genericiooptions.IOStreams{In: bytes.NewReader(nil), Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 	doc.GenMarkdownTree(kubectl, outDir) | ||||
| } | ||||
|   | ||||
| @@ -26,7 +26,7 @@ import ( | ||||
| 	mangen "github.com/cpuguy83/go-md2man/v2/md2man" | ||||
| 	"github.com/spf13/cobra" | ||||
| 	"github.com/spf13/pflag" | ||||
| 	"k8s.io/cli-runtime/pkg/genericclioptions" | ||||
| 	"k8s.io/cli-runtime/pkg/genericiooptions" | ||||
| 	kubectlcmd "k8s.io/kubectl/pkg/cmd" | ||||
| 	"k8s.io/kubernetes/cmd/genutils" | ||||
| 	apiservapp "k8s.io/kubernetes/cmd/kube-apiserver/app" | ||||
| @@ -97,7 +97,7 @@ func main() { | ||||
| 		} | ||||
| 	case "kubectl": | ||||
| 		// generate manpage for kubectl | ||||
| 		kubectl := kubectlcmd.NewKubectlCommand(kubectlcmd.KubectlOptions{IOStreams: genericclioptions.IOStreams{In: bytes.NewReader(nil), Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 		kubectl := kubectlcmd.NewKubectlCommand(kubectlcmd.KubectlOptions{IOStreams: genericiooptions.IOStreams{In: bytes.NewReader(nil), Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 		genMarkdown(kubectl, "", outDir) | ||||
| 		for _, c := range kubectl.Commands() { | ||||
| 			genMarkdown(c, "kubectl", outDir) | ||||
|   | ||||
| @@ -26,7 +26,6 @@ import ( | ||||
| 	"github.com/spf13/cobra" | ||||
| 	"github.com/spf13/pflag" | ||||
| 	"gopkg.in/yaml.v2" | ||||
| 	"k8s.io/cli-runtime/pkg/genericclioptions" | ||||
| 	"k8s.io/kubectl/pkg/cmd" | ||||
| 	"k8s.io/kubernetes/cmd/genutils" | ||||
| ) | ||||
| @@ -66,7 +65,7 @@ func main() { | ||||
| 	// Set environment variables used by kubectl so the output is consistent, | ||||
| 	// regardless of where we run. | ||||
| 	os.Setenv("HOME", "/home/username") | ||||
| 	kubectl := cmd.NewKubectlCommand(cmd.KubectlOptions{IOStreams: genericclioptions.IOStreams{In: bytes.NewReader(nil), Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 	kubectl := cmd.NewKubectlCommand(cmd.KubectlOptions{IOStreams: genericiooptions.IOStreams{In: bytes.NewReader(nil), Out: io.Discard, ErrOut: io.Discard}}) | ||||
| 	genYaml(kubectl, "", outDir) | ||||
| 	for _, c := range kubectl.Commands() { | ||||
| 		genYaml(c, "kubectl", outDir) | ||||
|   | ||||
| @@ -36,7 +36,7 @@ func main() { | ||||
| 	matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags) | ||||
|  | ||||
| 	f := cmdutil.NewFactory(matchVersionKubeConfigFlags) | ||||
| 	cmd := convert.NewCmdConvert(f, genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}) | ||||
| 	cmd := convert.NewCmdConvert(f, genericiooptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}) | ||||
| 	matchVersionKubeConfigFlags.AddFlags(cmd.PersistentFlags()) | ||||
| 	code := cli.Run(cmd) | ||||
| 	os.Exit(code) | ||||
|   | ||||
| @@ -73,10 +73,10 @@ type ConvertOptions struct { | ||||
| 	validator func() (validation.Schema, error) | ||||
|  | ||||
| 	resource.FilenameOptions | ||||
| 	genericclioptions.IOStreams | ||||
| 	genericiooptions.IOStreams | ||||
| } | ||||
|  | ||||
| func NewConvertOptions(ioStreams genericclioptions.IOStreams) *ConvertOptions { | ||||
| func NewConvertOptions(ioStreams genericiooptions.IOStreams) *ConvertOptions { | ||||
| 	return &ConvertOptions{ | ||||
| 		PrintFlags: genericclioptions.NewPrintFlags("converted").WithTypeSetter(scheme.Scheme).WithDefaultOutput("yaml"), | ||||
| 		local:      true, | ||||
| @@ -86,7 +86,7 @@ func NewConvertOptions(ioStreams genericclioptions.IOStreams) *ConvertOptions { | ||||
|  | ||||
| // NewCmdConvert creates a command object for the generic "convert" action, which | ||||
| // translates the config file into a given version. | ||||
| func NewCmdConvert(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command { | ||||
| func NewCmdConvert(f cmdutil.Factory, ioStreams genericiooptions.IOStreams) *cobra.Command { | ||||
| 	o := NewConvertOptions(ioStreams) | ||||
|  | ||||
| 	cmd := &cobra.Command{ | ||||
|   | ||||
| @@ -23,7 +23,6 @@ import ( | ||||
| 	"strings" | ||||
| 	"testing" | ||||
|  | ||||
| 	"k8s.io/cli-runtime/pkg/genericclioptions" | ||||
| 	"k8s.io/client-go/rest/fake" | ||||
| 	cmdtesting "k8s.io/kubectl/pkg/cmd/testing" | ||||
| ) | ||||
| @@ -116,7 +115,7 @@ func TestConvertObject(t *testing.T) { | ||||
| 				} | ||||
|  | ||||
| 				buf := bytes.NewBuffer([]byte{}) | ||||
| 				cmd := NewCmdConvert(tf, genericclioptions.IOStreams{Out: buf, ErrOut: buf}) | ||||
| 				cmd := NewCmdConvert(tf, genericiooptions.IOStreams{Out: buf, ErrOut: buf}) | ||||
| 				cmd.Flags().Set("filename", tc.file) | ||||
| 				cmd.Flags().Set("output-version", tc.outputVersion) | ||||
| 				cmd.Flags().Set("local", "true") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Arda Güçlü
					Arda Güçlü