mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-02 18:03:23 +00:00
Merge pull request #72406 from wojtek-t/speedup_listers
Speedup listers for empty selectors Kubernetes-commit: 7c112762b0df87f3a1772f3bbede7fe9185fa249
This commit is contained in:
commit
8145e5e321
102
Godeps/Godeps.json
generated
102
Godeps/Godeps.json
generated
@ -408,207 +408,207 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/naming",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
||||
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||
"Rev": "9c4c366543346abeca2a5cd2c40cf1a30d19a2ec"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/klog",
|
||||
|
20
tools/cache/listers.go
vendored
20
tools/cache/listers.go
vendored
@ -31,7 +31,14 @@ import (
|
||||
type AppendFunc func(interface{})
|
||||
|
||||
func ListAll(store Store, selector labels.Selector, appendFn AppendFunc) error {
|
||||
selectAll := selector.Empty()
|
||||
for _, m := range store.List() {
|
||||
if selectAll {
|
||||
// Avoid computing labels of the objects to speed up common flows
|
||||
// of listing all objects.
|
||||
appendFn(m)
|
||||
continue
|
||||
}
|
||||
metadata, err := meta.Accessor(m)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -44,8 +51,15 @@ func ListAll(store Store, selector labels.Selector, appendFn AppendFunc) error {
|
||||
}
|
||||
|
||||
func ListAllByNamespace(indexer Indexer, namespace string, selector labels.Selector, appendFn AppendFunc) error {
|
||||
selectAll := selector.Empty()
|
||||
if namespace == metav1.NamespaceAll {
|
||||
for _, m := range indexer.List() {
|
||||
if selectAll {
|
||||
// Avoid computing labels of the objects to speed up common flows
|
||||
// of listing all objects.
|
||||
appendFn(m)
|
||||
continue
|
||||
}
|
||||
metadata, err := meta.Accessor(m)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -74,6 +88,12 @@ func ListAllByNamespace(indexer Indexer, namespace string, selector labels.Selec
|
||||
return nil
|
||||
}
|
||||
for _, m := range items {
|
||||
if selectAll {
|
||||
// Avoid computing labels of the objects to speed up common flows
|
||||
// of listing all objects.
|
||||
appendFn(m)
|
||||
continue
|
||||
}
|
||||
metadata, err := meta.Accessor(m)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user