Skip to content

Commit 009c42f

Browse files
listergen: document assumptions from indexer
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
1 parent ea5c56c commit 009c42f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/internal/listergen/lister.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ type {{.kind.String | lowerFirst }}ClusterLister struct {
8484
}
8585
8686
// New{{.kind.String}}ClusterLister returns a new {{.kind.String}}ClusterLister.
87+
// We assume that the indexer:
88+
// - is fed by a cross-workspace LIST+WATCH
89+
// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function
90+
// - has the kcpcache.ClusterIndex as an index
91+
{{ if .kind.IsNamespaced -}}
92+
// - has the kcpcache.ClusterAndNamespaceIndex as an index
93+
{{end -}}
8794
func New{{.kind.String}}ClusterLister(indexer cache.Indexer) *{{.kind.String | lowerFirst}}ClusterLister {
8895
return &{{.kind.String | lowerFirst}}ClusterLister{indexer: indexer}
8996
}

0 commit comments

Comments
 (0)