Merge pull request #75730 from wojtek-t/minor_perf_improvements

Avoid allocations in ByIndex() function
This commit is contained in:
Kubernetes Prow Robot 2019-03-26 18:11:16 -07:00 committed by GitHub
commit feb9bb151c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -185,7 +185,7 @@ func (c *threadSafeMap) ByIndex(indexName, indexKey string) ([]interface{}, erro
set := index[indexKey]
list := make([]interface{}, 0, set.Len())
for _, key := range set.List() {
for key := range set {
list = append(list, c.items[key])
}

View File

@ -827,7 +827,7 @@ func (config *RCConfig) start() error {
if oldRunning != config.Replicas {
// List only pods from a given replication controller.
options := metav1.ListOptions{LabelSelector: label.String()}
if pods, err := config.Client.CoreV1().Pods(metav1.NamespaceAll).List(options); err == nil {
if pods, err := config.Client.CoreV1().Pods(config.Namespace).List(options); err == nil {
for _, pod := range pods.Items {
config.RCConfigLog("Pod %s\t%s\t%s\t%s", pod.Name, pod.Spec.NodeName, pod.Status.Phase, pod.DeletionTimestamp)
}