Merge pull request #20139 from janetkuo/rcList-namespace

Auto commit by PR queue bot
pull/6/head
k8s-merge-robot 2016-01-30 09:42:35 -08:00
commit 783d1d00d7
2 changed files with 21 additions and 2 deletions

View File

@ -161,6 +161,25 @@ func (s *StoreToReplicationControllerLister) List() (controllers []api.Replicati
return controllers, nil
}
func (s *StoreToReplicationControllerLister) ReplicationControllers(namespace string) storeReplicationControllersNamespacer {
return storeReplicationControllersNamespacer{s.Store, namespace}
}
type storeReplicationControllersNamespacer struct {
store Store
namespace string
}
func (s storeReplicationControllersNamespacer) List() (controllers []api.ReplicationController, err error) {
for _, c := range s.store.List() {
rc := *(c.(*api.ReplicationController))
if s.namespace == api.NamespaceAll || s.namespace == rc.Namespace {
controllers = append(controllers, rc)
}
}
return
}
// GetPodControllers returns a list of replication controllers managing a pod. Returns an error only if no matching controllers are found.
func (s *StoreToReplicationControllerLister) GetPodControllers(pod *api.Pod) (controllers []api.ReplicationController, err error) {
var selector labels.Selector

View File

@ -533,7 +533,7 @@ func (dc *DeploymentController) getOldRCs(deployment extensions.Deployment) ([]*
return &podList, err
},
func(namespace string, options api.ListOptions) ([]api.ReplicationController, error) {
return dc.rcStore.List()
return dc.rcStore.ReplicationControllers(namespace).List()
})
}
@ -542,7 +542,7 @@ func (dc *DeploymentController) getOldRCs(deployment extensions.Deployment) ([]*
func (dc *DeploymentController) getNewRC(deployment extensions.Deployment) (*api.ReplicationController, error) {
existingNewRC, err := deploymentutil.GetNewRCFromList(deployment, dc.client,
func(namespace string, options api.ListOptions) ([]api.ReplicationController, error) {
return dc.rcStore.List()
return dc.rcStore.ReplicationControllers(namespace).List()
})
if err != nil || existingNewRC != nil {
return existingNewRC, err