mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #87030 from jiayingz/test-host
In test framework LoadConfig(), use CurrentContext.Server for TestCon…
This commit is contained in:
commit
fdd575f8dc
@ -557,6 +557,14 @@ func LoadConfig() (config *restclient.Config, err error) {
|
|||||||
}
|
}
|
||||||
return nil, err
|
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()
|
return clientcmd.NewDefaultClientConfig(*c, &clientcmd.ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: TestContext.Host}}).ClientConfig()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user