Merge pull request https://github.com/kubernetes/contrib/pull/2419 from mwielgus/dyn-fix

Automatic merge from submit-queue

Cluster-autoscaler: use listers from ListersRegistry

Fix after #2226.

cc: @mumoshu @fgrzadkowski @jszczepkowski @MaciekPytel
This commit is contained in:
Kubernetes Submit Queue 2017-02-26 17:05:51 -08:00 committed by GitHub
commit 067cb842b3
1 changed files with 5 additions and 9 deletions

View File

@ -34,10 +34,6 @@ type StaticAutoscaler struct {
// AutoscalingContext consists of validated settings and options for this autoscaler
*AutoscalingContext
kube_util.ListerRegistry
readyNodeLister *kube_util.ReadyNodeLister
scheduledPodLister *kube_util.ScheduledPodLister
unschedulablePodLister *kube_util.UnschedulablePodLister
allNodeLister *kube_util.AllNodeLister
kubeClient kube_client.Interface
lastScaleUpTime time.Time
lastScaleDownFailedTrial time.Time
@ -62,17 +58,17 @@ func NewStaticAutoscaler(opts AutoscalingOptions, predicateChecker *simulator.Pr
// CleanUp cleans up ToBeDeleted taints added by the previously run and then failed CA
func (a *StaticAutoscaler) CleanUp() {
// CA can die at any time. Removing taints that might have been left from the previous run.
if readyNodes, err := a.readyNodeLister.List(); err != nil {
if readyNodes, err := a.ReadyNodeLister().List(); err != nil {
cleanToBeDeleted(readyNodes, a.kubeClient, a.Recorder)
}
}
// RunOnce iterates over node groups and scales them up/down if necessary
func (a *StaticAutoscaler) RunOnce(currentTime time.Time) {
readyNodeLister := a.readyNodeLister
allNodeLister := a.allNodeLister
unschedulablePodLister := a.unschedulablePodLister
scheduledPodLister := a.scheduledPodLister
readyNodeLister := a.ReadyNodeLister()
allNodeLister := a.AllNodeLister()
unschedulablePodLister := a.UnschedulablePodLister()
scheduledPodLister := a.ScheduledPodLister()
scaleDown := a.scaleDown
autoscalingContext := a.AutoscalingContext