Change LoadConfig to generate restclient config for node e2e test

This commit is contained in:
Random-Liu 2016-07-22 14:55:50 -07:00
parent c5756d22e2
commit cdb1a039c1
2 changed files with 8 additions and 16 deletions

View File

@ -32,7 +32,6 @@ import (
apierrs "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_2"
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_3"
"k8s.io/kubernetes/pkg/client/restclient"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
@ -137,21 +136,10 @@ func (f *Framework) BeforeEach() {
f.cleanupHandle = AddCleanupAction(f.AfterEach)
if f.Client == nil {
By("Creating a kubernetes client")
var config *restclient.Config
if TestContext.NodeName != "" {
// This is a node e2e test, apply the node e2e configuration
config = &restclient.Config{
Host: TestContext.Host,
QPS: 100,
Burst: 100,
}
} else {
var err error
config, err = LoadConfig()
config, err := LoadConfig()
Expect(err).NotTo(HaveOccurred())
config.QPS = f.options.ClientQPS
config.Burst = f.options.ClientBurst
}
if TestContext.KubeAPIContentType != "" {
config.ContentType = TestContext.KubeAPIContentType
}

View File

@ -1711,6 +1711,10 @@ func restclientConfig(kubeContext string) (*clientcmdapi.Config, error) {
type ClientConfigGetter func() (*restclient.Config, error)
func LoadConfig() (*restclient.Config, error) {
if TestContext.NodeName != "" {
// This is a node e2e test, apply the node e2e configuration
return &restclient.Config{Host: TestContext.Host}, nil
}
c, err := restclientConfig(TestContext.KubeContext)
if err != nil {
return nil, err