Skip to content

Commit 50389c0

Browse files
Merge pull request #16986 from enj/enj/i/rbac_memory/16954
Automatic merge from submit-queue. UPSTREAM: 54257: Use GetByKey() in typeLister_NonNamespacedGet The Get() function of non-namespace lister passes a temporary object to indexer.Get() in order to fetch the actual object from the indexer. This may cause Go to allocate the temporary object on the heap instead of the stack, as it is passed into interfaces. For non-namespaced objects, Get(&Type{ObjectMeta: v1.ObjectMeta{Name: name}}) should be equivalent to GetByKey(name). This could be the root cause of excessive allocations, e.g. in tests clusterRoleLister.Get() has trigger 4 billion allocations. Signed-off-by: Christian Heimes <[email protected]> Signed-off-by: Monis Khan <[email protected]> Fixes #16954 /assign @deads2k @simo5
2 parents c0ea123 + 6b4f948 commit 50389c0

File tree

81 files changed

+81
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+81
-242
lines changed

pkg/authorization/generated/listers/authorization/internalversion/clusterpolicy.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
authorization "github.com/openshift/origin/pkg/authorization/apis/authorization"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterPolicyLister) List(selector labels.Selector) (ret []*authorizati
3938

4039
// Get retrieves the ClusterPolicy from the index for a given name.
4140
func (s *clusterPolicyLister) Get(name string) (*authorization.ClusterPolicy, error) {
42-
key := &authorization.ClusterPolicy{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/authorization/generated/listers/authorization/internalversion/clusterpolicybinding.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
authorization "github.com/openshift/origin/pkg/authorization/apis/authorization"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterPolicyBindingLister) List(selector labels.Selector) (ret []*auth
3938

4039
// Get retrieves the ClusterPolicyBinding from the index for a given name.
4140
func (s *clusterPolicyBindingLister) Get(name string) (*authorization.ClusterPolicyBinding, error) {
42-
key := &authorization.ClusterPolicyBinding{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/authorization/generated/listers/authorization/internalversion/clusterrole.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
authorization "github.com/openshift/origin/pkg/authorization/apis/authorization"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterRoleLister) List(selector labels.Selector) (ret []*authorization
3938

4039
// Get retrieves the ClusterRole from the index for a given name.
4140
func (s *clusterRoleLister) Get(name string) (*authorization.ClusterRole, error) {
42-
key := &authorization.ClusterRole{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/authorization/generated/listers/authorization/internalversion/clusterrolebinding.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
authorization "github.com/openshift/origin/pkg/authorization/apis/authorization"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*author
3938

4039
// Get retrieves the ClusterRoleBinding from the index for a given name.
4140
func (s *clusterRoleBindingLister) Get(name string) (*authorization.ClusterRoleBinding, error) {
42-
key := &authorization.ClusterRoleBinding{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/authorization/generated/listers/authorization/v1/clusterpolicy.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/authorization/apis/authorization/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterPolicyLister) List(selector labels.Selector) (ret []*v1.ClusterP
3938

4039
// Get retrieves the ClusterPolicy from the index for a given name.
4140
func (s *clusterPolicyLister) Get(name string) (*v1.ClusterPolicy, error) {
42-
key := &v1.ClusterPolicy{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/authorization/generated/listers/authorization/v1/clusterpolicybinding.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/authorization/apis/authorization/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterPolicyBindingLister) List(selector labels.Selector) (ret []*v1.C
3938

4039
// Get retrieves the ClusterPolicyBinding from the index for a given name.
4140
func (s *clusterPolicyBindingLister) Get(name string) (*v1.ClusterPolicyBinding, error) {
42-
key := &v1.ClusterPolicyBinding{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/authorization/generated/listers/authorization/v1/clusterrole.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/authorization/apis/authorization/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1.ClusterRol
3938

4039
// Get retrieves the ClusterRole from the index for a given name.
4140
func (s *clusterRoleLister) Get(name string) (*v1.ClusterRole, error) {
42-
key := &v1.ClusterRole{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/authorization/generated/listers/authorization/v1/clusterrolebinding.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/authorization/apis/authorization/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1.Clu
3938

4039
// Get retrieves the ClusterRoleBinding from the index for a given name.
4140
func (s *clusterRoleBindingLister) Get(name string) (*v1.ClusterRoleBinding, error) {
42-
key := &v1.ClusterRoleBinding{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/image/generated/listers/image/internalversion/image.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
image "github.com/openshift/origin/pkg/image/apis/image"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *imageLister) List(selector labels.Selector) (ret []*image.Image, err er
3938

4039
// Get retrieves the Image from the index for a given name.
4140
func (s *imageLister) Get(name string) (*image.Image, error) {
42-
key := &image.Image{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/image/generated/listers/image/v1/image.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/image/apis/image/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *imageLister) List(selector labels.Selector) (ret []*v1.Image, err error
3938

4039
// Get retrieves the Image from the index for a given name.
4140
func (s *imageLister) Get(name string) (*v1.Image, error) {
42-
key := &v1.Image{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/network/generated/listers/network/internalversion/clusternetwork.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
network "github.com/openshift/origin/pkg/network/apis/network"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterNetworkLister) List(selector labels.Selector) (ret []*network.Cl
3938

4039
// Get retrieves the ClusterNetwork from the index for a given name.
4140
func (s *clusterNetworkLister) Get(name string) (*network.ClusterNetwork, error) {
42-
key := &network.ClusterNetwork{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/network/generated/listers/network/internalversion/hostsubnet.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
network "github.com/openshift/origin/pkg/network/apis/network"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *hostSubnetLister) List(selector labels.Selector) (ret []*network.HostSu
3938

4039
// Get retrieves the HostSubnet from the index for a given name.
4140
func (s *hostSubnetLister) Get(name string) (*network.HostSubnet, error) {
42-
key := &network.HostSubnet{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/network/generated/listers/network/internalversion/netnamespace.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
network "github.com/openshift/origin/pkg/network/apis/network"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *netNamespaceLister) List(selector labels.Selector) (ret []*network.NetN
3938

4039
// Get retrieves the NetNamespace from the index for a given name.
4140
func (s *netNamespaceLister) Get(name string) (*network.NetNamespace, error) {
42-
key := &network.NetNamespace{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/network/generated/listers/network/v1/clusternetwork.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/network/apis/network/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *clusterNetworkLister) List(selector labels.Selector) (ret []*v1.Cluster
3938

4039
// Get retrieves the ClusterNetwork from the index for a given name.
4140
func (s *clusterNetworkLister) Get(name string) (*v1.ClusterNetwork, error) {
42-
key := &v1.ClusterNetwork{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/network/generated/listers/network/v1/hostsubnet.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/network/apis/network/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *hostSubnetLister) List(selector labels.Selector) (ret []*v1.HostSubnet,
3938

4039
// Get retrieves the HostSubnet from the index for a given name.
4140
func (s *hostSubnetLister) Get(name string) (*v1.HostSubnet, error) {
42-
key := &v1.HostSubnet{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/network/generated/listers/network/v1/netnamespace.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/network/apis/network/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *netNamespaceLister) List(selector labels.Selector) (ret []*v1.NetNamesp
3938

4039
// Get retrieves the NetNamespace from the index for a given name.
4140
func (s *netNamespaceLister) Get(name string) (*v1.NetNamespace, error) {
42-
key := &v1.NetNamespace{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/oauth/generated/listers/oauth/internalversion/oauthaccesstoken.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *oAuthAccessTokenLister) List(selector labels.Selector) (ret []*oauth.OA
3938

4039
// Get retrieves the OAuthAccessToken from the index for a given name.
4140
func (s *oAuthAccessTokenLister) Get(name string) (*oauth.OAuthAccessToken, error) {
42-
key := &oauth.OAuthAccessToken{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/oauth/generated/listers/oauth/internalversion/oauthauthorizetoken.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *oAuthAuthorizeTokenLister) List(selector labels.Selector) (ret []*oauth
3938

4039
// Get retrieves the OAuthAuthorizeToken from the index for a given name.
4140
func (s *oAuthAuthorizeTokenLister) Get(name string) (*oauth.OAuthAuthorizeToken, error) {
42-
key := &oauth.OAuthAuthorizeToken{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/oauth/generated/listers/oauth/internalversion/oauthclient.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *oAuthClientLister) List(selector labels.Selector) (ret []*oauth.OAuthCl
3938

4039
// Get retrieves the OAuthClient from the index for a given name.
4140
func (s *oAuthClientLister) Get(name string) (*oauth.OAuthClient, error) {
42-
key := &oauth.OAuthClient{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/oauth/generated/listers/oauth/internalversion/oauthclientauthorization.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package internalversion
55
import (
66
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *oAuthClientAuthorizationLister) List(selector labels.Selector) (ret []*
3938

4039
// Get retrieves the OAuthClientAuthorization from the index for a given name.
4140
func (s *oAuthClientAuthorizationLister) Get(name string) (*oauth.OAuthClientAuthorization, error) {
42-
key := &oauth.OAuthClientAuthorization{ObjectMeta: v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/oauth/generated/listers/oauth/v1/oauthaccesstoken.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/oauth/apis/oauth/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *oAuthAccessTokenLister) List(selector labels.Selector) (ret []*v1.OAuth
3938

4039
// Get retrieves the OAuthAccessToken from the index for a given name.
4140
func (s *oAuthAccessTokenLister) Get(name string) (*v1.OAuthAccessToken, error) {
42-
key := &v1.OAuthAccessToken{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

pkg/oauth/generated/listers/oauth/v1/oauthauthorizetoken.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package v1
55
import (
66
v1 "github.com/openshift/origin/pkg/oauth/apis/oauth/v1"
77
"k8s.io/apimachinery/pkg/api/errors"
8-
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/labels"
109
"k8s.io/client-go/tools/cache"
1110
)
@@ -39,8 +38,7 @@ func (s *oAuthAuthorizeTokenLister) List(selector labels.Selector) (ret []*v1.OA
3938

4039
// Get retrieves the OAuthAuthorizeToken from the index for a given name.
4140
func (s *oAuthAuthorizeTokenLister) Get(name string) (*v1.OAuthAuthorizeToken, error) {
42-
key := &v1.OAuthAuthorizeToken{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
43-
obj, exists, err := s.indexer.Get(key)
41+
obj, exists, err := s.indexer.GetByKey(name)
4442
if err != nil {
4543
return nil, err
4644
}

0 commit comments

Comments
 (0)