prow/kube/client.go
func ClientMapFromFile(clustersPath, namespace string) (map[string]*Client, error) {
	data, err := ioutil.ReadFile(clustersPath)
	if err != nil {
		return nil, fmt.Errorf("read error: %v", err)
	}
	raw, err := UnmarshalClusterMap(data)
	if err != nil {
		return nil, fmt.Errorf("unmarshal error: %v", err)
	}
	foundDefault := false
	result := map[string]*Client{}
	for alias, config := range raw {
		client, err := newClient(&config, namespace)
		if err != nil {
			return nil, fmt.Errorf("failed to load config for build cluster alias %q in file %q: %v", alias, clustersPath, err)
		}
		result[alias] = client
		if alias == DefaultClusterAlias {
			foundDefault = true
		}
	}
	if !foundDefault {
		return nil, fmt.Errorf("failed to find the required %q alias in build cluster config %q", DefaultClusterAlias, clustersPath)
	}
	return result, nil
}
func ClientMapFromFile(clustersPath, namespace string) (map[string]*Client, error) {
	data, err := ioutil.ReadFile(clustersPath)
	if err != nil {
		return nil, fmt.Errorf("read error: %v", err)
	}
	raw, err := UnmarshalClusterMap(data)
	if err != nil {
		return nil, fmt.Errorf("unmarshal error: %v", err)
	}
	foundDefault := false
	result := map[string]*Client{}
	for alias, config := range raw {
		client, err := newClient(&config, namespace)
		if err != nil {
			return nil, fmt.Errorf("failed to load config for build cluster alias %q in file %q: %v", alias, clustersPath, err)
		}
		result[alias] = client
		if alias == DefaultClusterAlias {
			foundDefault = true
		}
	}
	if !foundDefault {
		return nil, fmt.Errorf("failed to find the required %q alias in build cluster config %q", DefaultClusterAlias, clustersPath)
	}
	return result, nil
}
func ClientMapFromFile ( clustersPath , namespace string ) ( map [ string ] * Client , error ) { data , err := ioutil . ReadFile ( clustersPath ) if err != nil { return nil , fmt . Errorf ( " " , err ) } raw , err := UnmarshalClusterMap ( data ) if err != nil { return nil , fmt . Errorf ( " " , err ) } foundDefault := false result := map [ string ] * Client { } for alias , config := range raw { client , err := newClient ( & config , namespace ) if err != nil { return nil , fmt . Errorf ( " " , alias , clustersPath , err ) } result [ alias ] = client if alias == DefaultClusterAlias { foundDefault = true } } if ! foundDefault { return nil , fmt . Errorf ( " " , DefaultClusterAlias , clustersPath ) } return result , nil }
// ClientMapFromFile reads the file at clustersPath and attempts to load a map of cluster aliases
// to authenticated clients to the respective clusters.
// The file at clustersPath is expected to be a yaml map from strings to Cluster structs OR it may
// simply be a single Cluster struct which will be assigned the alias $DefaultClusterAlias.
// If the file is an alias map, it must include the alias $DefaultClusterAlias.
ClientMapFromFile reads the file at clustersPath and attempts to load a map of cluster aliases to authenticated clients to the respective clusters . The file at clustersPath is expected to be a yaml map from strings to Cluster structs OR it may simply be a single Cluster struct which will be assigned the alias $DefaultClusterAlias . If the file is an alias map it must include the alias $DefaultClusterAlias .