Merge pull request #87030 from jiayingz/test-host

In test framework LoadConfig(), use CurrentContext.Server for TestCon…
This commit is contained in:
Kubernetes Prow Robot 2020-01-16 23:20:55 -08:00 committed by GitHub
commit fdd575f8dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -557,6 +557,14 @@ func LoadConfig() (config *restclient.Config, err error) {
}
return nil, err
}
// In case Host is not set in TestContext, sets it as
// CurrentContext Server for k8s API client to connect to.
if TestContext.Host == "" && c.Clusters != nil {
currentContext, ok := c.Clusters[c.CurrentContext]
if ok {
TestContext.Host = currentContext.Server
}
}
return clientcmd.NewDefaultClientConfig(*c, &clientcmd.ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: TestContext.Host}}).ClientConfig()
}