|
|
@ -1,7 +1,6 @@ |
|
|
|
package kubectl |
|
|
|
package kubectl |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
goflag "flag" |
|
|
|
|
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"math/rand" |
|
|
|
"math/rand" |
|
|
|
"os" |
|
|
|
"os" |
|
|
@ -10,10 +9,9 @@ import ( |
|
|
|
|
|
|
|
|
|
|
|
"github.com/k3s-io/k3s/pkg/server" |
|
|
|
"github.com/k3s-io/k3s/pkg/server" |
|
|
|
"github.com/sirupsen/logrus" |
|
|
|
"github.com/sirupsen/logrus" |
|
|
|
"github.com/spf13/pflag" |
|
|
|
"k8s.io/component-base/cli" |
|
|
|
utilflag "k8s.io/component-base/cli/flag" |
|
|
|
|
|
|
|
"k8s.io/component-base/logs" |
|
|
|
|
|
|
|
"k8s.io/kubectl/pkg/cmd" |
|
|
|
"k8s.io/kubectl/pkg/cmd" |
|
|
|
|
|
|
|
"k8s.io/kubectl/pkg/cmd/util" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func Main() { |
|
|
|
func Main() { |
|
|
@ -42,19 +40,8 @@ func main() { |
|
|
|
rand.Seed(time.Now().UnixNano()) |
|
|
|
rand.Seed(time.Now().UnixNano()) |
|
|
|
|
|
|
|
|
|
|
|
command := cmd.NewDefaultKubectlCommand() |
|
|
|
command := cmd.NewDefaultKubectlCommand() |
|
|
|
|
|
|
|
if err := cli.RunNoErrOutput(command); err != nil { |
|
|
|
// TODO: once we switch everything over to Cobra commands, we can go back to calling
|
|
|
|
util.CheckErr(err) |
|
|
|
// utilflag.InitFlags() (by removing its pflag.Parse() call). For now, we have to set the
|
|
|
|
|
|
|
|
// normalize func and add the go flag set by hand.
|
|
|
|
|
|
|
|
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc) |
|
|
|
|
|
|
|
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine) |
|
|
|
|
|
|
|
// utilflag.InitFlags()
|
|
|
|
|
|
|
|
logs.InitLogs() |
|
|
|
|
|
|
|
defer logs.FlushLogs() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := command.Execute(); err != nil { |
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "%v\n", err) |
|
|
|
|
|
|
|
os.Exit(1) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|