From 53ee37959b4166bc30599f0338d93ed8074f7403 Mon Sep 17 00:00:00 2001 From: jayunit100 Date: Wed, 29 Jul 2015 16:16:58 -0400 Subject: [PATCH] Rename getPodControllers to getPodController so that the truncate/ignore of overlapping RCs is clear --- pkg/controller/replication/replication_controller.go | 12 ++++++------ .../replication/replication_controller_test.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/controller/replication/replication_controller.go b/pkg/controller/replication/replication_controller.go index e05a4ce35db..6725dc71d07 100644 --- a/pkg/controller/replication/replication_controller.go +++ b/pkg/controller/replication/replication_controller.go @@ -191,9 +191,9 @@ func (rm *ReplicationManager) Run(workers int, stopCh <-chan struct{}) { rm.queue.ShutDown() } -// getPodControllers returns the controller managing the given pod. +// getPodController returns the controller managing the given 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) getPodController(pod *api.Pod) *api.ReplicationController { controllers, err := rm.rcStore.GetPodControllers(pod) if err != nil { glog.V(4).Infof("No controllers found for pod %v, replication manager will avoid syncing", pod.Name) @@ -211,7 +211,7 @@ func (rm *ReplicationManager) getPodControllers(pod *api.Pod) *api.ReplicationCo // When a pod is created, enqueue the controller that manages it and update it's expectations. func (rm *ReplicationManager) addPod(obj interface{}) { pod := obj.(*api.Pod) - if rc := rm.getPodControllers(pod); rc != nil { + if rc := rm.getPodController(pod); rc != nil { rcKey, err := controller.KeyFunc(rc) if err != nil { glog.Errorf("Couldn't get key for replication controller %#v: %v", rc, err) @@ -232,7 +232,7 @@ func (rm *ReplicationManager) updatePod(old, cur interface{}) { } // TODO: Write a unittest for this case curPod := cur.(*api.Pod) - if rc := rm.getPodControllers(curPod); rc != nil { + if rc := rm.getPodController(curPod); rc != nil { rm.enqueueController(rc) } oldPod := old.(*api.Pod) @@ -240,7 +240,7 @@ func (rm *ReplicationManager) updatePod(old, cur interface{}) { if !reflect.DeepEqual(curPod.Labels, oldPod.Labels) { // If the old and new rc are the same, the first one that syncs // will set expectations preventing any damage from the second. - if oldRC := rm.getPodControllers(oldPod); oldRC != nil { + if oldRC := rm.getPodController(oldPod); oldRC != nil { rm.enqueueController(oldRC) } } @@ -267,7 +267,7 @@ func (rm *ReplicationManager) deletePod(obj interface{}) { return } } - if rc := rm.getPodControllers(pod); rc != nil { + if rc := rm.getPodController(pod); rc != nil { rcKey, err := controller.KeyFunc(rc) if err != nil { glog.Errorf("Couldn't get key for replication controller %#v: %v", rc, err) diff --git a/pkg/controller/replication/replication_controller_test.go b/pkg/controller/replication/replication_controller_test.go index 292c116515e..e63191d15ce 100644 --- a/pkg/controller/replication/replication_controller_test.go +++ b/pkg/controller/replication/replication_controller_test.go @@ -484,7 +484,7 @@ func TestPodControllerLookup(t *testing.T) { for _, r := range c.inRCs { manager.rcStore.Add(r) } - if rc := manager.getPodControllers(c.pod); rc != nil { + if rc := manager.getPodController(c.pod); rc != nil { if c.outRCName != rc.Name { t.Errorf("Got controller %+v expected %+v", rc.Name, c.outRCName) }