Switch to versioned ListOptions in client.

This commit is contained in:
Wojciech Tyczynski
2015-12-10 10:39:03 +01:00
parent 4ef062c22f
commit 960808bf08
167 changed files with 602 additions and 671 deletions

View File

@@ -22,7 +22,6 @@ import (
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/labels"
@@ -34,7 +33,7 @@ func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.Rep
namespace := deployment.ObjectMeta.Namespace
// 1. Find all pods whose labels match deployment.Spec.Selector
selector := labels.SelectorFromSet(deployment.Spec.Selector)
options := unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{selector}}
options := api.ListOptions{LabelSelector: selector}
podList, err := c.Pods(namespace).List(options)
if err != nil {
return nil, fmt.Errorf("error listing pods: %v", err)
@@ -42,7 +41,7 @@ func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.Rep
// 2. Find the corresponding RCs for pods in podList.
// TODO: Right now we list all RCs and then filter. We should add an API for this.
oldRCs := map[string]api.ReplicationController{}
rcList, err := c.ReplicationControllers(namespace).List(unversioned.ListOptions{})
rcList, err := c.ReplicationControllers(namespace).List(api.ListOptions{})
if err != nil {
return nil, fmt.Errorf("error listing replication controllers: %v", err)
}
@@ -75,7 +74,7 @@ func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.Rep
// Returns nil if the new RC doesnt exist yet.
func GetNewRC(deployment extensions.Deployment, c client.Interface) (*api.ReplicationController, error) {
namespace := deployment.ObjectMeta.Namespace
rcList, err := c.ReplicationControllers(namespace).List(unversioned.ListOptions{})
rcList, err := c.ReplicationControllers(namespace).List(api.ListOptions{})
if err != nil {
return nil, fmt.Errorf("error listing replication controllers: %v", err)
}
@@ -173,7 +172,7 @@ func getPodsForRCs(c client.Interface, replicationControllers []*api.Replication
allPods := []api.Pod{}
for _, rc := range replicationControllers {
selector := labels.SelectorFromSet(rc.Spec.Selector)
options := unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{selector}}
options := api.ListOptions{LabelSelector: selector}
podList, err := c.Pods(rc.ObjectMeta.Namespace).List(options)
if err != nil {
return allPods, fmt.Errorf("error listing pods: %v", err)