Replace client with clientset in code
This commit is contained in:
@@ -25,8 +25,8 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/test/integration"
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
)
|
||||
@@ -36,7 +36,7 @@ func TestConfigMap(t *testing.T) {
|
||||
_, s := framework.RunAMaster(nil)
|
||||
defer s.Close()
|
||||
|
||||
client := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion}})
|
||||
client := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion}})
|
||||
|
||||
ns := framework.CreateTestingNamespace("config-map", s, t)
|
||||
defer framework.DeleteTestingNamespace(ns, s, t)
|
||||
@@ -44,7 +44,7 @@ func TestConfigMap(t *testing.T) {
|
||||
DoTestConfigMap(t, client, ns)
|
||||
}
|
||||
|
||||
func DoTestConfigMap(t *testing.T, client *client.Client, ns *api.Namespace) {
|
||||
func DoTestConfigMap(t *testing.T, client clientset.Interface, ns *api.Namespace) {
|
||||
cfg := api.ConfigMap{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "configmap",
|
||||
@@ -57,7 +57,7 @@ func DoTestConfigMap(t *testing.T, client *client.Client, ns *api.Namespace) {
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := client.ConfigMaps(cfg.Namespace).Create(&cfg); err != nil {
|
||||
if _, err := client.Core().ConfigMaps(cfg.Namespace).Create(&cfg); err != nil {
|
||||
t.Errorf("unable to create test configMap: %v", err)
|
||||
}
|
||||
defer deleteConfigMapOrErrorf(t, client, cfg.Namespace, cfg.Name)
|
||||
@@ -112,14 +112,14 @@ func DoTestConfigMap(t *testing.T, client *client.Client, ns *api.Namespace) {
|
||||
}
|
||||
|
||||
pod.ObjectMeta.Name = "uses-configmap"
|
||||
if _, err := client.Pods(ns.Name).Create(pod); err != nil {
|
||||
if _, err := client.Core().Pods(ns.Name).Create(pod); err != nil {
|
||||
t.Errorf("Failed to create pod: %v", err)
|
||||
}
|
||||
defer integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
|
||||
}
|
||||
|
||||
func deleteConfigMapOrErrorf(t *testing.T, c *client.Client, ns, name string) {
|
||||
if err := c.ConfigMaps(ns).Delete(name); err != nil {
|
||||
func deleteConfigMapOrErrorf(t *testing.T, c clientset.Interface, ns, name string) {
|
||||
if err := c.Core().ConfigMaps(ns).Delete(name, nil); err != nil {
|
||||
t.Errorf("unable to delete ConfigMap %v: %v", name, err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user