openshift/openshift-copies.go
func loadFromFile(filename string) (*clientcmdConfig, error) {
	kubeconfigBytes, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	config, err := load(kubeconfigBytes)
	if err != nil {
		return nil, err
	}

	// set LocationOfOrigin on every Cluster, User, and Context
	for key, obj := range config.AuthInfos {
		obj.LocationOfOrigin = filename
		config.AuthInfos[key] = obj
	}
	for key, obj := range config.Clusters {
		obj.LocationOfOrigin = filename
		config.Clusters[key] = obj
	}
	for key, obj := range config.Contexts {
		obj.LocationOfOrigin = filename
		config.Contexts[key] = obj
	}

	if config.AuthInfos == nil {
		config.AuthInfos = map[string]*clientcmdAuthInfo{}
	}
	if config.Clusters == nil {
		config.Clusters = map[string]*clientcmdCluster{}
	}
	if config.Contexts == nil {
		config.Contexts = map[string]*clientcmdContext{}
	}

	return config, nil
}
func loadFromFile(filename string) (*clientcmdConfig, error) {
	kubeconfigBytes, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	config, err := load(kubeconfigBytes)
	if err != nil {
		return nil, err
	}

	// set LocationOfOrigin on every Cluster, User, and Context
	for key, obj := range config.AuthInfos {
		obj.LocationOfOrigin = filename
		config.AuthInfos[key] = obj
	}
	for key, obj := range config.Clusters {
		obj.LocationOfOrigin = filename
		config.Clusters[key] = obj
	}
	for key, obj := range config.Contexts {
		obj.LocationOfOrigin = filename
		config.Contexts[key] = obj
	}

	if config.AuthInfos == nil {
		config.AuthInfos = map[string]*clientcmdAuthInfo{}
	}
	if config.Clusters == nil {
		config.Clusters = map[string]*clientcmdCluster{}
	}
	if config.Contexts == nil {
		config.Contexts = map[string]*clientcmdContext{}
	}

	return config, nil
}
func loadFromFile ( filename string ) ( * clientcmdConfig , error ) { kubeconfigBytes , err := ioutil . ReadFile ( filename ) if err != nil { return nil , err } config , err := load ( kubeconfigBytes ) if err != nil { return nil , err } // set LocationOfOrigin on every Cluster, User, and Context for key , obj := range config . AuthInfos { obj . LocationOfOrigin = filename config . AuthInfos [ key ] = obj } for key , obj := range config . Clusters { obj . LocationOfOrigin = filename config . Clusters [ key ] = obj } for key , obj := range config . Contexts { obj . LocationOfOrigin = filename config . Contexts [ key ] = obj } if config . AuthInfos == nil { config . AuthInfos = map [ string ] * clientcmdAuthInfo { } } if config . Clusters == nil { config . Clusters = map [ string ] * clientcmdCluster { } } if config . Contexts == nil { config . Contexts = map [ string ] * clientcmdContext { } } return config , nil }
// loadFromFile is a modified copy of k8s.io/kubernetes/pkg/client/unversioned/clientcmd.LoadFromFile
// LoadFromFile takes a filename and deserializes the contents into Config object
loadFromFile is a modified copy of k8s . io / kubernetes / pkg / client / unversioned / clientcmd . LoadFromFile LoadFromFile takes a filename and deserializes the contents into Config object