prow/kube/cluster.go
func loadClusterConfig(masterURL, kubeConfig string) (*rest.Config, error) {
	clusterConfig, err := clientcmd.BuildConfigFromFlags(masterURL, kubeConfig)
	if err == nil {
		return clusterConfig, nil
	}

	credentials, err := clientcmd.NewDefaultClientConfigLoadingRules().Load()
	if err != nil {
		return nil, fmt.Errorf("could not load credentials from config: %v", err)
	}

	clusterConfig, err = clientcmd.NewDefaultClientConfig(*credentials, &clientcmd.ConfigOverrides{}).ClientConfig()
	if err != nil {
		return nil, fmt.Errorf("could not load client configuration: %v", err)
	}
	return clusterConfig, nil
}
func loadClusterConfig(masterURL, kubeConfig string) (*rest.Config, error) {
	clusterConfig, err := clientcmd.BuildConfigFromFlags(masterURL, kubeConfig)
	if err == nil {
		return clusterConfig, nil
	}

	credentials, err := clientcmd.NewDefaultClientConfigLoadingRules().Load()
	if err != nil {
		return nil, fmt.Errorf("could not load credentials from config: %v", err)
	}

	clusterConfig, err = clientcmd.NewDefaultClientConfig(*credentials, &clientcmd.ConfigOverrides{}).ClientConfig()
	if err != nil {
		return nil, fmt.Errorf("could not load client configuration: %v", err)
	}
	return clusterConfig, nil
}
func loadClusterConfig ( masterURL , kubeConfig string ) ( * rest . Config , error ) { clusterConfig , err := clientcmd . BuildConfigFromFlags ( masterURL , kubeConfig ) if err == nil { return clusterConfig , nil } credentials , err := clientcmd . NewDefaultClientConfigLoadingRules ( ) . Load ( ) if err != nil { return nil , fmt . Errorf ( " " , err ) } clusterConfig , err = clientcmd . NewDefaultClientConfig ( * credentials , & clientcmd . ConfigOverrides { } ) . ClientConfig ( ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return clusterConfig , nil }
// loadClusterConfig loads connection configuration
// for the cluster we're deploying to. We prefer to
// use in-cluster configuration if possible, but will
// fall back to using default rules otherwise.
loadClusterConfig loads connection configuration for the cluster we re deploying to . We prefer to use in - cluster configuration if possible but will fall back to using default rules otherwise .