Merge pull request #5541 from deads2k/deads-expose-resolve-local-paths

allow any number of kubeconfig files
This commit is contained in:
Jeff Lowdermilk
2015-03-18 10:46:47 -07:00
5 changed files with 48 additions and 50 deletions

View File

@@ -322,9 +322,8 @@ func (f *Factory) ClientMapperForCommand(cmd *cobra.Command) resource.ClientMapp
// 3. If the command line specifies one and the auth info specifies another, honor the command line technique.
// 2. Use default values and potentially prompt for auth information
func DefaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig {
loadingRules := clientcmd.NewClientConfigLoadingRules()
loadingRules.EnvVarPath = os.Getenv(clientcmd.RecommendedConfigPathEnvVar)
flags.StringVar(&loadingRules.CommandLinePath, "kubeconfig", "", "Path to the kubeconfig file to use for CLI requests.")
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
flags.StringVar(&loadingRules.ExplicitPath, "kubeconfig", "", "Path to the kubeconfig file to use for CLI requests.")
overrides := &clientcmd.ConfigOverrides{}
flagNames := clientcmd.RecommendedConfigOverrideFlags("")

View File

@@ -19,7 +19,6 @@ package config
import (
"fmt"
"io"
"os"
"github.com/golang/glog"
"github.com/spf13/cobra"
@@ -113,9 +112,8 @@ func (o viewOptions) validate() error {
func (o *viewOptions) getStartingConfig() (*clientcmdapi.Config, string, error) {
switch {
case o.merge.Value():
loadingRules := clientcmd.NewClientConfigLoadingRules()
loadingRules.EnvVarPath = os.Getenv("KUBECONFIG")
loadingRules.CommandLinePath = o.pathOptions.specifiedFile
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
loadingRules.ExplicitPath = o.pathOptions.specifiedFile
overrides := &clientcmd.ConfigOverrides{}
clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, overrides)