Merge pull request #89339 from alvaroaleman/lister-clarify-read-only

Lister codegen: Clarify that returned objects are read-only

Kubernetes-commit: 0c9ba6b5d7c4c91e1edfdb230574b99ebc5d1027
This commit is contained in:
Kubernetes Publisher 2020-03-24 15:27:16 -07:00
commit c32b5dc3cb
4 changed files with 17 additions and 12 deletions

6
Godeps/Godeps.json generated
View File

@ -348,15 +348,15 @@
},
{
"ImportPath": "k8s.io/apimachinery",
"Rev": "48159c651603"
"Rev": "1aec6bc431a9"
},
{
"ImportPath": "k8s.io/client-go",
"Rev": "70eb4849511b"
"Rev": "80b546a37f63"
},
{
"ImportPath": "k8s.io/code-generator",
"Rev": "6bb2b634cece"
"Rev": "134829e366d8"
},
{
"ImportPath": "k8s.io/gengo",

12
go.mod
View File

@ -6,9 +6,9 @@ go 1.13
require (
k8s.io/api v0.0.0-20200320042356-1fc28ea2498c
k8s.io/apimachinery v0.0.0-20200320122144-48159c651603
k8s.io/client-go v0.0.0-20200323042902-70eb4849511b
k8s.io/code-generator v0.0.0-20200319201949-6bb2b634cece
k8s.io/apimachinery v0.0.0-20200324202305-1aec6bc431a9
k8s.io/client-go v0.0.0-20200325002657-80b546a37f63
k8s.io/code-generator v0.0.0-20200324222716-134829e366d8
k8s.io/klog v1.0.0
)
@ -16,7 +16,7 @@ replace (
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
k8s.io/api => k8s.io/api v0.0.0-20200320042356-1fc28ea2498c
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200320122144-48159c651603
k8s.io/client-go => k8s.io/client-go v0.0.0-20200323042902-70eb4849511b
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200319201949-6bb2b634cece
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200324202305-1aec6bc431a9
k8s.io/client-go => k8s.io/client-go v0.0.0-20200325002657-80b546a37f63
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200324222716-134829e366d8
)

6
go.sum
View File

@ -199,9 +199,9 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20200320042356-1fc28ea2498c/go.mod h1:5nMyHS4bWX496fulniJ+Sws3P6GLvaP43GadMObLf58=
k8s.io/apimachinery v0.0.0-20200320122144-48159c651603/go.mod h1:yKN3QjQfKl8UdUL9RQ+/1VkR7nIUs7w02zC5CXhD+G0=
k8s.io/client-go v0.0.0-20200323042902-70eb4849511b/go.mod h1:64IdCZeusi2RxFpEc1R4cLo9mtiRealqqsl6ysIAFeY=
k8s.io/code-generator v0.0.0-20200319201949-6bb2b634cece/go.mod h1:HgVCDA66DadRZIO1Ym1MX49lfUdXKOzJ8HA7GQVQTMI=
k8s.io/apimachinery v0.0.0-20200324202305-1aec6bc431a9/go.mod h1:yKN3QjQfKl8UdUL9RQ+/1VkR7nIUs7w02zC5CXhD+G0=
k8s.io/client-go v0.0.0-20200325002657-80b546a37f63/go.mod h1:gP8YoPoPGqVSSen7AOdYHMpeiVu1pyCqnhsANkZ23V0=
k8s.io/code-generator v0.0.0-20200324222716-134829e366d8/go.mod h1:HgVCDA66DadRZIO1Ym1MX49lfUdXKOzJ8HA7GQVQTMI=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=

View File

@ -26,8 +26,10 @@ import (
)
// FooLister helps list Foos.
// All objects returned here must be treated as read-only.
type FooLister interface {
// List lists all Foos in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.Foo, err error)
// Foos returns an object that can list and get Foos.
Foos(namespace string) FooNamespaceLister
@ -58,10 +60,13 @@ func (s *fooLister) Foos(namespace string) FooNamespaceLister {
}
// FooNamespaceLister helps list and get Foos.
// All objects returned here must be treated as read-only.
type FooNamespaceLister interface {
// List lists all Foos in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.Foo, err error)
// Get retrieves the Foo from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.Foo, error)
FooNamespaceListerExpansion
}