Switch from arguments to an input structure for kubectl command

This commit is contained in:
Maciej Szulik
2021-11-04 16:29:08 +01:00
parent c5aea015c3
commit baab99d04c
6 changed files with 81 additions and 70 deletions

View File

@@ -23,6 +23,7 @@ import (
"os"
"github.com/spf13/cobra/doc"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd"
"k8s.io/kubernetes/cmd/genutils"
)
@@ -46,6 +47,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(bytes.NewReader(nil), ioutil.Discard, ioutil.Discard)
kubectl := cmd.NewKubectlCommand(cmd.KubectlOptions{IOStreams: genericclioptions.IOStreams{In: bytes.NewReader(nil), Out: ioutil.Discard, ErrOut: ioutil.Discard}})
doc.GenMarkdownTree(kubectl, outDir)
}