func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) {
	if err := config.ConfirmUsable(); err != nil {
		return nil, err
	}
	configAuthInfo := config.getAuthInfo()
	configClusterInfo := config.getCluster()
	clientConfig := &restclient.Config{}
	clientConfig.Host = configClusterInfo.Server
	if u, err := url.ParseRequestURI(clientConfig.Host); err == nil && u.Opaque == "" && len(u.Path) > 1 {
		u.RawQuery = ""
		u.Fragment = ""
		clientConfig.Host = u.String()
	}
	if restclient.IsConfigTransportTLS(*clientConfig) {
		var err error
		userAuthPartialConfig, err := getUserIdentificationPartialConfig(configAuthInfo, config.fallbackReader)
		if err != nil {
			return nil, err
		}
		mergo.Merge(clientConfig, userAuthPartialConfig)
		serverAuthPartialConfig, err := getServerIdentificationPartialConfig(configAuthInfo, configClusterInfo)
		if err != nil {
			return nil, err
		}
		mergo.Merge(clientConfig, serverAuthPartialConfig)
	}
	return clientConfig, nil
}
ClientConfig implements ClientConfig
package clientcmd
import (
	"fmt"
	"io"
	"io/ioutil"
	"net/url"
	"os"
	"strings"
	"github.com/golang/glog"
	"github.com/imdario/mergo"
	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/client/restclient"
	clientauth "k8s.io/kubernetes/pkg/client/unversioned/auth"
	clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
)
var (
	DefaultCluster = clientcmdapi.Cluster{Server: "http://localhost:8080"}
	EnvVarCluster = clientcmdapi.Cluster{Server: os.Getenv("KUBERNETES_MASTER")}
	DefaultClientConfig = DirectClientConfig{*clientcmdapi.NewConfig(), "", &ConfigOverrides{}, nil}
)
type ClientConfig interface {
	RawConfig() (clientcmdapi.Config, error)
	ClientConfig() (*restclient.Config, error)
	Namespace() (string, bool, error)
}
type DirectClientConfig struct {
	config         clientcmdapi.Config
	contextName    string
	overrides      *ConfigOverrides
	fallbackReader io.Reader
}
func NewDefaultClientConfig(config clientcmdapi.Config, overrides *ConfigOverrides) ClientConfig {
	return &DirectClientConfig{config, config.CurrentContext, overrides, nil}
}
func NewNonInteractiveClientConfig(config clientcmdapi.Config, contextName string, overrides *ConfigOverrides) ClientConfig {
	return &DirectClientConfig{config, contextName, overrides, nil}
}
func NewInteractiveClientConfig(config clientcmdapi.Config, contextName string, overrides *ConfigOverrides, fallbackReader io.Reader) ClientConfig {
	return &DirectClientConfig{config, contextName, overrides, fallbackReader}
}
func (config *DirectClientConfig) RawConfig() (clientcmdapi.Config, error) {
	return config.config, nil
}