From 0c76c449722bdf581bd745e8d846b0a6288c0d76 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Tue, 11 Nov 2014 16:02:39 +0100 Subject: [PATCH] Make getKubeConfig public to allow it for external consumption --- pkg/kubectl/cmd/cmd.go | 6 ++++-- pkg/kubectl/cmd/proxy.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/kubectl/cmd/cmd.go b/pkg/kubectl/cmd/cmd.go index e071e7a1081..84034e35739 100644 --- a/pkg/kubectl/cmd/cmd.go +++ b/pkg/kubectl/cmd/cmd.go @@ -153,7 +153,9 @@ func getExplicitKubeNamespace(cmd *cobra.Command) (string, bool) { return "", false } -func getKubeConfig(cmd *cobra.Command) *client.Config { +// GetKubeConfig returns a config used for the Kubernetes client with CLI +// options parsed. +func GetKubeConfig(cmd *cobra.Command) *client.Config { config := &client.Config{} var host string @@ -203,7 +205,7 @@ func getKubeConfig(cmd *cobra.Command) *client.Config { } func getKubeClient(cmd *cobra.Command) *client.Client { - config := getKubeConfig(cmd) + config := GetKubeConfig(cmd) // The binary version. matchVersion := GetFlagBool(cmd, "match-server-version") diff --git a/pkg/kubectl/cmd/proxy.go b/pkg/kubectl/cmd/proxy.go index 5a8892a6703..f0ab531e518 100644 --- a/pkg/kubectl/cmd/proxy.go +++ b/pkg/kubectl/cmd/proxy.go @@ -32,7 +32,7 @@ func NewCmdProxy(out io.Writer) *cobra.Command { Run: func(cmd *cobra.Command, args []string) { port := GetFlagInt(cmd, "port") glog.Infof("Starting to serve on localhost:%d", port) - server, err := kubectl.NewProxyServer(GetFlagString(cmd, "www"), getKubeConfig(cmd), port) + server, err := kubectl.NewProxyServer(GetFlagString(cmd, "www"), GetKubeConfig(cmd), port) checkErr(err) glog.Fatal(server.Serve()) },