remove almost all usages of clientadapter

This commit is contained in:
deads2k
2016-09-22 11:00:19 -04:00
parent c19e08ebbc
commit c22f076561
8 changed files with 56 additions and 52 deletions

View File

@@ -35,6 +35,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/dynamic"
@@ -59,7 +60,12 @@ const (
type Framework struct {
BaseName string
Client *client.Client
// Client is manually created and should not be used unless absolutely necessary. Use Clientset_1_5
// where possible.
Client *client.Client
// ClientSet uses internal objects, you should use Clientset_1_5 where possible.
ClientSet internalclientset.Interface
Clientset_1_5 *release_1_5.Clientset
StagingClient *staging.Clientset
ClientPool dynamic.ClientPool
@@ -193,6 +199,8 @@ func (f *Framework) BeforeEach() {
c, err := loadClientFromConfig(config)
Expect(err).NotTo(HaveOccurred())
f.Client = c
f.ClientSet, err = internalclientset.NewForConfig(config)
Expect(err).NotTo(HaveOccurred())
f.Clientset_1_5, err = release_1_5.NewForConfig(config)
Expect(err).NotTo(HaveOccurred())
clientRepoConfig := getClientRepoConfig(config)

View File

@@ -3770,11 +3770,11 @@ func CheckNewRSAnnotations(c clientset.Interface, ns, deploymentName string, exp
return nil
}
func WaitForPodsReady(c *clientset.Clientset, ns, name string, minReadySeconds int) error {
func WaitForPodsReady(c clientset.Interface, ns, name string, minReadySeconds int) error {
label := labels.SelectorFromSet(labels.Set(map[string]string{"name": name}))
options := api.ListOptions{LabelSelector: label}
return wait.Poll(Poll, 5*time.Minute, func() (bool, error) {
pods, err := c.Pods(ns).List(options)
pods, err := c.Core().Pods(ns).List(options)
if err != nil {
return false, nil
}
@@ -3788,7 +3788,7 @@ func WaitForPodsReady(c *clientset.Clientset, ns, name string, minReadySeconds i
}
// Waits for the deployment to clean up old rcs.
func WaitForDeploymentOldRSsNum(c *clientset.Clientset, ns, deploymentName string, desiredRSNum int) error {
func WaitForDeploymentOldRSsNum(c clientset.Interface, ns, deploymentName string, desiredRSNum int) error {
return wait.Poll(Poll, 5*time.Minute, func() (bool, error) {
deployment, err := c.Extensions().Deployments(ns).Get(deploymentName)
if err != nil {
@@ -3814,7 +3814,7 @@ func logReplicaSetsOfDeployment(deployment *extensions.Deployment, allOldRSs []*
}
}
func WaitForObservedDeployment(c *clientset.Clientset, ns, deploymentName string, desiredGeneration int64) error {
func WaitForObservedDeployment(c clientset.Interface, ns, deploymentName string, desiredGeneration int64) error {
return deploymentutil.WaitForObservedDeployment(func() (*extensions.Deployment, error) { return c.Extensions().Deployments(ns).Get(deploymentName) }, desiredGeneration, Poll, 1*time.Minute)
}
@@ -3875,7 +3875,7 @@ func WaitForPartialEvents(c *client.Client, ns string, objOrRef runtime.Object,
type updateDeploymentFunc func(d *extensions.Deployment)
func UpdateDeploymentWithRetries(c *clientset.Clientset, namespace, name string, applyUpdate updateDeploymentFunc) (deployment *extensions.Deployment, err error) {
func UpdateDeploymentWithRetries(c clientset.Interface, namespace, name string, applyUpdate updateDeploymentFunc) (deployment *extensions.Deployment, err error) {
deployments := c.Extensions().Deployments(namespace)
err = wait.Poll(10*time.Millisecond, 1*time.Minute, func() (bool, error) {
if deployment, err = deployments.Get(name); err != nil {