func (c *PodReadyCount) GetReadyPodsCount(namespace string, selector labels.Selector) (int64, error) {
	podList, err := c.PodLister.Pods(namespace).List(selector)
	if err != nil {
		return 0, fmt.Errorf("unable to get pods while calculating replica count: %v", err)
	}
	readyPodCount := int64(0)
	for _, pod := range podList {
		if pod.Status.Phase == v1.PodRunning && podutil.IsPodReady(pod) {
			readyPodCount++
		}
	}
	return readyPodCount, nil
}
GetReadyPodsCount returns the number of pods that are deemed 'ready'
package podutil
import (
	"fmt"
	"time"
	v1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/apimachinery/pkg/util/sets"
	corelisters "k8s.io/client-go/listers/core/v1"
	podutil "k8s.io/kubernetes/pkg/api/v1/pod"
	metricsclient "k8s.io/kubernetes/pkg/controller/podautoscaler/metrics"
)
type PodReadyCounter interface {
	GetReadyPodsCount(namespace string, selector labels.Selector) (int64, error)
}
type PodReadyCount struct {
	PodLister corelisters.PodLister
}