Try in cluster config when input KubeConfig is empty

This commit is contained in:
Timothy St. Clair 2017-04-12 20:33:10 -05:00
parent 7a1687dc93
commit d401627a10

View File

@ -1886,7 +1886,11 @@ func LoadConfig() (*restclient.Config, error) {
}
c, err := RestclientConfig(TestContext.KubeContext)
if err != nil {
return nil, err
if TestContext.KubeConfig == "" {
return restclient.InClusterConfig()
} else {
return nil, err
}
}
return clientcmd.NewDefaultClientConfig(*c, &clientcmd.ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: TestContext.Host}}).ClientConfig()