// GetKubeConfig fetches a config based off a given context.
GetKubeConfig fetches a config based off a given context.
// GetKubeConfig fetches a config based off a given context .
func GetKubeConfig(context string) (*rest.Config, string, error) {
	rules := clientcmd.NewDefaultClientConfigLoadingRules()
	rules.DefaultClientConfig = &clientcmd.DefaultClientConfig
	overrides := &clientcmd.ConfigOverrides{}
	if context != "" {
		overrides.CurrentContext = context
	}
	clientLoader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
		rules,
		overrides)
	config, err := clientLoader.ClientConfig()
	if err != nil {
		return nil, "", fmt.Errorf(
			"could not get config for context (%q): %s", context, err)
	}
	return config, clientLoader.ConfigAccess().GetDefaultFilename(), nil
}
func GetKubeConfig ( context string ) ( * rest . Config , string , error ) { rules := clientcmd . NewDefaultClientConfigLoadingRules ( ) rules . DefaultClientConfig = & clientcmd . DefaultClientConfig overrides := & clientcmd . ConfigOverrides { } if context != " " { overrides . CurrentContext = context } clientLoader := clientcmd . NewNonInteractiveDeferredLoadingClientConfig ( rules , overrides ) config , err := clientLoader . ClientConfig ( ) if err != nil { return nil , " " , fmt . Errorf ( " " , context , err ) } return config , clientLoader . ConfigAccess ( ) . GetDefaultFilename ( ) , nil }
GetKubeConfig fetches a config based off a given context.
GetKubeConfig fetches a config based off a given context .