mirror of https://github.com/k3s-io/k3s
Avoid allocations in ByIndex() function
parent
231e372d0c
commit
7d46e27db1
|
@ -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])
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue