mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 11:48:15 +00:00 
			
		
		
		
	Merge pull request #11903 from mikedanese/renamers
rename StoreToControllerLister -> StoreToReplicationControllerLister
This commit is contained in:
		
							
								
								
									
										14
									
								
								pkg/client/cache/listers.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								pkg/client/cache/listers.go
									
									
									
									
										vendored
									
									
								
							@@ -172,13 +172,13 @@ func (s *StoreToNodeLister) GetNodeInfo(id string) (*api.Node, error) {
 | 
				
			|||||||
	return minion.(*api.Node), nil
 | 
						return minion.(*api.Node), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// StoreToControllerLister gives a store List and Exists methods. The store must contain only ReplicationControllers.
 | 
					// StoreToReplicationControllerLister gives a store List and Exists methods. The store must contain only ReplicationControllers.
 | 
				
			||||||
type StoreToControllerLister struct {
 | 
					type StoreToReplicationControllerLister struct {
 | 
				
			||||||
	Store
 | 
						Store
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Exists checks if the given rc exists in the store.
 | 
					// Exists checks if the given rc exists in the store.
 | 
				
			||||||
func (s *StoreToControllerLister) Exists(controller *api.ReplicationController) (bool, error) {
 | 
					func (s *StoreToReplicationControllerLister) Exists(controller *api.ReplicationController) (bool, error) {
 | 
				
			||||||
	_, exists, err := s.Store.Get(controller)
 | 
						_, exists, err := s.Store.Get(controller)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return false, err
 | 
							return false, err
 | 
				
			||||||
@@ -186,17 +186,17 @@ func (s *StoreToControllerLister) Exists(controller *api.ReplicationController)
 | 
				
			|||||||
	return exists, nil
 | 
						return exists, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// StoreToControllerLister lists all controllers in the store.
 | 
					// StoreToReplicationControllerLister lists all controllers in the store.
 | 
				
			||||||
// TODO: converge on the interface in pkg/client
 | 
					// TODO: converge on the interface in pkg/client
 | 
				
			||||||
func (s *StoreToControllerLister) List() (controllers []api.ReplicationController, err error) {
 | 
					func (s *StoreToReplicationControllerLister) List() (controllers []api.ReplicationController, err error) {
 | 
				
			||||||
	for _, c := range s.Store.List() {
 | 
						for _, c := range s.Store.List() {
 | 
				
			||||||
		controllers = append(controllers, *(c.(*api.ReplicationController)))
 | 
							controllers = append(controllers, *(c.(*api.ReplicationController)))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return controllers, nil
 | 
						return controllers, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetPodControllers returns a list of controllers managing a pod. Returns an error only if no matching controllers are found.
 | 
					// GetPodControllers returns a list of replication controllers managing a pod. Returns an error only if no matching controllers are found.
 | 
				
			||||||
func (s *StoreToControllerLister) GetPodControllers(pod *api.Pod) (controllers []api.ReplicationController, err error) {
 | 
					func (s *StoreToReplicationControllerLister) GetPodControllers(pod *api.Pod) (controllers []api.ReplicationController, err error) {
 | 
				
			||||||
	var selector labels.Selector
 | 
						var selector labels.Selector
 | 
				
			||||||
	var rc api.ReplicationController
 | 
						var rc api.ReplicationController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								pkg/client/cache/listers_test.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								pkg/client/cache/listers_test.go
									
									
									
									
										vendored
									
									
								
							@@ -45,9 +45,9 @@ func TestStoreToMinionLister(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestStoreToControllerLister(t *testing.T) {
 | 
					func TestStoreToReplicationControllerLister(t *testing.T) {
 | 
				
			||||||
	store := NewStore(MetaNamespaceKeyFunc)
 | 
						store := NewStore(MetaNamespaceKeyFunc)
 | 
				
			||||||
	lister := StoreToControllerLister{store}
 | 
						lister := StoreToReplicationControllerLister{store}
 | 
				
			||||||
	testCases := []struct {
 | 
						testCases := []struct {
 | 
				
			||||||
		inRCs      []*api.ReplicationController
 | 
							inRCs      []*api.ReplicationController
 | 
				
			||||||
		list       func() ([]api.ReplicationController, error)
 | 
							list       func() ([]api.ReplicationController, error)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,8 +91,8 @@ type ReplicationManager struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// A TTLCache of pod creates/deletes each rc expects to see
 | 
						// A TTLCache of pod creates/deletes each rc expects to see
 | 
				
			||||||
	expectations RCExpectationsManager
 | 
						expectations RCExpectationsManager
 | 
				
			||||||
	// A store of controllers, populated by the rcController
 | 
						// A store of replication controllers, populated by the rcController
 | 
				
			||||||
	controllerStore cache.StoreToControllerLister
 | 
						rcStore cache.StoreToReplicationControllerLister
 | 
				
			||||||
	// A store of pods, populated by the podController
 | 
						// A store of pods, populated by the podController
 | 
				
			||||||
	podStore cache.StoreToPodLister
 | 
						podStore cache.StoreToPodLister
 | 
				
			||||||
	// Watches changes to all replication controllers
 | 
						// Watches changes to all replication controllers
 | 
				
			||||||
@@ -120,7 +120,7 @@ func NewReplicationManager(kubeClient client.Interface, burstReplicas int) *Repl
 | 
				
			|||||||
		queue:         workqueue.New(),
 | 
							queue:         workqueue.New(),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rm.controllerStore.Store, rm.rcController = framework.NewInformer(
 | 
						rm.rcStore.Store, rm.rcController = framework.NewInformer(
 | 
				
			||||||
		&cache.ListWatch{
 | 
							&cache.ListWatch{
 | 
				
			||||||
			ListFunc: func() (runtime.Object, error) {
 | 
								ListFunc: func() (runtime.Object, error) {
 | 
				
			||||||
				return rm.kubeClient.ReplicationControllers(api.NamespaceAll).List(labels.Everything())
 | 
									return rm.kubeClient.ReplicationControllers(api.NamespaceAll).List(labels.Everything())
 | 
				
			||||||
@@ -204,7 +204,7 @@ func (rm *ReplicationManager) Run(workers int, stopCh <-chan struct{}) {
 | 
				
			|||||||
// getPodControllers returns the controller managing the given pod.
 | 
					// getPodControllers returns the controller managing the given pod.
 | 
				
			||||||
// TODO: Surface that we are ignoring multiple controllers for a single pod.
 | 
					// TODO: Surface that we are ignoring multiple controllers for a single pod.
 | 
				
			||||||
func (rm *ReplicationManager) getPodControllers(pod *api.Pod) *api.ReplicationController {
 | 
					func (rm *ReplicationManager) getPodControllers(pod *api.Pod) *api.ReplicationController {
 | 
				
			||||||
	controllers, err := rm.controllerStore.GetPodControllers(pod)
 | 
						controllers, err := rm.rcStore.GetPodControllers(pod)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.V(4).Infof("No controllers found for pod %v, replication manager will avoid syncing", pod.Name)
 | 
							glog.V(4).Infof("No controllers found for pod %v, replication manager will avoid syncing", pod.Name)
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
@@ -376,7 +376,7 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
 | 
				
			|||||||
		glog.V(4).Infof("Finished syncing controller %q (%v)", key, time.Now().Sub(startTime))
 | 
							glog.V(4).Infof("Finished syncing controller %q (%v)", key, time.Now().Sub(startTime))
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	obj, exists, err := rm.controllerStore.Store.GetByKey(key)
 | 
						obj, exists, err := rm.rcStore.Store.GetByKey(key)
 | 
				
			||||||
	if !exists {
 | 
						if !exists {
 | 
				
			||||||
		glog.Infof("Replication Controller has been deleted %v", key)
 | 
							glog.Infof("Replication Controller has been deleted %v", key)
 | 
				
			||||||
		rm.expectations.DeleteExpectations(key)
 | 
							rm.expectations.DeleteExpectations(key)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -229,7 +229,7 @@ func TestSyncReplicationControllerDoesNothing(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// 2 running pods, a controller with 2 replicas, sync is a no-op
 | 
						// 2 running pods, a controller with 2 replicas, sync is a no-op
 | 
				
			||||||
	controllerSpec := newReplicationController(2)
 | 
						controllerSpec := newReplicationController(2)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controllerSpec)
 | 
						manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
	newPodList(manager.podStore.Store, 2, api.PodRunning, controllerSpec)
 | 
						newPodList(manager.podStore.Store, 2, api.PodRunning, controllerSpec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	manager.podControl = &fakePodControl
 | 
						manager.podControl = &fakePodControl
 | 
				
			||||||
@@ -246,7 +246,7 @@ func TestSyncReplicationControllerDeletes(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// 2 running pods and a controller with 1 replica, one pod delete expected
 | 
						// 2 running pods and a controller with 1 replica, one pod delete expected
 | 
				
			||||||
	controllerSpec := newReplicationController(1)
 | 
						controllerSpec := newReplicationController(1)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controllerSpec)
 | 
						manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
	newPodList(manager.podStore.Store, 2, api.PodRunning, controllerSpec)
 | 
						newPodList(manager.podStore.Store, 2, api.PodRunning, controllerSpec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	manager.syncReplicationController(getKey(controllerSpec, t))
 | 
						manager.syncReplicationController(getKey(controllerSpec, t))
 | 
				
			||||||
@@ -269,7 +269,7 @@ func TestDeleteFinalStateUnknown(t *testing.T) {
 | 
				
			|||||||
	// The DeletedFinalStateUnknown object should cause the rc manager to insert
 | 
						// The DeletedFinalStateUnknown object should cause the rc manager to insert
 | 
				
			||||||
	// the controller matching the selectors of the deleted pod into the work queue.
 | 
						// the controller matching the selectors of the deleted pod into the work queue.
 | 
				
			||||||
	controllerSpec := newReplicationController(1)
 | 
						controllerSpec := newReplicationController(1)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controllerSpec)
 | 
						manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
	pods := newPodList(nil, 1, api.PodRunning, controllerSpec)
 | 
						pods := newPodList(nil, 1, api.PodRunning, controllerSpec)
 | 
				
			||||||
	manager.deletePod(cache.DeletedFinalStateUnknown{Key: "foo", Obj: &pods.Items[0]})
 | 
						manager.deletePod(cache.DeletedFinalStateUnknown{Key: "foo", Obj: &pods.Items[0]})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -293,7 +293,7 @@ func TestSyncReplicationControllerCreates(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// A controller with 2 replicas and no pods in the store, 2 creates expected
 | 
						// A controller with 2 replicas and no pods in the store, 2 creates expected
 | 
				
			||||||
	controller := newReplicationController(2)
 | 
						controller := newReplicationController(2)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controller)
 | 
						manager.rcStore.Store.Add(controller)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fakePodControl := FakePodControl{}
 | 
						fakePodControl := FakePodControl{}
 | 
				
			||||||
	manager.podControl = &fakePodControl
 | 
						manager.podControl = &fakePodControl
 | 
				
			||||||
@@ -355,7 +355,7 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) {
 | 
				
			|||||||
	// Steady state for the replication controller, no Status.Replicas updates expected
 | 
						// Steady state for the replication controller, no Status.Replicas updates expected
 | 
				
			||||||
	activePods := 5
 | 
						activePods := 5
 | 
				
			||||||
	rc := newReplicationController(activePods)
 | 
						rc := newReplicationController(activePods)
 | 
				
			||||||
	manager.controllerStore.Store.Add(rc)
 | 
						manager.rcStore.Store.Add(rc)
 | 
				
			||||||
	rc.Status = api.ReplicationControllerStatus{Replicas: activePods}
 | 
						rc.Status = api.ReplicationControllerStatus{Replicas: activePods}
 | 
				
			||||||
	newPodList(manager.podStore.Store, activePods, api.PodRunning, rc)
 | 
						newPodList(manager.podStore.Store, activePods, api.PodRunning, rc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -397,7 +397,7 @@ func TestControllerUpdateReplicas(t *testing.T) {
 | 
				
			|||||||
	// Insufficient number of pods in the system, and Status.Replicas is wrong;
 | 
						// Insufficient number of pods in the system, and Status.Replicas is wrong;
 | 
				
			||||||
	// Status.Replica should update to match number of pods in system, 1 new pod should be created.
 | 
						// Status.Replica should update to match number of pods in system, 1 new pod should be created.
 | 
				
			||||||
	rc := newReplicationController(5)
 | 
						rc := newReplicationController(5)
 | 
				
			||||||
	manager.controllerStore.Store.Add(rc)
 | 
						manager.rcStore.Store.Add(rc)
 | 
				
			||||||
	rc.Status = api.ReplicationControllerStatus{Replicas: 2, ObservedGeneration: 0}
 | 
						rc.Status = api.ReplicationControllerStatus{Replicas: 2, ObservedGeneration: 0}
 | 
				
			||||||
	rc.Generation = 1
 | 
						rc.Generation = 1
 | 
				
			||||||
	newPodList(manager.podStore.Store, 4, api.PodRunning, rc)
 | 
						newPodList(manager.podStore.Store, 4, api.PodRunning, rc)
 | 
				
			||||||
@@ -586,7 +586,7 @@ func TestSyncReplicationControllerDormancy(t *testing.T) {
 | 
				
			|||||||
	manager.podControl = &fakePodControl
 | 
						manager.podControl = &fakePodControl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	controllerSpec := newReplicationController(2)
 | 
						controllerSpec := newReplicationController(2)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controllerSpec)
 | 
						manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
	newPodList(manager.podStore.Store, 1, api.PodRunning, controllerSpec)
 | 
						newPodList(manager.podStore.Store, 1, api.PodRunning, controllerSpec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Creates a replica and sets expectations
 | 
						// Creates a replica and sets expectations
 | 
				
			||||||
@@ -668,7 +668,7 @@ func TestPodControllerLookup(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	for _, c := range testCases {
 | 
						for _, c := range testCases {
 | 
				
			||||||
		for _, r := range c.inRCs {
 | 
							for _, r := range c.inRCs {
 | 
				
			||||||
			manager.controllerStore.Add(r)
 | 
								manager.rcStore.Add(r)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if rc := manager.getPodControllers(c.pod); rc != nil {
 | 
							if rc := manager.getPodControllers(c.pod); rc != nil {
 | 
				
			||||||
			if c.outRCName != rc.Name {
 | 
								if c.outRCName != rc.Name {
 | 
				
			||||||
@@ -699,7 +699,7 @@ func TestWatchControllers(t *testing.T) {
 | 
				
			|||||||
	// and closes the received channel to indicate that the test can finish.
 | 
						// and closes the received channel to indicate that the test can finish.
 | 
				
			||||||
	manager.syncHandler = func(key string) error {
 | 
						manager.syncHandler = func(key string) error {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		obj, exists, err := manager.controllerStore.Store.GetByKey(key)
 | 
							obj, exists, err := manager.rcStore.Store.GetByKey(key)
 | 
				
			||||||
		if !exists || err != nil {
 | 
							if !exists || err != nil {
 | 
				
			||||||
			t.Errorf("Expected to find controller under key %v", key)
 | 
								t.Errorf("Expected to find controller under key %v", key)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -735,13 +735,13 @@ func TestWatchPods(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Put one rc and one pod into the controller's stores
 | 
						// Put one rc and one pod into the controller's stores
 | 
				
			||||||
	testControllerSpec := newReplicationController(1)
 | 
						testControllerSpec := newReplicationController(1)
 | 
				
			||||||
	manager.controllerStore.Store.Add(testControllerSpec)
 | 
						manager.rcStore.Store.Add(testControllerSpec)
 | 
				
			||||||
	received := make(chan string)
 | 
						received := make(chan string)
 | 
				
			||||||
	// The pod update sent through the fakeWatcher should figure out the managing rc and
 | 
						// The pod update sent through the fakeWatcher should figure out the managing rc and
 | 
				
			||||||
	// send it into the syncHandler.
 | 
						// send it into the syncHandler.
 | 
				
			||||||
	manager.syncHandler = func(key string) error {
 | 
						manager.syncHandler = func(key string) error {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		obj, exists, err := manager.controllerStore.Store.GetByKey(key)
 | 
							obj, exists, err := manager.rcStore.Store.GetByKey(key)
 | 
				
			||||||
		if !exists || err != nil {
 | 
							if !exists || err != nil {
 | 
				
			||||||
			t.Errorf("Expected to find controller under key %v", key)
 | 
								t.Errorf("Expected to find controller under key %v", key)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -780,7 +780,7 @@ func TestUpdatePods(t *testing.T) {
 | 
				
			|||||||
	received := make(chan string)
 | 
						received := make(chan string)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	manager.syncHandler = func(key string) error {
 | 
						manager.syncHandler = func(key string) error {
 | 
				
			||||||
		obj, exists, err := manager.controllerStore.Store.GetByKey(key)
 | 
							obj, exists, err := manager.rcStore.Store.GetByKey(key)
 | 
				
			||||||
		if !exists || err != nil {
 | 
							if !exists || err != nil {
 | 
				
			||||||
			t.Errorf("Expected to find controller under key %v", key)
 | 
								t.Errorf("Expected to find controller under key %v", key)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -794,11 +794,11 @@ func TestUpdatePods(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Put 2 rcs and one pod into the controller's stores
 | 
						// Put 2 rcs and one pod into the controller's stores
 | 
				
			||||||
	testControllerSpec1 := newReplicationController(1)
 | 
						testControllerSpec1 := newReplicationController(1)
 | 
				
			||||||
	manager.controllerStore.Store.Add(testControllerSpec1)
 | 
						manager.rcStore.Store.Add(testControllerSpec1)
 | 
				
			||||||
	testControllerSpec2 := *testControllerSpec1
 | 
						testControllerSpec2 := *testControllerSpec1
 | 
				
			||||||
	testControllerSpec2.Spec.Selector = map[string]string{"bar": "foo"}
 | 
						testControllerSpec2.Spec.Selector = map[string]string{"bar": "foo"}
 | 
				
			||||||
	testControllerSpec2.Name = "barfoo"
 | 
						testControllerSpec2.Name = "barfoo"
 | 
				
			||||||
	manager.controllerStore.Store.Add(&testControllerSpec2)
 | 
						manager.rcStore.Store.Add(&testControllerSpec2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Put one pod in the podStore
 | 
						// Put one pod in the podStore
 | 
				
			||||||
	pod1 := newPodList(manager.podStore.Store, 1, api.PodRunning, testControllerSpec1).Items[0]
 | 
						pod1 := newPodList(manager.podStore.Store, 1, api.PodRunning, testControllerSpec1).Items[0]
 | 
				
			||||||
@@ -837,7 +837,7 @@ func TestControllerUpdateRequeue(t *testing.T) {
 | 
				
			|||||||
	manager.podStoreSynced = alwaysReady
 | 
						manager.podStoreSynced = alwaysReady
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rc := newReplicationController(1)
 | 
						rc := newReplicationController(1)
 | 
				
			||||||
	manager.controllerStore.Store.Add(rc)
 | 
						manager.rcStore.Store.Add(rc)
 | 
				
			||||||
	rc.Status = api.ReplicationControllerStatus{Replicas: 2}
 | 
						rc.Status = api.ReplicationControllerStatus{Replicas: 2}
 | 
				
			||||||
	newPodList(manager.podStore.Store, 1, api.PodRunning, rc)
 | 
						newPodList(manager.podStore.Store, 1, api.PodRunning, rc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -915,7 +915,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
 | 
				
			|||||||
	manager.podControl = &fakePodControl
 | 
						manager.podControl = &fakePodControl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	controllerSpec := newReplicationController(numReplicas)
 | 
						controllerSpec := newReplicationController(numReplicas)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controllerSpec)
 | 
						manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	expectedPods := 0
 | 
						expectedPods := 0
 | 
				
			||||||
	pods := newPodList(nil, numReplicas, api.PodPending, controllerSpec)
 | 
						pods := newPodList(nil, numReplicas, api.PodPending, controllerSpec)
 | 
				
			||||||
@@ -924,7 +924,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
 | 
				
			|||||||
	for _, replicas := range []int{numReplicas, 0} {
 | 
						for _, replicas := range []int{numReplicas, 0} {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		controllerSpec.Spec.Replicas = replicas
 | 
							controllerSpec.Spec.Replicas = replicas
 | 
				
			||||||
		manager.controllerStore.Store.Add(controllerSpec)
 | 
							manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for i := 0; i < numReplicas; i += burstReplicas {
 | 
							for i := 0; i < numReplicas; i += burstReplicas {
 | 
				
			||||||
			manager.syncReplicationController(getKey(controllerSpec, t))
 | 
								manager.syncReplicationController(getKey(controllerSpec, t))
 | 
				
			||||||
@@ -1030,7 +1030,7 @@ func TestRCSyncExpectations(t *testing.T) {
 | 
				
			|||||||
	manager.podControl = &fakePodControl
 | 
						manager.podControl = &fakePodControl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	controllerSpec := newReplicationController(2)
 | 
						controllerSpec := newReplicationController(2)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controllerSpec)
 | 
						manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
	pods := newPodList(nil, 2, api.PodPending, controllerSpec)
 | 
						pods := newPodList(nil, 2, api.PodPending, controllerSpec)
 | 
				
			||||||
	manager.podStore.Store.Add(&pods.Items[0])
 | 
						manager.podStore.Store.Add(&pods.Items[0])
 | 
				
			||||||
	postExpectationsPod := pods.Items[1]
 | 
						postExpectationsPod := pods.Items[1]
 | 
				
			||||||
@@ -1053,7 +1053,7 @@ func TestDeleteControllerAndExpectations(t *testing.T) {
 | 
				
			|||||||
	manager.podStoreSynced = alwaysReady
 | 
						manager.podStoreSynced = alwaysReady
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rc := newReplicationController(1)
 | 
						rc := newReplicationController(1)
 | 
				
			||||||
	manager.controllerStore.Store.Add(rc)
 | 
						manager.rcStore.Store.Add(rc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fakePodControl := FakePodControl{}
 | 
						fakePodControl := FakePodControl{}
 | 
				
			||||||
	manager.podControl = &fakePodControl
 | 
						manager.podControl = &fakePodControl
 | 
				
			||||||
@@ -1069,7 +1069,7 @@ func TestDeleteControllerAndExpectations(t *testing.T) {
 | 
				
			|||||||
	if !exists || err != nil {
 | 
						if !exists || err != nil {
 | 
				
			||||||
		t.Errorf("No expectations found for rc")
 | 
							t.Errorf("No expectations found for rc")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	manager.controllerStore.Delete(rc)
 | 
						manager.rcStore.Delete(rc)
 | 
				
			||||||
	manager.syncReplicationController(getKey(rc, t))
 | 
						manager.syncReplicationController(getKey(rc, t))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if _, exists, err = manager.expectations.GetExpectations(rc); exists {
 | 
						if _, exists, err = manager.expectations.GetExpectations(rc); exists {
 | 
				
			||||||
@@ -1094,7 +1094,7 @@ func TestRCManagerNotReady(t *testing.T) {
 | 
				
			|||||||
	// want to end up creating replicas in this case until the pod reflector
 | 
						// want to end up creating replicas in this case until the pod reflector
 | 
				
			||||||
	// has synced, so the rc manager should just requeue the rc.
 | 
						// has synced, so the rc manager should just requeue the rc.
 | 
				
			||||||
	controllerSpec := newReplicationController(1)
 | 
						controllerSpec := newReplicationController(1)
 | 
				
			||||||
	manager.controllerStore.Store.Add(controllerSpec)
 | 
						manager.rcStore.Store.Add(controllerSpec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rcKey := getKey(controllerSpec, t)
 | 
						rcKey := getKey(controllerSpec, t)
 | 
				
			||||||
	manager.syncReplicationController(rcKey)
 | 
						manager.syncReplicationController(rcKey)
 | 
				
			||||||
@@ -1137,7 +1137,7 @@ func TestOverlappingRCs(t *testing.T) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		shuffledControllers := shuffle(controllers)
 | 
							shuffledControllers := shuffle(controllers)
 | 
				
			||||||
		for j := range shuffledControllers {
 | 
							for j := range shuffledControllers {
 | 
				
			||||||
			manager.controllerStore.Store.Add(shuffledControllers[j])
 | 
								manager.rcStore.Store.Add(shuffledControllers[j])
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// Add a pod and make sure only the oldest rc is synced
 | 
							// Add a pod and make sure only the oldest rc is synced
 | 
				
			||||||
		pods := newPodList(nil, 1, api.PodPending, controllers[0])
 | 
							pods := newPodList(nil, 1, api.PodPending, controllers[0])
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user