From 96277385063889b00f7aaedcb51c8e3ab81e9474 Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Wed, 10 Aug 2022 13:05:39 -0400 Subject: [PATCH 1/4] undo changes to informer/lister gen --- .../cmd/informer-gen/generators/factory.go | 57 ++----------------- .../generators/factoryinterface.go | 5 -- .../cmd/informer-gen/generators/informer.go | 29 ++-------- .../cmd/informer-gen/generators/types.go | 12 +--- 4 files changed, 13 insertions(+), 90 deletions(-) diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factory.go b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factory.go index 6b758f110a50b..1ee9fa5d39dcb 100644 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factory.go +++ b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factory.go @@ -74,7 +74,6 @@ func (g *factoryGenerator) GenerateType(c *generator.Context, t *types.Type, w i gvNewFuncs[groupPkgName] = c.Universe.Function(types.Name{Package: path.Join(g.outputPackage, groupPkgName), Name: "New"}) } m := map[string]interface{}{ - "cacheIndexers": c.Universe.Type(cacheIndexers), "cacheSharedIndexInformer": c.Universe.Type(cacheSharedIndexInformer), "groupVersions": g.groupVersions, "gvInterfaces": gvInterfaces, @@ -83,7 +82,6 @@ func (g *factoryGenerator) GenerateType(c *generator.Context, t *types.Type, w i "interfacesNewInformerFunc": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "NewInformerFunc"}), "interfacesTweakListOptionsFunc": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "TweakListOptionsFunc"}), "informerFactoryInterface": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "SharedInformerFactory"}), - "cacheKeyFunc": c.Universe.Type(cacheKeyFunc), "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), "reflectType": c.Universe.Type(reflectType), "runtimeObject": c.Universe.Type(runtimeObject), @@ -111,9 +109,6 @@ type sharedInformerFactory struct { lock {{.syncMutex|raw}} defaultResync {{.timeDuration|raw}} customResync map[{{.reflectType|raw}}]{{.timeDuration|raw}} - extraClusterScopedIndexers {{.cacheIndexers|raw}} - extraNamespaceScopedIndexers {{.cacheIndexers|raw}} - keyFunc {{.cacheKeyFunc|raw}} informers map[{{.reflectType|raw}}]{{.cacheSharedIndexInformer|raw}} // startedInformers is used for tracking which informers have been started. @@ -147,30 +142,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers {{.cacheIndexers|raw}}) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers {{.cacheIndexers|raw}}) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc {{.cacheKeyFunc|raw}}) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client {{.clientSetInterface|raw}}, defaultResync {{.timeDuration|raw}}) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -187,14 +158,12 @@ func NewFilteredSharedInformerFactory(client {{.clientSetInterface|raw}}, defaul // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client {{.clientSetInterface|raw}}, defaultResync {{.timeDuration|raw}}, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[{{.reflectType|raw}}]{{.cacheSharedIndexInformer|raw}}), - startedInformers: make(map[{{.reflectType|raw}}]bool), - customResync: make(map[{{.reflectType|raw}}]{{.timeDuration|raw}}), - extraClusterScopedIndexers: {{.cacheIndexers|raw}}{}, - extraNamespaceScopedIndexers: {{.cacheIndexers|raw}}{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[{{.reflectType|raw}}]{{.cacheSharedIndexInformer|raw}}), + startedInformers: make(map[{{.reflectType|raw}}]bool), + customResync: make(map[{{.reflectType|raw}}]{{.timeDuration|raw}}), } // Apply all options @@ -263,20 +232,6 @@ func (f *sharedInformerFactory) InformerFor(obj {{.runtimeObject|raw}}, newFunc return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() {{.cacheIndexers|raw}} { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() {{.cacheIndexers|raw}} { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() {{.cacheKeyFunc|raw}} { - return f.keyFunc -} ` var sharedInformerFactoryInterface = ` diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go index de0ee96e93d45..70826ebaad50a 100644 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go +++ b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go @@ -63,10 +63,8 @@ func (g *factoryInterfaceGenerator) GenerateType(c *generator.Context, t *types. klog.V(5).Infof("processing type %v", t) m := map[string]interface{}{ - "cacheIndexers": c.Universe.Type(cacheIndexers), "cacheSharedIndexInformer": c.Universe.Type(cacheSharedIndexInformer), "clientSetPackage": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), - "cacheKeyFunc": c.Universe.Type(cacheKeyFunc), "runtimeObject": c.Universe.Type(runtimeObject), "timeDuration": c.Universe.Type(timeDuration), "v1ListOptions": c.Universe.Type(v1ListOptions), @@ -85,9 +83,6 @@ type NewInformerFunc func({{.clientSetPackage|raw}}, {{.timeDuration|raw}}) cach type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj {{.runtimeObject|raw}}, newFunc NewInformerFunc) {{.cacheSharedIndexInformer|raw}} - ExtraClusterScopedIndexers() {{.cacheIndexers|raw}} - ExtraNamespaceScopedIndexers() {{.cacheIndexers|raw}} - KeyFunction() {{.cacheKeyFunc|raw}} } // TweakListOptionsFunc is a function that transforms a {{.v1ListOptions|raw}}. diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/informer.go b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/informer.go index f44415b98119e..da00e6e61fe5d 100644 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/informer.go +++ b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/informer.go @@ -80,10 +80,6 @@ func (g *informerGenerator) GenerateType(c *generator.Context, t *types.Type, w m := map[string]interface{}{ "apiScheme": c.Universe.Type(apiScheme), "cacheIndexers": c.Universe.Type(cacheIndexers), - "cacheSharedInformerOption": c.Universe.Type(cacheSharedInformerOption), - "cacheWithResyncPeriod": c.Universe.Function(cacheWithResyncPeriod), - "cacheWithKeyFunction": c.Universe.Function(cacheWithKeyFunction), - "cacheWithIndexers": c.Universe.Function(cacheWithIndexers), "cacheListWatch": c.Universe.Type(cacheListWatch), "cacheMetaNamespaceIndexFunc": c.Universe.Function(cacheMetaNamespaceIndexFunc), "cacheNamespaceIndex": c.Universe.Variable(cacheNamespaceIndex), @@ -149,11 +145,7 @@ var typeFilteredInformerPublicConstructor = ` // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFiltered$.type|public$Informer(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, resyncPeriod $.timeDuration|raw$, indexers $.cacheIndexers|raw$, tweakListOptions $.interfacesTweakListOptionsFunc|raw$) $.cacheSharedIndexInformer|raw$ { - return NewFiltered$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, tweakListOptions, $.cacheWithResyncPeriod|raw$(resyncPeriod), $.cacheWithIndexers|raw$(indexers)) -} - -func NewFiltered$.type|public$InformerWithOptions(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, tweakListOptions $.interfacesTweakListOptionsFunc|raw$, opts ...$.cacheSharedInformerOption|raw$) $.cacheSharedIndexInformer|raw$ { - return $.cacheNewSharedIndexInformer|raw$WithOptions( + return $.cacheNewSharedIndexInformer|raw$( &$.cacheListWatch|raw${ ListFunc: func(options $.v1ListOptions|raw$) ($.runtimeObject|raw$, error) { if tweakListOptions != nil { @@ -169,28 +161,15 @@ func NewFiltered$.type|public$InformerWithOptions(client $.clientSetInterface|ra }, }, &$.type|raw${}, - opts..., + resyncPeriod, + indexers, ) } ` var typeInformerConstructor = ` func (f *$.type|private$Informer) defaultInformer(client $.clientSetInterface|raw$, resyncPeriod $.timeDuration|raw$) $.cacheSharedIndexInformer|raw$ { - $if .namespaced$ indexers := $.cacheIndexers|raw${$.cacheNamespaceIndex|raw$: $.cacheMetaNamespaceIndexFunc|raw$} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - $else$indexers := $.cacheIndexers|raw${} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - }$end$ - - return NewFiltered$.type|public$InformerWithOptions(client$if .namespaced$, f.namespace$end$, - f.tweakListOptions, - $.cacheWithResyncPeriod|raw$(resyncPeriod), - $.cacheWithIndexers|raw$(indexers), - $.cacheWithKeyFunction|raw$(f.factory.KeyFunction()), - ) + return NewFiltered$.type|public$Informer(client$if .namespaced$, f.namespace$end$, resyncPeriod, $.cacheIndexers|raw${$.cacheNamespaceIndex|raw$: $.cacheMetaNamespaceIndexFunc|raw$}, f.tweakListOptions) } ` diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/types.go b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/types.go index 653d2e25aa5df..27d4bd51ab125 100644 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/types.go +++ b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/types.go @@ -19,21 +19,15 @@ package generators import "k8s.io/gengo/types" var ( - apiScheme = types.Name{Package: "k8s.io/kubernetes/pkg/api/legacyscheme", Name: "Scheme"} - cacheGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "GenericLister"} - cacheIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "Indexers"} - cacheSharedInformerOption = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedInformerOption"} - cacheWithIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "WithIndexers"} - cacheWithKeyFunction = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "WithKeyFunction"} - cacheWithResyncPeriod = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "WithResyncPeriod"} - + apiScheme = types.Name{Package: "k8s.io/kubernetes/pkg/api/legacyscheme", Name: "Scheme"} + cacheGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "GenericLister"} + cacheIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "Indexers"} cacheListWatch = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "ListWatch"} cacheMetaNamespaceIndexFunc = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "MetaNamespaceIndexFunc"} cacheNamespaceIndex = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NamespaceIndex"} cacheNewGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewGenericLister"} cacheNewSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewSharedIndexInformer"} cacheSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedIndexInformer"} - cacheKeyFunc = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "KeyFunc"} listOptions = types.Name{Package: "k8s.io/kubernetes/pkg/apis/core", Name: "ListOptions"} reflectType = types.Name{Package: "reflect", Name: "Type"} runtimeObject = types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "Object"} From 2edd0d6223808121b376361c6b63e8a6fe6dd225 Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Wed, 10 Aug 2022 13:06:17 -0400 Subject: [PATCH 2/4] TODO: fix kcp-codegen, using kcp-codegen-orig for now --- hack/update-kcp-codegen-orig.sh | 70 +++++++++++++++++++++++++++++++++ hack/update-kcp-codegen.sh | 53 +++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100755 hack/update-kcp-codegen-orig.sh create mode 100755 hack/update-kcp-codegen.sh diff --git a/hack/update-kcp-codegen-orig.sh b/hack/update-kcp-codegen-orig.sh new file mode 100755 index 0000000000000..8b43b70f0ff49 --- /dev/null +++ b/hack/update-kcp-codegen-orig.sh @@ -0,0 +1,70 @@ + #!/bin/bash + +set -e + +code-generator informer,lister \ + --go-header-file hack/boilerplate/boilerplate.generatego.txt \ + --clientset-api-path k8s.io/client-go/kubernetes \ + --listers-package k8s.io/client-go/listers \ + --informers-package k8s.io/client-go/informers \ + --informers-internal-interfaces-package k8s.io/client-go/informers/internalinterfaces \ + --input-dir staging/src/k8s.io/api \ + --output-dir staging/src/k8s.io/client-go/kcp \ + --group-versions storage:v1beta1 \ + --group-versions scheduling:v1alpha1 \ + --group-versions apiserverinternal:v1alpha1 \ + --group-versions core:v1 \ + --group-versions admission:v1 \ + --group-versions admission:v1beta1 \ + --group-versions admissionregistration:v1 \ + --group-versions admissionregistration:v1beta1 \ + --group-versions apps:v1 \ + --group-versions apps:v1beta1 \ + --group-versions apps:v1beta2 \ + --group-versions authentication:v1 \ + --group-versions authentication:v1beta1 \ + --group-versions authorization:v1 \ + --group-versions authorization:v1beta1 \ + --group-versions autoscaling:v1 \ + --group-versions autoscaling:v2 \ + --group-versions autoscaling:v2beta1 \ + --group-versions autoscaling:v2beta2 \ + --group-versions batch:v1 \ + --group-versions batch:v1beta1 \ + --group-versions certificates:v1 \ + --group-versions certificates:v1beta1 \ + --group-versions coordination:v1beta1 \ + --group-versions coordination:v1 \ + --group-versions discovery:v1 \ + --group-versions discovery:v1beta1 \ + --group-versions extensions:v1beta1 \ + --group-versions events:v1 \ + --group-versions events:v1beta1 \ + --group-versions imagepolicy:v1alpha1 \ + --group-versions networking:v1 \ + --group-versions networking:v1beta1 \ + --group-versions node:v1 \ + --group-versions node:v1alpha1 \ + --group-versions node:v1beta1 \ + --group-versions policy:v1 \ + --group-versions policy:v1beta1 \ + --group-versions rbac:v1 \ + --group-versions rbac:v1beta1 \ + --group-versions rbac:v1alpha1 \ + --group-versions scheduling:v1beta1 \ + --group-versions scheduling:v1 \ + --group-versions scheduling:v1alpha1 \ + --group-versions storage:v1 \ + --group-versions flowcontrol:v1alpha1 \ + --group-versions flowcontrol:v1beta1 \ + --group-versions flowcontrol:v1beta2 + +code-generator informer,lister \ + --go-header-file hack/boilerplate/boilerplate.generatego.txt \ + --clientset-api-path k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset \ + --listers-package k8s.io/apiextensions-apiserver/pkg/client/listers \ + --informers-package k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions \ + --informers-internal-interfaces-package k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces \ + --input-dir staging/src/k8s.io/apiextensions-apiserver/pkg/apis \ + --output-dir staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp \ + --group-versions "apiextensions:v1beta1,v1" diff --git a/hack/update-kcp-codegen.sh b/hack/update-kcp-codegen.sh new file mode 100755 index 0000000000000..d50be84fe8b25 --- /dev/null +++ b/hack/update-kcp-codegen.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# set -o errexit +# set -o nounset +# set -o pipefail + +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +source "${KUBE_ROOT}/hack/lib/init.sh" + +# kube::golang::setup_env + +# go install github.com/kcp-dev/code-generator +kcpcodegen=$(kube::util::find-binary "code-generator") + +IFS=" " read -r -a GROUP_VERSIONS <<< "${KUBE_AVAILABLE_GROUP_VERSIONS}" +GV_DIRS=() +for gv in "${GROUP_VERSIONS[@]}"; do + # add items, but strip off any leading apis/ you find to match command expectations + api_dir=$(kube::util::group-version-to-pkg-path "${gv}") + nopkg_dir=${api_dir#pkg/} + nopkg_dir=${nopkg_dir#vendor/k8s.io/api/} + pkg_dir=${nopkg_dir#apis/} + + + # skip groups that aren't being served, clients for these don't matter + if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${gv} "* ]]; then + continue + fi + + GV_DIRS+=("${pkg_dir}") +done +# delimit by commas for the command +GVS=$(echo "${GV_DIRS[*]// /,}" | sed 's|/|:|g' ) + +set +e +${kcpcodegen} informer,lister \ + --output-dir staging/src/k8s.io/client-go/kcp \ + --clientset-api-path k8s.io/client-go/kubernetes \ + --listers-package k8s.io/client-go/listers \ + --informers-package k8s.io/client-go/informers \ + --informers-internal-interfaces-package k8s.io/client-go/informers/internalinterfaces \ + --input-dir staging/src/k8s.io/api \ + --go-header-file "${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt" \ + --group-versions $(echo ${GVS} | sed 's/ / --group-versions /g') + +${kcpcodegen} informer,lister \ + --output-dir staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp \ + --clientset-api-path k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset \ + --listers-package k8s.io/apiextensions-apiserver/pkg/client/listers \ + --informers-package k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions \ + --input-dir staging/src/k8s.io/apiextensions-apiserver/pkg/apis \ + --go-header-file "${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt" \ + --group-versions "apiextensions:v1beta1,v1" From b067d0ac724ace9522b81656b05a4121e3bbd131 Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Wed, 10 Aug 2022 13:08:04 -0400 Subject: [PATCH 3/4] regenerate informers and listers --- .../externalversions/cr/v1/example.go | 21 ++---- .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../v1/customresourcedefinition.go | 21 ++---- .../v1beta1/customresourcedefinition.go | 21 ++---- .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../v1/mutatingwebhookconfiguration.go | 21 ++---- .../v1/validatingwebhookconfiguration.go | 21 ++---- .../v1beta1/mutatingwebhookconfiguration.go | 21 ++---- .../v1beta1/validatingwebhookconfiguration.go | 21 ++---- .../v1alpha1/storageversion.go | 21 ++---- .../informers/apps/v1/controllerrevision.go | 21 ++---- .../client-go/informers/apps/v1/daemonset.go | 21 ++---- .../client-go/informers/apps/v1/deployment.go | 21 ++---- .../client-go/informers/apps/v1/replicaset.go | 21 ++---- .../informers/apps/v1/statefulset.go | 21 ++---- .../apps/v1beta1/controllerrevision.go | 21 ++---- .../informers/apps/v1beta1/deployment.go | 21 ++---- .../informers/apps/v1beta1/statefulset.go | 21 ++---- .../apps/v1beta2/controllerrevision.go | 21 ++---- .../informers/apps/v1beta2/daemonset.go | 21 ++---- .../informers/apps/v1beta2/deployment.go | 21 ++---- .../informers/apps/v1beta2/replicaset.go | 21 ++---- .../informers/apps/v1beta2/statefulset.go | 21 ++---- .../autoscaling/v1/horizontalpodautoscaler.go | 21 ++---- .../autoscaling/v2/horizontalpodautoscaler.go | 21 ++---- .../v2beta1/horizontalpodautoscaler.go | 21 ++---- .../v2beta2/horizontalpodautoscaler.go | 21 ++---- .../client-go/informers/batch/v1/cronjob.go | 21 ++---- .../client-go/informers/batch/v1/job.go | 21 ++---- .../informers/batch/v1beta1/cronjob.go | 21 ++---- .../v1/certificatesigningrequest.go | 21 ++---- .../v1beta1/certificatesigningrequest.go | 21 ++---- .../informers/coordination/v1/lease.go | 21 ++---- .../informers/coordination/v1beta1/lease.go | 21 ++---- .../informers/core/v1/componentstatus.go | 21 ++---- .../client-go/informers/core/v1/configmap.go | 21 ++---- .../client-go/informers/core/v1/endpoints.go | 21 ++---- .../client-go/informers/core/v1/event.go | 21 ++---- .../client-go/informers/core/v1/limitrange.go | 21 ++---- .../client-go/informers/core/v1/namespace.go | 21 ++---- .../client-go/informers/core/v1/node.go | 21 ++---- .../informers/core/v1/persistentvolume.go | 21 ++---- .../core/v1/persistentvolumeclaim.go | 21 ++---- .../k8s.io/client-go/informers/core/v1/pod.go | 21 ++---- .../informers/core/v1/podtemplate.go | 21 ++---- .../core/v1/replicationcontroller.go | 21 ++---- .../informers/core/v1/resourcequota.go | 21 ++---- .../client-go/informers/core/v1/secret.go | 21 ++---- .../client-go/informers/core/v1/service.go | 21 ++---- .../informers/core/v1/serviceaccount.go | 21 ++---- .../informers/discovery/v1/endpointslice.go | 21 ++---- .../discovery/v1beta1/endpointslice.go | 21 ++---- .../client-go/informers/events/v1/event.go | 21 ++---- .../informers/events/v1beta1/event.go | 21 ++---- .../informers/extensions/v1beta1/daemonset.go | 21 ++---- .../extensions/v1beta1/deployment.go | 21 ++---- .../informers/extensions/v1beta1/ingress.go | 21 ++---- .../extensions/v1beta1/networkpolicy.go | 21 ++---- .../extensions/v1beta1/podsecuritypolicy.go | 21 ++---- .../extensions/v1beta1/replicaset.go | 21 ++---- .../src/k8s.io/client-go/informers/factory.go | 68 ++++--------------- .../flowcontrol/v1alpha1/flowschema.go | 21 ++---- .../v1alpha1/prioritylevelconfiguration.go | 21 ++---- .../flowcontrol/v1beta1/flowschema.go | 21 ++---- .../v1beta1/prioritylevelconfiguration.go | 21 ++---- .../flowcontrol/v1beta2/flowschema.go | 21 ++---- .../v1beta2/prioritylevelconfiguration.go | 21 ++---- .../internalinterfaces/factory_interfaces.go | 3 - .../informers/networking/v1/ingress.go | 21 ++---- .../informers/networking/v1/ingressclass.go | 21 ++---- .../informers/networking/v1/networkpolicy.go | 21 ++---- .../informers/networking/v1beta1/ingress.go | 21 ++---- .../networking/v1beta1/ingressclass.go | 21 ++---- .../informers/node/v1/runtimeclass.go | 21 ++---- .../informers/node/v1alpha1/runtimeclass.go | 21 ++---- .../informers/node/v1beta1/runtimeclass.go | 21 ++---- .../policy/v1/poddisruptionbudget.go | 21 ++---- .../policy/v1beta1/poddisruptionbudget.go | 21 ++---- .../policy/v1beta1/podsecuritypolicy.go | 21 ++---- .../informers/rbac/v1/clusterrole.go | 21 ++---- .../informers/rbac/v1/clusterrolebinding.go | 21 ++---- .../client-go/informers/rbac/v1/role.go | 21 ++---- .../informers/rbac/v1/rolebinding.go | 21 ++---- .../informers/rbac/v1alpha1/clusterrole.go | 21 ++---- .../rbac/v1alpha1/clusterrolebinding.go | 21 ++---- .../client-go/informers/rbac/v1alpha1/role.go | 21 ++---- .../informers/rbac/v1alpha1/rolebinding.go | 21 ++---- .../informers/rbac/v1beta1/clusterrole.go | 21 ++---- .../rbac/v1beta1/clusterrolebinding.go | 21 ++---- .../client-go/informers/rbac/v1beta1/role.go | 21 ++---- .../informers/rbac/v1beta1/rolebinding.go | 21 ++---- .../informers/scheduling/v1/priorityclass.go | 21 ++---- .../scheduling/v1alpha1/priorityclass.go | 21 ++---- .../scheduling/v1beta1/priorityclass.go | 21 ++---- .../informers/storage/v1/csidriver.go | 21 ++---- .../client-go/informers/storage/v1/csinode.go | 21 ++---- .../informers/storage/v1/storageclass.go | 21 ++---- .../informers/storage/v1/volumeattachment.go | 21 ++---- .../storage/v1alpha1/csistoragecapacity.go | 21 ++---- .../storage/v1alpha1/volumeattachment.go | 21 ++---- .../informers/storage/v1beta1/csidriver.go | 21 ++---- .../informers/storage/v1beta1/csinode.go | 21 ++---- .../storage/v1beta1/csistoragecapacity.go | 21 ++---- .../informers/storage/v1beta1/storageclass.go | 21 ++---- .../storage/v1beta1/volumeattachment.go | 21 ++---- .../example/v1/clustertesttype.go | 21 ++---- .../externalversions/example/v1/testtype.go | 21 ++---- .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../example/v1/clustertesttype.go | 21 ++---- .../externalversions/example/v1/testtype.go | 21 ++---- .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../externalversions/example/v1/testtype.go | 21 ++---- .../externalversions/example2/v1/testtype.go | 21 ++---- .../example3.io/v1/testtype.go | 21 ++---- .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../example/internalversion/testtype.go | 21 ++---- .../example2/internalversion/testtype.go | 21 ++---- .../example3.io/internalversion/testtype.go | 21 ++---- .../informers/internalversion/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../example/v1/clustertesttype.go | 21 ++---- .../externalversions/example/v1/testtype.go | 21 ++---- .../externalversions/example2/v1/testtype.go | 21 ++---- .../crd/informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../apiregistration/v1/apiservice.go | 21 ++---- .../apiregistration/v1beta1/apiservice.go | 21 ++---- .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../wardle/v1alpha1/fischer.go | 21 ++---- .../wardle/v1alpha1/flunder.go | 21 ++---- .../wardle/v1beta1/flunder.go | 21 ++---- .../informers/externalversions/factory.go | 68 ++++--------------- .../internalinterfaces/factory_interfaces.go | 3 - .../samplecontroller/v1alpha1/foo.go | 21 ++---- 142 files changed, 612 insertions(+), 2689 deletions(-) diff --git a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/cr/v1/example.go b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/cr/v1/example.go index f2fc3db666e2f..d0389d42b65da 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/cr/v1/example.go +++ b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/cr/v1/example.go @@ -56,11 +56,7 @@ func NewExampleInformer(client versioned.Interface, namespace string, resyncPeri // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredExampleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredExampleInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredExampleInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredExampleInformerWithOptions(client versioned.Interface, namespace }, }, &crv1.Example{}, - opts..., + resyncPeriod, + indexers, ) } func (f *exampleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredExampleInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredExampleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *exampleInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/factory.go b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/factory.go index 4c61bb0b26445..67c55af392026 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/factory.go +++ b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/factory.go @@ -36,15 +36,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -78,30 +75,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -118,14 +91,12 @@ func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -194,21 +165,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 63637ad6fb0e7..c39e812f050e5 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/customresourcedefinition.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/customresourcedefinition.go index 4bb7500ce4fc3..7d1b571112645 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/customresourcedefinition.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/customresourcedefinition.go @@ -55,11 +55,7 @@ func NewCustomResourceDefinitionInformer(client clientset.Interface, resyncPerio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCustomResourceDefinitionInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCustomResourceDefinitionInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCustomResourceDefinitionInformerWithOptions(client clientset.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCustomResourceDefinitionInformerWithOptions(client clientset.Int }, }, &apiextensionsv1.CustomResourceDefinition{}, - opts..., + resyncPeriod, + indexers, ) } func (f *customResourceDefinitionInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCustomResourceDefinitionInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *customResourceDefinitionInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/customresourcedefinition.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/customresourcedefinition.go index c29c4bf8f0927..489c87ae9058f 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/customresourcedefinition.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/customresourcedefinition.go @@ -55,11 +55,7 @@ func NewCustomResourceDefinitionInformer(client clientset.Interface, resyncPerio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCustomResourceDefinitionInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCustomResourceDefinitionInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCustomResourceDefinitionInformerWithOptions(client clientset.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCustomResourceDefinitionInformerWithOptions(client clientset.Int }, }, &apiextensionsv1beta1.CustomResourceDefinition{}, - opts..., + resyncPeriod, + indexers, ) } func (f *customResourceDefinitionInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCustomResourceDefinitionInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *customResourceDefinitionInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/factory.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/factory.go index 5e114e7877345..94d039c7292f4 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/factory.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/factory.go @@ -36,15 +36,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client clientset.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client clientset.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -78,30 +75,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client clientset.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -118,14 +91,12 @@ func NewFilteredSharedInformerFactory(client clientset.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client clientset.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -194,21 +165,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 52d1f92174140..da6eadaa7f952 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(clientset.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go index c6b1aafa94515..b768f6f7f3992 100644 --- a/staging/src/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go +++ b/staging/src/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -55,11 +55,7 @@ func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredMutatingWebhookConfigurationInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredMutatingWebhookConfigurationInformerWithOptions(client kubernete }, }, &admissionregistrationv1.MutatingWebhookConfiguration{}, - opts..., + resyncPeriod, + indexers, ) } func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredMutatingWebhookConfigurationInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go index e5194c16003f8..8ddcdf2d905c3 100644 --- a/staging/src/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go +++ b/staging/src/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -55,11 +55,7 @@ func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resy // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredValidatingWebhookConfigurationInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredValidatingWebhookConfigurationInformerWithOptions(client kuberne }, }, &admissionregistrationv1.ValidatingWebhookConfiguration{}, - opts..., + resyncPeriod, + indexers, ) } func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredValidatingWebhookConfigurationInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go index ecddb8818a7dc..12c8ec1fbddd7 100644 --- a/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go +++ b/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -55,11 +55,7 @@ func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredMutatingWebhookConfigurationInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredMutatingWebhookConfigurationInformerWithOptions(client kubernete }, }, &admissionregistrationv1beta1.MutatingWebhookConfiguration{}, - opts..., + resyncPeriod, + indexers, ) } func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredMutatingWebhookConfigurationInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go index 713e152efef15..05eb05097f57d 100644 --- a/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go +++ b/staging/src/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -55,11 +55,7 @@ func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resy // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredValidatingWebhookConfigurationInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredValidatingWebhookConfigurationInformerWithOptions(client kuberne }, }, &admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, - opts..., + resyncPeriod, + indexers, ) } func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredValidatingWebhookConfigurationInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go b/staging/src/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go index c7861bb705c41..34175b522d860 100644 --- a/staging/src/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go +++ b/staging/src/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go @@ -55,11 +55,7 @@ func NewStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Du // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredStorageVersionInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredStorageVersionInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredStorageVersionInformerWithOptions(client kubernetes.Interface, t }, }, &apiserverinternalv1alpha1.StorageVersion{}, - opts..., + resyncPeriod, + indexers, ) } func (f *storageVersionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredStorageVersionInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredStorageVersionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *storageVersionInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1/controllerrevision.go b/staging/src/k8s.io/client-go/informers/apps/v1/controllerrevision.go index 78ddd0af38d09..31e2b74d0f3ee 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1/controllerrevision.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1/controllerrevision.go @@ -56,11 +56,7 @@ func NewControllerRevisionInformer(client kubernetes.Interface, namespace string // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredControllerRevisionInformerWithOptions(client kubernetes.Interfac }, }, &appsv1.ControllerRevision{}, - opts..., + resyncPeriod, + indexers, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredControllerRevisionInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1/daemonset.go b/staging/src/k8s.io/client-go/informers/apps/v1/daemonset.go index adac876e82ff5..da7fe9509b932 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1/daemonset.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1/daemonset.go @@ -56,11 +56,7 @@ func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncP // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredDaemonSetInformerWithOptions(client kubernetes.Interface, namesp }, }, &appsv1.DaemonSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredDaemonSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1/deployment.go b/staging/src/k8s.io/client-go/informers/apps/v1/deployment.go index bb5c63fbd1689..bd639bb3d907b 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1/deployment.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1/deployment.go @@ -56,11 +56,7 @@ func NewDeploymentInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredDeploymentInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, names }, }, &appsv1.Deployment{}, - opts..., + resyncPeriod, + indexers, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredDeploymentInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1/replicaset.go b/staging/src/k8s.io/client-go/informers/apps/v1/replicaset.go index 849bedd1666af..6d81a471a4484 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1/replicaset.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1/replicaset.go @@ -56,11 +56,7 @@ func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredReplicaSetInformerWithOptions(client kubernetes.Interface, names }, }, &appsv1.ReplicaSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredReplicaSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1/statefulset.go b/staging/src/k8s.io/client-go/informers/apps/v1/statefulset.go index fb767391193a4..c99bbb73ed83e 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1/statefulset.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1/statefulset.go @@ -56,11 +56,7 @@ func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyn // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredStatefulSetInformerWithOptions(client kubernetes.Interface, name }, }, &appsv1.StatefulSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredStatefulSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go b/staging/src/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go index 458716720db02..cb36bd7fd84a1 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go @@ -56,11 +56,7 @@ func NewControllerRevisionInformer(client kubernetes.Interface, namespace string // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredControllerRevisionInformerWithOptions(client kubernetes.Interfac }, }, &appsv1beta1.ControllerRevision{}, - opts..., + resyncPeriod, + indexers, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredControllerRevisionInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta1/deployment.go b/staging/src/k8s.io/client-go/informers/apps/v1beta1/deployment.go index e6b92606797e1..e02a13c2f4c58 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta1/deployment.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta1/deployment.go @@ -56,11 +56,7 @@ func NewDeploymentInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredDeploymentInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, names }, }, &appsv1beta1.Deployment{}, - opts..., + resyncPeriod, + indexers, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredDeploymentInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta1/statefulset.go b/staging/src/k8s.io/client-go/informers/apps/v1beta1/statefulset.go index 9fd613ac75972..b845cc99c989a 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta1/statefulset.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta1/statefulset.go @@ -56,11 +56,7 @@ func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyn // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredStatefulSetInformerWithOptions(client kubernetes.Interface, name }, }, &appsv1beta1.StatefulSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredStatefulSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go b/staging/src/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go index df59ca52c5a36..4d0e91320b632 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go @@ -56,11 +56,7 @@ func NewControllerRevisionInformer(client kubernetes.Interface, namespace string // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredControllerRevisionInformerWithOptions(client kubernetes.Interfac }, }, &appsv1beta2.ControllerRevision{}, - opts..., + resyncPeriod, + indexers, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredControllerRevisionInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta2/daemonset.go b/staging/src/k8s.io/client-go/informers/apps/v1beta2/daemonset.go index f2b367366eea1..280e2fe465657 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta2/daemonset.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta2/daemonset.go @@ -56,11 +56,7 @@ func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncP // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredDaemonSetInformerWithOptions(client kubernetes.Interface, namesp }, }, &appsv1beta2.DaemonSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredDaemonSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta2/deployment.go b/staging/src/k8s.io/client-go/informers/apps/v1beta2/deployment.go index a1c9993ef2c3e..67bdb79720a23 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta2/deployment.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta2/deployment.go @@ -56,11 +56,7 @@ func NewDeploymentInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredDeploymentInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, names }, }, &appsv1beta2.Deployment{}, - opts..., + resyncPeriod, + indexers, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredDeploymentInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta2/replicaset.go b/staging/src/k8s.io/client-go/informers/apps/v1beta2/replicaset.go index d2f407d083f33..85d12bb65da93 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta2/replicaset.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta2/replicaset.go @@ -56,11 +56,7 @@ func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredReplicaSetInformerWithOptions(client kubernetes.Interface, names }, }, &appsv1beta2.ReplicaSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredReplicaSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/apps/v1beta2/statefulset.go b/staging/src/k8s.io/client-go/informers/apps/v1beta2/statefulset.go index 969c3c4aab360..2fab6f7b2bf1c 100644 --- a/staging/src/k8s.io/client-go/informers/apps/v1beta2/statefulset.go +++ b/staging/src/k8s.io/client-go/informers/apps/v1beta2/statefulset.go @@ -56,11 +56,7 @@ func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyn // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredStatefulSetInformerWithOptions(client kubernetes.Interface, name }, }, &appsv1beta2.StatefulSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredStatefulSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go index 1acd0e46e0459..44f041e906b56 100644 --- a/staging/src/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go +++ b/staging/src/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go @@ -56,11 +56,7 @@ func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace s // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Int }, }, &autoscalingv1.HorizontalPodAutoscaler{}, - opts..., + resyncPeriod, + indexers, ) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go index 89432a5b3a618..5ddb3b015f2dd 100644 --- a/staging/src/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go +++ b/staging/src/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go @@ -56,11 +56,7 @@ func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace s // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Int }, }, &autoscalingv2.HorizontalPodAutoscaler{}, - opts..., + resyncPeriod, + indexers, ) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go index 6c83c7eb73b53..6385a2a190a30 100644 --- a/staging/src/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go +++ b/staging/src/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -56,11 +56,7 @@ func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace s // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Int }, }, &autoscalingv2beta1.HorizontalPodAutoscaler{}, - opts..., + resyncPeriod, + indexers, ) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go index ac13e277aa020..f1ac3f0737c83 100644 --- a/staging/src/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go +++ b/staging/src/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -56,11 +56,7 @@ func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace s // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Int }, }, &autoscalingv2beta2.HorizontalPodAutoscaler{}, - opts..., + resyncPeriod, + indexers, ) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/batch/v1/cronjob.go b/staging/src/k8s.io/client-go/informers/batch/v1/cronjob.go index 49fb93dbef3bf..fdfb655134d03 100644 --- a/staging/src/k8s.io/client-go/informers/batch/v1/cronjob.go +++ b/staging/src/k8s.io/client-go/informers/batch/v1/cronjob.go @@ -56,11 +56,7 @@ func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCronJobInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCronJobInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredCronJobInformerWithOptions(client kubernetes.Interface, namespac }, }, &batchv1.CronJob{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCronJobInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/batch/v1/job.go b/staging/src/k8s.io/client-go/informers/batch/v1/job.go index c83c4ef5b03b9..4992f52286312 100644 --- a/staging/src/k8s.io/client-go/informers/batch/v1/job.go +++ b/staging/src/k8s.io/client-go/informers/batch/v1/job.go @@ -56,11 +56,7 @@ func NewJobInformer(client kubernetes.Interface, namespace string, resyncPeriod // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredJobInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredJobInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredJobInformerWithOptions(client kubernetes.Interface, namespace st }, }, &batchv1.Job{}, - opts..., + resyncPeriod, + indexers, ) } func (f *jobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredJobInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *jobInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/batch/v1beta1/cronjob.go b/staging/src/k8s.io/client-go/informers/batch/v1beta1/cronjob.go index 7e916f5898263..820c93eaaafed 100644 --- a/staging/src/k8s.io/client-go/informers/batch/v1beta1/cronjob.go +++ b/staging/src/k8s.io/client-go/informers/batch/v1beta1/cronjob.go @@ -56,11 +56,7 @@ func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCronJobInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCronJobInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredCronJobInformerWithOptions(client kubernetes.Interface, namespac }, }, &batchv1beta1.CronJob{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCronJobInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go b/staging/src/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go index ea14cc7ce0e33..73d33a914ce18 100644 --- a/staging/src/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go +++ b/staging/src/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go @@ -55,11 +55,7 @@ func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCertificateSigningRequestInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCertificateSigningRequestInformerWithOptions(client kubernetes.I }, }, &certificatesv1.CertificateSigningRequest{}, - opts..., + resyncPeriod, + indexers, ) } func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCertificateSigningRequestInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go b/staging/src/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go index 7c67c9aecb09b..4e167ab8b1318 100644 --- a/staging/src/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go +++ b/staging/src/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go @@ -55,11 +55,7 @@ func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCertificateSigningRequestInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCertificateSigningRequestInformerWithOptions(client kubernetes.I }, }, &certificatesv1beta1.CertificateSigningRequest{}, - opts..., + resyncPeriod, + indexers, ) } func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCertificateSigningRequestInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/coordination/v1/lease.go b/staging/src/k8s.io/client-go/informers/coordination/v1/lease.go index c67536762e23a..e538923a86b8f 100644 --- a/staging/src/k8s.io/client-go/informers/coordination/v1/lease.go +++ b/staging/src/k8s.io/client-go/informers/coordination/v1/lease.go @@ -56,11 +56,7 @@ func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPerio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredLeaseInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredLeaseInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredLeaseInformerWithOptions(client kubernetes.Interface, namespace }, }, &coordinationv1.Lease{}, - opts..., + resyncPeriod, + indexers, ) } func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredLeaseInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *leaseInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/coordination/v1beta1/lease.go b/staging/src/k8s.io/client-go/informers/coordination/v1beta1/lease.go index dd59b57a7b8c7..5a6959c0ba971 100644 --- a/staging/src/k8s.io/client-go/informers/coordination/v1beta1/lease.go +++ b/staging/src/k8s.io/client-go/informers/coordination/v1beta1/lease.go @@ -56,11 +56,7 @@ func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPerio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredLeaseInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredLeaseInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredLeaseInformerWithOptions(client kubernetes.Interface, namespace }, }, &coordinationv1beta1.Lease{}, - opts..., + resyncPeriod, + indexers, ) } func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredLeaseInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *leaseInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/componentstatus.go b/staging/src/k8s.io/client-go/informers/core/v1/componentstatus.go index 8217de7c36ecb..ccdee535bc2fa 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/componentstatus.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/componentstatus.go @@ -55,11 +55,7 @@ func NewComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.D // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredComponentStatusInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredComponentStatusInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredComponentStatusInformerWithOptions(client kubernetes.Interface, }, }, &corev1.ComponentStatus{}, - opts..., + resyncPeriod, + indexers, ) } func (f *componentStatusInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredComponentStatusInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredComponentStatusInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *componentStatusInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/configmap.go b/staging/src/k8s.io/client-go/informers/core/v1/configmap.go index 23dfb5e529210..6253581784ea1 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/configmap.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/configmap.go @@ -56,11 +56,7 @@ func NewConfigMapInformer(client kubernetes.Interface, namespace string, resyncP // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredConfigMapInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredConfigMapInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredConfigMapInformerWithOptions(client kubernetes.Interface, namesp }, }, &corev1.ConfigMap{}, - opts..., + resyncPeriod, + indexers, ) } func (f *configMapInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredConfigMapInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredConfigMapInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *configMapInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/endpoints.go b/staging/src/k8s.io/client-go/informers/core/v1/endpoints.go index 5ebbefecdb06e..cd0f25b7f7031 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/endpoints.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/endpoints.go @@ -56,11 +56,7 @@ func NewEndpointsInformer(client kubernetes.Interface, namespace string, resyncP // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredEndpointsInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredEndpointsInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredEndpointsInformerWithOptions(client kubernetes.Interface, namesp }, }, &corev1.Endpoints{}, - opts..., + resyncPeriod, + indexers, ) } func (f *endpointsInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredEndpointsInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredEndpointsInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *endpointsInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/event.go b/staging/src/k8s.io/client-go/informers/core/v1/event.go index d0f68e9d00a31..8825e9b7a4921 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/event.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/event.go @@ -56,11 +56,7 @@ func NewEventInformer(client kubernetes.Interface, namespace string, resyncPerio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredEventInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredEventInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredEventInformerWithOptions(client kubernetes.Interface, namespace }, }, &corev1.Event{}, - opts..., + resyncPeriod, + indexers, ) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredEventInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *eventInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/limitrange.go b/staging/src/k8s.io/client-go/informers/core/v1/limitrange.go index dd40c87a075a4..4cbfda1f7a6cf 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/limitrange.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/limitrange.go @@ -56,11 +56,7 @@ func NewLimitRangeInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredLimitRangeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredLimitRangeInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredLimitRangeInformerWithOptions(client kubernetes.Interface, names }, }, &corev1.LimitRange{}, - opts..., + resyncPeriod, + indexers, ) } func (f *limitRangeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredLimitRangeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredLimitRangeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *limitRangeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/namespace.go b/staging/src/k8s.io/client-go/informers/core/v1/namespace.go index 3e2248bdf701c..506f930a7d534 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/namespace.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/namespace.go @@ -55,11 +55,7 @@ func NewNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duratio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredNamespaceInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredNamespaceInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredNamespaceInformerWithOptions(client kubernetes.Interface, tweakL }, }, &corev1.Namespace{}, - opts..., + resyncPeriod, + indexers, ) } func (f *namespaceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredNamespaceInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredNamespaceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *namespaceInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/node.go b/staging/src/k8s.io/client-go/informers/core/v1/node.go index 77ff3bd950aa9..9939fc2cb6c16 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/node.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/node.go @@ -55,11 +55,7 @@ func NewNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, in // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredNodeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredNodeInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredNodeInformerWithOptions(client kubernetes.Interface, tweakListOp }, }, &corev1.Node{}, - opts..., + resyncPeriod, + indexers, ) } func (f *nodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredNodeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredNodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *nodeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/persistentvolume.go b/staging/src/k8s.io/client-go/informers/core/v1/persistentvolume.go index f34e8309ae829..c82445997ca97 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/persistentvolume.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/persistentvolume.go @@ -55,11 +55,7 @@ func NewPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPersistentVolumeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPersistentVolumeInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPersistentVolumeInformerWithOptions(client kubernetes.Interface, }, }, &corev1.PersistentVolume{}, - opts..., + resyncPeriod, + indexers, ) } func (f *persistentVolumeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPersistentVolumeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *persistentVolumeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go b/staging/src/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go index 214e54271390f..7a7df1cff8193 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go @@ -56,11 +56,7 @@ func NewPersistentVolumeClaimInformer(client kubernetes.Interface, namespace str // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPersistentVolumeClaimInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPersistentVolumeClaimInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredPersistentVolumeClaimInformerWithOptions(client kubernetes.Inter }, }, &corev1.PersistentVolumeClaim{}, - opts..., + resyncPeriod, + indexers, ) } func (f *persistentVolumeClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPersistentVolumeClaimInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPersistentVolumeClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *persistentVolumeClaimInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/pod.go b/staging/src/k8s.io/client-go/informers/core/v1/pod.go index 18648e94b8552..5c713a9b6f499 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/pod.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/pod.go @@ -56,11 +56,7 @@ func NewPodInformer(client kubernetes.Interface, namespace string, resyncPeriod // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPodInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPodInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredPodInformerWithOptions(client kubernetes.Interface, namespace st }, }, &corev1.Pod{}, - opts..., + resyncPeriod, + indexers, ) } func (f *podInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPodInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPodInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *podInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/podtemplate.go b/staging/src/k8s.io/client-go/informers/core/v1/podtemplate.go index ef84c75748142..2a16e910dbe5f 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/podtemplate.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/podtemplate.go @@ -56,11 +56,7 @@ func NewPodTemplateInformer(client kubernetes.Interface, namespace string, resyn // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPodTemplateInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPodTemplateInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredPodTemplateInformerWithOptions(client kubernetes.Interface, name }, }, &corev1.PodTemplate{}, - opts..., + resyncPeriod, + indexers, ) } func (f *podTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPodTemplateInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPodTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *podTemplateInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/replicationcontroller.go b/staging/src/k8s.io/client-go/informers/core/v1/replicationcontroller.go index b6b51bdbd0807..930beb4cd5f52 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/replicationcontroller.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/replicationcontroller.go @@ -56,11 +56,7 @@ func NewReplicationControllerInformer(client kubernetes.Interface, namespace str // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredReplicationControllerInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredReplicationControllerInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredReplicationControllerInformerWithOptions(client kubernetes.Inter }, }, &corev1.ReplicationController{}, - opts..., + resyncPeriod, + indexers, ) } func (f *replicationControllerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredReplicationControllerInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredReplicationControllerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *replicationControllerInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/resourcequota.go b/staging/src/k8s.io/client-go/informers/core/v1/resourcequota.go index b16153b456b64..619262a6128b3 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/resourcequota.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/resourcequota.go @@ -56,11 +56,7 @@ func NewResourceQuotaInformer(client kubernetes.Interface, namespace string, res // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredResourceQuotaInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredResourceQuotaInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredResourceQuotaInformerWithOptions(client kubernetes.Interface, na }, }, &corev1.ResourceQuota{}, - opts..., + resyncPeriod, + indexers, ) } func (f *resourceQuotaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredResourceQuotaInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredResourceQuotaInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *resourceQuotaInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/secret.go b/staging/src/k8s.io/client-go/informers/core/v1/secret.go index 25eb79d971d01..a6be070693077 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/secret.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/secret.go @@ -56,11 +56,7 @@ func NewSecretInformer(client kubernetes.Interface, namespace string, resyncPeri // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredSecretInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredSecretInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredSecretInformerWithOptions(client kubernetes.Interface, namespace }, }, &corev1.Secret{}, - opts..., + resyncPeriod, + indexers, ) } func (f *secretInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredSecretInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredSecretInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *secretInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/service.go b/staging/src/k8s.io/client-go/informers/core/v1/service.go index 191fdb8f42a05..3d9ecc6e95401 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/service.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/service.go @@ -56,11 +56,7 @@ func NewServiceInformer(client kubernetes.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredServiceInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredServiceInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredServiceInformerWithOptions(client kubernetes.Interface, namespac }, }, &corev1.Service{}, - opts..., + resyncPeriod, + indexers, ) } func (f *serviceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredServiceInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *serviceInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/core/v1/serviceaccount.go b/staging/src/k8s.io/client-go/informers/core/v1/serviceaccount.go index 42107c67e1898..44371c9fa4f94 100644 --- a/staging/src/k8s.io/client-go/informers/core/v1/serviceaccount.go +++ b/staging/src/k8s.io/client-go/informers/core/v1/serviceaccount.go @@ -56,11 +56,7 @@ func NewServiceAccountInformer(client kubernetes.Interface, namespace string, re // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredServiceAccountInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredServiceAccountInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredServiceAccountInformerWithOptions(client kubernetes.Interface, n }, }, &corev1.ServiceAccount{}, - opts..., + resyncPeriod, + indexers, ) } func (f *serviceAccountInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredServiceAccountInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredServiceAccountInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *serviceAccountInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/discovery/v1/endpointslice.go b/staging/src/k8s.io/client-go/informers/discovery/v1/endpointslice.go index d1b9364a652e9..6c6c3372bfc84 100644 --- a/staging/src/k8s.io/client-go/informers/discovery/v1/endpointslice.go +++ b/staging/src/k8s.io/client-go/informers/discovery/v1/endpointslice.go @@ -56,11 +56,7 @@ func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, res // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredEndpointSliceInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredEndpointSliceInformerWithOptions(client kubernetes.Interface, na }, }, &discoveryv1.EndpointSlice{}, - opts..., + resyncPeriod, + indexers, ) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredEndpointSliceInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go index feb6f8a5d616e..69ae38a91a11b 100644 --- a/staging/src/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go +++ b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go @@ -56,11 +56,7 @@ func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, res // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredEndpointSliceInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredEndpointSliceInformerWithOptions(client kubernetes.Interface, na }, }, &discoveryv1beta1.EndpointSlice{}, - opts..., + resyncPeriod, + indexers, ) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredEndpointSliceInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/events/v1/event.go b/staging/src/k8s.io/client-go/informers/events/v1/event.go index 629678581d33f..f8d35ee15ccb3 100644 --- a/staging/src/k8s.io/client-go/informers/events/v1/event.go +++ b/staging/src/k8s.io/client-go/informers/events/v1/event.go @@ -56,11 +56,7 @@ func NewEventInformer(client kubernetes.Interface, namespace string, resyncPerio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredEventInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredEventInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredEventInformerWithOptions(client kubernetes.Interface, namespace }, }, &eventsv1.Event{}, - opts..., + resyncPeriod, + indexers, ) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredEventInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *eventInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/events/v1beta1/event.go b/staging/src/k8s.io/client-go/informers/events/v1beta1/event.go index 5511c526c1f0d..025f6a5cf36da 100644 --- a/staging/src/k8s.io/client-go/informers/events/v1beta1/event.go +++ b/staging/src/k8s.io/client-go/informers/events/v1beta1/event.go @@ -56,11 +56,7 @@ func NewEventInformer(client kubernetes.Interface, namespace string, resyncPerio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredEventInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredEventInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredEventInformerWithOptions(client kubernetes.Interface, namespace }, }, &eventsv1beta1.Event{}, - opts..., + resyncPeriod, + indexers, ) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredEventInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *eventInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go index 953ce84f67ded..050080a598609 100644 --- a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go +++ b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go @@ -56,11 +56,7 @@ func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncP // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredDaemonSetInformerWithOptions(client kubernetes.Interface, namesp }, }, &extensionsv1beta1.DaemonSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredDaemonSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/deployment.go b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/deployment.go index e0710141cfc6c..1b16c5cc919ea 100644 --- a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/deployment.go +++ b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/deployment.go @@ -56,11 +56,7 @@ func NewDeploymentInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredDeploymentInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredDeploymentInformerWithOptions(client kubernetes.Interface, names }, }, &extensionsv1beta1.Deployment{}, - opts..., + resyncPeriod, + indexers, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredDeploymentInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/ingress.go b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/ingress.go index f1962c01c957b..f01a8876174d2 100644 --- a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/ingress.go +++ b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/ingress.go @@ -56,11 +56,7 @@ func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredIngressInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredIngressInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredIngressInformerWithOptions(client kubernetes.Interface, namespac }, }, &extensionsv1beta1.Ingress{}, - opts..., + resyncPeriod, + indexers, ) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredIngressInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go index c3c7dbb5185ac..4a924619fb2da 100644 --- a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go +++ b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go @@ -56,11 +56,7 @@ func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, res // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredNetworkPolicyInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredNetworkPolicyInformerWithOptions(client kubernetes.Interface, na }, }, &extensionsv1beta1.NetworkPolicy{}, - opts..., + resyncPeriod, + indexers, ) } func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredNetworkPolicyInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go index fbf279f051c1a..11be2751ccf46 100644 --- a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go +++ b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go @@ -55,11 +55,7 @@ func NewPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPodSecurityPolicyInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPodSecurityPolicyInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPodSecurityPolicyInformerWithOptions(client kubernetes.Interface }, }, &extensionsv1beta1.PodSecurityPolicy{}, - opts..., + resyncPeriod, + indexers, ) } func (f *podSecurityPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPodSecurityPolicyInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *podSecurityPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go index a3d2c532382fc..f7e224bcfbfcd 100644 --- a/staging/src/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go +++ b/staging/src/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go @@ -56,11 +56,7 @@ func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resync // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredReplicaSetInformerWithOptions(client kubernetes.Interface, names }, }, &extensionsv1beta1.ReplicaSet{}, - opts..., + resyncPeriod, + indexers, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredReplicaSetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/factory.go b/staging/src/k8s.io/client-go/informers/factory.go index f294d8ecdfd13..c6e102699051a 100644 --- a/staging/src/k8s.io/client-go/informers/factory.go +++ b/staging/src/k8s.io/client-go/informers/factory.go @@ -53,15 +53,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client kubernetes.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client kubernetes.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -95,30 +92,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -135,14 +108,12 @@ func NewFilteredSharedInformerFactory(client kubernetes.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client kubernetes.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -211,21 +182,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go b/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go index 195213576da59..9a4a904481d8a 100644 --- a/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go +++ b/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go @@ -55,11 +55,7 @@ func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Durati // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredFlowSchemaInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredFlowSchemaInformerWithOptions(client kubernetes.Interface, tweak }, }, &flowcontrolv1alpha1.FlowSchema{}, - opts..., + resyncPeriod, + indexers, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredFlowSchemaInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go index 3044cb14c14b2..b81f5c9c36b6d 100644 --- a/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go +++ b/staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -55,11 +55,7 @@ func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPe // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPriorityLevelConfigurationInformerWithOptions(client kubernetes. }, }, &flowcontrolv1alpha1.PriorityLevelConfiguration{}, - opts..., + resyncPeriod, + indexers, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPriorityLevelConfigurationInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go index e7bf27a00f661..13f4ff0933979 100644 --- a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go +++ b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go @@ -55,11 +55,7 @@ func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Durati // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredFlowSchemaInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredFlowSchemaInformerWithOptions(client kubernetes.Interface, tweak }, }, &flowcontrolv1beta1.FlowSchema{}, - opts..., + resyncPeriod, + indexers, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredFlowSchemaInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go index daef853e004f9..fa4835906a9c0 100644 --- a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go +++ b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -55,11 +55,7 @@ func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPe // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPriorityLevelConfigurationInformerWithOptions(client kubernetes. }, }, &flowcontrolv1beta1.PriorityLevelConfiguration{}, - opts..., + resyncPeriod, + indexers, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPriorityLevelConfigurationInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go index ac3dd4cd50f6a..6f6abecea8ab2 100644 --- a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go +++ b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go @@ -55,11 +55,7 @@ func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Durati // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredFlowSchemaInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredFlowSchemaInformerWithOptions(client kubernetes.Interface, tweak }, }, &flowcontrolv1beta2.FlowSchema{}, - opts..., + resyncPeriod, + indexers, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredFlowSchemaInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go index 7b04cc8665559..306a9018517b6 100644 --- a/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go +++ b/staging/src/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go @@ -55,11 +55,7 @@ func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPe // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPriorityLevelConfigurationInformerWithOptions(client kubernetes. }, }, &flowcontrolv1beta2.PriorityLevelConfiguration{}, - opts..., + resyncPeriod, + indexers, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPriorityLevelConfigurationInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go index 6567dea09bb42..b00ed70cfdb71 100644 --- a/staging/src/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(kubernetes.Interface, time.Duration) cache.SharedIndex type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/client-go/informers/networking/v1/ingress.go b/staging/src/k8s.io/client-go/informers/networking/v1/ingress.go index 337b4e31e5ff0..06c317ad313eb 100644 --- a/staging/src/k8s.io/client-go/informers/networking/v1/ingress.go +++ b/staging/src/k8s.io/client-go/informers/networking/v1/ingress.go @@ -56,11 +56,7 @@ func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredIngressInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredIngressInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredIngressInformerWithOptions(client kubernetes.Interface, namespac }, }, &networkingv1.Ingress{}, - opts..., + resyncPeriod, + indexers, ) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredIngressInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/networking/v1/ingressclass.go b/staging/src/k8s.io/client-go/informers/networking/v1/ingressclass.go index 1fb5bdbb17f0f..15514745bfce3 100644 --- a/staging/src/k8s.io/client-go/informers/networking/v1/ingressclass.go +++ b/staging/src/k8s.io/client-go/informers/networking/v1/ingressclass.go @@ -55,11 +55,7 @@ func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Dura // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredIngressClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredIngressClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredIngressClassInformerWithOptions(client kubernetes.Interface, twe }, }, &networkingv1.IngressClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredIngressClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/networking/v1/networkpolicy.go b/staging/src/k8s.io/client-go/informers/networking/v1/networkpolicy.go index dc0749174fb57..a75c9ac21f215 100644 --- a/staging/src/k8s.io/client-go/informers/networking/v1/networkpolicy.go +++ b/staging/src/k8s.io/client-go/informers/networking/v1/networkpolicy.go @@ -56,11 +56,7 @@ func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, res // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredNetworkPolicyInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredNetworkPolicyInformerWithOptions(client kubernetes.Interface, na }, }, &networkingv1.NetworkPolicy{}, - opts..., + resyncPeriod, + indexers, ) } func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredNetworkPolicyInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingress.go b/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingress.go index 690cafaf1a59a..8800d6c9cd86d 100644 --- a/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingress.go +++ b/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingress.go @@ -56,11 +56,7 @@ func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredIngressInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredIngressInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredIngressInformerWithOptions(client kubernetes.Interface, namespac }, }, &networkingv1beta1.Ingress{}, - opts..., + resyncPeriod, + indexers, ) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredIngressInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go b/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go index f6f3285a3d904..17864299bcbdd 100644 --- a/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go +++ b/staging/src/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go @@ -55,11 +55,7 @@ func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Dura // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredIngressClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredIngressClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredIngressClassInformerWithOptions(client kubernetes.Interface, twe }, }, &networkingv1beta1.IngressClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredIngressClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/node/v1/runtimeclass.go b/staging/src/k8s.io/client-go/informers/node/v1/runtimeclass.go index c46daf54caafd..293f4e2e2b68a 100644 --- a/staging/src/k8s.io/client-go/informers/node/v1/runtimeclass.go +++ b/staging/src/k8s.io/client-go/informers/node/v1/runtimeclass.go @@ -55,11 +55,7 @@ func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Dura // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRuntimeClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredRuntimeClassInformerWithOptions(client kubernetes.Interface, twe }, }, &nodev1.RuntimeClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRuntimeClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go b/staging/src/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go index 5cc5b055013de..d314a9573c677 100644 --- a/staging/src/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go +++ b/staging/src/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go @@ -55,11 +55,7 @@ func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Dura // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRuntimeClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredRuntimeClassInformerWithOptions(client kubernetes.Interface, twe }, }, &nodev1alpha1.RuntimeClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRuntimeClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go b/staging/src/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go index 2878e3d2dbde4..07619b2306f72 100644 --- a/staging/src/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go +++ b/staging/src/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go @@ -55,11 +55,7 @@ func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Dura // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRuntimeClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredRuntimeClassInformerWithOptions(client kubernetes.Interface, twe }, }, &nodev1beta1.RuntimeClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRuntimeClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go b/staging/src/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go index eb62646443e82..436598512af2b 100644 --- a/staging/src/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go +++ b/staging/src/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go @@ -56,11 +56,7 @@ func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace strin // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPodDisruptionBudgetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredPodDisruptionBudgetInformerWithOptions(client kubernetes.Interfa }, }, &policyv1.PodDisruptionBudget{}, - opts..., + resyncPeriod, + indexers, ) } func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPodDisruptionBudgetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go b/staging/src/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go index cc090cd1211ac..4530343ecc031 100644 --- a/staging/src/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go +++ b/staging/src/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go @@ -56,11 +56,7 @@ func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace strin // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPodDisruptionBudgetInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredPodDisruptionBudgetInformerWithOptions(client kubernetes.Interfa }, }, &policyv1beta1.PodDisruptionBudget{}, - opts..., + resyncPeriod, + indexers, ) } func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPodDisruptionBudgetInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go b/staging/src/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go index 8bf2e3655bf14..b87d23434ef82 100644 --- a/staging/src/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go +++ b/staging/src/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go @@ -55,11 +55,7 @@ func NewPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPodSecurityPolicyInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPodSecurityPolicyInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPodSecurityPolicyInformerWithOptions(client kubernetes.Interface }, }, &policyv1beta1.PodSecurityPolicy{}, - opts..., + resyncPeriod, + indexers, ) } func (f *podSecurityPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPodSecurityPolicyInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *podSecurityPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrole.go b/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrole.go index d00956894152c..0572be264bb6b 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrole.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrole.go @@ -55,11 +55,7 @@ func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Durat // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterRoleInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterRoleInformerWithOptions(client kubernetes.Interface, twea }, }, &rbacv1.ClusterRole{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterRoleInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go b/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go index 8d89cde6ea4c2..51026c0558031 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go @@ -55,11 +55,7 @@ func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod tim // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterRoleBindingInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterRoleBindingInformerWithOptions(client kubernetes.Interfac }, }, &rbacv1.ClusterRoleBinding{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterRoleBindingInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1/role.go b/staging/src/k8s.io/client-go/informers/rbac/v1/role.go index 775a3f04879d1..986a5f29f4a66 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1/role.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1/role.go @@ -56,11 +56,7 @@ func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRoleInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRoleInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredRoleInformerWithOptions(client kubernetes.Interface, namespace s }, }, &rbacv1.Role{}, - opts..., + resyncPeriod, + indexers, ) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRoleInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *roleInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1/rolebinding.go b/staging/src/k8s.io/client-go/informers/rbac/v1/rolebinding.go index 6f229b4ddeeb7..0264049fb0e69 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1/rolebinding.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1/rolebinding.go @@ -56,11 +56,7 @@ func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyn // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredRoleBindingInformerWithOptions(client kubernetes.Interface, name }, }, &rbacv1.RoleBinding{}, - opts..., + resyncPeriod, + indexers, ) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRoleBindingInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go index 7f5e05e4dca40..70d9885f0a086 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go @@ -55,11 +55,7 @@ func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Durat // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterRoleInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterRoleInformerWithOptions(client kubernetes.Interface, twea }, }, &rbacv1alpha1.ClusterRole{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterRoleInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go index c637d54248094..8c18f6792849b 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go @@ -55,11 +55,7 @@ func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod tim // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterRoleBindingInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterRoleBindingInformerWithOptions(client kubernetes.Interfac }, }, &rbacv1alpha1.ClusterRoleBinding{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterRoleBindingInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/role.go b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/role.go index 8ee04080f98ca..7dc4551d92706 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/role.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/role.go @@ -56,11 +56,7 @@ func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRoleInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRoleInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredRoleInformerWithOptions(client kubernetes.Interface, namespace s }, }, &rbacv1alpha1.Role{}, - opts..., + resyncPeriod, + indexers, ) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRoleInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *roleInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go index 39cd3102e2f0c..d49ec8b362ba9 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go @@ -56,11 +56,7 @@ func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyn // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredRoleBindingInformerWithOptions(client kubernetes.Interface, name }, }, &rbacv1alpha1.RoleBinding{}, - opts..., + resyncPeriod, + indexers, ) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRoleBindingInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go index 7d83c957384c6..e50e1d39354ae 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go @@ -55,11 +55,7 @@ func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Durat // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterRoleInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterRoleInformerWithOptions(client kubernetes.Interface, twea }, }, &rbacv1beta1.ClusterRole{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterRoleInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go index cd3588af3c296..a7ea4cd38d5b8 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go @@ -55,11 +55,7 @@ func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod tim // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterRoleBindingInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterRoleBindingInformerWithOptions(client kubernetes.Interfac }, }, &rbacv1beta1.ClusterRoleBinding{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterRoleBindingInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/role.go b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/role.go index 0526d6e0f3b66..e56961e81e70b 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/role.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/role.go @@ -56,11 +56,7 @@ func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRoleInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRoleInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredRoleInformerWithOptions(client kubernetes.Interface, namespace s }, }, &rbacv1beta1.Role{}, - opts..., + resyncPeriod, + indexers, ) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRoleInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *roleInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go index 0c649fdbbf62c..d893882db35ed 100644 --- a/staging/src/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go +++ b/staging/src/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go @@ -56,11 +56,7 @@ func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyn // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredRoleBindingInformerWithOptions(client kubernetes.Interface, name }, }, &rbacv1beta1.RoleBinding{}, - opts..., + resyncPeriod, + indexers, ) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredRoleBindingInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/scheduling/v1/priorityclass.go b/staging/src/k8s.io/client-go/informers/scheduling/v1/priorityclass.go index 6ba2bcaad7a67..730616b4a524a 100644 --- a/staging/src/k8s.io/client-go/informers/scheduling/v1/priorityclass.go +++ b/staging/src/k8s.io/client-go/informers/scheduling/v1/priorityclass.go @@ -55,11 +55,7 @@ func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Dur // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPriorityClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPriorityClassInformerWithOptions(client kubernetes.Interface, tw }, }, &schedulingv1.PriorityClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPriorityClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go b/staging/src/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go index 08ce6a0de6937..f82b6643690c6 100644 --- a/staging/src/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go +++ b/staging/src/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go @@ -55,11 +55,7 @@ func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Dur // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPriorityClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPriorityClassInformerWithOptions(client kubernetes.Interface, tw }, }, &schedulingv1alpha1.PriorityClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPriorityClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go b/staging/src/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go index 234ef1804ca2c..fc7848891ee2c 100644 --- a/staging/src/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go +++ b/staging/src/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go @@ -55,11 +55,7 @@ func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Dur // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredPriorityClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredPriorityClassInformerWithOptions(client kubernetes.Interface, tw }, }, &schedulingv1beta1.PriorityClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredPriorityClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1/csidriver.go b/staging/src/k8s.io/client-go/informers/storage/v1/csidriver.go index a551505fa3e55..6fd1e678d9590 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1/csidriver.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1/csidriver.go @@ -55,11 +55,7 @@ func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duratio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCSIDriverInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCSIDriverInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCSIDriverInformerWithOptions(client kubernetes.Interface, tweakL }, }, &storagev1.CSIDriver{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCSIDriverInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1/csinode.go b/staging/src/k8s.io/client-go/informers/storage/v1/csinode.go index e3b1dd88f4464..96416967fb870 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1/csinode.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1/csinode.go @@ -55,11 +55,7 @@ func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCSINodeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCSINodeInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCSINodeInformerWithOptions(client kubernetes.Interface, tweakLis }, }, &storagev1.CSINode{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCSINodeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1/storageclass.go b/staging/src/k8s.io/client-go/informers/storage/v1/storageclass.go index 53867041aa576..8cde79d9a3bfa 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1/storageclass.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1/storageclass.go @@ -55,11 +55,7 @@ func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Dura // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredStorageClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredStorageClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredStorageClassInformerWithOptions(client kubernetes.Interface, twe }, }, &storagev1.StorageClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredStorageClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1/volumeattachment.go b/staging/src/k8s.io/client-go/informers/storage/v1/volumeattachment.go index eae376d35e258..be605ff48c6e6 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1/volumeattachment.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1/volumeattachment.go @@ -55,11 +55,7 @@ func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredVolumeAttachmentInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredVolumeAttachmentInformerWithOptions(client kubernetes.Interface, }, }, &storagev1.VolumeAttachment{}, - opts..., + resyncPeriod, + indexers, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredVolumeAttachmentInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go b/staging/src/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go index 29c30293e8077..e59dfab2d11bf 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go @@ -56,11 +56,7 @@ func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredCSIStorageCapacityInformerWithOptions(client kubernetes.Interfac }, }, &storagev1alpha1.CSIStorageCapacity{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCSIStorageCapacityInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go b/staging/src/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go index bc4de33b9967a..445496dade46c 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go @@ -55,11 +55,7 @@ func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredVolumeAttachmentInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredVolumeAttachmentInformerWithOptions(client kubernetes.Interface, }, }, &storagev1alpha1.VolumeAttachment{}, - opts..., + resyncPeriod, + indexers, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredVolumeAttachmentInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1beta1/csidriver.go b/staging/src/k8s.io/client-go/informers/storage/v1beta1/csidriver.go index b67a4b83afd7d..f138a915b8830 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1beta1/csidriver.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1beta1/csidriver.go @@ -55,11 +55,7 @@ func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duratio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCSIDriverInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCSIDriverInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCSIDriverInformerWithOptions(client kubernetes.Interface, tweakL }, }, &storagev1beta1.CSIDriver{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCSIDriverInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1beta1/csinode.go b/staging/src/k8s.io/client-go/informers/storage/v1beta1/csinode.go index 8e282d623654c..6ba63172a3445 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1beta1/csinode.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1beta1/csinode.go @@ -55,11 +55,7 @@ func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCSINodeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCSINodeInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredCSINodeInformerWithOptions(client kubernetes.Interface, tweakLis }, }, &storagev1beta1.CSINode{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCSINodeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go b/staging/src/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go index 7995bf9f54fec..8f0cc4668793e 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go @@ -56,11 +56,7 @@ func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredCSIStorageCapacityInformerWithOptions(client kubernetes.Interfac }, }, &storagev1beta1.CSIStorageCapacity{}, - opts..., + resyncPeriod, + indexers, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredCSIStorageCapacityInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1beta1/storageclass.go b/staging/src/k8s.io/client-go/informers/storage/v1beta1/storageclass.go index d2022e8c0f916..a6582bf3d61e5 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1beta1/storageclass.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1beta1/storageclass.go @@ -55,11 +55,7 @@ func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Dura // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredStorageClassInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredStorageClassInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredStorageClassInformerWithOptions(client kubernetes.Interface, twe }, }, &storagev1beta1.StorageClass{}, - opts..., + resyncPeriod, + indexers, ) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredStorageClassInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go b/staging/src/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go index 2422bcd52d603..e894246349007 100644 --- a/staging/src/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go +++ b/staging/src/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go @@ -55,11 +55,7 @@ func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredVolumeAttachmentInformerWithOptions(client kubernetes.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredVolumeAttachmentInformerWithOptions(client kubernetes.Interface, }, }, &storagev1beta1.VolumeAttachment{}, - opts..., + resyncPeriod, + indexers, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredVolumeAttachmentInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/clustertesttype.go b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/clustertesttype.go index e4003795544b7..7e0dbbbee9ec4 100644 --- a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/clustertesttype.go +++ b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/clustertesttype.go @@ -55,11 +55,7 @@ func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Du // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterTestTypeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterTestTypeInformerWithOptions(client versioned.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterTestTypeInformerWithOptions(client versioned.Interface, t }, }, &examplev1.ClusterTestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterTestTypeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterTestTypeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/testtype.go b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/testtype.go index 08462808bb11b..f09df2c4d7d20 100644 --- a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/example/v1/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespac }, }, &examplev1.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/factory.go b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/factory.go index 66a400df3599d..9fcb71d3e7b23 100644 --- a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/factory.go +++ b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/factory.go @@ -36,15 +36,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -78,30 +75,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -118,14 +91,12 @@ func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -194,21 +165,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/internalinterfaces/factory_interfaces.go index ca63cbdb49376..6169d26170200 100644 --- a/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/clustertesttype.go b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/clustertesttype.go index 914d8b130d692..16dec81234052 100644 --- a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/clustertesttype.go +++ b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/clustertesttype.go @@ -55,11 +55,7 @@ func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Du // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterTestTypeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterTestTypeInformerWithOptions(client versioned.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterTestTypeInformerWithOptions(client versioned.Interface, t }, }, &examplev1.ClusterTestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterTestTypeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterTestTypeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/testtype.go b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/testtype.go index e1126b4696bce..80af810bd2a4f 100644 --- a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/example/v1/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespac }, }, &examplev1.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/factory.go b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/factory.go index 3bdaa31c1994f..43ec3650e272e 100644 --- a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/factory.go +++ b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/factory.go @@ -36,15 +36,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -78,30 +75,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -118,14 +91,12 @@ func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -194,21 +165,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/internalinterfaces/factory_interfaces.go index 05d19a35cf0b5..2576a2ed11319 100644 --- a/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example/v1/testtype.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example/v1/testtype.go index 56dbcc65e1ac3..98e72746a80b6 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example/v1/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example/v1/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespac }, }, &examplev1.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example2/v1/testtype.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example2/v1/testtype.go index a25b56971c230..521eb487abb8e 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example2/v1/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example2/v1/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespac }, }, &example2v1.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example3.io/v1/testtype.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example3.io/v1/testtype.go index f1e26a1ca11c0..dcc6c0dfe4193 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example3.io/v1/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/example3.io/v1/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespac }, }, &example3iov1.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/factory.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/factory.go index 184abbb376bef..28197e4e0c3c7 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/factory.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/factory.go @@ -38,15 +38,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -80,30 +77,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -120,14 +93,12 @@ func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -196,21 +167,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/internalinterfaces/factory_interfaces.go index 131d7cb44704e..25586f80b9a6a 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example/internalversion/testtype.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example/internalversion/testtype.go index ee5ff1c9fe0ab..143e979a660fe 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example/internalversion/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example/internalversion/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client clientsetinternalversion.Interface, namespace st // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client clientsetinternalversion.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client clientsetinternalversion.Inte }, }, &example.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example2/internalversion/testtype.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example2/internalversion/testtype.go index ccf3e33ffe1b0..d3781a0aee8ff 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example2/internalversion/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example2/internalversion/testtype.go @@ -55,11 +55,7 @@ func NewTestTypeInformer(client clientsetinternalversion.Interface, resyncPeriod // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client clientsetinternalversion.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredTestTypeInformerWithOptions(client clientsetinternalversion.Inte }, }, &example2.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example3.io/internalversion/testtype.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example3.io/internalversion/testtype.go index fb42890f026a6..cb1911aaab5f8 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example3.io/internalversion/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/example3.io/internalversion/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client clientsetinternalversion.Interface, namespace st // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client clientsetinternalversion.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client clientsetinternalversion.Inte }, }, &example3io.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/factory.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/factory.go index 25b4d424e5ac8..9e8bf9289018d 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/factory.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/factory.go @@ -38,15 +38,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client internalversion.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client internalversion.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -80,30 +77,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client internalversion.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -120,14 +93,12 @@ func NewFilteredSharedInformerFactory(client internalversion.Interface, defaultR // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client internalversion.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -196,21 +167,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/internalinterfaces/factory_interfaces.go index 4a3c287ef8734..e984d63132b7a 100644 --- a/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(internalversion.Interface, time.Duration) cache.Shared type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/clustertesttype.go b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/clustertesttype.go index 6f8e1ab6416dd..4df86555ba38e 100644 --- a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/clustertesttype.go +++ b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/clustertesttype.go @@ -55,11 +55,7 @@ func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Du // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredClusterTestTypeInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredClusterTestTypeInformerWithOptions(client versioned.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredClusterTestTypeInformerWithOptions(client versioned.Interface, t }, }, &examplev1.ClusterTestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredClusterTestTypeInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredClusterTestTypeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/testtype.go b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/testtype.go index c86e35b239180..d2f840d430ecf 100644 --- a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example/v1/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespac }, }, &examplev1.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example2/v1/testtype.go b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example2/v1/testtype.go index 95fdad5de8218..ec88fe6321218 100644 --- a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example2/v1/testtype.go +++ b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/example2/v1/testtype.go @@ -56,11 +56,7 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredTestTypeInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredTestTypeInformerWithOptions(client versioned.Interface, namespac }, }, &example2v1.TestType{}, - opts..., + resyncPeriod, + indexers, ) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredTestTypeInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/factory.go b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/factory.go index f129038a2de4a..ea75a64008aed 100644 --- a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/factory.go +++ b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/factory.go @@ -37,15 +37,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -79,30 +76,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -119,14 +92,12 @@ func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -195,21 +166,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces/factory_interfaces.go index e1e2cdbecc55f..4e150f3b7e7c0 100644 --- a/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1/apiservice.go b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1/apiservice.go index 465b510becee4..1c6a5cf20bd6c 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1/apiservice.go +++ b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1/apiservice.go @@ -55,11 +55,7 @@ func NewAPIServiceInformer(client clientset.Interface, resyncPeriod time.Duratio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredAPIServiceInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredAPIServiceInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredAPIServiceInformerWithOptions(client clientset.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredAPIServiceInformerWithOptions(client clientset.Interface, tweakL }, }, &apiregistrationv1.APIService{}, - opts..., + resyncPeriod, + indexers, ) } func (f *aPIServiceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredAPIServiceInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredAPIServiceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *aPIServiceInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1beta1/apiservice.go b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1beta1/apiservice.go index 5f5896954ddcc..aab505a259621 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1beta1/apiservice.go +++ b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1beta1/apiservice.go @@ -55,11 +55,7 @@ func NewAPIServiceInformer(client clientset.Interface, resyncPeriod time.Duratio // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredAPIServiceInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredAPIServiceInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredAPIServiceInformerWithOptions(client clientset.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredAPIServiceInformerWithOptions(client clientset.Interface, tweakL }, }, &apiregistrationv1beta1.APIService{}, - opts..., + resyncPeriod, + indexers, ) } func (f *aPIServiceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredAPIServiceInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredAPIServiceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *aPIServiceInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/factory.go b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/factory.go index 133eb1e4909a0..88cb2bdecf3a8 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/factory.go +++ b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/factory.go @@ -36,15 +36,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client clientset.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client clientset.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -78,30 +75,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client clientset.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -118,14 +91,12 @@ func NewFilteredSharedInformerFactory(client clientset.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client clientset.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -194,21 +165,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index ce31191874631..5fd2bca8ce64b 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(clientset.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/factory.go b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/factory.go index 6588701a497c5..b5aa28e97651e 100644 --- a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/factory.go +++ b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/factory.go @@ -36,15 +36,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -78,30 +75,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -118,14 +91,12 @@ func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -194,21 +165,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index fb14da05f9fb8..f71c664287c9c 100644 --- a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/fischer.go b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/fischer.go index ff535fe3a6d8a..74f3425bba25b 100644 --- a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/fischer.go +++ b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/fischer.go @@ -55,11 +55,7 @@ func NewFischerInformer(client versioned.Interface, resyncPeriod time.Duration, // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFischerInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredFischerInformerWithOptions(client, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredFischerInformerWithOptions(client versioned.Interface, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -75,22 +71,13 @@ func NewFilteredFischerInformerWithOptions(client versioned.Interface, tweakList }, }, &wardlev1alpha1.Fischer{}, - opts..., + resyncPeriod, + indexers, ) } func (f *fischerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{} - for k, v := range f.factory.ExtraClusterScopedIndexers() { - indexers[k] = v - } - - return NewFilteredFischerInformerWithOptions(client, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredFischerInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *fischerInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/flunder.go b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/flunder.go index 4302bb200c2ea..7a432b914ebcc 100644 --- a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/flunder.go +++ b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1alpha1/flunder.go @@ -56,11 +56,7 @@ func NewFlunderInformer(client versioned.Interface, namespace string, resyncPeri // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlunderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredFlunderInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredFlunderInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredFlunderInformerWithOptions(client versioned.Interface, namespace }, }, &wardlev1alpha1.Flunder{}, - opts..., + resyncPeriod, + indexers, ) } func (f *flunderInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredFlunderInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredFlunderInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *flunderInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1beta1/flunder.go b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1beta1/flunder.go index a90bd2a8a2c2f..4bba41dd5a81a 100644 --- a/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1beta1/flunder.go +++ b/staging/src/k8s.io/sample-apiserver/pkg/generated/informers/externalversions/wardle/v1beta1/flunder.go @@ -56,11 +56,7 @@ func NewFlunderInformer(client versioned.Interface, namespace string, resyncPeri // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlunderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredFlunderInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredFlunderInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredFlunderInformerWithOptions(client versioned.Interface, namespace }, }, &wardlev1beta1.Flunder{}, - opts..., + resyncPeriod, + indexers, ) } func (f *flunderInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredFlunderInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredFlunderInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *flunderInformer) Informer() cache.SharedIndexInformer { diff --git a/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/factory.go b/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/factory.go index 3ec5477f379e7..a22e1054c5f7f 100644 --- a/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/factory.go +++ b/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/factory.go @@ -36,15 +36,12 @@ import ( type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - extraClusterScopedIndexers cache.Indexers - extraNamespaceScopedIndexers cache.Indexers - keyFunc cache.KeyFunc + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -78,30 +75,6 @@ func WithNamespace(namespace string) SharedInformerOption { } } -// WithExtraClusterScopedIndexers adds cluster scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraClusterScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraClusterScopedIndexers = indexers - return factory - } -} - -// WithExtraNamespaceScopedIndexers adds namespace scoped indexers on all informers of the configured SharedInformerFactory -func WithExtraNamespaceScopedIndexers(indexers cache.Indexers) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.extraNamespaceScopedIndexers = indexers - return factory - } -} - -// WithKeyFunction sets a custom key function for all informers of the configured SharedInformerFactory -func WithKeyFunction(keyFunc cache.KeyFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.keyFunc = keyFunc - return factory - } -} - // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -118,14 +91,12 @@ func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - extraClusterScopedIndexers: cache.Indexers{}, - extraNamespaceScopedIndexers: cache.Indexers{}, + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), } // Apply all options @@ -194,21 +165,6 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal return informer } -// KeyFunction returns any extra cluster scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraClusterScopedIndexers() cache.Indexers { - return f.extraClusterScopedIndexers -} - -// KeyFunction returns any extra namespace scoped indexers set on the factory -func (f *sharedInformerFactory) ExtraNamespaceScopedIndexers() cache.Indexers { - return f.extraNamespaceScopedIndexers -} - -// KeyFunction returns the keyfunction set on the factory -func (f *sharedInformerFactory) KeyFunction() cache.KeyFunc { - return f.keyFunc -} - // SharedInformerFactory provides shared informers for resources in all known // API group versions. type SharedInformerFactory interface { diff --git a/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index 273391f8cf7d7..71c802bab9171 100644 --- a/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -34,9 +34,6 @@ type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexI type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer - ExtraClusterScopedIndexers() cache.Indexers - ExtraNamespaceScopedIndexers() cache.Indexers - KeyFunction() cache.KeyFunc } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. diff --git a/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go b/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go index 4393372bdf796..44f3487cf21a6 100644 --- a/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go +++ b/staging/src/k8s.io/sample-controller/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go @@ -56,11 +56,7 @@ func NewFooInformer(client versioned.Interface, namespace string, resyncPeriod t // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFooInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFilteredFooInformerWithOptions(client, namespace, tweakListOptions, cache.WithResyncPeriod(resyncPeriod), cache.WithIndexers(indexers)) -} - -func NewFilteredFooInformerWithOptions(client versioned.Interface, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc, opts ...cache.SharedInformerOption) cache.SharedIndexInformer { - return cache.NewSharedIndexInformerWithOptions( + return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -76,22 +72,13 @@ func NewFilteredFooInformerWithOptions(client versioned.Interface, namespace str }, }, &samplecontrollerv1alpha1.Foo{}, - opts..., + resyncPeriod, + indexers, ) } func (f *fooInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc} - for k, v := range f.factory.ExtraNamespaceScopedIndexers() { - indexers[k] = v - } - - return NewFilteredFooInformerWithOptions(client, f.namespace, - f.tweakListOptions, - cache.WithResyncPeriod(resyncPeriod), - cache.WithIndexers(indexers), - cache.WithKeyFunction(f.factory.KeyFunction()), - ) + return NewFilteredFooInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *fooInformer) Informer() cache.SharedIndexInformer { From 7861062eafe2f51224ea0ff6bb925c013ef7c177 Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Wed, 10 Aug 2022 13:08:33 -0400 Subject: [PATCH 4/4] generate cluster-aware informers and listers --- .../kcp/informers/apiextensions/interface.go | 49 +++ .../v1/customresourcedefinitions.go | 100 +++++ .../informers/apiextensions/v1/interface.go | 43 ++ .../v1beta1/customresourcedefinitions.go | 100 +++++ .../apiextensions/v1beta1/interface.go | 43 ++ .../pkg/client/kcp/informers/factory.go | 178 +++++++++ .../pkg/client/kcp/informers/generic.go | 67 ++++ .../v1/customresourcedefinition.go | 106 +++++ .../v1beta1/customresourcedefinition.go | 106 +++++ staging/src/k8s.io/client-go/go.mod | 4 +- staging/src/k8s.io/client-go/go.sum | 5 + .../admissionregistration/interface.go | 49 +++ .../admissionregistration/v1/interface.go | 48 +++ .../v1/mutatingwebhookconfigurations.go | 100 +++++ .../v1/validatingwebhookconfigurations.go | 100 +++++ .../v1beta1/interface.go | 48 +++ .../v1beta1/mutatingwebhookconfigurations.go | 100 +++++ .../validatingwebhookconfigurations.go | 100 +++++ .../informers/apiserverinternal/interface.go | 43 ++ .../apiserverinternal/v1alpha1/interface.go | 43 ++ .../v1alpha1/storageversions.go | 100 +++++ .../client-go/kcp/informers/apps/interface.go | 55 +++ .../informers/apps/v1/controllerrevisions.go | 101 +++++ .../kcp/informers/apps/v1/daemonsets.go | 101 +++++ .../kcp/informers/apps/v1/deployments.go | 101 +++++ .../kcp/informers/apps/v1/interface.go | 63 +++ .../kcp/informers/apps/v1/replicasets.go | 101 +++++ .../kcp/informers/apps/v1/statefulsets.go | 101 +++++ .../apps/v1beta1/controllerrevisions.go | 101 +++++ .../kcp/informers/apps/v1beta1/deployments.go | 101 +++++ .../kcp/informers/apps/v1beta1/interface.go | 53 +++ .../informers/apps/v1beta1/statefulsets.go | 101 +++++ .../apps/v1beta2/controllerrevisions.go | 101 +++++ .../kcp/informers/apps/v1beta2/daemonsets.go | 101 +++++ .../kcp/informers/apps/v1beta2/deployments.go | 101 +++++ .../kcp/informers/apps/v1beta2/interface.go | 63 +++ .../kcp/informers/apps/v1beta2/replicasets.go | 101 +++++ .../informers/apps/v1beta2/statefulsets.go | 101 +++++ .../kcp/informers/autoscaling/interface.go | 61 +++ .../v1/horizontalpodautoscalers.go | 101 +++++ .../kcp/informers/autoscaling/v1/interface.go | 43 ++ .../v2/horizontalpodautoscalers.go | 101 +++++ .../kcp/informers/autoscaling/v2/interface.go | 43 ++ .../v2beta1/horizontalpodautoscalers.go | 101 +++++ .../autoscaling/v2beta1/interface.go | 43 ++ .../v2beta2/horizontalpodautoscalers.go | 101 +++++ .../autoscaling/v2beta2/interface.go | 43 ++ .../kcp/informers/batch/interface.go | 49 +++ .../kcp/informers/batch/v1/cronjobs.go | 101 +++++ .../kcp/informers/batch/v1/interface.go | 48 +++ .../client-go/kcp/informers/batch/v1/jobs.go | 101 +++++ .../kcp/informers/batch/v1beta1/cronjobs.go | 101 +++++ .../kcp/informers/batch/v1beta1/interface.go | 43 ++ .../kcp/informers/certificates/interface.go | 49 +++ .../v1/certificatesigningrequests.go | 100 +++++ .../informers/certificates/v1/interface.go | 43 ++ .../v1beta1/certificatesigningrequests.go | 100 +++++ .../certificates/v1beta1/interface.go | 43 ++ .../kcp/informers/coordination/interface.go | 49 +++ .../informers/coordination/v1/interface.go | 43 ++ .../kcp/informers/coordination/v1/leases.go | 101 +++++ .../coordination/v1beta1/interface.go | 43 ++ .../informers/coordination/v1beta1/leases.go | 101 +++++ .../client-go/kcp/informers/core/interface.go | 43 ++ .../informers/core/v1/componentstatuses.go | 100 +++++ .../kcp/informers/core/v1/configmaps.go | 101 +++++ .../kcp/informers/core/v1/endpoints.go | 101 +++++ .../client-go/kcp/informers/core/v1/events.go | 101 +++++ .../kcp/informers/core/v1/interface.go | 118 ++++++ .../kcp/informers/core/v1/limitranges.go | 101 +++++ .../kcp/informers/core/v1/namespaces.go | 100 +++++ .../client-go/kcp/informers/core/v1/nodes.go | 100 +++++ .../core/v1/persistentvolumeclaims.go | 101 +++++ .../informers/core/v1/persistentvolumes.go | 100 +++++ .../client-go/kcp/informers/core/v1/pods.go | 101 +++++ .../kcp/informers/core/v1/podtemplates.go | 101 +++++ .../core/v1/replicationcontrollers.go | 101 +++++ .../kcp/informers/core/v1/resourcequotas.go | 101 +++++ .../kcp/informers/core/v1/secrets.go | 101 +++++ .../kcp/informers/core/v1/serviceaccounts.go | 101 +++++ .../kcp/informers/core/v1/services.go | 101 +++++ .../kcp/informers/discovery/interface.go | 49 +++ .../informers/discovery/v1/endpointslices.go | 101 +++++ .../kcp/informers/discovery/v1/interface.go | 43 ++ .../discovery/v1beta1/endpointslices.go | 101 +++++ .../informers/discovery/v1beta1/interface.go | 43 ++ .../kcp/informers/events/interface.go | 49 +++ .../kcp/informers/events/v1/events.go | 101 +++++ .../kcp/informers/events/v1/interface.go | 43 ++ .../kcp/informers/events/v1beta1/events.go | 101 +++++ .../kcp/informers/events/v1beta1/interface.go | 43 ++ .../kcp/informers/extensions/interface.go | 43 ++ .../extensions/v1beta1/daemonsets.go | 101 +++++ .../extensions/v1beta1/deployments.go | 101 +++++ .../informers/extensions/v1beta1/ingresses.go | 101 +++++ .../informers/extensions/v1beta1/interface.go | 68 ++++ .../extensions/v1beta1/networkpolicies.go | 101 +++++ .../extensions/v1beta1/podsecuritypolicies.go | 100 +++++ .../extensions/v1beta1/replicasets.go | 101 +++++ .../k8s.io/client-go/kcp/informers/factory.go | 263 +++++++++++++ .../kcp/informers/flowcontrol/interface.go | 55 +++ .../flowcontrol/v1alpha1/flowschemas.go | 100 +++++ .../flowcontrol/v1alpha1/interface.go | 48 +++ .../v1alpha1/prioritylevelconfigurations.go | 100 +++++ .../flowcontrol/v1beta1/flowschemas.go | 100 +++++ .../flowcontrol/v1beta1/interface.go | 48 +++ .../v1beta1/prioritylevelconfigurations.go | 100 +++++ .../flowcontrol/v1beta2/flowschemas.go | 100 +++++ .../flowcontrol/v1beta2/interface.go | 48 +++ .../v1beta2/prioritylevelconfigurations.go | 100 +++++ .../k8s.io/client-go/kcp/informers/generic.go | 371 ++++++++++++++++++ .../kcp/informers/networking/interface.go | 49 +++ .../informers/networking/v1/ingressclasses.go | 100 +++++ .../kcp/informers/networking/v1/ingresses.go | 101 +++++ .../kcp/informers/networking/v1/interface.go | 53 +++ .../networking/v1/networkpolicies.go | 101 +++++ .../networking/v1beta1/ingressclasses.go | 100 +++++ .../informers/networking/v1beta1/ingresses.go | 101 +++++ .../informers/networking/v1beta1/interface.go | 48 +++ .../client-go/kcp/informers/node/interface.go | 55 +++ .../kcp/informers/node/v1/interface.go | 43 ++ .../kcp/informers/node/v1/runtimeclasses.go | 100 +++++ .../kcp/informers/node/v1alpha1/interface.go | 43 ++ .../informers/node/v1alpha1/runtimeclasses.go | 100 +++++ .../kcp/informers/node/v1beta1/interface.go | 43 ++ .../informers/node/v1beta1/runtimeclasses.go | 100 +++++ .../kcp/informers/policy/interface.go | 49 +++ .../kcp/informers/policy/v1/interface.go | 43 ++ .../policy/v1/poddisruptionbudgets.go | 101 +++++ .../kcp/informers/policy/v1beta1/interface.go | 48 +++ .../policy/v1beta1/poddisruptionbudgets.go | 101 +++++ .../policy/v1beta1/podsecuritypolicies.go | 100 +++++ .../client-go/kcp/informers/rbac/interface.go | 55 +++ .../informers/rbac/v1/clusterrolebindings.go | 100 +++++ .../kcp/informers/rbac/v1/clusterroles.go | 100 +++++ .../kcp/informers/rbac/v1/interface.go | 58 +++ .../kcp/informers/rbac/v1/rolebindings.go | 101 +++++ .../client-go/kcp/informers/rbac/v1/roles.go | 101 +++++ .../rbac/v1alpha1/clusterrolebindings.go | 100 +++++ .../informers/rbac/v1alpha1/clusterroles.go | 100 +++++ .../kcp/informers/rbac/v1alpha1/interface.go | 58 +++ .../informers/rbac/v1alpha1/rolebindings.go | 101 +++++ .../kcp/informers/rbac/v1alpha1/roles.go | 101 +++++ .../rbac/v1beta1/clusterrolebindings.go | 100 +++++ .../informers/rbac/v1beta1/clusterroles.go | 100 +++++ .../kcp/informers/rbac/v1beta1/interface.go | 58 +++ .../informers/rbac/v1beta1/rolebindings.go | 101 +++++ .../kcp/informers/rbac/v1beta1/roles.go | 101 +++++ .../kcp/informers/scheduling/interface.go | 55 +++ .../kcp/informers/scheduling/v1/interface.go | 43 ++ .../scheduling/v1/priorityclasses.go | 100 +++++ .../scheduling/v1alpha1/interface.go | 43 ++ .../scheduling/v1alpha1/priorityclasses.go | 100 +++++ .../informers/scheduling/v1beta1/interface.go | 43 ++ .../scheduling/v1beta1/priorityclasses.go | 100 +++++ .../kcp/informers/storage/interface.go | 49 +++ .../kcp/informers/storage/v1/csidrivers.go | 100 +++++ .../kcp/informers/storage/v1/csinodes.go | 100 +++++ .../storage/v1/csistoragecapacities.go | 101 +++++ .../kcp/informers/storage/v1/interface.go | 63 +++ .../informers/storage/v1/storageclasses.go | 100 +++++ .../informers/storage/v1/volumeattachments.go | 100 +++++ .../informers/storage/v1beta1/csidrivers.go | 100 +++++ .../kcp/informers/storage/v1beta1/csinodes.go | 100 +++++ .../storage/v1beta1/csistoragecapacities.go | 101 +++++ .../informers/storage/v1beta1/interface.go | 63 +++ .../storage/v1beta1/storageclasses.go | 100 +++++ .../storage/v1beta1/volumeattachments.go | 100 +++++ .../v1/mutatingwebhookconfiguration.go | 106 +++++ .../v1/validatingwebhookconfiguration.go | 106 +++++ .../v1beta1/mutatingwebhookconfiguration.go | 106 +++++ .../v1beta1/validatingwebhookconfiguration.go | 106 +++++ .../v1alpha1/storageversion.go | 106 +++++ .../kcp/listers/apps/v1/controllerrevision.go | 141 +++++++ .../kcp/listers/apps/v1/daemonset.go | 141 +++++++ .../listers/apps/v1/daemonset_expansion.go | 111 ++++++ .../kcp/listers/apps/v1/deployment.go | 141 +++++++ .../kcp/listers/apps/v1/replicaset.go | 141 +++++++ .../listers/apps/v1/replicaset_expansion.go | 68 ++++ .../kcp/listers/apps/v1/statefulset.go | 141 +++++++ .../listers/apps/v1/statefulset_expansion.go | 72 ++++ .../apps/v1beta1/controllerrevision.go | 141 +++++++ .../kcp/listers/apps/v1beta1/deployment.go | 141 +++++++ .../kcp/listers/apps/v1beta1/statefulset.go | 141 +++++++ .../apps/v1beta1/statefulset_expansion.go | 72 ++++ .../apps/v1beta2/controllerrevision.go | 141 +++++++ .../kcp/listers/apps/v1beta2/daemonset.go | 141 +++++++ .../apps/v1beta2/daemonset_expansion.go | 111 ++++++ .../kcp/listers/apps/v1beta2/deployment.go | 141 +++++++ .../kcp/listers/apps/v1beta2/replicaset.go | 141 +++++++ .../apps/v1beta2/replicaset_expansion.go | 68 ++++ .../kcp/listers/apps/v1beta2/statefulset.go | 141 +++++++ .../apps/v1beta2/statefulset_expansion.go | 72 ++++ .../autoscaling/v1/horizontalpodautoscaler.go | 141 +++++++ .../autoscaling/v2/horizontalpodautoscaler.go | 141 +++++++ .../v2beta1/horizontalpodautoscaler.go | 141 +++++++ .../v2beta2/horizontalpodautoscaler.go | 141 +++++++ .../client-go/kcp/listers/batch/v1/cronjob.go | 141 +++++++ .../client-go/kcp/listers/batch/v1/job.go | 141 +++++++ .../kcp/listers/batch/v1/job_expansion.go | 66 ++++ .../kcp/listers/batch/v1beta1/cronjob.go | 141 +++++++ .../v1/certificatesigningrequest.go | 106 +++++ .../v1beta1/certificatesigningrequest.go | 106 +++++ .../kcp/listers/coordination/v1/lease.go | 141 +++++++ .../kcp/listers/coordination/v1beta1/lease.go | 141 +++++++ .../kcp/listers/core/v1/componentstatus.go | 106 +++++ .../kcp/listers/core/v1/configmap.go | 141 +++++++ .../kcp/listers/core/v1/endpoints.go | 141 +++++++ .../client-go/kcp/listers/core/v1/event.go | 141 +++++++ .../kcp/listers/core/v1/limitrange.go | 141 +++++++ .../kcp/listers/core/v1/namespace.go | 106 +++++ .../client-go/kcp/listers/core/v1/node.go | 106 +++++ .../kcp/listers/core/v1/persistentvolume.go | 106 +++++ .../listers/core/v1/persistentvolumeclaim.go | 141 +++++++ .../client-go/kcp/listers/core/v1/pod.go | 141 +++++++ .../kcp/listers/core/v1/podtemplate.go | 141 +++++++ .../listers/core/v1/replicationcontroller.go | 141 +++++++ .../v1/replicationcontroller_expansion.go | 60 +++ .../kcp/listers/core/v1/resourcequota.go | 141 +++++++ .../client-go/kcp/listers/core/v1/secret.go | 141 +++++++ .../client-go/kcp/listers/core/v1/service.go | 141 +++++++ .../kcp/listers/core/v1/serviceaccount.go | 141 +++++++ .../kcp/listers/discovery/v1/endpointslice.go | 141 +++++++ .../discovery/v1beta1/endpointslice.go | 141 +++++++ .../client-go/kcp/listers/events/v1/event.go | 141 +++++++ .../kcp/listers/events/v1beta1/event.go | 141 +++++++ .../listers/extensions/v1beta1/daemonset.go | 141 +++++++ .../extensions/v1beta1/daemonset_expansion.go | 112 ++++++ .../listers/extensions/v1beta1/deployment.go | 141 +++++++ .../kcp/listers/extensions/v1beta1/ingress.go | 141 +++++++ .../extensions/v1beta1/networkpolicy.go | 141 +++++++ .../extensions/v1beta1/podsecuritypolicy.go | 106 +++++ .../listers/extensions/v1beta1/replicaset.go | 141 +++++++ .../v1beta1/replicaset_expansion.go | 68 ++++ .../flowcontrol/v1alpha1/flowschema.go | 106 +++++ .../v1alpha1/prioritylevelconfiguration.go | 106 +++++ .../listers/flowcontrol/v1beta1/flowschema.go | 106 +++++ .../v1beta1/prioritylevelconfiguration.go | 106 +++++ .../listers/flowcontrol/v1beta2/flowschema.go | 106 +++++ .../v1beta2/prioritylevelconfiguration.go | 106 +++++ .../kcp/listers/networking/v1/ingress.go | 141 +++++++ .../kcp/listers/networking/v1/ingressclass.go | 106 +++++ .../listers/networking/v1/networkpolicy.go | 141 +++++++ .../kcp/listers/networking/v1beta1/ingress.go | 141 +++++++ .../networking/v1beta1/ingressclass.go | 106 +++++ .../kcp/listers/node/v1/runtimeclass.go | 106 +++++ .../kcp/listers/node/v1alpha1/runtimeclass.go | 106 +++++ .../kcp/listers/node/v1beta1/runtimeclass.go | 106 +++++ .../listers/policy/v1/poddisruptionbudget.go | 141 +++++++ .../v1/poddisruptionbudget_expansion.go | 62 +++ .../policy/v1beta1/poddisruptionbudget.go | 141 +++++++ .../v1beta1/poddisruptionbudget_expansion.go | 62 +++ .../policy/v1beta1/podsecuritypolicy.go | 106 +++++ .../kcp/listers/rbac/v1/clusterrole.go | 106 +++++ .../kcp/listers/rbac/v1/clusterrolebinding.go | 106 +++++ .../client-go/kcp/listers/rbac/v1/role.go | 141 +++++++ .../kcp/listers/rbac/v1/rolebinding.go | 141 +++++++ .../kcp/listers/rbac/v1alpha1/clusterrole.go | 106 +++++ .../rbac/v1alpha1/clusterrolebinding.go | 106 +++++ .../kcp/listers/rbac/v1alpha1/role.go | 141 +++++++ .../kcp/listers/rbac/v1alpha1/rolebinding.go | 141 +++++++ .../kcp/listers/rbac/v1beta1/clusterrole.go | 106 +++++ .../rbac/v1beta1/clusterrolebinding.go | 106 +++++ .../kcp/listers/rbac/v1beta1/role.go | 141 +++++++ .../kcp/listers/rbac/v1beta1/rolebinding.go | 141 +++++++ .../listers/scheduling/v1/priorityclass.go | 106 +++++ .../scheduling/v1alpha1/priorityclass.go | 106 +++++ .../scheduling/v1beta1/priorityclass.go | 106 +++++ .../kcp/listers/storage/v1/csidriver.go | 106 +++++ .../kcp/listers/storage/v1/csinode.go | 106 +++++ .../listers/storage/v1/csistoragecapacity.go | 141 +++++++ .../kcp/listers/storage/v1/storageclass.go | 106 +++++ .../listers/storage/v1/volumeattachment.go | 106 +++++ .../kcp/listers/storage/v1beta1/csidriver.go | 106 +++++ .../kcp/listers/storage/v1beta1/csinode.go | 106 +++++ .../storage/v1beta1/csistoragecapacity.go | 141 +++++++ .../listers/storage/v1beta1/storageclass.go | 106 +++++ .../storage/v1beta1/volumeattachment.go | 106 +++++ 278 files changed, 27347 insertions(+), 1 deletion(-) create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/interface.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/customresourcedefinitions.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/interface.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/customresourcedefinitions.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/interface.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/factory.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/generic.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1/customresourcedefinition.go create mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1beta1/customresourcedefinition.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/admissionregistration/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/mutatingwebhookconfigurations.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/validatingwebhookconfigurations.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/mutatingwebhookconfigurations.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/validatingwebhookconfigurations.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/storageversions.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1/controllerrevisions.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1/daemonsets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1/deployments.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1/replicasets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1/statefulsets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/controllerrevisions.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/deployments.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/statefulsets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/controllerrevisions.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/daemonsets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/deployments.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/replicasets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/statefulsets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/horizontalpodautoscalers.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/horizontalpodautoscalers.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/horizontalpodautoscalers.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/horizontalpodautoscalers.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/batch/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/batch/v1/cronjobs.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/batch/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/batch/v1/jobs.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/cronjobs.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/certificates/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/certificates/v1/certificatesigningrequests.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/certificates/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/certificatesigningrequests.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/coordination/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/coordination/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/coordination/v1/leases.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/leases.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/componentstatuses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/configmaps.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/endpoints.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/events.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/limitranges.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/namespaces.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/nodes.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumeclaims.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumes.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/pods.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/podtemplates.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/replicationcontrollers.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/resourcequotas.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/secrets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/serviceaccounts.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/core/v1/services.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/discovery/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/discovery/v1/endpointslices.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/discovery/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/endpointslices.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/events/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/events/v1/events.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/events/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/events.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/daemonsets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/deployments.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/ingresses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/networkpolicies.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/podsecuritypolicies.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/replicasets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/factory.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/flowschemas.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/prioritylevelconfigurations.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/flowschemas.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/prioritylevelconfigurations.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/flowschemas.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/prioritylevelconfigurations.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/generic.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingressclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingresses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/v1/networkpolicies.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingressclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingresses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/node/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/node/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/node/v1/runtimeclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/runtimeclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/runtimeclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/policy/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/policy/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/policy/v1/poddisruptionbudgets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/poddisruptionbudgets.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/podsecuritypolicies.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterrolebindings.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterroles.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1/rolebindings.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1/roles.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterrolebindings.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterroles.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/rolebindings.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/roles.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterrolebindings.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterroles.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/rolebindings.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/roles.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/scheduling/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/priorityclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/priorityclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/priorityclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1/csidrivers.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1/csinodes.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1/csistoragecapacities.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1/storageclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1/volumeattachments.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csidrivers.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csinodes.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csistoragecapacities.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/interface.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/storageclasses.go create mode 100644 staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/volumeattachments.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/mutatingwebhookconfiguration.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/validatingwebhookconfiguration.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apiserverinternal/v1alpha1/storageversion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/controllerrevision.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/deployment.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/controllerrevision.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/deployment.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/controllerrevision.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/deployment.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/autoscaling/v1/horizontalpodautoscaler.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2/horizontalpodautoscaler.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta1/horizontalpodautoscaler.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/batch/v1/cronjob.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/batch/v1/job.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/batch/v1/job_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/batch/v1beta1/cronjob.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/certificates/v1/certificatesigningrequest.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/certificates/v1beta1/certificatesigningrequest.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/coordination/v1/lease.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/coordination/v1beta1/lease.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/componentstatus.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/configmap.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/endpoints.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/event.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/limitrange.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/namespace.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/node.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolume.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolumeclaim.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/pod.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/podtemplate.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/resourcequota.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/secret.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/service.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/core/v1/serviceaccount.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/discovery/v1/endpointslice.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/discovery/v1beta1/endpointslice.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/events/v1/event.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/events/v1beta1/event.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/deployment.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/ingress.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/networkpolicy.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/podsecuritypolicy.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/flowschema.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/flowschema.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/flowschema.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/prioritylevelconfiguration.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingress.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingressclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/networking/v1/networkpolicy.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingress.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingressclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/node/v1/runtimeclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/node/v1alpha1/runtimeclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/node/v1beta1/runtimeclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget_expansion.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/podsecuritypolicy.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrole.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrolebinding.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1/role.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1/rolebinding.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrole.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrolebinding.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/role.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/rolebinding.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrole.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrolebinding.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/role.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/rolebinding.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/scheduling/v1/priorityclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/scheduling/v1alpha1/priorityclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/scheduling/v1beta1/priorityclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1/csidriver.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1/csinode.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1/csistoragecapacity.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1/storageclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1/volumeattachment.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csidriver.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csinode.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csistoragecapacity.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/storageclass.go create mode 100644 staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/volumeattachment.go diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/interface.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/interface.go new file mode 100644 index 0000000000000..1e83a8dad0805 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package apiextensions + +import ( + internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" + v1 "k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1" + v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/customresourcedefinitions.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/customresourcedefinitions.go new file mode 100644 index 0000000000000..0e407d9fd135c --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/customresourcedefinitions.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + versioned "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + v1 "k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1" + + internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" + apiextensionsv1listers "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" +) + +// CustomResourceDefinitionInformer provides access to a shared informer and lister for +// CustomResourceDefinitions. +type CustomResourceDefinitionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCustomResourceDefinitionInformer constructs a new informer for CustomResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCustomResourceDefinitionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCustomResourceDefinitionInformer constructs a new informer for CustomResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCustomResourceDefinitionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiextensionsV1().CustomResourceDefinitions().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiextensionsV1().CustomResourceDefinitions().Watch(context.TODO(), options) + }, + }, + &apiextensionsv1.CustomResourceDefinition{}, + resyncPeriod, + indexers, + ) +} + +func (f CustomResourceDefinitionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCustomResourceDefinitionInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CustomResourceDefinitionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiextensionsv1.CustomResourceDefinition{}, f.defaultInformer) +} + +func (f CustomResourceDefinitionInformer) Lister() apiextensionsv1listers.CustomResourceDefinitionLister { + return v1.NewCustomResourceDefinitionClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/interface.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/interface.go new file mode 100644 index 0000000000000..a9aaa2626aa19 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1" + internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CustomResourceDefinitions returns a CustomResourceDefinitionInformer. +func (v Interface) CustomResourceDefinitions() upstreaminformers.CustomResourceDefinitionInformer { + return &CustomResourceDefinitionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/customresourcedefinitions.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/customresourcedefinitions.go new file mode 100644 index 0000000000000..e88d9bb2825ff --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/customresourcedefinitions.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + versioned "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1beta1" + + internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" + apiextensionsv1beta1listers "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1" +) + +// CustomResourceDefinitionInformer provides access to a shared informer and lister for +// CustomResourceDefinitions. +type CustomResourceDefinitionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCustomResourceDefinitionInformer constructs a new informer for CustomResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCustomResourceDefinitionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCustomResourceDefinitionInformer constructs a new informer for CustomResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCustomResourceDefinitionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiextensionsV1beta1().CustomResourceDefinitions().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiextensionsV1beta1().CustomResourceDefinitions().Watch(context.TODO(), options) + }, + }, + &apiextensionsv1beta1.CustomResourceDefinition{}, + resyncPeriod, + indexers, + ) +} + +func (f CustomResourceDefinitionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCustomResourceDefinitionInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CustomResourceDefinitionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiextensionsv1beta1.CustomResourceDefinition{}, f.defaultInformer) +} + +func (f CustomResourceDefinitionInformer) Lister() apiextensionsv1beta1listers.CustomResourceDefinitionLister { + return v1beta1.NewCustomResourceDefinitionClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/interface.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/interface.go new file mode 100644 index 0000000000000..3071d638193b9 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/apiextensions/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1" + internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CustomResourceDefinitions returns a CustomResourceDefinitionInformer. +func (v Interface) CustomResourceDefinitions() upstreaminformers.CustomResourceDefinitionInformer { + return &CustomResourceDefinitionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/factory.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/factory.go new file mode 100644 index 0000000000000..8fab19d717903 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/factory.go @@ -0,0 +1,178 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package informers + +import ( + "reflect" + "sync" + "time" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/tools/cache" + + versioned "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + + upstreaminformers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions" + apiextensions "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions" + internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" +) + +var _ upstreaminformers.SharedInformerFactory = &SharedInformerFactory{} + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*SharedInformerFactory) *SharedInformerFactory + +type SharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[metav1.Object]time.Duration) SharedInformerOption { + return func(factory *SharedInformerFactory) *SharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *SharedInformerFactory) *SharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *SharedInformerFactory) *SharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of SharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) upstreaminformers.SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of SharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) upstreaminformers.SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) upstreaminformers.SharedInformerFactory { + factory := &SharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *SharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *SharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *SharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +func (f *SharedInformerFactory) Apiextensions() apiextensions.Interface { + return apiextensions.New(f, f.namespace, f.tweakListOptions) +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/generic.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/generic.go new file mode 100644 index 0000000000000..a7b0e822c647e --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/generic.go @@ -0,0 +1,67 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package informers + +import ( + "fmt" + + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + upstreaminformers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions" +) + +type GenericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *GenericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericClusterLister. +func (f *GenericInformer) Lister() cache.GenericLister { + return kcpcache.NewGenericClusterLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *SharedInformerFactory) ForResource(resource schema.GroupVersionResource) (upstreaminformers.GenericInformer, error) { + switch resource { + // Group=apiextensions.k8s.io, Version=v1 + case apiextensionsv1.SchemeGroupVersion.WithResource("customresourcedefinitions"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().V1().CustomResourceDefinitions().Informer()}, nil + + // Group=apiextensions.k8s.io, Version=v1beta1 + case apiextensionsv1beta1.SchemeGroupVersion.WithResource("customresourcedefinitions"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().V1beta1().CustomResourceDefinitions().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1/customresourcedefinition.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1/customresourcedefinition.go new file mode 100644 index 0000000000000..444a92108971c --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1/customresourcedefinition.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apiextensionsv1listers "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +var _ apiextensionsv1listers.CustomResourceDefinitionLister = &CustomResourceDefinitionClusterLister{} + +// CustomResourceDefinitionClusterLister implements the apiextensionsv1listers.CustomResourceDefinitionLister interface. +type CustomResourceDefinitionClusterLister struct { + indexer cache.Indexer +} + +// NewCustomResourceDefinitionClusterLister returns a new CustomResourceDefinitionClusterLister. +func NewCustomResourceDefinitionClusterLister(indexer cache.Indexer) apiextensionsv1listers.CustomResourceDefinitionLister { + return &CustomResourceDefinitionClusterLister{indexer: indexer} +} + +// List lists all apiextensionsv1.CustomResourceDefinition in the indexer. +func (s CustomResourceDefinitionClusterLister) List(selector labels.Selector) (ret []*apiextensionsv1.CustomResourceDefinition, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*apiextensionsv1.CustomResourceDefinition)) + }) + return ret, err +} + +// Get retrieves the apiextensionsv1.CustomResourceDefinition from the indexer for a given name. +func (s CustomResourceDefinitionClusterLister) Get(name string) (*apiextensionsv1.CustomResourceDefinition, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get apiextensionsv1.CustomResourceDefinition. + +func (s CustomResourceDefinitionClusterLister) Cluster(cluster logicalcluster.Name) apiextensionsv1listers.CustomResourceDefinitionLister { + return &CustomResourceDefinitionLister{indexer: s.indexer, cluster: cluster} +} + +// CustomResourceDefinitionLister implements the apiextensionsv1listers.CustomResourceDefinitionLister interface. +type CustomResourceDefinitionLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all apiextensionsv1.CustomResourceDefinition in the indexer. +func (s CustomResourceDefinitionLister) List(selector labels.Selector) (ret []*apiextensionsv1.CustomResourceDefinition, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*apiextensionsv1.CustomResourceDefinition) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the apiextensionsv1.CustomResourceDefinition from the indexer for a given name. +func (s CustomResourceDefinitionLister) Get(name string) (*apiextensionsv1.CustomResourceDefinition, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(apiextensionsv1.Resource("CustomResourceDefinition"), name) + } + return obj.(*apiextensionsv1.CustomResourceDefinition), nil +} diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1beta1/customresourcedefinition.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1beta1/customresourcedefinition.go new file mode 100644 index 0000000000000..5dfb6f36b7d28 --- /dev/null +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1beta1/customresourcedefinition.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + apiextensionsv1beta1listers "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +var _ apiextensionsv1beta1listers.CustomResourceDefinitionLister = &CustomResourceDefinitionClusterLister{} + +// CustomResourceDefinitionClusterLister implements the apiextensionsv1beta1listers.CustomResourceDefinitionLister interface. +type CustomResourceDefinitionClusterLister struct { + indexer cache.Indexer +} + +// NewCustomResourceDefinitionClusterLister returns a new CustomResourceDefinitionClusterLister. +func NewCustomResourceDefinitionClusterLister(indexer cache.Indexer) apiextensionsv1beta1listers.CustomResourceDefinitionLister { + return &CustomResourceDefinitionClusterLister{indexer: indexer} +} + +// List lists all apiextensionsv1beta1.CustomResourceDefinition in the indexer. +func (s CustomResourceDefinitionClusterLister) List(selector labels.Selector) (ret []*apiextensionsv1beta1.CustomResourceDefinition, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*apiextensionsv1beta1.CustomResourceDefinition)) + }) + return ret, err +} + +// Get retrieves the apiextensionsv1beta1.CustomResourceDefinition from the indexer for a given name. +func (s CustomResourceDefinitionClusterLister) Get(name string) (*apiextensionsv1beta1.CustomResourceDefinition, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get apiextensionsv1beta1.CustomResourceDefinition. + +func (s CustomResourceDefinitionClusterLister) Cluster(cluster logicalcluster.Name) apiextensionsv1beta1listers.CustomResourceDefinitionLister { + return &CustomResourceDefinitionLister{indexer: s.indexer, cluster: cluster} +} + +// CustomResourceDefinitionLister implements the apiextensionsv1beta1listers.CustomResourceDefinitionLister interface. +type CustomResourceDefinitionLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all apiextensionsv1beta1.CustomResourceDefinition in the indexer. +func (s CustomResourceDefinitionLister) List(selector labels.Selector) (ret []*apiextensionsv1beta1.CustomResourceDefinition, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*apiextensionsv1beta1.CustomResourceDefinition) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the apiextensionsv1beta1.CustomResourceDefinition from the indexer for a given name. +func (s CustomResourceDefinitionLister) Get(name string) (*apiextensionsv1beta1.CustomResourceDefinition, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(apiextensionsv1beta1.Resource("CustomResourceDefinition"), name) + } + return obj.(*apiextensionsv1beta1.CustomResourceDefinition), nil +} diff --git a/staging/src/k8s.io/client-go/go.mod b/staging/src/k8s.io/client-go/go.mod index 19c22cd2f834b..cf77b0d7215af 100644 --- a/staging/src/k8s.io/client-go/go.mod +++ b/staging/src/k8s.io/client-go/go.mod @@ -24,11 +24,13 @@ require ( github.com/google/uuid v1.1.2 github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 github.com/imdario/mergo v0.3.5 + github.com/kcp-dev/apimachinery v0.0.0-20220805180221-5b13097793e1 // indirect + github.com/kcp-dev/logicalcluster v1.1.1 // indirect github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.1 github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 diff --git a/staging/src/k8s.io/client-go/go.sum b/staging/src/k8s.io/client-go/go.sum index 9732b04711d8c..79deec1ed11da 100644 --- a/staging/src/k8s.io/client-go/go.sum +++ b/staging/src/k8s.io/client-go/go.sum @@ -203,6 +203,10 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kcp-dev/apimachinery v0.0.0-20220805180221-5b13097793e1 h1:2jkhBzHHpqfnOd036CS/9SYEkBsjPahmQQVM6+xytDU= +github.com/kcp-dev/apimachinery v0.0.0-20220805180221-5b13097793e1/go.mod h1:qnvUHkdxOrNzX17yX+z8r81CZEBuFdveNzWqFlwZ55w= +github.com/kcp-dev/logicalcluster v1.1.1 h1:6jv54KRHDVvsJjuaV6dWNHVivYCSxDjGjfN+m1pVu3k= +github.com/kcp-dev/logicalcluster v1.1.1/go.mod h1:3IvnQ1TDaTuyhgRqagtKWd1XKz3kBeP8ByLvyNiWywg= github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.1 h1:6EMfOioekQNrpcHEK7k2ANBWogFMlf+3xTB3CC4k+2s= github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.1/go.mod h1:lfWJL764jKFJxZWOGuFuT3PCCLPo6lV5Cl8P7u9T05g= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -262,6 +266,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/interface.go b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/interface.go new file mode 100644 index 0000000000000..7c60478cb6c18 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package admissionregistration + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/admissionregistration/v1" + v1beta1 "k8s.io/client-go/kcp/informers/admissionregistration/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/interface.go new file mode 100644 index 0000000000000..5de2b3acd120c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/admissionregistration/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. +func (v Interface) MutatingWebhookConfigurations() upstreaminformers.MutatingWebhookConfigurationInformer { + return &MutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. +func (v Interface) ValidatingWebhookConfigurations() upstreaminformers.ValidatingWebhookConfigurationInformer { + return &ValidatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/mutatingwebhookconfigurations.go b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/mutatingwebhookconfigurations.go new file mode 100644 index 0000000000000..fc2c0dbdb90cc --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/mutatingwebhookconfigurations.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + v1 "k8s.io/client-go/kcp/listers/admissionregistration/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + admissionregistrationv1listers "k8s.io/client-go/listers/admissionregistration/v1" +) + +// MutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations. +type MutatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.MutatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f MutatingWebhookConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f MutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.MutatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f MutatingWebhookConfigurationInformer) Lister() admissionregistrationv1listers.MutatingWebhookConfigurationLister { + return v1.NewMutatingWebhookConfigurationClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/validatingwebhookconfigurations.go b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/validatingwebhookconfigurations.go new file mode 100644 index 0000000000000..46479cc6fc8a4 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1/validatingwebhookconfigurations.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + v1 "k8s.io/client-go/kcp/listers/admissionregistration/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + admissionregistrationv1listers "k8s.io/client-go/listers/admissionregistration/v1" +) + +// ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations. +type ValidatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredValidatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.ValidatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f ValidatingWebhookConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ValidatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.ValidatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f ValidatingWebhookConfigurationInformer) Lister() admissionregistrationv1listers.ValidatingWebhookConfigurationLister { + return v1.NewValidatingWebhookConfigurationClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/interface.go new file mode 100644 index 0000000000000..8b9fe25b09c3e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/admissionregistration/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. +func (v Interface) MutatingWebhookConfigurations() upstreaminformers.MutatingWebhookConfigurationInformer { + return &MutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. +func (v Interface) ValidatingWebhookConfigurations() upstreaminformers.ValidatingWebhookConfigurationInformer { + return &ValidatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/mutatingwebhookconfigurations.go b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/mutatingwebhookconfigurations.go new file mode 100644 index 0000000000000..7abb03400e6f1 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/mutatingwebhookconfigurations.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/admissionregistration/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + admissionregistrationv1beta1listers "k8s.io/client-go/listers/admissionregistration/v1beta1" +) + +// MutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations. +type MutatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1beta1.MutatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f MutatingWebhookConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f MutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1beta1.MutatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f MutatingWebhookConfigurationInformer) Lister() admissionregistrationv1beta1listers.MutatingWebhookConfigurationLister { + return v1beta1.NewMutatingWebhookConfigurationClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/validatingwebhookconfigurations.go b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/validatingwebhookconfigurations.go new file mode 100644 index 0000000000000..a39fe9f4ca9d8 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/admissionregistration/v1beta1/validatingwebhookconfigurations.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/admissionregistration/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + admissionregistrationv1beta1listers "k8s.io/client-go/listers/admissionregistration/v1beta1" +) + +// ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations. +type ValidatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredValidatingWebhookConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f ValidatingWebhookConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ValidatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f ValidatingWebhookConfigurationInformer) Lister() admissionregistrationv1beta1listers.ValidatingWebhookConfigurationLister { + return v1beta1.NewValidatingWebhookConfigurationClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/interface.go b/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/interface.go new file mode 100644 index 0000000000000..866b90d8f7439 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package apiserverinternal + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1alpha1 "k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g Interface) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/interface.go new file mode 100644 index 0000000000000..355d44d16404b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + upstreaminformers "k8s.io/client-go/informers/apiserverinternal/v1alpha1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// StorageVersions returns a StorageVersionInformer. +func (v Interface) StorageVersions() upstreaminformers.StorageVersionInformer { + return &StorageVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/storageversions.go b/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/storageversions.go new file mode 100644 index 0000000000000..0349a6bb0506e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apiserverinternal/v1alpha1/storageversions.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/apiserverinternal/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + apiserverinternalv1alpha1listers "k8s.io/client-go/listers/apiserverinternal/v1alpha1" +) + +// StorageVersionInformer provides access to a shared informer and lister for +// StorageVersions. +type StorageVersionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageVersionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageVersionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageVersionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InternalV1alpha1().StorageVersions().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InternalV1alpha1().StorageVersions().Watch(context.TODO(), options) + }, + }, + &apiserverinternalv1alpha1.StorageVersion{}, + resyncPeriod, + indexers, + ) +} + +func (f StorageVersionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageVersionInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f StorageVersionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiserverinternalv1alpha1.StorageVersion{}, f.defaultInformer) +} + +func (f StorageVersionInformer) Lister() apiserverinternalv1alpha1listers.StorageVersionLister { + return v1alpha1.NewStorageVersionClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/interface.go b/staging/src/k8s.io/client-go/kcp/informers/apps/interface.go new file mode 100644 index 0000000000000..8730cff242abd --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/interface.go @@ -0,0 +1,55 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package apps + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/apps/v1" + v1beta1 "k8s.io/client-go/kcp/informers/apps/v1beta1" + v1beta2 "k8s.io/client-go/kcp/informers/apps/v1beta2" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta2 returns a new v1beta2.Interface. +func (g Interface) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1/controllerrevisions.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/controllerrevisions.go new file mode 100644 index 0000000000000..8eb446405bd9e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/controllerrevisions.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/client-go/kcp/listers/apps/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1listers "k8s.io/client-go/listers/apps/v1" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f ControllerRevisionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ControllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ControllerRevision{}, f.defaultInformer) +} + +func (f ControllerRevisionInformer) Lister() appsv1listers.ControllerRevisionLister { + return v1.NewControllerRevisionClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1/daemonsets.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/daemonsets.go new file mode 100644 index 0000000000000..a25110fecee21 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/daemonsets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/client-go/kcp/listers/apps/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1listers "k8s.io/client-go/listers/apps/v1" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f DaemonSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f DaemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.DaemonSet{}, f.defaultInformer) +} + +func (f DaemonSetInformer) Lister() appsv1listers.DaemonSetLister { + return v1.NewDaemonSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1/deployments.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/deployments.go new file mode 100644 index 0000000000000..2dbc6cceeb7da --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/deployments.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/client-go/kcp/listers/apps/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1listers "k8s.io/client-go/listers/apps/v1" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f DeploymentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f DeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.Deployment{}, f.defaultInformer) +} + +func (f DeploymentInformer) Lister() appsv1listers.DeploymentLister { + return v1.NewDeploymentClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/interface.go new file mode 100644 index 0000000000000..cc37e856b546c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/interface.go @@ -0,0 +1,63 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/apps/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v Interface) ControllerRevisions() upstreaminformers.ControllerRevisionInformer { + return &ControllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v Interface) DaemonSets() upstreaminformers.DaemonSetInformer { + return &DaemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v Interface) Deployments() upstreaminformers.DeploymentInformer { + return &DeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v Interface) ReplicaSets() upstreaminformers.ReplicaSetInformer { + return &ReplicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v Interface) StatefulSets() upstreaminformers.StatefulSetInformer { + return &StatefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1/replicasets.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/replicasets.go new file mode 100644 index 0000000000000..1ab999a5d292a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/replicasets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/client-go/kcp/listers/apps/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1listers "k8s.io/client-go/listers/apps/v1" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f ReplicaSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ReplicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ReplicaSet{}, f.defaultInformer) +} + +func (f ReplicaSetInformer) Lister() appsv1listers.ReplicaSetLister { + return v1.NewReplicaSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1/statefulsets.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/statefulsets.go new file mode 100644 index 0000000000000..163a307733504 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1/statefulsets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/client-go/kcp/listers/apps/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1listers "k8s.io/client-go/listers/apps/v1" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f StatefulSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f StatefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.StatefulSet{}, f.defaultInformer) +} + +func (f StatefulSetInformer) Lister() appsv1listers.StatefulSetLister { + return v1.NewStatefulSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/controllerrevisions.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/controllerrevisions.go new file mode 100644 index 0000000000000..cc69ea104c0ad --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/controllerrevisions.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/apps/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta1listers "k8s.io/client-go/listers/apps/v1beta1" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f ControllerRevisionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ControllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.ControllerRevision{}, f.defaultInformer) +} + +func (f ControllerRevisionInformer) Lister() appsv1beta1listers.ControllerRevisionLister { + return v1beta1.NewControllerRevisionClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/deployments.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/deployments.go new file mode 100644 index 0000000000000..231aa18e21567 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/deployments.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/apps/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta1listers "k8s.io/client-go/listers/apps/v1beta1" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f DeploymentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f DeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.Deployment{}, f.defaultInformer) +} + +func (f DeploymentInformer) Lister() appsv1beta1listers.DeploymentLister { + return v1beta1.NewDeploymentClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/interface.go new file mode 100644 index 0000000000000..e3ebb2351f118 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/interface.go @@ -0,0 +1,53 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/apps/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v Interface) ControllerRevisions() upstreaminformers.ControllerRevisionInformer { + return &ControllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v Interface) Deployments() upstreaminformers.DeploymentInformer { + return &DeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v Interface) StatefulSets() upstreaminformers.StatefulSetInformer { + return &StatefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/statefulsets.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/statefulsets.go new file mode 100644 index 0000000000000..7195fd0fa8a12 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta1/statefulsets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/apps/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta1listers "k8s.io/client-go/listers/apps/v1beta1" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f StatefulSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f StatefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.StatefulSet{}, f.defaultInformer) +} + +func (f StatefulSetInformer) Lister() appsv1beta1listers.StatefulSetLister { + return v1beta1.NewStatefulSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/controllerrevisions.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/controllerrevisions.go new file mode 100644 index 0000000000000..bb0d0adfd036b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/controllerrevisions.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1beta2 "k8s.io/client-go/kcp/listers/apps/v1beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f ControllerRevisionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ControllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.ControllerRevision{}, f.defaultInformer) +} + +func (f ControllerRevisionInformer) Lister() appsv1beta2listers.ControllerRevisionLister { + return v1beta2.NewControllerRevisionClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/daemonsets.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/daemonsets.go new file mode 100644 index 0000000000000..95a3428f1d77c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/daemonsets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1beta2 "k8s.io/client-go/kcp/listers/apps/v1beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f DaemonSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f DaemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.DaemonSet{}, f.defaultInformer) +} + +func (f DaemonSetInformer) Lister() appsv1beta2listers.DaemonSetLister { + return v1beta2.NewDaemonSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/deployments.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/deployments.go new file mode 100644 index 0000000000000..28ff0daeb2302 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/deployments.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1beta2 "k8s.io/client-go/kcp/listers/apps/v1beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f DeploymentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f DeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.Deployment{}, f.defaultInformer) +} + +func (f DeploymentInformer) Lister() appsv1beta2listers.DeploymentLister { + return v1beta2.NewDeploymentClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/interface.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/interface.go new file mode 100644 index 0000000000000..99db301aa3449 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/interface.go @@ -0,0 +1,63 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + upstreaminformers "k8s.io/client-go/informers/apps/v1beta2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v Interface) ControllerRevisions() upstreaminformers.ControllerRevisionInformer { + return &ControllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v Interface) DaemonSets() upstreaminformers.DaemonSetInformer { + return &DaemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v Interface) Deployments() upstreaminformers.DeploymentInformer { + return &DeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v Interface) ReplicaSets() upstreaminformers.ReplicaSetInformer { + return &ReplicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v Interface) StatefulSets() upstreaminformers.StatefulSetInformer { + return &StatefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/replicasets.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/replicasets.go new file mode 100644 index 0000000000000..5f072d2f3dfeb --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/replicasets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1beta2 "k8s.io/client-go/kcp/listers/apps/v1beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f ReplicaSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ReplicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.ReplicaSet{}, f.defaultInformer) +} + +func (f ReplicaSetInformer) Lister() appsv1beta2listers.ReplicaSetLister { + return v1beta2.NewReplicaSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/statefulsets.go b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/statefulsets.go new file mode 100644 index 0000000000000..2180e98c91157 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/apps/v1beta2/statefulsets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1beta2 "k8s.io/client-go/kcp/listers/apps/v1beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f StatefulSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f StatefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.StatefulSet{}, f.defaultInformer) +} + +func (f StatefulSetInformer) Lister() appsv1beta2listers.StatefulSetLister { + return v1beta2.NewStatefulSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/interface.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/interface.go new file mode 100644 index 0000000000000..1c3566af9e7d5 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/interface.go @@ -0,0 +1,61 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package autoscaling + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/autoscaling/v1" + v2 "k8s.io/client-go/kcp/informers/autoscaling/v2" + v2beta1 "k8s.io/client-go/kcp/informers/autoscaling/v2beta1" + v2beta2 "k8s.io/client-go/kcp/informers/autoscaling/v2beta2" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2 returns a new v2.Interface. +func (g Interface) V2() v2.Interface { + return v2.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2beta1 returns a new v2beta1.Interface. +func (g Interface) V2beta1() v2beta1.Interface { + return v2beta1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2beta2 returns a new v2beta2.Interface. +func (g Interface) V2beta2() v2beta2.Interface { + return v2beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/horizontalpodautoscalers.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/horizontalpodautoscalers.go new file mode 100644 index 0000000000000..05a10e2ff2bfc --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/horizontalpodautoscalers.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + autoscalingv1 "k8s.io/api/autoscaling/v1" + v1 "k8s.io/client-go/kcp/listers/autoscaling/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + autoscalingv1listers "k8s.io/client-go/listers/autoscaling/v1" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv1.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f HorizontalPodAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f HorizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv1.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f HorizontalPodAutoscalerInformer) Lister() autoscalingv1listers.HorizontalPodAutoscalerLister { + return v1.NewHorizontalPodAutoscalerClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/interface.go new file mode 100644 index 0000000000000..2c01cb0ddd981 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/autoscaling/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v Interface) HorizontalPodAutoscalers() upstreaminformers.HorizontalPodAutoscalerInformer { + return &HorizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/horizontalpodautoscalers.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/horizontalpodautoscalers.go new file mode 100644 index 0000000000000..b7536e51a774f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/horizontalpodautoscalers.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + autoscalingv2 "k8s.io/api/autoscaling/v2" + v2 "k8s.io/client-go/kcp/listers/autoscaling/v2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + autoscalingv2listers "k8s.io/client-go/listers/autoscaling/v2" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f HorizontalPodAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f HorizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f HorizontalPodAutoscalerInformer) Lister() autoscalingv2listers.HorizontalPodAutoscalerLister { + return v2.NewHorizontalPodAutoscalerClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/interface.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/interface.go new file mode 100644 index 0000000000000..4339975fac2f9 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2 + +import ( + upstreaminformers "k8s.io/client-go/informers/autoscaling/v2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v Interface) HorizontalPodAutoscalers() upstreaminformers.HorizontalPodAutoscalerInformer { + return &HorizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/horizontalpodautoscalers.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/horizontalpodautoscalers.go new file mode 100644 index 0000000000000..b71f23dc74c92 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/horizontalpodautoscalers.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + v2beta1 "k8s.io/client-go/kcp/listers/autoscaling/v2beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + autoscalingv2beta1listers "k8s.io/client-go/listers/autoscaling/v2beta1" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2beta1.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f HorizontalPodAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f HorizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2beta1.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f HorizontalPodAutoscalerInformer) Lister() autoscalingv2beta1listers.HorizontalPodAutoscalerLister { + return v2beta1.NewHorizontalPodAutoscalerClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/interface.go new file mode 100644 index 0000000000000..a3fb2c3dd111a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/autoscaling/v2beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v Interface) HorizontalPodAutoscalers() upstreaminformers.HorizontalPodAutoscalerInformer { + return &HorizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/horizontalpodautoscalers.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/horizontalpodautoscalers.go new file mode 100644 index 0000000000000..cd071865c0e03 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/horizontalpodautoscalers.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + v2beta2 "k8s.io/client-go/kcp/listers/autoscaling/v2beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + autoscalingv2beta2listers "k8s.io/client-go/listers/autoscaling/v2beta2" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2beta2.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f HorizontalPodAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f HorizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2beta2.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f HorizontalPodAutoscalerInformer) Lister() autoscalingv2beta2listers.HorizontalPodAutoscalerLister { + return v2beta2.NewHorizontalPodAutoscalerClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/interface.go b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/interface.go new file mode 100644 index 0000000000000..c8cfbc77983b7 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/autoscaling/v2beta2/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2beta2 + +import ( + upstreaminformers "k8s.io/client-go/informers/autoscaling/v2beta2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v Interface) HorizontalPodAutoscalers() upstreaminformers.HorizontalPodAutoscalerInformer { + return &HorizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/batch/interface.go b/staging/src/k8s.io/client-go/kcp/informers/batch/interface.go new file mode 100644 index 0000000000000..aa5b96215f7a0 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/batch/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package batch + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/batch/v1" + v1beta1 "k8s.io/client-go/kcp/informers/batch/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/batch/v1/cronjobs.go b/staging/src/k8s.io/client-go/kcp/informers/batch/v1/cronjobs.go new file mode 100644 index 0000000000000..1c177109a3fef --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/batch/v1/cronjobs.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + batchv1 "k8s.io/api/batch/v1" + v1 "k8s.io/client-go/kcp/listers/batch/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + batchv1listers "k8s.io/client-go/listers/batch/v1" +) + +// CronJobInformer provides access to a shared informer and lister for +// CronJobs. +type CronJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCronJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.CronJob{}, + resyncPeriod, + indexers, + ) +} + +func (f CronJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCronJobInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f CronJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.CronJob{}, f.defaultInformer) +} + +func (f CronJobInformer) Lister() batchv1listers.CronJobLister { + return v1.NewCronJobClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/batch/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/batch/v1/interface.go new file mode 100644 index 0000000000000..7322d59006e85 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/batch/v1/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/batch/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CronJobs returns a CronJobInformer. +func (v Interface) CronJobs() upstreaminformers.CronJobInformer { + return &CronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Jobs returns a JobInformer. +func (v Interface) Jobs() upstreaminformers.JobInformer { + return &JobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/batch/v1/jobs.go b/staging/src/k8s.io/client-go/kcp/informers/batch/v1/jobs.go new file mode 100644 index 0000000000000..58861ed7b34d0 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/batch/v1/jobs.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + batchv1 "k8s.io/api/batch/v1" + v1 "k8s.io/client-go/kcp/listers/batch/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + batchv1listers "k8s.io/client-go/listers/batch/v1" +) + +// JobInformer provides access to a shared informer and lister for +// Jobs. +type JobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.Job{}, + resyncPeriod, + indexers, + ) +} + +func (f JobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredJobInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f JobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.Job{}, f.defaultInformer) +} + +func (f JobInformer) Lister() batchv1listers.JobLister { + return v1.NewJobClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/cronjobs.go b/staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/cronjobs.go new file mode 100644 index 0000000000000..19e7e89ff865c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/cronjobs.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + batchv1beta1 "k8s.io/api/batch/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/batch/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + batchv1beta1listers "k8s.io/client-go/listers/batch/v1beta1" +) + +// CronJobInformer provides access to a shared informer and lister for +// CronJobs. +type CronJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCronJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1beta1().CronJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1beta1().CronJobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1beta1.CronJob{}, + resyncPeriod, + indexers, + ) +} + +func (f CronJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCronJobInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f CronJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1beta1.CronJob{}, f.defaultInformer) +} + +func (f CronJobInformer) Lister() batchv1beta1listers.CronJobLister { + return v1beta1.NewCronJobClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/interface.go new file mode 100644 index 0000000000000..af17320b8f6c3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/batch/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/batch/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CronJobs returns a CronJobInformer. +func (v Interface) CronJobs() upstreaminformers.CronJobInformer { + return &CronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/certificates/interface.go b/staging/src/k8s.io/client-go/kcp/informers/certificates/interface.go new file mode 100644 index 0000000000000..ad77138d527b3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/certificates/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package certificates + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/certificates/v1" + v1beta1 "k8s.io/client-go/kcp/informers/certificates/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/certificates/v1/certificatesigningrequests.go b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1/certificatesigningrequests.go new file mode 100644 index 0000000000000..f4bd84d4e2691 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1/certificatesigningrequests.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + certificatesv1 "k8s.io/api/certificates/v1" + v1 "k8s.io/client-go/kcp/listers/certificates/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + certificatesv1listers "k8s.io/client-go/listers/certificates/v1" +) + +// CertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests. +type CertificateSigningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateSigningRequestInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().Watch(context.TODO(), options) + }, + }, + &certificatesv1.CertificateSigningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f CertificateSigningRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CertificateSigningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certificatesv1.CertificateSigningRequest{}, f.defaultInformer) +} + +func (f CertificateSigningRequestInformer) Lister() certificatesv1listers.CertificateSigningRequestLister { + return v1.NewCertificateSigningRequestClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/certificates/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1/interface.go new file mode 100644 index 0000000000000..fd90b5c6804d1 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/certificates/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CertificateSigningRequests returns a CertificateSigningRequestInformer. +func (v Interface) CertificateSigningRequests() upstreaminformers.CertificateSigningRequestInformer { + return &CertificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/certificatesigningrequests.go b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/certificatesigningrequests.go new file mode 100644 index 0000000000000..daa3858d64834 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/certificatesigningrequests.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/certificates/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + certificatesv1beta1listers "k8s.io/client-go/listers/certificates/v1beta1" +) + +// CertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests. +type CertificateSigningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateSigningRequestInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1beta1().CertificateSigningRequests().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1beta1().CertificateSigningRequests().Watch(context.TODO(), options) + }, + }, + &certificatesv1beta1.CertificateSigningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f CertificateSigningRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CertificateSigningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certificatesv1beta1.CertificateSigningRequest{}, f.defaultInformer) +} + +func (f CertificateSigningRequestInformer) Lister() certificatesv1beta1listers.CertificateSigningRequestLister { + return v1beta1.NewCertificateSigningRequestClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/interface.go new file mode 100644 index 0000000000000..92685cf8d1278 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/certificates/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/certificates/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CertificateSigningRequests returns a CertificateSigningRequestInformer. +func (v Interface) CertificateSigningRequests() upstreaminformers.CertificateSigningRequestInformer { + return &CertificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/coordination/interface.go b/staging/src/k8s.io/client-go/kcp/informers/coordination/interface.go new file mode 100644 index 0000000000000..9519b7a7af6ac --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/coordination/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package coordination + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/coordination/v1" + v1beta1 "k8s.io/client-go/kcp/informers/coordination/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/coordination/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1/interface.go new file mode 100644 index 0000000000000..fe6eb536a83ed --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/coordination/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Leases returns a LeaseInformer. +func (v Interface) Leases() upstreaminformers.LeaseInformer { + return &LeaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/coordination/v1/leases.go b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1/leases.go new file mode 100644 index 0000000000000..7f1794e7f6fd8 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1/leases.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + coordinationv1 "k8s.io/api/coordination/v1" + v1 "k8s.io/client-go/kcp/listers/coordination/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + coordinationv1listers "k8s.io/client-go/listers/coordination/v1" +) + +// LeaseInformer provides access to a shared informer and lister for +// Leases. +type LeaseInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).Watch(context.TODO(), options) + }, + }, + &coordinationv1.Lease{}, + resyncPeriod, + indexers, + ) +} + +func (f LeaseInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f LeaseInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&coordinationv1.Lease{}, f.defaultInformer) +} + +func (f LeaseInformer) Lister() coordinationv1listers.LeaseLister { + return v1.NewLeaseClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/interface.go new file mode 100644 index 0000000000000..3d574054bf203 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/coordination/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Leases returns a LeaseInformer. +func (v Interface) Leases() upstreaminformers.LeaseInformer { + return &LeaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/leases.go b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/leases.go new file mode 100644 index 0000000000000..a7eb936c77a74 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/coordination/v1beta1/leases.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/coordination/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + coordinationv1beta1listers "k8s.io/client-go/listers/coordination/v1beta1" +) + +// LeaseInformer provides access to a shared informer and lister for +// Leases. +type LeaseInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1beta1().Leases(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1beta1().Leases(namespace).Watch(context.TODO(), options) + }, + }, + &coordinationv1beta1.Lease{}, + resyncPeriod, + indexers, + ) +} + +func (f LeaseInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f LeaseInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&coordinationv1beta1.Lease{}, f.defaultInformer) +} + +func (f LeaseInformer) Lister() coordinationv1beta1listers.LeaseLister { + return v1beta1.NewLeaseClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/interface.go b/staging/src/k8s.io/client-go/kcp/informers/core/interface.go new file mode 100644 index 0000000000000..a46848965a821 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package core + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/core/v1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/componentstatuses.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/componentstatuses.go new file mode 100644 index 0000000000000..17d25f1bd90ab --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/componentstatuses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// ComponentStatusInformer provides access to a shared informer and lister for +// ComponentStatuses. +type ComponentStatusInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewComponentStatusInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredComponentStatusInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().Watch(context.TODO(), options) + }, + }, + &corev1.ComponentStatus{}, + resyncPeriod, + indexers, + ) +} + +func (f ComponentStatusInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ComponentStatusInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ComponentStatus{}, f.defaultInformer) +} + +func (f ComponentStatusInformer) Lister() corev1listers.ComponentStatusLister { + return v1.NewComponentStatusClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/configmaps.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/configmaps.go new file mode 100644 index 0000000000000..a344cb4c8f82f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/configmaps.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// ConfigMapInformer provides access to a shared informer and lister for +// ConfigMaps. +type ConfigMapInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConfigMapInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredConfigMapInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ConfigMap{}, + resyncPeriod, + indexers, + ) +} + +func (f ConfigMapInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ConfigMapInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ConfigMap{}, f.defaultInformer) +} + +func (f ConfigMapInformer) Lister() corev1listers.ConfigMapLister { + return v1.NewConfigMapClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/endpoints.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/endpoints.go new file mode 100644 index 0000000000000..e6de8fa2d77aa --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/endpoints.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// EndpointsInformer provides access to a shared informer and lister for +// Endpoints. +type EndpointsInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointsInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointsInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Endpoints{}, + resyncPeriod, + indexers, + ) +} + +func (f EndpointsInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f EndpointsInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Endpoints{}, f.defaultInformer) +} + +func (f EndpointsInformer) Lister() corev1listers.EndpointsLister { + return v1.NewEndpointsClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/events.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/events.go new file mode 100644 index 0000000000000..40c3b23fc92a6 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/events.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f EventInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f EventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Event{}, f.defaultInformer) +} + +func (f EventInformer) Lister() corev1listers.EventLister { + return v1.NewEventClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/interface.go new file mode 100644 index 0000000000000..d533bf89703a8 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/interface.go @@ -0,0 +1,118 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/core/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ComponentStatuses returns a ComponentStatusInformer. +func (v Interface) ComponentStatuses() upstreaminformers.ComponentStatusInformer { + return &ComponentStatusInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ConfigMaps returns a ConfigMapInformer. +func (v Interface) ConfigMaps() upstreaminformers.ConfigMapInformer { + return &ConfigMapInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Endpoints returns a EndpointsInformer. +func (v Interface) Endpoints() upstreaminformers.EndpointsInformer { + return &EndpointsInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Events returns a EventInformer. +func (v Interface) Events() upstreaminformers.EventInformer { + return &EventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// LimitRanges returns a LimitRangeInformer. +func (v Interface) LimitRanges() upstreaminformers.LimitRangeInformer { + return &LimitRangeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Namespaces returns a NamespaceInformer. +func (v Interface) Namespaces() upstreaminformers.NamespaceInformer { + return &NamespaceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Nodes returns a NodeInformer. +func (v Interface) Nodes() upstreaminformers.NodeInformer { + return &NodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumes returns a PersistentVolumeInformer. +func (v Interface) PersistentVolumes() upstreaminformers.PersistentVolumeInformer { + return &PersistentVolumeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumeClaims returns a PersistentVolumeClaimInformer. +func (v Interface) PersistentVolumeClaims() upstreaminformers.PersistentVolumeClaimInformer { + return &PersistentVolumeClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Pods returns a PodInformer. +func (v Interface) Pods() upstreaminformers.PodInformer { + return &PodInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodTemplates returns a PodTemplateInformer. +func (v Interface) PodTemplates() upstreaminformers.PodTemplateInformer { + return &PodTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicationControllers returns a ReplicationControllerInformer. +func (v Interface) ReplicationControllers() upstreaminformers.ReplicationControllerInformer { + return &ReplicationControllerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceQuotas returns a ResourceQuotaInformer. +func (v Interface) ResourceQuotas() upstreaminformers.ResourceQuotaInformer { + return &ResourceQuotaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Secrets returns a SecretInformer. +func (v Interface) Secrets() upstreaminformers.SecretInformer { + return &SecretInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Services returns a ServiceInformer. +func (v Interface) Services() upstreaminformers.ServiceInformer { + return &ServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ServiceAccounts returns a ServiceAccountInformer. +func (v Interface) ServiceAccounts() upstreaminformers.ServiceAccountInformer { + return &ServiceAccountInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/limitranges.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/limitranges.go new file mode 100644 index 0000000000000..b213dbef33239 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/limitranges.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// LimitRangeInformer provides access to a shared informer and lister for +// LimitRanges. +type LimitRangeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLimitRangeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLimitRangeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.LimitRange{}, + resyncPeriod, + indexers, + ) +} + +func (f LimitRangeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f LimitRangeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.LimitRange{}, f.defaultInformer) +} + +func (f LimitRangeInformer) Lister() corev1listers.LimitRangeLister { + return v1.NewLimitRangeClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/namespaces.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/namespaces.go new file mode 100644 index 0000000000000..cfdfa3888a2d7 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/namespaces.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// NamespaceInformer provides access to a shared informer and lister for +// Namespaces. +type NamespaceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNamespaceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNamespaceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().Watch(context.TODO(), options) + }, + }, + &corev1.Namespace{}, + resyncPeriod, + indexers, + ) +} + +func (f NamespaceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f NamespaceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Namespace{}, f.defaultInformer) +} + +func (f NamespaceInformer) Lister() corev1listers.NamespaceLister { + return v1.NewNamespaceClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/nodes.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/nodes.go new file mode 100644 index 0000000000000..72395968f13bd --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/nodes.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// NodeInformer provides access to a shared informer and lister for +// Nodes. +type NodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNodeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNodeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().Watch(context.TODO(), options) + }, + }, + &corev1.Node{}, + resyncPeriod, + indexers, + ) +} + +func (f NodeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNodeInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f NodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Node{}, f.defaultInformer) +} + +func (f NodeInformer) Lister() corev1listers.NodeLister { + return v1.NewNodeClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumeclaims.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumeclaims.go new file mode 100644 index 0000000000000..ab691dff644f3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumeclaims.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// PersistentVolumeClaimInformer provides access to a shared informer and lister for +// PersistentVolumeClaims. +type PersistentVolumeClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolumeClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f PersistentVolumeClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f PersistentVolumeClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolumeClaim{}, f.defaultInformer) +} + +func (f PersistentVolumeClaimInformer) Lister() corev1listers.PersistentVolumeClaimLister { + return v1.NewPersistentVolumeClaimClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumes.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumes.go new file mode 100644 index 0000000000000..b5e803d1a875d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/persistentvolumes.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// PersistentVolumeInformer provides access to a shared informer and lister for +// PersistentVolumes. +type PersistentVolumeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolume{}, + resyncPeriod, + indexers, + ) +} + +func (f PersistentVolumeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PersistentVolumeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolume{}, f.defaultInformer) +} + +func (f PersistentVolumeInformer) Lister() corev1listers.PersistentVolumeLister { + return v1.NewPersistentVolumeClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/pods.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/pods.go new file mode 100644 index 0000000000000..ffc96e95b12ec --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/pods.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// PodInformer provides access to a shared informer and lister for +// Pods. +type PodInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Pod{}, + resyncPeriod, + indexers, + ) +} + +func (f PodInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f PodInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Pod{}, f.defaultInformer) +} + +func (f PodInformer) Lister() corev1listers.PodLister { + return v1.NewPodClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/podtemplates.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/podtemplates.go new file mode 100644 index 0000000000000..b5ee12f328a25 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/podtemplates.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// PodTemplateInformer provides access to a shared informer and lister for +// PodTemplates. +type PodTemplateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodTemplateInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodTemplateInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PodTemplate{}, + resyncPeriod, + indexers, + ) +} + +func (f PodTemplateInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f PodTemplateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PodTemplate{}, f.defaultInformer) +} + +func (f PodTemplateInformer) Lister() corev1listers.PodTemplateLister { + return v1.NewPodTemplateClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/replicationcontrollers.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/replicationcontrollers.go new file mode 100644 index 0000000000000..9a000f36c7a4e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/replicationcontrollers.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// ReplicationControllerInformer provides access to a shared informer and lister for +// ReplicationControllers. +type ReplicationControllerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicationControllerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicationControllerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ReplicationController{}, + resyncPeriod, + indexers, + ) +} + +func (f ReplicationControllerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ReplicationControllerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ReplicationController{}, f.defaultInformer) +} + +func (f ReplicationControllerInformer) Lister() corev1listers.ReplicationControllerLister { + return v1.NewReplicationControllerClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/resourcequotas.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/resourcequotas.go new file mode 100644 index 0000000000000..f2fba5face83a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/resourcequotas.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// ResourceQuotaInformer provides access to a shared informer and lister for +// ResourceQuotas. +type ResourceQuotaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceQuotaInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceQuotaInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ResourceQuota{}, + resyncPeriod, + indexers, + ) +} + +func (f ResourceQuotaInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ResourceQuotaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ResourceQuota{}, f.defaultInformer) +} + +func (f ResourceQuotaInformer) Lister() corev1listers.ResourceQuotaLister { + return v1.NewResourceQuotaClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/secrets.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/secrets.go new file mode 100644 index 0000000000000..86ee52161b1d0 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/secrets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// SecretInformer provides access to a shared informer and lister for +// Secrets. +type SecretInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSecretInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSecretInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSecretInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Secret{}, + resyncPeriod, + indexers, + ) +} + +func (f SecretInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSecretInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f SecretInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Secret{}, f.defaultInformer) +} + +func (f SecretInformer) Lister() corev1listers.SecretLister { + return v1.NewSecretClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/serviceaccounts.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/serviceaccounts.go new file mode 100644 index 0000000000000..2e36de6c7b6cd --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/serviceaccounts.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// ServiceAccountInformer provides access to a shared informer and lister for +// ServiceAccounts. +type ServiceAccountInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceAccountInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceAccountInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ServiceAccount{}, + resyncPeriod, + indexers, + ) +} + +func (f ServiceAccountInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ServiceAccountInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ServiceAccount{}, f.defaultInformer) +} + +func (f ServiceAccountInformer) Lister() corev1listers.ServiceAccountLister { + return v1.NewServiceAccountClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/core/v1/services.go b/staging/src/k8s.io/client-go/kcp/informers/core/v1/services.go new file mode 100644 index 0000000000000..f330b8ec6d746 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/core/v1/services.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/client-go/kcp/listers/core/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + corev1listers "k8s.io/client-go/listers/core/v1" +) + +// ServiceInformer provides access to a shared informer and lister for +// Services. +type ServiceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Service{}, + resyncPeriod, + indexers, + ) +} + +func (f ServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Service{}, f.defaultInformer) +} + +func (f ServiceInformer) Lister() corev1listers.ServiceLister { + return v1.NewServiceClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/discovery/interface.go b/staging/src/k8s.io/client-go/kcp/informers/discovery/interface.go new file mode 100644 index 0000000000000..deb8c8e01213e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/discovery/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package discovery + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/discovery/v1" + v1beta1 "k8s.io/client-go/kcp/informers/discovery/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/discovery/v1/endpointslices.go b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1/endpointslices.go new file mode 100644 index 0000000000000..541610f442034 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1/endpointslices.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + discoveryv1 "k8s.io/api/discovery/v1" + v1 "k8s.io/client-go/kcp/listers/discovery/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + discoveryv1listers "k8s.io/client-go/listers/discovery/v1" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointSliceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).Watch(context.TODO(), options) + }, + }, + &discoveryv1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f EndpointSliceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f EndpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1.EndpointSlice{}, f.defaultInformer) +} + +func (f EndpointSliceInformer) Lister() discoveryv1listers.EndpointSliceLister { + return v1.NewEndpointSliceClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/discovery/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1/interface.go new file mode 100644 index 0000000000000..ea4ab55ef8f72 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/discovery/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v Interface) EndpointSlices() upstreaminformers.EndpointSliceInformer { + return &EndpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/endpointslices.go b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/endpointslices.go new file mode 100644 index 0000000000000..0349924c3bee9 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/endpointslices.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/discovery/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + discoveryv1beta1listers "k8s.io/client-go/listers/discovery/v1beta1" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointSliceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(context.TODO(), options) + }, + }, + &discoveryv1beta1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f EndpointSliceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f EndpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1beta1.EndpointSlice{}, f.defaultInformer) +} + +func (f EndpointSliceInformer) Lister() discoveryv1beta1listers.EndpointSliceLister { + return v1beta1.NewEndpointSliceClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/interface.go new file mode 100644 index 0000000000000..1fa06d4b14460 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/discovery/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/discovery/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v Interface) EndpointSlices() upstreaminformers.EndpointSliceInformer { + return &EndpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/events/interface.go b/staging/src/k8s.io/client-go/kcp/informers/events/interface.go new file mode 100644 index 0000000000000..3150a57c17d45 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/events/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package events + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/events/v1" + v1beta1 "k8s.io/client-go/kcp/informers/events/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/events/v1/events.go b/staging/src/k8s.io/client-go/kcp/informers/events/v1/events.go new file mode 100644 index 0000000000000..89a38b6c6bafc --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/events/v1/events.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + eventsv1 "k8s.io/api/events/v1" + v1 "k8s.io/client-go/kcp/listers/events/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + eventsv1listers "k8s.io/client-go/listers/events/v1" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &eventsv1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f EventInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f EventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&eventsv1.Event{}, f.defaultInformer) +} + +func (f EventInformer) Lister() eventsv1listers.EventLister { + return v1.NewEventClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/events/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/events/v1/interface.go new file mode 100644 index 0000000000000..8860d6a9cc358 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/events/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + upstreaminformers "k8s.io/client-go/informers/events/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Events returns a EventInformer. +func (v Interface) Events() upstreaminformers.EventInformer { + return &EventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/events.go b/staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/events.go new file mode 100644 index 0000000000000..bda139498e59b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/events.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + eventsv1beta1 "k8s.io/api/events/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/events/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + eventsv1beta1listers "k8s.io/client-go/listers/events/v1beta1" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1beta1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1beta1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &eventsv1beta1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f EventInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f EventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&eventsv1beta1.Event{}, f.defaultInformer) +} + +func (f EventInformer) Lister() eventsv1beta1listers.EventLister { + return v1beta1.NewEventClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/interface.go new file mode 100644 index 0000000000000..4424088c84d49 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/events/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/events/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Events returns a EventInformer. +func (v Interface) Events() upstreaminformers.EventInformer { + return &EventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/interface.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/interface.go new file mode 100644 index 0000000000000..70f15254cde1c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package extensions + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1beta1 "k8s.io/client-go/kcp/informers/extensions/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/daemonsets.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/daemonsets.go new file mode 100644 index 0000000000000..4361dde1cbef3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/daemonsets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/extensions/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f DaemonSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f DaemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.DaemonSet{}, f.defaultInformer) +} + +func (f DaemonSetInformer) Lister() extensionsv1beta1listers.DaemonSetLister { + return v1beta1.NewDaemonSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/deployments.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/deployments.go new file mode 100644 index 0000000000000..25c8db0845e9f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/deployments.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/extensions/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f DeploymentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f DeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.Deployment{}, f.defaultInformer) +} + +func (f DeploymentInformer) Lister() extensionsv1beta1listers.DeploymentLister { + return v1beta1.NewDeploymentClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/ingresses.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/ingresses.go new file mode 100644 index 0000000000000..095a27de7cf5c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/ingresses.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/extensions/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f IngressInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f IngressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.Ingress{}, f.defaultInformer) +} + +func (f IngressInformer) Lister() extensionsv1beta1listers.IngressLister { + return v1beta1.NewIngressClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/interface.go new file mode 100644 index 0000000000000..b65f296da5fbc --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/interface.go @@ -0,0 +1,68 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/extensions/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v Interface) DaemonSets() upstreaminformers.DaemonSetInformer { + return &DaemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v Interface) Deployments() upstreaminformers.DeploymentInformer { + return &DeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v Interface) Ingresses() upstreaminformers.IngressInformer { + return &IngressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// NetworkPolicies returns a NetworkPolicyInformer. +func (v Interface) NetworkPolicies() upstreaminformers.NetworkPolicyInformer { + return &NetworkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodSecurityPolicies returns a PodSecurityPolicyInformer. +func (v Interface) PodSecurityPolicies() upstreaminformers.PodSecurityPolicyInformer { + return &PodSecurityPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v Interface) ReplicaSets() upstreaminformers.ReplicaSetInformer { + return &ReplicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/networkpolicies.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/networkpolicies.go new file mode 100644 index 0000000000000..a2205d5af7f58 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/networkpolicies.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/extensions/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" +) + +// NetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies. +type NetworkPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().NetworkPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().NetworkPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.NetworkPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f NetworkPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f NetworkPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.NetworkPolicy{}, f.defaultInformer) +} + +func (f NetworkPolicyInformer) Lister() extensionsv1beta1listers.NetworkPolicyLister { + return v1beta1.NewNetworkPolicyClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/podsecuritypolicies.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/podsecuritypolicies.go new file mode 100644 index 0000000000000..0246b5a3345d4 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/podsecuritypolicies.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/extensions/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" +) + +// PodSecurityPolicyInformer provides access to a shared informer and lister for +// PodSecurityPolicies. +type PodSecurityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodSecurityPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodSecurityPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().PodSecurityPolicies().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().PodSecurityPolicies().Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.PodSecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f PodSecurityPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PodSecurityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.PodSecurityPolicy{}, f.defaultInformer) +} + +func (f PodSecurityPolicyInformer) Lister() extensionsv1beta1listers.PodSecurityPolicyLister { + return v1beta1.NewPodSecurityPolicyClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/replicasets.go b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/replicasets.go new file mode 100644 index 0000000000000..725b170c0b7d3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/extensions/v1beta1/replicasets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/extensions/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f ReplicaSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f ReplicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.ReplicaSet{}, f.defaultInformer) +} + +func (f ReplicaSetInformer) Lister() extensionsv1beta1listers.ReplicaSetLister { + return v1beta1.NewReplicaSetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/factory.go b/staging/src/k8s.io/client-go/kcp/informers/factory.go new file mode 100644 index 0000000000000..29433ee68d1aa --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/factory.go @@ -0,0 +1,263 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package informers + +import ( + "reflect" + "sync" + "time" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/tools/cache" + + versioned "k8s.io/client-go/kubernetes" + + upstreaminformers "k8s.io/client-go/informers" + admissionregistration "k8s.io/client-go/informers/admissionregistration" + apiserverinternal "k8s.io/client-go/informers/apiserverinternal" + apps "k8s.io/client-go/informers/apps" + autoscaling "k8s.io/client-go/informers/autoscaling" + batch "k8s.io/client-go/informers/batch" + certificates "k8s.io/client-go/informers/certificates" + coordination "k8s.io/client-go/informers/coordination" + core "k8s.io/client-go/informers/core" + discovery "k8s.io/client-go/informers/discovery" + events "k8s.io/client-go/informers/events" + extensions "k8s.io/client-go/informers/extensions" + flowcontrol "k8s.io/client-go/informers/flowcontrol" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networking "k8s.io/client-go/informers/networking" + node "k8s.io/client-go/informers/node" + policy "k8s.io/client-go/informers/policy" + rbac "k8s.io/client-go/informers/rbac" + scheduling "k8s.io/client-go/informers/scheduling" + storage "k8s.io/client-go/informers/storage" +) + +var _ upstreaminformers.SharedInformerFactory = &SharedInformerFactory{} + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*SharedInformerFactory) *SharedInformerFactory + +type SharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[metav1.Object]time.Duration) SharedInformerOption { + return func(factory *SharedInformerFactory) *SharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *SharedInformerFactory) *SharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *SharedInformerFactory) *SharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of SharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) upstreaminformers.SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of SharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) upstreaminformers.SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) upstreaminformers.SharedInformerFactory { + factory := &SharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *SharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *SharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *SharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +func (f *SharedInformerFactory) Admissionregistration() admissionregistration.Interface { + return admissionregistration.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Internal() apiserverinternal.Interface { + return apiserverinternal.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Apps() apps.Interface { + return apps.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Autoscaling() autoscaling.Interface { + return autoscaling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Batch() batch.Interface { + return batch.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Certificates() certificates.Interface { + return certificates.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Coordination() coordination.Interface { + return coordination.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Core() core.Interface { + return core.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Discovery() discovery.Interface { + return discovery.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Events() events.Interface { + return events.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Extensions() extensions.Interface { + return extensions.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Flowcontrol() flowcontrol.Interface { + return flowcontrol.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Networking() networking.Interface { + return networking.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Node() node.Interface { + return node.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Policy() policy.Interface { + return policy.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Rbac() rbac.Interface { + return rbac.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Scheduling() scheduling.Interface { + return scheduling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *SharedInformerFactory) Storage() storage.Interface { + return storage.New(f, f.namespace, f.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/interface.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/interface.go new file mode 100644 index 0000000000000..8a2e8934a03b7 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/interface.go @@ -0,0 +1,55 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package flowcontrol + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1alpha1 "k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1" + v1beta1 "k8s.io/client-go/kcp/informers/flowcontrol/v1beta1" + v1beta2 "k8s.io/client-go/kcp/informers/flowcontrol/v1beta2" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g Interface) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta2 returns a new v1beta2.Interface. +func (g Interface) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/flowschemas.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/flowschemas.go new file mode 100644 index 0000000000000..44cad6e199bb9 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/flowschemas.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + flowcontrolv1alpha1listers "k8s.io/client-go/listers/flowcontrol/v1alpha1" +) + +// FlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas. +type FlowSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredFlowSchemaInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().FlowSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().FlowSchemas().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1alpha1.FlowSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f FlowSchemaInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f FlowSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1alpha1.FlowSchema{}, f.defaultInformer) +} + +func (f FlowSchemaInformer) Lister() flowcontrolv1alpha1listers.FlowSchemaLister { + return v1alpha1.NewFlowSchemaClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/interface.go new file mode 100644 index 0000000000000..a45f041664d1f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + upstreaminformers "k8s.io/client-go/informers/flowcontrol/v1alpha1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// FlowSchemas returns a FlowSchemaInformer. +func (v Interface) FlowSchemas() upstreaminformers.FlowSchemaInformer { + return &FlowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. +func (v Interface) PriorityLevelConfigurations() upstreaminformers.PriorityLevelConfigurationInformer { + return &PriorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/prioritylevelconfigurations.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/prioritylevelconfigurations.go new file mode 100644 index 0000000000000..bd9745bd1858f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1alpha1/prioritylevelconfigurations.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + flowcontrolv1alpha1listers "k8s.io/client-go/listers/flowcontrol/v1alpha1" +) + +// PriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations. +type PriorityLevelConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityLevelConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().PriorityLevelConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().PriorityLevelConfigurations().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1alpha1.PriorityLevelConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f PriorityLevelConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PriorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1alpha1.PriorityLevelConfiguration{}, f.defaultInformer) +} + +func (f PriorityLevelConfigurationInformer) Lister() flowcontrolv1alpha1listers.PriorityLevelConfigurationLister { + return v1alpha1.NewPriorityLevelConfigurationClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/flowschemas.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/flowschemas.go new file mode 100644 index 0000000000000..80553550ddcab --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/flowschemas.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/flowcontrol/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + flowcontrolv1beta1listers "k8s.io/client-go/listers/flowcontrol/v1beta1" +) + +// FlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas. +type FlowSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredFlowSchemaInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().FlowSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().FlowSchemas().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta1.FlowSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f FlowSchemaInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f FlowSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta1.FlowSchema{}, f.defaultInformer) +} + +func (f FlowSchemaInformer) Lister() flowcontrolv1beta1listers.FlowSchemaLister { + return v1beta1.NewFlowSchemaClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/interface.go new file mode 100644 index 0000000000000..8eec06f987a2e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + upstreaminformers "k8s.io/client-go/informers/flowcontrol/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// FlowSchemas returns a FlowSchemaInformer. +func (v Interface) FlowSchemas() upstreaminformers.FlowSchemaInformer { + return &FlowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. +func (v Interface) PriorityLevelConfigurations() upstreaminformers.PriorityLevelConfigurationInformer { + return &PriorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/prioritylevelconfigurations.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/prioritylevelconfigurations.go new file mode 100644 index 0000000000000..b7ea9d4282515 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta1/prioritylevelconfigurations.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/flowcontrol/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + flowcontrolv1beta1listers "k8s.io/client-go/listers/flowcontrol/v1beta1" +) + +// PriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations. +type PriorityLevelConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityLevelConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta1.PriorityLevelConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f PriorityLevelConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PriorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta1.PriorityLevelConfiguration{}, f.defaultInformer) +} + +func (f PriorityLevelConfigurationInformer) Lister() flowcontrolv1beta1listers.PriorityLevelConfigurationLister { + return v1beta1.NewPriorityLevelConfigurationClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/flowschemas.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/flowschemas.go new file mode 100644 index 0000000000000..5ee04255b650b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/flowschemas.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" + v1beta2 "k8s.io/client-go/kcp/listers/flowcontrol/v1beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + flowcontrolv1beta2listers "k8s.io/client-go/listers/flowcontrol/v1beta2" +) + +// FlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas. +type FlowSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredFlowSchemaInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta2().FlowSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta2().FlowSchemas().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta2.FlowSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f FlowSchemaInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f FlowSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta2.FlowSchema{}, f.defaultInformer) +} + +func (f FlowSchemaInformer) Lister() flowcontrolv1beta2listers.FlowSchemaLister { + return v1beta2.NewFlowSchemaClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/interface.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/interface.go new file mode 100644 index 0000000000000..64ceb2d8c712f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + upstreaminformers "k8s.io/client-go/informers/flowcontrol/v1beta2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// FlowSchemas returns a FlowSchemaInformer. +func (v Interface) FlowSchemas() upstreaminformers.FlowSchemaInformer { + return &FlowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. +func (v Interface) PriorityLevelConfigurations() upstreaminformers.PriorityLevelConfigurationInformer { + return &PriorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/prioritylevelconfigurations.go b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/prioritylevelconfigurations.go new file mode 100644 index 0000000000000..769411b6342e4 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/flowcontrol/v1beta2/prioritylevelconfigurations.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" + v1beta2 "k8s.io/client-go/kcp/listers/flowcontrol/v1beta2" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + flowcontrolv1beta2listers "k8s.io/client-go/listers/flowcontrol/v1beta2" +) + +// PriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations. +type PriorityLevelConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityLevelConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta2().PriorityLevelConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta2().PriorityLevelConfigurations().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta2.PriorityLevelConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f PriorityLevelConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PriorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta2.PriorityLevelConfiguration{}, f.defaultInformer) +} + +func (f PriorityLevelConfigurationInformer) Lister() flowcontrolv1beta2listers.PriorityLevelConfigurationLister { + return v1beta2.NewPriorityLevelConfigurationClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/generic.go b/staging/src/k8s.io/client-go/kcp/informers/generic.go new file mode 100644 index 0000000000000..0e24198957b63 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/generic.go @@ -0,0 +1,371 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package informers + +import ( + "fmt" + + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + appsv1 "k8s.io/api/apps/v1" + appsv1beta1 "k8s.io/api/apps/v1beta1" + appsv1beta2 "k8s.io/api/apps/v1beta2" + autoscalingv1 "k8s.io/api/autoscaling/v1" + autoscalingv2 "k8s.io/api/autoscaling/v2" + autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + batchv1 "k8s.io/api/batch/v1" + batchv1beta1 "k8s.io/api/batch/v1beta1" + certificatesv1 "k8s.io/api/certificates/v1" + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + coordinationv1 "k8s.io/api/coordination/v1" + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + corev1 "k8s.io/api/core/v1" + discoveryv1 "k8s.io/api/discovery/v1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + eventsv1 "k8s.io/api/events/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" + networkingv1 "k8s.io/api/networking/v1" + networkingv1beta1 "k8s.io/api/networking/v1beta1" + nodev1 "k8s.io/api/node/v1" + nodev1alpha1 "k8s.io/api/node/v1alpha1" + nodev1beta1 "k8s.io/api/node/v1beta1" + policyv1 "k8s.io/api/policy/v1" + policyv1beta1 "k8s.io/api/policy/v1beta1" + rbacv1 "k8s.io/api/rbac/v1" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + schedulingv1 "k8s.io/api/scheduling/v1" + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + storagev1 "k8s.io/api/storage/v1" + storagev1beta1 "k8s.io/api/storage/v1beta1" + upstreaminformers "k8s.io/client-go/informers" +) + +type GenericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *GenericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericClusterLister. +func (f *GenericInformer) Lister() cache.GenericLister { + return kcpcache.NewGenericClusterLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *SharedInformerFactory) ForResource(resource schema.GroupVersionResource) (upstreaminformers.GenericInformer, error) { + switch resource { + // Group=admissionregistration.k8s.io, Version=v1 + case admissionregistrationv1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingWebhookConfigurations().Informer()}, nil + case admissionregistrationv1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingWebhookConfigurations().Informer()}, nil + + // Group=admissionregistration.k8s.io, Version=v1beta1 + case admissionregistrationv1beta1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().MutatingWebhookConfigurations().Informer()}, nil + case admissionregistrationv1beta1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().ValidatingWebhookConfigurations().Informer()}, nil + + // Group=internal.apiserver.k8s.io, Version=v1alpha1 + case apiserverinternalv1alpha1.SchemeGroupVersion.WithResource("storageversions"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil + + // Group=apps, Version=v1 + case appsv1.SchemeGroupVersion.WithResource("controllerrevisions"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ControllerRevisions().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("daemonsets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().DaemonSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("deployments"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().Deployments().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("replicasets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ReplicaSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("statefulsets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().StatefulSets().Informer()}, nil + + // Group=apps, Version=v1beta1 + case appsv1beta1.SchemeGroupVersion.WithResource("controllerrevisions"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().ControllerRevisions().Informer()}, nil + case appsv1beta1.SchemeGroupVersion.WithResource("deployments"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().Deployments().Informer()}, nil + case appsv1beta1.SchemeGroupVersion.WithResource("statefulsets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().StatefulSets().Informer()}, nil + + // Group=apps, Version=v1beta2 + case appsv1beta2.SchemeGroupVersion.WithResource("controllerrevisions"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ControllerRevisions().Informer()}, nil + case appsv1beta2.SchemeGroupVersion.WithResource("daemonsets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().DaemonSets().Informer()}, nil + case appsv1beta2.SchemeGroupVersion.WithResource("deployments"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().Deployments().Informer()}, nil + case appsv1beta2.SchemeGroupVersion.WithResource("replicasets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ReplicaSets().Informer()}, nil + case appsv1beta2.SchemeGroupVersion.WithResource("statefulsets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().StatefulSets().Informer()}, nil + + // Group=autoscaling, Version=v1 + case autoscalingv1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2 + case autoscalingv2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2beta1 + case autoscalingv2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta1().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2beta2 + case autoscalingv2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta2().HorizontalPodAutoscalers().Informer()}, nil + + // Group=batch, Version=v1 + case batchv1.SchemeGroupVersion.WithResource("cronjobs"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().CronJobs().Informer()}, nil + case batchv1.SchemeGroupVersion.WithResource("jobs"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil + + // Group=batch, Version=v1beta1 + case batchv1beta1.SchemeGroupVersion.WithResource("cronjobs"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Batch().V1beta1().CronJobs().Informer()}, nil + + // Group=certificates.k8s.io, Version=v1 + case certificatesv1.SchemeGroupVersion.WithResource("certificatesigningrequests"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().CertificateSigningRequests().Informer()}, nil + + // Group=certificates.k8s.io, Version=v1beta1 + case certificatesv1beta1.SchemeGroupVersion.WithResource("certificatesigningrequests"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1beta1().CertificateSigningRequests().Informer()}, nil + + // Group=coordination.k8s.io, Version=v1 + case coordinationv1.SchemeGroupVersion.WithResource("leases"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1().Leases().Informer()}, nil + + // Group=coordination.k8s.io, Version=v1beta1 + case coordinationv1beta1.SchemeGroupVersion.WithResource("leases"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1beta1().Leases().Informer()}, nil + + // Group=core, Version=v1 + case corev1.SchemeGroupVersion.WithResource("componentstatuses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ComponentStatuses().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("configmaps"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ConfigMaps().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("endpoints"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Endpoints().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("events"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Events().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("limitranges"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().LimitRanges().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("namespaces"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Namespaces().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("nodes"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Nodes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumes"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumeclaims"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumeClaims().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("pods"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Pods().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("podtemplates"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PodTemplates().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("replicationcontrollers"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ReplicationControllers().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("resourcequotas"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ResourceQuotas().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("secrets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Secrets().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("services"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Services().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("serviceaccounts"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ServiceAccounts().Informer()}, nil + + // Group=discovery.k8s.io, Version=v1 + case discoveryv1.SchemeGroupVersion.WithResource("endpointslices"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1().EndpointSlices().Informer()}, nil + + // Group=discovery.k8s.io, Version=v1beta1 + case discoveryv1beta1.SchemeGroupVersion.WithResource("endpointslices"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1beta1().EndpointSlices().Informer()}, nil + + // Group=events.k8s.io, Version=v1 + case eventsv1.SchemeGroupVersion.WithResource("events"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Events().V1().Events().Informer()}, nil + + // Group=events.k8s.io, Version=v1beta1 + case eventsv1beta1.SchemeGroupVersion.WithResource("events"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Events().V1beta1().Events().Informer()}, nil + + // Group=extensions, Version=v1beta1 + case extensionsv1beta1.SchemeGroupVersion.WithResource("daemonsets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().DaemonSets().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("deployments"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Deployments().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("ingresses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Ingresses().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("networkpolicies"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().NetworkPolicies().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().PodSecurityPolicies().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("replicasets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().ReplicaSets().Informer()}, nil + + // Group=flowcontrol.apiserver.k8s.io, Version=v1alpha1 + case flowcontrolv1alpha1.SchemeGroupVersion.WithResource("flowschemas"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().FlowSchemas().Informer()}, nil + case flowcontrolv1alpha1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().PriorityLevelConfigurations().Informer()}, nil + + // Group=flowcontrol.apiserver.k8s.io, Version=v1beta1 + case flowcontrolv1beta1.SchemeGroupVersion.WithResource("flowschemas"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().FlowSchemas().Informer()}, nil + case flowcontrolv1beta1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().PriorityLevelConfigurations().Informer()}, nil + + // Group=flowcontrol.apiserver.k8s.io, Version=v1beta2 + case flowcontrolv1beta2.SchemeGroupVersion.WithResource("flowschemas"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta2().FlowSchemas().Informer()}, nil + case flowcontrolv1beta2.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta2().PriorityLevelConfigurations().Informer()}, nil + + // Group=networking.k8s.io, Version=v1 + case networkingv1.SchemeGroupVersion.WithResource("ingresses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().Ingresses().Informer()}, nil + case networkingv1.SchemeGroupVersion.WithResource("ingressclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IngressClasses().Informer()}, nil + case networkingv1.SchemeGroupVersion.WithResource("networkpolicies"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil + + // Group=networking.k8s.io, Version=v1beta1 + case networkingv1beta1.SchemeGroupVersion.WithResource("ingresses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Ingresses().Informer()}, nil + case networkingv1beta1.SchemeGroupVersion.WithResource("ingressclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().IngressClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1 + case nodev1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Node().V1().RuntimeClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1alpha1 + case nodev1alpha1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().RuntimeClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1beta1 + case nodev1beta1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Node().V1beta1().RuntimeClasses().Informer()}, nil + + // Group=policy, Version=v1 + case policyv1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Policy().V1().PodDisruptionBudgets().Informer()}, nil + + // Group=policy, Version=v1beta1 + case policyv1beta1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodDisruptionBudgets().Informer()}, nil + case policyv1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodSecurityPolicies().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1 + case rbacv1.SchemeGroupVersion.WithResource("clusterroles"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoleBindings().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("roles"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().Roles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("rolebindings"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().RoleBindings().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1alpha1 + case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterroles"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoles().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoleBindings().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("roles"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().Roles().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("rolebindings"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().RoleBindings().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1beta1 + case rbacv1beta1.SchemeGroupVersion.WithResource("clusterroles"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoles().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoleBindings().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("roles"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().Roles().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("rolebindings"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().RoleBindings().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1 + case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1alpha1 + case schedulingv1alpha1.SchemeGroupVersion.WithResource("priorityclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PriorityClasses().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1beta1 + case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PriorityClasses().Informer()}, nil + + // Group=storage.k8s.io, Version=v1 + case storagev1.SchemeGroupVersion.WithResource("csidrivers"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIDrivers().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("csinodes"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSINodes().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("csistoragecapacities"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIStorageCapacities().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("storageclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().StorageClasses().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("volumeattachments"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().VolumeAttachments().Informer()}, nil + + // Group=storage.k8s.io, Version=v1beta1 + case storagev1beta1.SchemeGroupVersion.WithResource("csidrivers"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIDrivers().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("csinodes"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSINodes().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("csistoragecapacities"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIStorageCapacities().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("storageclasses"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().StorageClasses().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("volumeattachments"): + return &GenericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().VolumeAttachments().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/interface.go b/staging/src/k8s.io/client-go/kcp/informers/networking/interface.go new file mode 100644 index 0000000000000..d67174f1d32df --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package networking + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/networking/v1" + v1beta1 "k8s.io/client-go/kcp/informers/networking/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingressclasses.go b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingressclasses.go new file mode 100644 index 0000000000000..ad0a226d57d91 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingressclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + networkingv1 "k8s.io/api/networking/v1" + v1 "k8s.io/client-go/kcp/listers/networking/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networkingv1listers "k8s.io/client-go/listers/networking/v1" +) + +// IngressClassInformer provides access to a shared informer and lister for +// IngressClasses. +type IngressClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().IngressClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().IngressClasses().Watch(context.TODO(), options) + }, + }, + &networkingv1.IngressClass{}, + resyncPeriod, + indexers, + ) +} + +func (f IngressClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f IngressClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.IngressClass{}, f.defaultInformer) +} + +func (f IngressClassInformer) Lister() networkingv1listers.IngressClassLister { + return v1.NewIngressClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingresses.go b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingresses.go new file mode 100644 index 0000000000000..8e5520fafe082 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/ingresses.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + networkingv1 "k8s.io/api/networking/v1" + v1 "k8s.io/client-go/kcp/listers/networking/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networkingv1listers "k8s.io/client-go/listers/networking/v1" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f IngressInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f IngressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.Ingress{}, f.defaultInformer) +} + +func (f IngressInformer) Lister() networkingv1listers.IngressLister { + return v1.NewIngressClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/interface.go new file mode 100644 index 0000000000000..2e69f49f55fbe --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/interface.go @@ -0,0 +1,53 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/networking/v1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v Interface) Ingresses() upstreaminformers.IngressInformer { + return &IngressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IngressClasses returns a IngressClassInformer. +func (v Interface) IngressClasses() upstreaminformers.IngressClassInformer { + return &IngressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// NetworkPolicies returns a NetworkPolicyInformer. +func (v Interface) NetworkPolicies() upstreaminformers.NetworkPolicyInformer { + return &NetworkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/v1/networkpolicies.go b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/networkpolicies.go new file mode 100644 index 0000000000000..205783ff4b805 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/v1/networkpolicies.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + networkingv1 "k8s.io/api/networking/v1" + v1 "k8s.io/client-go/kcp/listers/networking/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networkingv1listers "k8s.io/client-go/listers/networking/v1" +) + +// NetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies. +type NetworkPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1.NetworkPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f NetworkPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f NetworkPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.NetworkPolicy{}, f.defaultInformer) +} + +func (f NetworkPolicyInformer) Lister() networkingv1listers.NetworkPolicyLister { + return v1.NewNetworkPolicyClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingressclasses.go b/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingressclasses.go new file mode 100644 index 0000000000000..cf217eb0123aa --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingressclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + networkingv1beta1 "k8s.io/api/networking/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/networking/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1" +) + +// IngressClassInformer provides access to a shared informer and lister for +// IngressClasses. +type IngressClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().IngressClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().IngressClasses().Watch(context.TODO(), options) + }, + }, + &networkingv1beta1.IngressClass{}, + resyncPeriod, + indexers, + ) +} + +func (f IngressClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f IngressClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1beta1.IngressClass{}, f.defaultInformer) +} + +func (f IngressClassInformer) Lister() networkingv1beta1listers.IngressClassLister { + return v1beta1.NewIngressClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingresses.go b/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingresses.go new file mode 100644 index 0000000000000..b5459a23a062d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/ingresses.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + networkingv1beta1 "k8s.io/api/networking/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/networking/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1beta1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f IngressInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f IngressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1beta1.Ingress{}, f.defaultInformer) +} + +func (f IngressInformer) Lister() networkingv1beta1listers.IngressLister { + return v1beta1.NewIngressClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/interface.go new file mode 100644 index 0000000000000..6e0be66dfe877 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/networking/v1beta1/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/networking/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v Interface) Ingresses() upstreaminformers.IngressInformer { + return &IngressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IngressClasses returns a IngressClassInformer. +func (v Interface) IngressClasses() upstreaminformers.IngressClassInformer { + return &IngressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/node/interface.go b/staging/src/k8s.io/client-go/kcp/informers/node/interface.go new file mode 100644 index 0000000000000..6d2fe21fbe287 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/node/interface.go @@ -0,0 +1,55 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package node + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/node/v1" + v1alpha1 "k8s.io/client-go/kcp/informers/node/v1alpha1" + v1beta1 "k8s.io/client-go/kcp/informers/node/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g Interface) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/node/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/node/v1/interface.go new file mode 100644 index 0000000000000..5e0871e02e7fd --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/node/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/node/v1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v Interface) RuntimeClasses() upstreaminformers.RuntimeClassInformer { + return &RuntimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/node/v1/runtimeclasses.go b/staging/src/k8s.io/client-go/kcp/informers/node/v1/runtimeclasses.go new file mode 100644 index 0000000000000..add3588ffad72 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/node/v1/runtimeclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + nodev1 "k8s.io/api/node/v1" + v1 "k8s.io/client-go/kcp/listers/node/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + nodev1listers "k8s.io/client-go/listers/node/v1" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f RuntimeClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f RuntimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1.RuntimeClass{}, f.defaultInformer) +} + +func (f RuntimeClassInformer) Lister() nodev1listers.RuntimeClassLister { + return v1.NewRuntimeClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/interface.go new file mode 100644 index 0000000000000..ba619813c0dae --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/node/v1alpha1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v Interface) RuntimeClasses() upstreaminformers.RuntimeClassInformer { + return &RuntimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/runtimeclasses.go b/staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/runtimeclasses.go new file mode 100644 index 0000000000000..54d4e4dd25e5a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/node/v1alpha1/runtimeclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + nodev1alpha1 "k8s.io/api/node/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/node/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + nodev1alpha1listers "k8s.io/client-go/listers/node/v1alpha1" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1alpha1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1alpha1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1alpha1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f RuntimeClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f RuntimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1alpha1.RuntimeClass{}, f.defaultInformer) +} + +func (f RuntimeClassInformer) Lister() nodev1alpha1listers.RuntimeClassLister { + return v1alpha1.NewRuntimeClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/interface.go new file mode 100644 index 0000000000000..1fa5d2fb7424e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/node/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v Interface) RuntimeClasses() upstreaminformers.RuntimeClassInformer { + return &RuntimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/runtimeclasses.go b/staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/runtimeclasses.go new file mode 100644 index 0000000000000..bbd6de54438db --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/node/v1beta1/runtimeclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + nodev1beta1 "k8s.io/api/node/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/node/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + nodev1beta1listers "k8s.io/client-go/listers/node/v1beta1" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1beta1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1beta1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1beta1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f RuntimeClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f RuntimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1beta1.RuntimeClass{}, f.defaultInformer) +} + +func (f RuntimeClassInformer) Lister() nodev1beta1listers.RuntimeClassLister { + return v1beta1.NewRuntimeClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/policy/interface.go b/staging/src/k8s.io/client-go/kcp/informers/policy/interface.go new file mode 100644 index 0000000000000..130e791caed43 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/policy/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package policy + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/policy/v1" + v1beta1 "k8s.io/client-go/kcp/informers/policy/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/policy/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/policy/v1/interface.go new file mode 100644 index 0000000000000..9b49a045ddf1c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/policy/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/policy/v1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. +func (v Interface) PodDisruptionBudgets() upstreaminformers.PodDisruptionBudgetInformer { + return &PodDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/policy/v1/poddisruptionbudgets.go b/staging/src/k8s.io/client-go/kcp/informers/policy/v1/poddisruptionbudgets.go new file mode 100644 index 0000000000000..d43aa0404e04c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/policy/v1/poddisruptionbudgets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + policyv1 "k8s.io/api/policy/v1" + v1 "k8s.io/client-go/kcp/listers/policy/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + policyv1listers "k8s.io/client-go/listers/policy/v1" +) + +// PodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets. +type PodDisruptionBudgetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodDisruptionBudgetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1().PodDisruptionBudgets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1().PodDisruptionBudgets(namespace).Watch(context.TODO(), options) + }, + }, + &policyv1.PodDisruptionBudget{}, + resyncPeriod, + indexers, + ) +} + +func (f PodDisruptionBudgetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f PodDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1.PodDisruptionBudget{}, f.defaultInformer) +} + +func (f PodDisruptionBudgetInformer) Lister() policyv1listers.PodDisruptionBudgetLister { + return v1.NewPodDisruptionBudgetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/interface.go new file mode 100644 index 0000000000000..d71a297e6b636 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/interface.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/policy/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. +func (v Interface) PodDisruptionBudgets() upstreaminformers.PodDisruptionBudgetInformer { + return &PodDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodSecurityPolicies returns a PodSecurityPolicyInformer. +func (v Interface) PodSecurityPolicies() upstreaminformers.PodSecurityPolicyInformer { + return &PodSecurityPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/poddisruptionbudgets.go b/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/poddisruptionbudgets.go new file mode 100644 index 0000000000000..0877fb49ae3cd --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/poddisruptionbudgets.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + policyv1beta1 "k8s.io/api/policy/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/policy/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + policyv1beta1listers "k8s.io/client-go/listers/policy/v1beta1" +) + +// PodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets. +type PodDisruptionBudgetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodDisruptionBudgetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).Watch(context.TODO(), options) + }, + }, + &policyv1beta1.PodDisruptionBudget{}, + resyncPeriod, + indexers, + ) +} + +func (f PodDisruptionBudgetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f PodDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1beta1.PodDisruptionBudget{}, f.defaultInformer) +} + +func (f PodDisruptionBudgetInformer) Lister() policyv1beta1listers.PodDisruptionBudgetLister { + return v1beta1.NewPodDisruptionBudgetClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/podsecuritypolicies.go b/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/podsecuritypolicies.go new file mode 100644 index 0000000000000..4b901e3c09881 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/policy/v1beta1/podsecuritypolicies.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + policyv1beta1 "k8s.io/api/policy/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/policy/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + policyv1beta1listers "k8s.io/client-go/listers/policy/v1beta1" +) + +// PodSecurityPolicyInformer provides access to a shared informer and lister for +// PodSecurityPolicies. +type PodSecurityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodSecurityPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodSecurityPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodSecurityPolicies().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodSecurityPolicies().Watch(context.TODO(), options) + }, + }, + &policyv1beta1.PodSecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f PodSecurityPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PodSecurityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1beta1.PodSecurityPolicy{}, f.defaultInformer) +} + +func (f PodSecurityPolicyInformer) Lister() policyv1beta1listers.PodSecurityPolicyLister { + return v1beta1.NewPodSecurityPolicyClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/interface.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/interface.go new file mode 100644 index 0000000000000..407455733be5c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/interface.go @@ -0,0 +1,55 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package rbac + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/rbac/v1" + v1alpha1 "k8s.io/client-go/kcp/informers/rbac/v1alpha1" + v1beta1 "k8s.io/client-go/kcp/informers/rbac/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g Interface) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterrolebindings.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterrolebindings.go new file mode 100644 index 0000000000000..7dffb45b932f7 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterrolebindings.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1 "k8s.io/api/rbac/v1" + v1 "k8s.io/client-go/kcp/listers/rbac/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f ClusterRoleBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ClusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f ClusterRoleBindingInformer) Lister() rbacv1listers.ClusterRoleBindingLister { + return v1.NewClusterRoleBindingClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterroles.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterroles.go new file mode 100644 index 0000000000000..de4eb12e441f0 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/clusterroles.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1 "k8s.io/api/rbac/v1" + v1 "k8s.io/client-go/kcp/listers/rbac/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f ClusterRoleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ClusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRole{}, f.defaultInformer) +} + +func (f ClusterRoleInformer) Lister() rbacv1listers.ClusterRoleLister { + return v1.NewClusterRoleClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/interface.go new file mode 100644 index 0000000000000..76d937fc7087b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/interface.go @@ -0,0 +1,58 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/rbac/v1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v Interface) ClusterRoles() upstreaminformers.ClusterRoleInformer { + return &ClusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v Interface) ClusterRoleBindings() upstreaminformers.ClusterRoleBindingInformer { + return &ClusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v Interface) Roles() upstreaminformers.RoleInformer { + return &RoleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v Interface) RoleBindings() upstreaminformers.RoleBindingInformer { + return &RoleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/rolebindings.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/rolebindings.go new file mode 100644 index 0000000000000..bdab4df20eded --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/rolebindings.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1 "k8s.io/api/rbac/v1" + v1 "k8s.io/client-go/kcp/listers/rbac/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f RoleBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f RoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.RoleBinding{}, f.defaultInformer) +} + +func (f RoleBindingInformer) Lister() rbacv1listers.RoleBindingLister { + return v1.NewRoleBindingClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/roles.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/roles.go new file mode 100644 index 0000000000000..e596d88435c9c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1/roles.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1 "k8s.io/api/rbac/v1" + v1 "k8s.io/client-go/kcp/listers/rbac/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f RoleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f RoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.Role{}, f.defaultInformer) +} + +func (f RoleInformer) Lister() rbacv1listers.RoleLister { + return v1.NewRoleClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterrolebindings.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterrolebindings.go new file mode 100644 index 0000000000000..edfce2e3e947c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterrolebindings.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/rbac/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f ClusterRoleBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ClusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f ClusterRoleBindingInformer) Lister() rbacv1alpha1listers.ClusterRoleBindingLister { + return v1alpha1.NewClusterRoleBindingClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterroles.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterroles.go new file mode 100644 index 0000000000000..5a34126100db1 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/clusterroles.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/rbac/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f ClusterRoleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ClusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.ClusterRole{}, f.defaultInformer) +} + +func (f ClusterRoleInformer) Lister() rbacv1alpha1listers.ClusterRoleLister { + return v1alpha1.NewClusterRoleClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/interface.go new file mode 100644 index 0000000000000..cff34da788671 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/interface.go @@ -0,0 +1,58 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/rbac/v1alpha1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v Interface) ClusterRoles() upstreaminformers.ClusterRoleInformer { + return &ClusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v Interface) ClusterRoleBindings() upstreaminformers.ClusterRoleBindingInformer { + return &ClusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v Interface) Roles() upstreaminformers.RoleInformer { + return &RoleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v Interface) RoleBindings() upstreaminformers.RoleBindingInformer { + return &RoleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/rolebindings.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/rolebindings.go new file mode 100644 index 0000000000000..3e887e9ac23d1 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/rolebindings.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/rbac/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f RoleBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f RoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.RoleBinding{}, f.defaultInformer) +} + +func (f RoleBindingInformer) Lister() rbacv1alpha1listers.RoleBindingLister { + return v1alpha1.NewRoleBindingClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/roles.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/roles.go new file mode 100644 index 0000000000000..90d673add8883 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1alpha1/roles.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/rbac/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f RoleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f RoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.Role{}, f.defaultInformer) +} + +func (f RoleInformer) Lister() rbacv1alpha1listers.RoleLister { + return v1alpha1.NewRoleClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterrolebindings.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterrolebindings.go new file mode 100644 index 0000000000000..8f52ed42083b5 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterrolebindings.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/rbac/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f ClusterRoleBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ClusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f ClusterRoleBindingInformer) Lister() rbacv1beta1listers.ClusterRoleBindingLister { + return v1beta1.NewClusterRoleBindingClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterroles.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterroles.go new file mode 100644 index 0000000000000..633c2d503cf71 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/clusterroles.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/rbac/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f ClusterRoleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f ClusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.ClusterRole{}, f.defaultInformer) +} + +func (f ClusterRoleInformer) Lister() rbacv1beta1listers.ClusterRoleLister { + return v1beta1.NewClusterRoleClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/interface.go new file mode 100644 index 0000000000000..56da31dc6a790 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/interface.go @@ -0,0 +1,58 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/rbac/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v Interface) ClusterRoles() upstreaminformers.ClusterRoleInformer { + return &ClusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v Interface) ClusterRoleBindings() upstreaminformers.ClusterRoleBindingInformer { + return &ClusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v Interface) Roles() upstreaminformers.RoleInformer { + return &RoleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v Interface) RoleBindings() upstreaminformers.RoleBindingInformer { + return &RoleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/rolebindings.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/rolebindings.go new file mode 100644 index 0000000000000..0b0d40802e2d0 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/rolebindings.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/rbac/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f RoleBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f RoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.RoleBinding{}, f.defaultInformer) +} + +func (f RoleBindingInformer) Lister() rbacv1beta1listers.RoleBindingLister { + return v1beta1.NewRoleBindingClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/roles.go b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/roles.go new file mode 100644 index 0000000000000..f5bbfdea0c843 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/rbac/v1beta1/roles.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/rbac/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f RoleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f RoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.Role{}, f.defaultInformer) +} + +func (f RoleInformer) Lister() rbacv1beta1listers.RoleLister { + return v1beta1.NewRoleClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/scheduling/interface.go b/staging/src/k8s.io/client-go/kcp/informers/scheduling/interface.go new file mode 100644 index 0000000000000..7ef19763b43af --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/scheduling/interface.go @@ -0,0 +1,55 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package scheduling + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/scheduling/v1" + v1alpha1 "k8s.io/client-go/kcp/informers/scheduling/v1alpha1" + v1beta1 "k8s.io/client-go/kcp/informers/scheduling/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g Interface) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/interface.go new file mode 100644 index 0000000000000..3961dcb5b0e48 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/scheduling/v1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v Interface) PriorityClasses() upstreaminformers.PriorityClassInformer { + return &PriorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/priorityclasses.go b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/priorityclasses.go new file mode 100644 index 0000000000000..5b5b24d43f954 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1/priorityclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + schedulingv1 "k8s.io/api/scheduling/v1" + v1 "k8s.io/client-go/kcp/listers/scheduling/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + schedulingv1listers "k8s.io/client-go/listers/scheduling/v1" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f PriorityClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PriorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1.PriorityClass{}, f.defaultInformer) +} + +func (f PriorityClassInformer) Lister() schedulingv1listers.PriorityClassLister { + return v1.NewPriorityClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/interface.go new file mode 100644 index 0000000000000..b771bd52232ae --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/scheduling/v1alpha1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v Interface) PriorityClasses() upstreaminformers.PriorityClassInformer { + return &PriorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/priorityclasses.go b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/priorityclasses.go new file mode 100644 index 0000000000000..6f81fcb9fa5c3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1alpha1/priorityclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + v1alpha1 "k8s.io/client-go/kcp/listers/scheduling/v1alpha1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + schedulingv1alpha1listers "k8s.io/client-go/listers/scheduling/v1alpha1" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1alpha1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f PriorityClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PriorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1alpha1.PriorityClass{}, f.defaultInformer) +} + +func (f PriorityClassInformer) Lister() schedulingv1alpha1listers.PriorityClassLister { + return v1alpha1.NewPriorityClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/interface.go new file mode 100644 index 0000000000000..c7e0f0683cd2e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/interface.go @@ -0,0 +1,43 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/scheduling/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v Interface) PriorityClasses() upstreaminformers.PriorityClassInformer { + return &PriorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/priorityclasses.go b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/priorityclasses.go new file mode 100644 index 0000000000000..7cd0e015d3542 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/scheduling/v1beta1/priorityclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/scheduling/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + schedulingv1beta1listers "k8s.io/client-go/listers/scheduling/v1beta1" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1beta1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f PriorityClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f PriorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1beta1.PriorityClass{}, f.defaultInformer) +} + +func (f PriorityClassInformer) Lister() schedulingv1beta1listers.PriorityClassLister { + return v1beta1.NewPriorityClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/interface.go b/staging/src/k8s.io/client-go/kcp/informers/storage/interface.go new file mode 100644 index 0000000000000..8cee143a55dea --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/interface.go @@ -0,0 +1,49 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package storage + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/kcp/informers/storage/v1" + v1beta1 "k8s.io/client-go/kcp/informers/storage/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g Interface) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g Interface) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csidrivers.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csidrivers.go new file mode 100644 index 0000000000000..f28493fb1edd1 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csidrivers.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1 "k8s.io/api/storage/v1" + v1 "k8s.io/client-go/kcp/listers/storage/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1listers "k8s.io/client-go/listers/storage/v1" +) + +// CSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers. +type CSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIDriverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().Watch(context.TODO(), options) + }, + }, + &storagev1.CSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f CSIDriverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSIDriver{}, f.defaultInformer) +} + +func (f CSIDriverInformer) Lister() storagev1listers.CSIDriverLister { + return v1.NewCSIDriverClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csinodes.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csinodes.go new file mode 100644 index 0000000000000..49f837559b8f2 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csinodes.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1 "k8s.io/api/storage/v1" + v1 "k8s.io/client-go/kcp/listers/storage/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1listers "k8s.io/client-go/listers/storage/v1" +) + +// CSINodeInformer provides access to a shared informer and lister for +// CSINodes. +type CSINodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSINodeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().Watch(context.TODO(), options) + }, + }, + &storagev1.CSINode{}, + resyncPeriod, + indexers, + ) +} + +func (f CSINodeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CSINodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSINode{}, f.defaultInformer) +} + +func (f CSINodeInformer) Lister() storagev1listers.CSINodeLister { + return v1.NewCSINodeClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csistoragecapacities.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csistoragecapacities.go new file mode 100644 index 0000000000000..b4826b50ab32d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/csistoragecapacities.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1 "k8s.io/api/storage/v1" + v1 "k8s.io/client-go/kcp/listers/storage/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1listers "k8s.io/client-go/listers/storage/v1" +) + +// CSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities. +type CSIStorageCapacityInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIStorageCapacityInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIStorageCapacities(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) + }, + }, + &storagev1.CSIStorageCapacity{}, + resyncPeriod, + indexers, + ) +} + +func (f CSIStorageCapacityInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f CSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSIStorageCapacity{}, f.defaultInformer) +} + +func (f CSIStorageCapacityInformer) Lister() storagev1listers.CSIStorageCapacityLister { + return v1.NewCSIStorageCapacityClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/interface.go new file mode 100644 index 0000000000000..3d9ea026d1ff3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/interface.go @@ -0,0 +1,63 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/storage/v1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIDrivers returns a CSIDriverInformer. +func (v Interface) CSIDrivers() upstreaminformers.CSIDriverInformer { + return &CSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSINodes returns a CSINodeInformer. +func (v Interface) CSINodes() upstreaminformers.CSINodeInformer { + return &CSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSIStorageCapacities returns a CSIStorageCapacityInformer. +func (v Interface) CSIStorageCapacities() upstreaminformers.CSIStorageCapacityInformer { + return &CSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StorageClasses returns a StorageClassInformer. +func (v Interface) StorageClasses() upstreaminformers.StorageClassInformer { + return &StorageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v Interface) VolumeAttachments() upstreaminformers.VolumeAttachmentInformer { + return &VolumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1/storageclasses.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/storageclasses.go new file mode 100644 index 0000000000000..df15ec6da6f5b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/storageclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1 "k8s.io/api/storage/v1" + v1 "k8s.io/client-go/kcp/listers/storage/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1listers "k8s.io/client-go/listers/storage/v1" +) + +// StorageClassInformer provides access to a shared informer and lister for +// StorageClasses. +type StorageClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().Watch(context.TODO(), options) + }, + }, + &storagev1.StorageClass{}, + resyncPeriod, + indexers, + ) +} + +func (f StorageClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f StorageClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.StorageClass{}, f.defaultInformer) +} + +func (f StorageClassInformer) Lister() storagev1listers.StorageClassLister { + return v1.NewStorageClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1/volumeattachments.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/volumeattachments.go new file mode 100644 index 0000000000000..73d82dfb091fc --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1/volumeattachments.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1 "k8s.io/api/storage/v1" + v1 "k8s.io/client-go/kcp/listers/storage/v1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1listers "k8s.io/client-go/listers/storage/v1" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f VolumeAttachmentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f VolumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.VolumeAttachment{}, f.defaultInformer) +} + +func (f VolumeAttachmentInformer) Lister() storagev1listers.VolumeAttachmentLister { + return v1.NewVolumeAttachmentClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csidrivers.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csidrivers.go new file mode 100644 index 0000000000000..6e49264761ab2 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csidrivers.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/storage/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" +) + +// CSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers. +type CSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIDriverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIDrivers().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIDrivers().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f CSIDriverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSIDriver{}, f.defaultInformer) +} + +func (f CSIDriverInformer) Lister() storagev1beta1listers.CSIDriverLister { + return v1beta1.NewCSIDriverClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csinodes.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csinodes.go new file mode 100644 index 0000000000000..b58a9ef250d40 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csinodes.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/storage/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" +) + +// CSINodeInformer provides access to a shared informer and lister for +// CSINodes. +type CSINodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSINodeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSINodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSINodes().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSINode{}, + resyncPeriod, + indexers, + ) +} + +func (f CSINodeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f CSINodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSINode{}, f.defaultInformer) +} + +func (f CSINodeInformer) Lister() storagev1beta1listers.CSINodeLister { + return v1beta1.NewCSINodeClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csistoragecapacities.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csistoragecapacities.go new file mode 100644 index 0000000000000..23649ad871b53 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/csistoragecapacities.go @@ -0,0 +1,101 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/storage/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" +) + +// CSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities. +type CSIStorageCapacityInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIStorageCapacityInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIStorageCapacities(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSIStorageCapacity{}, + resyncPeriod, + indexers, + ) +} + +func (f CSIStorageCapacityInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer( + client, + f.namespace, resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f CSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSIStorageCapacity{}, f.defaultInformer) +} + +func (f CSIStorageCapacityInformer) Lister() storagev1beta1listers.CSIStorageCapacityLister { + return v1beta1.NewCSIStorageCapacityClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/interface.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/interface.go new file mode 100644 index 0000000000000..6b574e391d17d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/interface.go @@ -0,0 +1,63 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + upstreaminformers "k8s.io/client-go/informers/storage/v1beta1" +) + +type Interface struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return Interface{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIDrivers returns a CSIDriverInformer. +func (v Interface) CSIDrivers() upstreaminformers.CSIDriverInformer { + return &CSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSINodes returns a CSINodeInformer. +func (v Interface) CSINodes() upstreaminformers.CSINodeInformer { + return &CSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSIStorageCapacities returns a CSIStorageCapacityInformer. +func (v Interface) CSIStorageCapacities() upstreaminformers.CSIStorageCapacityInformer { + return &CSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StorageClasses returns a StorageClassInformer. +func (v Interface) StorageClasses() upstreaminformers.StorageClassInformer { + return &StorageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v Interface) VolumeAttachments() upstreaminformers.VolumeAttachmentInformer { + return &VolumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/storageclasses.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/storageclasses.go new file mode 100644 index 0000000000000..7e0661f5cc2f8 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/storageclasses.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/storage/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" +) + +// StorageClassInformer provides access to a shared informer and lister for +// StorageClasses. +type StorageClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().StorageClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().StorageClasses().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.StorageClass{}, + resyncPeriod, + indexers, + ) +} + +func (f StorageClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f StorageClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.StorageClass{}, f.defaultInformer) +} + +func (f StorageClassInformer) Lister() storagev1beta1listers.StorageClassLister { + return v1beta1.NewStorageClassClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/volumeattachments.go b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/volumeattachments.go new file mode 100644 index 0000000000000..cc3194ee15b8c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/informers/storage/v1beta1/volumeattachments.go @@ -0,0 +1,100 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/third_party/informers" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1beta1 "k8s.io/client-go/kcp/listers/storage/v1beta1" + versioned "k8s.io/client-go/kubernetes" + + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f VolumeAttachmentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer( + client, + resyncPeriod, + cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + }, + f.tweakListOptions, + ) +} + +func (f VolumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.VolumeAttachment{}, f.defaultInformer) +} + +func (f VolumeAttachmentInformer) Lister() storagev1beta1listers.VolumeAttachmentLister { + return v1beta1.NewVolumeAttachmentClusterLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/mutatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 0000000000000..8bd1435364c9b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + admissionregistrationv1listers "k8s.io/client-go/listers/admissionregistration/v1" + "k8s.io/client-go/tools/cache" +) + +var _ admissionregistrationv1listers.MutatingWebhookConfigurationLister = &MutatingWebhookConfigurationClusterLister{} + +// MutatingWebhookConfigurationClusterLister implements the admissionregistrationv1listers.MutatingWebhookConfigurationLister interface. +type MutatingWebhookConfigurationClusterLister struct { + indexer cache.Indexer +} + +// NewMutatingWebhookConfigurationClusterLister returns a new MutatingWebhookConfigurationClusterLister. +func NewMutatingWebhookConfigurationClusterLister(indexer cache.Indexer) admissionregistrationv1listers.MutatingWebhookConfigurationLister { + return &MutatingWebhookConfigurationClusterLister{indexer: indexer} +} + +// List lists all admissionregistrationv1.MutatingWebhookConfiguration in the indexer. +func (s MutatingWebhookConfigurationClusterLister) List(selector labels.Selector) (ret []*admissionregistrationv1.MutatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*admissionregistrationv1.MutatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the admissionregistrationv1.MutatingWebhookConfiguration from the indexer for a given name. +func (s MutatingWebhookConfigurationClusterLister) Get(name string) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get admissionregistrationv1.MutatingWebhookConfiguration. + +func (s MutatingWebhookConfigurationClusterLister) Cluster(cluster logicalcluster.Name) admissionregistrationv1listers.MutatingWebhookConfigurationLister { + return &MutatingWebhookConfigurationLister{indexer: s.indexer, cluster: cluster} +} + +// MutatingWebhookConfigurationLister implements the admissionregistrationv1listers.MutatingWebhookConfigurationLister interface. +type MutatingWebhookConfigurationLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all admissionregistrationv1.MutatingWebhookConfiguration in the indexer. +func (s MutatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*admissionregistrationv1.MutatingWebhookConfiguration, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*admissionregistrationv1.MutatingWebhookConfiguration) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the admissionregistrationv1.MutatingWebhookConfiguration from the indexer for a given name. +func (s MutatingWebhookConfigurationLister) Get(name string) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(admissionregistrationv1.Resource("MutatingWebhookConfiguration"), name) + } + return obj.(*admissionregistrationv1.MutatingWebhookConfiguration), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/validatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 0000000000000..fb0d90d285173 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + admissionregistrationv1listers "k8s.io/client-go/listers/admissionregistration/v1" + "k8s.io/client-go/tools/cache" +) + +var _ admissionregistrationv1listers.ValidatingWebhookConfigurationLister = &ValidatingWebhookConfigurationClusterLister{} + +// ValidatingWebhookConfigurationClusterLister implements the admissionregistrationv1listers.ValidatingWebhookConfigurationLister interface. +type ValidatingWebhookConfigurationClusterLister struct { + indexer cache.Indexer +} + +// NewValidatingWebhookConfigurationClusterLister returns a new ValidatingWebhookConfigurationClusterLister. +func NewValidatingWebhookConfigurationClusterLister(indexer cache.Indexer) admissionregistrationv1listers.ValidatingWebhookConfigurationLister { + return &ValidatingWebhookConfigurationClusterLister{indexer: indexer} +} + +// List lists all admissionregistrationv1.ValidatingWebhookConfiguration in the indexer. +func (s ValidatingWebhookConfigurationClusterLister) List(selector labels.Selector) (ret []*admissionregistrationv1.ValidatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*admissionregistrationv1.ValidatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the admissionregistrationv1.ValidatingWebhookConfiguration from the indexer for a given name. +func (s ValidatingWebhookConfigurationClusterLister) Get(name string) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get admissionregistrationv1.ValidatingWebhookConfiguration. + +func (s ValidatingWebhookConfigurationClusterLister) Cluster(cluster logicalcluster.Name) admissionregistrationv1listers.ValidatingWebhookConfigurationLister { + return &ValidatingWebhookConfigurationLister{indexer: s.indexer, cluster: cluster} +} + +// ValidatingWebhookConfigurationLister implements the admissionregistrationv1listers.ValidatingWebhookConfigurationLister interface. +type ValidatingWebhookConfigurationLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all admissionregistrationv1.ValidatingWebhookConfiguration in the indexer. +func (s ValidatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*admissionregistrationv1.ValidatingWebhookConfiguration, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*admissionregistrationv1.ValidatingWebhookConfiguration) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the admissionregistrationv1.ValidatingWebhookConfiguration from the indexer for a given name. +func (s ValidatingWebhookConfigurationLister) Get(name string) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(admissionregistrationv1.Resource("ValidatingWebhookConfiguration"), name) + } + return obj.(*admissionregistrationv1.ValidatingWebhookConfiguration), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go new file mode 100644 index 0000000000000..c67803343941d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + admissionregistrationv1beta1listers "k8s.io/client-go/listers/admissionregistration/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ admissionregistrationv1beta1listers.MutatingWebhookConfigurationLister = &MutatingWebhookConfigurationClusterLister{} + +// MutatingWebhookConfigurationClusterLister implements the admissionregistrationv1beta1listers.MutatingWebhookConfigurationLister interface. +type MutatingWebhookConfigurationClusterLister struct { + indexer cache.Indexer +} + +// NewMutatingWebhookConfigurationClusterLister returns a new MutatingWebhookConfigurationClusterLister. +func NewMutatingWebhookConfigurationClusterLister(indexer cache.Indexer) admissionregistrationv1beta1listers.MutatingWebhookConfigurationLister { + return &MutatingWebhookConfigurationClusterLister{indexer: indexer} +} + +// List lists all admissionregistrationv1beta1.MutatingWebhookConfiguration in the indexer. +func (s MutatingWebhookConfigurationClusterLister) List(selector labels.Selector) (ret []*admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*admissionregistrationv1beta1.MutatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the admissionregistrationv1beta1.MutatingWebhookConfiguration from the indexer for a given name. +func (s MutatingWebhookConfigurationClusterLister) Get(name string) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get admissionregistrationv1beta1.MutatingWebhookConfiguration. + +func (s MutatingWebhookConfigurationClusterLister) Cluster(cluster logicalcluster.Name) admissionregistrationv1beta1listers.MutatingWebhookConfigurationLister { + return &MutatingWebhookConfigurationLister{indexer: s.indexer, cluster: cluster} +} + +// MutatingWebhookConfigurationLister implements the admissionregistrationv1beta1listers.MutatingWebhookConfigurationLister interface. +type MutatingWebhookConfigurationLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all admissionregistrationv1beta1.MutatingWebhookConfiguration in the indexer. +func (s MutatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*admissionregistrationv1beta1.MutatingWebhookConfiguration) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the admissionregistrationv1beta1.MutatingWebhookConfiguration from the indexer for a given name. +func (s MutatingWebhookConfigurationLister) Get(name string) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(admissionregistrationv1beta1.Resource("MutatingWebhookConfiguration"), name) + } + return obj.(*admissionregistrationv1beta1.MutatingWebhookConfiguration), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go new file mode 100644 index 0000000000000..5ba3bbe0a8ece --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + admissionregistrationv1beta1listers "k8s.io/client-go/listers/admissionregistration/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ admissionregistrationv1beta1listers.ValidatingWebhookConfigurationLister = &ValidatingWebhookConfigurationClusterLister{} + +// ValidatingWebhookConfigurationClusterLister implements the admissionregistrationv1beta1listers.ValidatingWebhookConfigurationLister interface. +type ValidatingWebhookConfigurationClusterLister struct { + indexer cache.Indexer +} + +// NewValidatingWebhookConfigurationClusterLister returns a new ValidatingWebhookConfigurationClusterLister. +func NewValidatingWebhookConfigurationClusterLister(indexer cache.Indexer) admissionregistrationv1beta1listers.ValidatingWebhookConfigurationLister { + return &ValidatingWebhookConfigurationClusterLister{indexer: indexer} +} + +// List lists all admissionregistrationv1beta1.ValidatingWebhookConfiguration in the indexer. +func (s ValidatingWebhookConfigurationClusterLister) List(selector labels.Selector) (ret []*admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*admissionregistrationv1beta1.ValidatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the admissionregistrationv1beta1.ValidatingWebhookConfiguration from the indexer for a given name. +func (s ValidatingWebhookConfigurationClusterLister) Get(name string) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get admissionregistrationv1beta1.ValidatingWebhookConfiguration. + +func (s ValidatingWebhookConfigurationClusterLister) Cluster(cluster logicalcluster.Name) admissionregistrationv1beta1listers.ValidatingWebhookConfigurationLister { + return &ValidatingWebhookConfigurationLister{indexer: s.indexer, cluster: cluster} +} + +// ValidatingWebhookConfigurationLister implements the admissionregistrationv1beta1listers.ValidatingWebhookConfigurationLister interface. +type ValidatingWebhookConfigurationLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all admissionregistrationv1beta1.ValidatingWebhookConfiguration in the indexer. +func (s ValidatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*admissionregistrationv1beta1.ValidatingWebhookConfiguration) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the admissionregistrationv1beta1.ValidatingWebhookConfiguration from the indexer for a given name. +func (s ValidatingWebhookConfigurationLister) Get(name string) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(admissionregistrationv1beta1.Resource("ValidatingWebhookConfiguration"), name) + } + return obj.(*admissionregistrationv1beta1.ValidatingWebhookConfiguration), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apiserverinternal/v1alpha1/storageversion.go b/staging/src/k8s.io/client-go/kcp/listers/apiserverinternal/v1alpha1/storageversion.go new file mode 100644 index 0000000000000..c72db877a8a79 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apiserverinternal/v1alpha1/storageversion.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + apiserverinternalv1alpha1listers "k8s.io/client-go/listers/apiserverinternal/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ apiserverinternalv1alpha1listers.StorageVersionLister = &StorageVersionClusterLister{} + +// StorageVersionClusterLister implements the apiserverinternalv1alpha1listers.StorageVersionLister interface. +type StorageVersionClusterLister struct { + indexer cache.Indexer +} + +// NewStorageVersionClusterLister returns a new StorageVersionClusterLister. +func NewStorageVersionClusterLister(indexer cache.Indexer) apiserverinternalv1alpha1listers.StorageVersionLister { + return &StorageVersionClusterLister{indexer: indexer} +} + +// List lists all apiserverinternalv1alpha1.StorageVersion in the indexer. +func (s StorageVersionClusterLister) List(selector labels.Selector) (ret []*apiserverinternalv1alpha1.StorageVersion, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*apiserverinternalv1alpha1.StorageVersion)) + }) + return ret, err +} + +// Get retrieves the apiserverinternalv1alpha1.StorageVersion from the indexer for a given name. +func (s StorageVersionClusterLister) Get(name string) (*apiserverinternalv1alpha1.StorageVersion, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get apiserverinternalv1alpha1.StorageVersion. + +func (s StorageVersionClusterLister) Cluster(cluster logicalcluster.Name) apiserverinternalv1alpha1listers.StorageVersionLister { + return &StorageVersionLister{indexer: s.indexer, cluster: cluster} +} + +// StorageVersionLister implements the apiserverinternalv1alpha1listers.StorageVersionLister interface. +type StorageVersionLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all apiserverinternalv1alpha1.StorageVersion in the indexer. +func (s StorageVersionLister) List(selector labels.Selector) (ret []*apiserverinternalv1alpha1.StorageVersion, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*apiserverinternalv1alpha1.StorageVersion) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the apiserverinternalv1alpha1.StorageVersion from the indexer for a given name. +func (s StorageVersionLister) Get(name string) (*apiserverinternalv1alpha1.StorageVersion, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(apiserverinternalv1alpha1.Resource("StorageVersion"), name) + } + return obj.(*apiserverinternalv1alpha1.StorageVersion), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/controllerrevision.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/controllerrevision.go new file mode 100644 index 0000000000000..bdd61016aeafa --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/controllerrevision.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1listers "k8s.io/client-go/listers/apps/v1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1listers.ControllerRevisionLister = &ControllerRevisionClusterLister{} + +// ControllerRevisionClusterLister implements the appsv1listers.ControllerRevisionLister interface. +type ControllerRevisionClusterLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionClusterLister returns a new ControllerRevisionClusterLister. +func NewControllerRevisionClusterLister(indexer cache.Indexer) appsv1listers.ControllerRevisionLister { + return &ControllerRevisionClusterLister{indexer: indexer} +} + +// List lists all appsv1.ControllerRevision in the indexer. +func (s ControllerRevisionClusterLister) List(selector labels.Selector) (ret []*appsv1.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get appsv1.ControllerRevision. +func (s ControllerRevisionClusterLister) ControllerRevisions(namespace string) appsv1listers.ControllerRevisionNamespaceLister { + panic("Calling 'ControllerRevisions' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1.ControllerRevision. + +func (s ControllerRevisionClusterLister) Cluster(cluster logicalcluster.Name) appsv1listers.ControllerRevisionLister { + return &ControllerRevisionLister{indexer: s.indexer, cluster: cluster} +} + +// ControllerRevisionLister implements the appsv1listers.ControllerRevisionLister interface. +type ControllerRevisionLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1.ControllerRevision in the indexer. +func (s ControllerRevisionLister) List(selector labels.Selector) (ret []*appsv1.ControllerRevision, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.ControllerRevision) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ControllerRevisions returns an object that can list and get appsv1.ControllerRevision. +func (s ControllerRevisionLister) ControllerRevisions(namespace string) appsv1listers.ControllerRevisionNamespaceLister { + return &ControllerRevisionNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ControllerRevisionNamespaceLister implements the appsv1listers.ControllerRevisionNamespaceLister interface. +type ControllerRevisionNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1.ControllerRevision in the indexer for a given namespace. +func (s ControllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*appsv1.ControllerRevision, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.ControllerRevision) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1.ControllerRevision from the indexer for a given namespace and name. +func (s ControllerRevisionNamespaceLister) Get(name string) (*appsv1.ControllerRevision, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1.Resource("ControllerRevision"), name) + } + return obj.(*appsv1.ControllerRevision), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset.go new file mode 100644 index 0000000000000..a0476c66042eb --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1listers "k8s.io/client-go/listers/apps/v1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1listers.DaemonSetLister = &DaemonSetClusterLister{} + +// DaemonSetClusterLister implements the appsv1listers.DaemonSetLister interface. +type DaemonSetClusterLister struct { + indexer cache.Indexer +} + +// NewDaemonSetClusterLister returns a new DaemonSetClusterLister. +func NewDaemonSetClusterLister(indexer cache.Indexer) appsv1listers.DaemonSetLister { + return &DaemonSetClusterLister{indexer: indexer} +} + +// List lists all appsv1.DaemonSet in the indexer. +func (s DaemonSetClusterLister) List(selector labels.Selector) (ret []*appsv1.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get appsv1.DaemonSet. +func (s DaemonSetClusterLister) DaemonSets(namespace string) appsv1listers.DaemonSetNamespaceLister { + panic("Calling 'DaemonSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1.DaemonSet. + +func (s DaemonSetClusterLister) Cluster(cluster logicalcluster.Name) appsv1listers.DaemonSetLister { + return &DaemonSetLister{indexer: s.indexer, cluster: cluster} +} + +// DaemonSetLister implements the appsv1listers.DaemonSetLister interface. +type DaemonSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1.DaemonSet in the indexer. +func (s DaemonSetLister) List(selector labels.Selector) (ret []*appsv1.DaemonSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.DaemonSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// DaemonSets returns an object that can list and get appsv1.DaemonSet. +func (s DaemonSetLister) DaemonSets(namespace string) appsv1listers.DaemonSetNamespaceLister { + return &DaemonSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// DaemonSetNamespaceLister implements the appsv1listers.DaemonSetNamespaceLister interface. +type DaemonSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1.DaemonSet in the indexer for a given namespace. +func (s DaemonSetNamespaceLister) List(selector labels.Selector) (ret []*appsv1.DaemonSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.DaemonSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1.DaemonSet from the indexer for a given namespace and name. +func (s DaemonSetNamespaceLister) Get(name string) (*appsv1.DaemonSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1.Resource("DaemonSet"), name) + } + return obj.(*appsv1.DaemonSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset_expansion.go new file mode 100644 index 0000000000000..20d2507e94f37 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/daemonset_expansion.go @@ -0,0 +1,111 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *DaemonSetClusterLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + panic("Calling 'GetPodDaemonSets' is not supported before scoping lister to a workspace") +} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *DaemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + var selector labels.Selector + var daemonSet *apps.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +func (s *DaemonSetClusterLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + panic("Calling 'GetHistoryDaemonSets' is not supported before scoping lister to a workspace") +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *DaemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the history + continue + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/deployment.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/deployment.go new file mode 100644 index 0000000000000..515f09e2ed570 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/deployment.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1listers "k8s.io/client-go/listers/apps/v1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1listers.DeploymentLister = &DeploymentClusterLister{} + +// DeploymentClusterLister implements the appsv1listers.DeploymentLister interface. +type DeploymentClusterLister struct { + indexer cache.Indexer +} + +// NewDeploymentClusterLister returns a new DeploymentClusterLister. +func NewDeploymentClusterLister(indexer cache.Indexer) appsv1listers.DeploymentLister { + return &DeploymentClusterLister{indexer: indexer} +} + +// List lists all appsv1.Deployment in the indexer. +func (s DeploymentClusterLister) List(selector labels.Selector) (ret []*appsv1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get appsv1.Deployment. +func (s DeploymentClusterLister) Deployments(namespace string) appsv1listers.DeploymentNamespaceLister { + panic("Calling 'Deployments' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1.Deployment. + +func (s DeploymentClusterLister) Cluster(cluster logicalcluster.Name) appsv1listers.DeploymentLister { + return &DeploymentLister{indexer: s.indexer, cluster: cluster} +} + +// DeploymentLister implements the appsv1listers.DeploymentLister interface. +type DeploymentLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1.Deployment in the indexer. +func (s DeploymentLister) List(selector labels.Selector) (ret []*appsv1.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Deployments returns an object that can list and get appsv1.Deployment. +func (s DeploymentLister) Deployments(namespace string) appsv1listers.DeploymentNamespaceLister { + return &DeploymentNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// DeploymentNamespaceLister implements the appsv1listers.DeploymentNamespaceLister interface. +type DeploymentNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1.Deployment in the indexer for a given namespace. +func (s DeploymentNamespaceLister) List(selector labels.Selector) (ret []*appsv1.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1.Deployment from the indexer for a given namespace and name. +func (s DeploymentNamespaceLister) Get(name string) (*appsv1.Deployment, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1.Resource("Deployment"), name) + } + return obj.(*appsv1.Deployment), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset.go new file mode 100644 index 0000000000000..310c7befeef3f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1listers "k8s.io/client-go/listers/apps/v1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1listers.ReplicaSetLister = &ReplicaSetClusterLister{} + +// ReplicaSetClusterLister implements the appsv1listers.ReplicaSetLister interface. +type ReplicaSetClusterLister struct { + indexer cache.Indexer +} + +// NewReplicaSetClusterLister returns a new ReplicaSetClusterLister. +func NewReplicaSetClusterLister(indexer cache.Indexer) appsv1listers.ReplicaSetLister { + return &ReplicaSetClusterLister{indexer: indexer} +} + +// List lists all appsv1.ReplicaSet in the indexer. +func (s ReplicaSetClusterLister) List(selector labels.Selector) (ret []*appsv1.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get appsv1.ReplicaSet. +func (s ReplicaSetClusterLister) ReplicaSets(namespace string) appsv1listers.ReplicaSetNamespaceLister { + panic("Calling 'ReplicaSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1.ReplicaSet. + +func (s ReplicaSetClusterLister) Cluster(cluster logicalcluster.Name) appsv1listers.ReplicaSetLister { + return &ReplicaSetLister{indexer: s.indexer, cluster: cluster} +} + +// ReplicaSetLister implements the appsv1listers.ReplicaSetLister interface. +type ReplicaSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1.ReplicaSet in the indexer. +func (s ReplicaSetLister) List(selector labels.Selector) (ret []*appsv1.ReplicaSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.ReplicaSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ReplicaSets returns an object that can list and get appsv1.ReplicaSet. +func (s ReplicaSetLister) ReplicaSets(namespace string) appsv1listers.ReplicaSetNamespaceLister { + return &ReplicaSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ReplicaSetNamespaceLister implements the appsv1listers.ReplicaSetNamespaceLister interface. +type ReplicaSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1.ReplicaSet in the indexer for a given namespace. +func (s ReplicaSetNamespaceLister) List(selector labels.Selector) (ret []*appsv1.ReplicaSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.ReplicaSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1.ReplicaSet from the indexer for a given namespace and name. +func (s ReplicaSetNamespaceLister) Get(name string) (*appsv1.ReplicaSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1.Resource("ReplicaSet"), name) + } + return obj.(*appsv1.ReplicaSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset_expansion.go new file mode 100644 index 0000000000000..bad3608145351 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/replicaset_expansion.go @@ -0,0 +1,68 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *ReplicaSetClusterLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + panic("Calling 'GetPodReplicaSets' is not supported before scoping lister to a workspace") +} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *ReplicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*apps.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset.go new file mode 100644 index 0000000000000..ce7c61ead61dc --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1listers "k8s.io/client-go/listers/apps/v1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1listers.StatefulSetLister = &StatefulSetClusterLister{} + +// StatefulSetClusterLister implements the appsv1listers.StatefulSetLister interface. +type StatefulSetClusterLister struct { + indexer cache.Indexer +} + +// NewStatefulSetClusterLister returns a new StatefulSetClusterLister. +func NewStatefulSetClusterLister(indexer cache.Indexer) appsv1listers.StatefulSetLister { + return &StatefulSetClusterLister{indexer: indexer} +} + +// List lists all appsv1.StatefulSet in the indexer. +func (s StatefulSetClusterLister) List(selector labels.Selector) (ret []*appsv1.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get appsv1.StatefulSet. +func (s StatefulSetClusterLister) StatefulSets(namespace string) appsv1listers.StatefulSetNamespaceLister { + panic("Calling 'StatefulSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1.StatefulSet. + +func (s StatefulSetClusterLister) Cluster(cluster logicalcluster.Name) appsv1listers.StatefulSetLister { + return &StatefulSetLister{indexer: s.indexer, cluster: cluster} +} + +// StatefulSetLister implements the appsv1listers.StatefulSetLister interface. +type StatefulSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1.StatefulSet in the indexer. +func (s StatefulSetLister) List(selector labels.Selector) (ret []*appsv1.StatefulSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.StatefulSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// StatefulSets returns an object that can list and get appsv1.StatefulSet. +func (s StatefulSetLister) StatefulSets(namespace string) appsv1listers.StatefulSetNamespaceLister { + return &StatefulSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// StatefulSetNamespaceLister implements the appsv1listers.StatefulSetNamespaceLister interface. +type StatefulSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1.StatefulSet in the indexer for a given namespace. +func (s StatefulSetNamespaceLister) List(selector labels.Selector) (ret []*appsv1.StatefulSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1.StatefulSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1.StatefulSet from the indexer for a given namespace and name. +func (s StatefulSetNamespaceLister) Get(name string) (*appsv1.StatefulSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1.Resource("StatefulSet"), name) + } + return obj.(*appsv1.StatefulSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset_expansion.go new file mode 100644 index 0000000000000..bee1ffdf5cd34 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1/statefulset_expansion.go @@ -0,0 +1,72 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *StatefulSetClusterLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("Calling 'GetPodStatefulSets' is not supported before scoping lister to a workspace") +} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *StatefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/controllerrevision.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/controllerrevision.go new file mode 100644 index 0000000000000..fe6278b7da765 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/controllerrevision.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta1listers "k8s.io/client-go/listers/apps/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta1listers.ControllerRevisionLister = &ControllerRevisionClusterLister{} + +// ControllerRevisionClusterLister implements the appsv1beta1listers.ControllerRevisionLister interface. +type ControllerRevisionClusterLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionClusterLister returns a new ControllerRevisionClusterLister. +func NewControllerRevisionClusterLister(indexer cache.Indexer) appsv1beta1listers.ControllerRevisionLister { + return &ControllerRevisionClusterLister{indexer: indexer} +} + +// List lists all appsv1beta1.ControllerRevision in the indexer. +func (s ControllerRevisionClusterLister) List(selector labels.Selector) (ret []*appsv1beta1.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta1.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get appsv1beta1.ControllerRevision. +func (s ControllerRevisionClusterLister) ControllerRevisions(namespace string) appsv1beta1listers.ControllerRevisionNamespaceLister { + panic("Calling 'ControllerRevisions' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta1.ControllerRevision. + +func (s ControllerRevisionClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta1listers.ControllerRevisionLister { + return &ControllerRevisionLister{indexer: s.indexer, cluster: cluster} +} + +// ControllerRevisionLister implements the appsv1beta1listers.ControllerRevisionLister interface. +type ControllerRevisionLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta1.ControllerRevision in the indexer. +func (s ControllerRevisionLister) List(selector labels.Selector) (ret []*appsv1beta1.ControllerRevision, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta1.ControllerRevision) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ControllerRevisions returns an object that can list and get appsv1beta1.ControllerRevision. +func (s ControllerRevisionLister) ControllerRevisions(namespace string) appsv1beta1listers.ControllerRevisionNamespaceLister { + return &ControllerRevisionNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ControllerRevisionNamespaceLister implements the appsv1beta1listers.ControllerRevisionNamespaceLister interface. +type ControllerRevisionNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta1.ControllerRevision in the indexer for a given namespace. +func (s ControllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta1.ControllerRevision, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta1.ControllerRevision) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta1.ControllerRevision from the indexer for a given namespace and name. +func (s ControllerRevisionNamespaceLister) Get(name string) (*appsv1beta1.ControllerRevision, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta1.Resource("ControllerRevision"), name) + } + return obj.(*appsv1beta1.ControllerRevision), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/deployment.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/deployment.go new file mode 100644 index 0000000000000..adced65aeb77d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/deployment.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta1listers "k8s.io/client-go/listers/apps/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta1listers.DeploymentLister = &DeploymentClusterLister{} + +// DeploymentClusterLister implements the appsv1beta1listers.DeploymentLister interface. +type DeploymentClusterLister struct { + indexer cache.Indexer +} + +// NewDeploymentClusterLister returns a new DeploymentClusterLister. +func NewDeploymentClusterLister(indexer cache.Indexer) appsv1beta1listers.DeploymentLister { + return &DeploymentClusterLister{indexer: indexer} +} + +// List lists all appsv1beta1.Deployment in the indexer. +func (s DeploymentClusterLister) List(selector labels.Selector) (ret []*appsv1beta1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get appsv1beta1.Deployment. +func (s DeploymentClusterLister) Deployments(namespace string) appsv1beta1listers.DeploymentNamespaceLister { + panic("Calling 'Deployments' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta1.Deployment. + +func (s DeploymentClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta1listers.DeploymentLister { + return &DeploymentLister{indexer: s.indexer, cluster: cluster} +} + +// DeploymentLister implements the appsv1beta1listers.DeploymentLister interface. +type DeploymentLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta1.Deployment in the indexer. +func (s DeploymentLister) List(selector labels.Selector) (ret []*appsv1beta1.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta1.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Deployments returns an object that can list and get appsv1beta1.Deployment. +func (s DeploymentLister) Deployments(namespace string) appsv1beta1listers.DeploymentNamespaceLister { + return &DeploymentNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// DeploymentNamespaceLister implements the appsv1beta1listers.DeploymentNamespaceLister interface. +type DeploymentNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta1.Deployment in the indexer for a given namespace. +func (s DeploymentNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta1.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta1.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta1.Deployment from the indexer for a given namespace and name. +func (s DeploymentNamespaceLister) Get(name string) (*appsv1beta1.Deployment, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta1.Resource("Deployment"), name) + } + return obj.(*appsv1beta1.Deployment), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset.go new file mode 100644 index 0000000000000..9870d16c344b3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta1listers "k8s.io/client-go/listers/apps/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta1listers.StatefulSetLister = &StatefulSetClusterLister{} + +// StatefulSetClusterLister implements the appsv1beta1listers.StatefulSetLister interface. +type StatefulSetClusterLister struct { + indexer cache.Indexer +} + +// NewStatefulSetClusterLister returns a new StatefulSetClusterLister. +func NewStatefulSetClusterLister(indexer cache.Indexer) appsv1beta1listers.StatefulSetLister { + return &StatefulSetClusterLister{indexer: indexer} +} + +// List lists all appsv1beta1.StatefulSet in the indexer. +func (s StatefulSetClusterLister) List(selector labels.Selector) (ret []*appsv1beta1.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta1.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get appsv1beta1.StatefulSet. +func (s StatefulSetClusterLister) StatefulSets(namespace string) appsv1beta1listers.StatefulSetNamespaceLister { + panic("Calling 'StatefulSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta1.StatefulSet. + +func (s StatefulSetClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta1listers.StatefulSetLister { + return &StatefulSetLister{indexer: s.indexer, cluster: cluster} +} + +// StatefulSetLister implements the appsv1beta1listers.StatefulSetLister interface. +type StatefulSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta1.StatefulSet in the indexer. +func (s StatefulSetLister) List(selector labels.Selector) (ret []*appsv1beta1.StatefulSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta1.StatefulSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// StatefulSets returns an object that can list and get appsv1beta1.StatefulSet. +func (s StatefulSetLister) StatefulSets(namespace string) appsv1beta1listers.StatefulSetNamespaceLister { + return &StatefulSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// StatefulSetNamespaceLister implements the appsv1beta1listers.StatefulSetNamespaceLister interface. +type StatefulSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta1.StatefulSet in the indexer for a given namespace. +func (s StatefulSetNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta1.StatefulSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta1.StatefulSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta1.StatefulSet from the indexer for a given namespace and name. +func (s StatefulSetNamespaceLister) Get(name string) (*appsv1beta1.StatefulSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta1.Resource("StatefulSet"), name) + } + return obj.(*appsv1beta1.StatefulSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset_expansion.go new file mode 100644 index 0000000000000..ffb7344c248cf --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta1/statefulset_expansion.go @@ -0,0 +1,72 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *StatefulSetClusterLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("Calling 'GetPodStatefulSets' is not supported before scoping lister to a workspace") +} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *StatefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/controllerrevision.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/controllerrevision.go new file mode 100644 index 0000000000000..ff022c0954f3f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/controllerrevision.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta2listers.ControllerRevisionLister = &ControllerRevisionClusterLister{} + +// ControllerRevisionClusterLister implements the appsv1beta2listers.ControllerRevisionLister interface. +type ControllerRevisionClusterLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionClusterLister returns a new ControllerRevisionClusterLister. +func NewControllerRevisionClusterLister(indexer cache.Indexer) appsv1beta2listers.ControllerRevisionLister { + return &ControllerRevisionClusterLister{indexer: indexer} +} + +// List lists all appsv1beta2.ControllerRevision in the indexer. +func (s ControllerRevisionClusterLister) List(selector labels.Selector) (ret []*appsv1beta2.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta2.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get appsv1beta2.ControllerRevision. +func (s ControllerRevisionClusterLister) ControllerRevisions(namespace string) appsv1beta2listers.ControllerRevisionNamespaceLister { + panic("Calling 'ControllerRevisions' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta2.ControllerRevision. + +func (s ControllerRevisionClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta2listers.ControllerRevisionLister { + return &ControllerRevisionLister{indexer: s.indexer, cluster: cluster} +} + +// ControllerRevisionLister implements the appsv1beta2listers.ControllerRevisionLister interface. +type ControllerRevisionLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta2.ControllerRevision in the indexer. +func (s ControllerRevisionLister) List(selector labels.Selector) (ret []*appsv1beta2.ControllerRevision, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.ControllerRevision) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ControllerRevisions returns an object that can list and get appsv1beta2.ControllerRevision. +func (s ControllerRevisionLister) ControllerRevisions(namespace string) appsv1beta2listers.ControllerRevisionNamespaceLister { + return &ControllerRevisionNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ControllerRevisionNamespaceLister implements the appsv1beta2listers.ControllerRevisionNamespaceLister interface. +type ControllerRevisionNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta2.ControllerRevision in the indexer for a given namespace. +func (s ControllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta2.ControllerRevision, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.ControllerRevision) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta2.ControllerRevision from the indexer for a given namespace and name. +func (s ControllerRevisionNamespaceLister) Get(name string) (*appsv1beta2.ControllerRevision, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta2.Resource("ControllerRevision"), name) + } + return obj.(*appsv1beta2.ControllerRevision), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset.go new file mode 100644 index 0000000000000..3b50128a2cb92 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta2listers.DaemonSetLister = &DaemonSetClusterLister{} + +// DaemonSetClusterLister implements the appsv1beta2listers.DaemonSetLister interface. +type DaemonSetClusterLister struct { + indexer cache.Indexer +} + +// NewDaemonSetClusterLister returns a new DaemonSetClusterLister. +func NewDaemonSetClusterLister(indexer cache.Indexer) appsv1beta2listers.DaemonSetLister { + return &DaemonSetClusterLister{indexer: indexer} +} + +// List lists all appsv1beta2.DaemonSet in the indexer. +func (s DaemonSetClusterLister) List(selector labels.Selector) (ret []*appsv1beta2.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta2.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get appsv1beta2.DaemonSet. +func (s DaemonSetClusterLister) DaemonSets(namespace string) appsv1beta2listers.DaemonSetNamespaceLister { + panic("Calling 'DaemonSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta2.DaemonSet. + +func (s DaemonSetClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta2listers.DaemonSetLister { + return &DaemonSetLister{indexer: s.indexer, cluster: cluster} +} + +// DaemonSetLister implements the appsv1beta2listers.DaemonSetLister interface. +type DaemonSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta2.DaemonSet in the indexer. +func (s DaemonSetLister) List(selector labels.Selector) (ret []*appsv1beta2.DaemonSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.DaemonSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// DaemonSets returns an object that can list and get appsv1beta2.DaemonSet. +func (s DaemonSetLister) DaemonSets(namespace string) appsv1beta2listers.DaemonSetNamespaceLister { + return &DaemonSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// DaemonSetNamespaceLister implements the appsv1beta2listers.DaemonSetNamespaceLister interface. +type DaemonSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta2.DaemonSet in the indexer for a given namespace. +func (s DaemonSetNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta2.DaemonSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.DaemonSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta2.DaemonSet from the indexer for a given namespace and name. +func (s DaemonSetNamespaceLister) Get(name string) (*appsv1beta2.DaemonSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta2.Resource("DaemonSet"), name) + } + return obj.(*appsv1beta2.DaemonSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset_expansion.go new file mode 100644 index 0000000000000..ca2df6b5eb5a3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/daemonset_expansion.go @@ -0,0 +1,111 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *DaemonSetClusterLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + panic("Calling 'GetPodDaemonSets' is not supported before scoping lister to a workspace") +} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *DaemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + var selector labels.Selector + var daemonSet *apps.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +func (s *DaemonSetClusterLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + panic("Calling 'GetHistoryDaemonSets' is not supported before scoping lister to a workspace") +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *DaemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the history object + continue + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/deployment.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/deployment.go new file mode 100644 index 0000000000000..e2c79a3ae0b20 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/deployment.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta2listers.DeploymentLister = &DeploymentClusterLister{} + +// DeploymentClusterLister implements the appsv1beta2listers.DeploymentLister interface. +type DeploymentClusterLister struct { + indexer cache.Indexer +} + +// NewDeploymentClusterLister returns a new DeploymentClusterLister. +func NewDeploymentClusterLister(indexer cache.Indexer) appsv1beta2listers.DeploymentLister { + return &DeploymentClusterLister{indexer: indexer} +} + +// List lists all appsv1beta2.Deployment in the indexer. +func (s DeploymentClusterLister) List(selector labels.Selector) (ret []*appsv1beta2.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta2.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get appsv1beta2.Deployment. +func (s DeploymentClusterLister) Deployments(namespace string) appsv1beta2listers.DeploymentNamespaceLister { + panic("Calling 'Deployments' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta2.Deployment. + +func (s DeploymentClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta2listers.DeploymentLister { + return &DeploymentLister{indexer: s.indexer, cluster: cluster} +} + +// DeploymentLister implements the appsv1beta2listers.DeploymentLister interface. +type DeploymentLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta2.Deployment in the indexer. +func (s DeploymentLister) List(selector labels.Selector) (ret []*appsv1beta2.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Deployments returns an object that can list and get appsv1beta2.Deployment. +func (s DeploymentLister) Deployments(namespace string) appsv1beta2listers.DeploymentNamespaceLister { + return &DeploymentNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// DeploymentNamespaceLister implements the appsv1beta2listers.DeploymentNamespaceLister interface. +type DeploymentNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta2.Deployment in the indexer for a given namespace. +func (s DeploymentNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta2.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta2.Deployment from the indexer for a given namespace and name. +func (s DeploymentNamespaceLister) Get(name string) (*appsv1beta2.Deployment, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta2.Resource("Deployment"), name) + } + return obj.(*appsv1beta2.Deployment), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset.go new file mode 100644 index 0000000000000..9c9ba3d1f75cb --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta2listers.ReplicaSetLister = &ReplicaSetClusterLister{} + +// ReplicaSetClusterLister implements the appsv1beta2listers.ReplicaSetLister interface. +type ReplicaSetClusterLister struct { + indexer cache.Indexer +} + +// NewReplicaSetClusterLister returns a new ReplicaSetClusterLister. +func NewReplicaSetClusterLister(indexer cache.Indexer) appsv1beta2listers.ReplicaSetLister { + return &ReplicaSetClusterLister{indexer: indexer} +} + +// List lists all appsv1beta2.ReplicaSet in the indexer. +func (s ReplicaSetClusterLister) List(selector labels.Selector) (ret []*appsv1beta2.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta2.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get appsv1beta2.ReplicaSet. +func (s ReplicaSetClusterLister) ReplicaSets(namespace string) appsv1beta2listers.ReplicaSetNamespaceLister { + panic("Calling 'ReplicaSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta2.ReplicaSet. + +func (s ReplicaSetClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta2listers.ReplicaSetLister { + return &ReplicaSetLister{indexer: s.indexer, cluster: cluster} +} + +// ReplicaSetLister implements the appsv1beta2listers.ReplicaSetLister interface. +type ReplicaSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta2.ReplicaSet in the indexer. +func (s ReplicaSetLister) List(selector labels.Selector) (ret []*appsv1beta2.ReplicaSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.ReplicaSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ReplicaSets returns an object that can list and get appsv1beta2.ReplicaSet. +func (s ReplicaSetLister) ReplicaSets(namespace string) appsv1beta2listers.ReplicaSetNamespaceLister { + return &ReplicaSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ReplicaSetNamespaceLister implements the appsv1beta2listers.ReplicaSetNamespaceLister interface. +type ReplicaSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta2.ReplicaSet in the indexer for a given namespace. +func (s ReplicaSetNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta2.ReplicaSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.ReplicaSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta2.ReplicaSet from the indexer for a given namespace and name. +func (s ReplicaSetNamespaceLister) Get(name string) (*appsv1beta2.ReplicaSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta2.Resource("ReplicaSet"), name) + } + return obj.(*appsv1beta2.ReplicaSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset_expansion.go new file mode 100644 index 0000000000000..93b0da85b91bc --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/replicaset_expansion.go @@ -0,0 +1,68 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *ReplicaSetClusterLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + panic("Calling 'GetPodReplicaSets' is not supported before scoping lister to a workspace") +} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *ReplicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*apps.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset.go new file mode 100644 index 0000000000000..8990e3bdf4e01 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + appsv1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + appsv1beta2listers "k8s.io/client-go/listers/apps/v1beta2" + "k8s.io/client-go/tools/cache" +) + +var _ appsv1beta2listers.StatefulSetLister = &StatefulSetClusterLister{} + +// StatefulSetClusterLister implements the appsv1beta2listers.StatefulSetLister interface. +type StatefulSetClusterLister struct { + indexer cache.Indexer +} + +// NewStatefulSetClusterLister returns a new StatefulSetClusterLister. +func NewStatefulSetClusterLister(indexer cache.Indexer) appsv1beta2listers.StatefulSetLister { + return &StatefulSetClusterLister{indexer: indexer} +} + +// List lists all appsv1beta2.StatefulSet in the indexer. +func (s StatefulSetClusterLister) List(selector labels.Selector) (ret []*appsv1beta2.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*appsv1beta2.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get appsv1beta2.StatefulSet. +func (s StatefulSetClusterLister) StatefulSets(namespace string) appsv1beta2listers.StatefulSetNamespaceLister { + panic("Calling 'StatefulSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get appsv1beta2.StatefulSet. + +func (s StatefulSetClusterLister) Cluster(cluster logicalcluster.Name) appsv1beta2listers.StatefulSetLister { + return &StatefulSetLister{indexer: s.indexer, cluster: cluster} +} + +// StatefulSetLister implements the appsv1beta2listers.StatefulSetLister interface. +type StatefulSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all appsv1beta2.StatefulSet in the indexer. +func (s StatefulSetLister) List(selector labels.Selector) (ret []*appsv1beta2.StatefulSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.StatefulSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// StatefulSets returns an object that can list and get appsv1beta2.StatefulSet. +func (s StatefulSetLister) StatefulSets(namespace string) appsv1beta2listers.StatefulSetNamespaceLister { + return &StatefulSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// StatefulSetNamespaceLister implements the appsv1beta2listers.StatefulSetNamespaceLister interface. +type StatefulSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all appsv1beta2.StatefulSet in the indexer for a given namespace. +func (s StatefulSetNamespaceLister) List(selector labels.Selector) (ret []*appsv1beta2.StatefulSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*appsv1beta2.StatefulSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the appsv1beta2.StatefulSet from the indexer for a given namespace and name. +func (s StatefulSetNamespaceLister) Get(name string) (*appsv1beta2.StatefulSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(appsv1beta2.Resource("StatefulSet"), name) + } + return obj.(*appsv1beta2.StatefulSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset_expansion.go new file mode 100644 index 0000000000000..9791496b4ffd1 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/apps/v1beta2/statefulset_expansion.go @@ -0,0 +1,72 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *StatefulSetClusterLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("Calling 'GetPodStatefulSets' is not supported before scoping lister to a workspace") +} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *StatefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v1/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 0000000000000..70c1aa4febce9 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + autoscalingv1 "k8s.io/api/autoscaling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + autoscalingv1listers "k8s.io/client-go/listers/autoscaling/v1" + "k8s.io/client-go/tools/cache" +) + +var _ autoscalingv1listers.HorizontalPodAutoscalerLister = &HorizontalPodAutoscalerClusterLister{} + +// HorizontalPodAutoscalerClusterLister implements the autoscalingv1listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerClusterLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerClusterLister returns a new HorizontalPodAutoscalerClusterLister. +func NewHorizontalPodAutoscalerClusterLister(indexer cache.Indexer) autoscalingv1listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerClusterLister{indexer: indexer} +} + +// List lists all autoscalingv1.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerClusterLister) List(selector labels.Selector) (ret []*autoscalingv1.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*autoscalingv1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv1.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerClusterLister) HorizontalPodAutoscalers(namespace string) autoscalingv1listers.HorizontalPodAutoscalerNamespaceLister { + panic("Calling 'HorizontalPodAutoscalers' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get autoscalingv1.HorizontalPodAutoscaler. + +func (s HorizontalPodAutoscalerClusterLister) Cluster(cluster logicalcluster.Name) autoscalingv1listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerLister{indexer: s.indexer, cluster: cluster} +} + +// HorizontalPodAutoscalerLister implements the autoscalingv1listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all autoscalingv1.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*autoscalingv1.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv1.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv1.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) autoscalingv1listers.HorizontalPodAutoscalerNamespaceLister { + return &HorizontalPodAutoscalerNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister implements the autoscalingv1listers.HorizontalPodAutoscalerNamespaceLister interface. +type HorizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all autoscalingv1.HorizontalPodAutoscaler in the indexer for a given namespace. +func (s HorizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*autoscalingv1.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv1.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the autoscalingv1.HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s HorizontalPodAutoscalerNamespaceLister) Get(name string) (*autoscalingv1.HorizontalPodAutoscaler, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(autoscalingv1.Resource("HorizontalPodAutoscaler"), name) + } + return obj.(*autoscalingv1.HorizontalPodAutoscaler), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2/horizontalpodautoscaler.go new file mode 100644 index 0000000000000..fab0e748acfee --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2/horizontalpodautoscaler.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + autoscalingv2 "k8s.io/api/autoscaling/v2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + autoscalingv2listers "k8s.io/client-go/listers/autoscaling/v2" + "k8s.io/client-go/tools/cache" +) + +var _ autoscalingv2listers.HorizontalPodAutoscalerLister = &HorizontalPodAutoscalerClusterLister{} + +// HorizontalPodAutoscalerClusterLister implements the autoscalingv2listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerClusterLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerClusterLister returns a new HorizontalPodAutoscalerClusterLister. +func NewHorizontalPodAutoscalerClusterLister(indexer cache.Indexer) autoscalingv2listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerClusterLister{indexer: indexer} +} + +// List lists all autoscalingv2.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerClusterLister) List(selector labels.Selector) (ret []*autoscalingv2.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*autoscalingv2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv2.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerClusterLister) HorizontalPodAutoscalers(namespace string) autoscalingv2listers.HorizontalPodAutoscalerNamespaceLister { + panic("Calling 'HorizontalPodAutoscalers' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get autoscalingv2.HorizontalPodAutoscaler. + +func (s HorizontalPodAutoscalerClusterLister) Cluster(cluster logicalcluster.Name) autoscalingv2listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerLister{indexer: s.indexer, cluster: cluster} +} + +// HorizontalPodAutoscalerLister implements the autoscalingv2listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all autoscalingv2.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*autoscalingv2.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv2.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv2.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) autoscalingv2listers.HorizontalPodAutoscalerNamespaceLister { + return &HorizontalPodAutoscalerNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister implements the autoscalingv2listers.HorizontalPodAutoscalerNamespaceLister interface. +type HorizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all autoscalingv2.HorizontalPodAutoscaler in the indexer for a given namespace. +func (s HorizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*autoscalingv2.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv2.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the autoscalingv2.HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s HorizontalPodAutoscalerNamespaceLister) Get(name string) (*autoscalingv2.HorizontalPodAutoscaler, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(autoscalingv2.Resource("HorizontalPodAutoscaler"), name) + } + return obj.(*autoscalingv2.HorizontalPodAutoscaler), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta1/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta1/horizontalpodautoscaler.go new file mode 100644 index 0000000000000..de0624f03b189 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + autoscalingv2beta1listers "k8s.io/client-go/listers/autoscaling/v2beta1" + "k8s.io/client-go/tools/cache" +) + +var _ autoscalingv2beta1listers.HorizontalPodAutoscalerLister = &HorizontalPodAutoscalerClusterLister{} + +// HorizontalPodAutoscalerClusterLister implements the autoscalingv2beta1listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerClusterLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerClusterLister returns a new HorizontalPodAutoscalerClusterLister. +func NewHorizontalPodAutoscalerClusterLister(indexer cache.Indexer) autoscalingv2beta1listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerClusterLister{indexer: indexer} +} + +// List lists all autoscalingv2beta1.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerClusterLister) List(selector labels.Selector) (ret []*autoscalingv2beta1.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*autoscalingv2beta1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv2beta1.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerClusterLister) HorizontalPodAutoscalers(namespace string) autoscalingv2beta1listers.HorizontalPodAutoscalerNamespaceLister { + panic("Calling 'HorizontalPodAutoscalers' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get autoscalingv2beta1.HorizontalPodAutoscaler. + +func (s HorizontalPodAutoscalerClusterLister) Cluster(cluster logicalcluster.Name) autoscalingv2beta1listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerLister{indexer: s.indexer, cluster: cluster} +} + +// HorizontalPodAutoscalerLister implements the autoscalingv2beta1listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all autoscalingv2beta1.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*autoscalingv2beta1.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv2beta1.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv2beta1.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) autoscalingv2beta1listers.HorizontalPodAutoscalerNamespaceLister { + return &HorizontalPodAutoscalerNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister implements the autoscalingv2beta1listers.HorizontalPodAutoscalerNamespaceLister interface. +type HorizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all autoscalingv2beta1.HorizontalPodAutoscaler in the indexer for a given namespace. +func (s HorizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*autoscalingv2beta1.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv2beta1.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the autoscalingv2beta1.HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s HorizontalPodAutoscalerNamespaceLister) Get(name string) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(autoscalingv2beta1.Resource("HorizontalPodAutoscaler"), name) + } + return obj.(*autoscalingv2beta1.HorizontalPodAutoscaler), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta2/horizontalpodautoscaler.go b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta2/horizontalpodautoscaler.go new file mode 100644 index 0000000000000..9b99f6718a48d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v2beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + autoscalingv2beta2listers "k8s.io/client-go/listers/autoscaling/v2beta2" + "k8s.io/client-go/tools/cache" +) + +var _ autoscalingv2beta2listers.HorizontalPodAutoscalerLister = &HorizontalPodAutoscalerClusterLister{} + +// HorizontalPodAutoscalerClusterLister implements the autoscalingv2beta2listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerClusterLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerClusterLister returns a new HorizontalPodAutoscalerClusterLister. +func NewHorizontalPodAutoscalerClusterLister(indexer cache.Indexer) autoscalingv2beta2listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerClusterLister{indexer: indexer} +} + +// List lists all autoscalingv2beta2.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerClusterLister) List(selector labels.Selector) (ret []*autoscalingv2beta2.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*autoscalingv2beta2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv2beta2.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerClusterLister) HorizontalPodAutoscalers(namespace string) autoscalingv2beta2listers.HorizontalPodAutoscalerNamespaceLister { + panic("Calling 'HorizontalPodAutoscalers' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get autoscalingv2beta2.HorizontalPodAutoscaler. + +func (s HorizontalPodAutoscalerClusterLister) Cluster(cluster logicalcluster.Name) autoscalingv2beta2listers.HorizontalPodAutoscalerLister { + return &HorizontalPodAutoscalerLister{indexer: s.indexer, cluster: cluster} +} + +// HorizontalPodAutoscalerLister implements the autoscalingv2beta2listers.HorizontalPodAutoscalerLister interface. +type HorizontalPodAutoscalerLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all autoscalingv2beta2.HorizontalPodAutoscaler in the indexer. +func (s HorizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*autoscalingv2beta2.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv2beta2.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get autoscalingv2beta2.HorizontalPodAutoscaler. +func (s HorizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) autoscalingv2beta2listers.HorizontalPodAutoscalerNamespaceLister { + return &HorizontalPodAutoscalerNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister implements the autoscalingv2beta2listers.HorizontalPodAutoscalerNamespaceLister interface. +type HorizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all autoscalingv2beta2.HorizontalPodAutoscaler in the indexer for a given namespace. +func (s HorizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*autoscalingv2beta2.HorizontalPodAutoscaler, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*autoscalingv2beta2.HorizontalPodAutoscaler) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the autoscalingv2beta2.HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s HorizontalPodAutoscalerNamespaceLister) Get(name string) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(autoscalingv2beta2.Resource("HorizontalPodAutoscaler"), name) + } + return obj.(*autoscalingv2beta2.HorizontalPodAutoscaler), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/batch/v1/cronjob.go b/staging/src/k8s.io/client-go/kcp/listers/batch/v1/cronjob.go new file mode 100644 index 0000000000000..89a54a08ff3bd --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/batch/v1/cronjob.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + batchv1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + batchv1listers "k8s.io/client-go/listers/batch/v1" + "k8s.io/client-go/tools/cache" +) + +var _ batchv1listers.CronJobLister = &CronJobClusterLister{} + +// CronJobClusterLister implements the batchv1listers.CronJobLister interface. +type CronJobClusterLister struct { + indexer cache.Indexer +} + +// NewCronJobClusterLister returns a new CronJobClusterLister. +func NewCronJobClusterLister(indexer cache.Indexer) batchv1listers.CronJobLister { + return &CronJobClusterLister{indexer: indexer} +} + +// List lists all batchv1.CronJob in the indexer. +func (s CronJobClusterLister) List(selector labels.Selector) (ret []*batchv1.CronJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*batchv1.CronJob)) + }) + return ret, err +} + +// CronJobs returns an object that can list and get batchv1.CronJob. +func (s CronJobClusterLister) CronJobs(namespace string) batchv1listers.CronJobNamespaceLister { + panic("Calling 'CronJobs' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get batchv1.CronJob. + +func (s CronJobClusterLister) Cluster(cluster logicalcluster.Name) batchv1listers.CronJobLister { + return &CronJobLister{indexer: s.indexer, cluster: cluster} +} + +// CronJobLister implements the batchv1listers.CronJobLister interface. +type CronJobLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all batchv1.CronJob in the indexer. +func (s CronJobLister) List(selector labels.Selector) (ret []*batchv1.CronJob, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*batchv1.CronJob) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// CronJobs returns an object that can list and get batchv1.CronJob. +func (s CronJobLister) CronJobs(namespace string) batchv1listers.CronJobNamespaceLister { + return &CronJobNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// CronJobNamespaceLister implements the batchv1listers.CronJobNamespaceLister interface. +type CronJobNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all batchv1.CronJob in the indexer for a given namespace. +func (s CronJobNamespaceLister) List(selector labels.Selector) (ret []*batchv1.CronJob, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*batchv1.CronJob) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the batchv1.CronJob from the indexer for a given namespace and name. +func (s CronJobNamespaceLister) Get(name string) (*batchv1.CronJob, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(batchv1.Resource("CronJob"), name) + } + return obj.(*batchv1.CronJob), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/batch/v1/job.go b/staging/src/k8s.io/client-go/kcp/listers/batch/v1/job.go new file mode 100644 index 0000000000000..b02c605508387 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/batch/v1/job.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + batchv1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + batchv1listers "k8s.io/client-go/listers/batch/v1" + "k8s.io/client-go/tools/cache" +) + +var _ batchv1listers.JobLister = &JobClusterLister{} + +// JobClusterLister implements the batchv1listers.JobLister interface. +type JobClusterLister struct { + indexer cache.Indexer +} + +// NewJobClusterLister returns a new JobClusterLister. +func NewJobClusterLister(indexer cache.Indexer) batchv1listers.JobLister { + return &JobClusterLister{indexer: indexer} +} + +// List lists all batchv1.Job in the indexer. +func (s JobClusterLister) List(selector labels.Selector) (ret []*batchv1.Job, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*batchv1.Job)) + }) + return ret, err +} + +// Jobs returns an object that can list and get batchv1.Job. +func (s JobClusterLister) Jobs(namespace string) batchv1listers.JobNamespaceLister { + panic("Calling 'Jobs' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get batchv1.Job. + +func (s JobClusterLister) Cluster(cluster logicalcluster.Name) batchv1listers.JobLister { + return &JobLister{indexer: s.indexer, cluster: cluster} +} + +// JobLister implements the batchv1listers.JobLister interface. +type JobLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all batchv1.Job in the indexer. +func (s JobLister) List(selector labels.Selector) (ret []*batchv1.Job, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*batchv1.Job) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Jobs returns an object that can list and get batchv1.Job. +func (s JobLister) Jobs(namespace string) batchv1listers.JobNamespaceLister { + return &JobNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// JobNamespaceLister implements the batchv1listers.JobNamespaceLister interface. +type JobNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all batchv1.Job in the indexer for a given namespace. +func (s JobNamespaceLister) List(selector labels.Selector) (ret []*batchv1.Job, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*batchv1.Job) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the batchv1.Job from the indexer for a given namespace and name. +func (s JobNamespaceLister) Get(name string) (*batchv1.Job, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(batchv1.Resource("Job"), name) + } + return obj.(*batchv1.Job), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/batch/v1/job_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/batch/v1/job_expansion.go new file mode 100644 index 0000000000000..258382e9b190f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/batch/v1/job_expansion.go @@ -0,0 +1,66 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "fmt" + + batch "k8s.io/api/batch/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (l *JobClusterLister) GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) { + panic("Calling 'GetPodJobs' is not supported before scoping lister to a workspace") +} + +// GetPodJobs returns a list of Jobs that potentially +// match a Pod. Only the one specified in the Pod's ControllerRef +// will actually manage it. +// Returns an error only if no matching Jobs are found. +func (l *JobLister) GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) { + if len(pod.Labels) == 0 { + err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name) + return + } + + var list []*batch.Job + list, err = l.Jobs(pod.Namespace).List(labels.Everything()) + if err != nil { + return + } + for _, job := range list { + selector, err := metav1.LabelSelectorAsSelector(job.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + if !selector.Matches(labels.Set(pod.Labels)) { + continue + } + jobs = append(jobs, *job) + } + if len(jobs) == 0 { + err = fmt.Errorf("could not find jobs for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + return +} + +// JobNamespaceListerExpansion allows custom methods to be added to +// JobNamespaceLister. +type JobNamespaceListerExpansion interface{} diff --git a/staging/src/k8s.io/client-go/kcp/listers/batch/v1beta1/cronjob.go b/staging/src/k8s.io/client-go/kcp/listers/batch/v1beta1/cronjob.go new file mode 100644 index 0000000000000..bd5c88643507e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/batch/v1beta1/cronjob.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + batchv1beta1 "k8s.io/api/batch/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + batchv1beta1listers "k8s.io/client-go/listers/batch/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ batchv1beta1listers.CronJobLister = &CronJobClusterLister{} + +// CronJobClusterLister implements the batchv1beta1listers.CronJobLister interface. +type CronJobClusterLister struct { + indexer cache.Indexer +} + +// NewCronJobClusterLister returns a new CronJobClusterLister. +func NewCronJobClusterLister(indexer cache.Indexer) batchv1beta1listers.CronJobLister { + return &CronJobClusterLister{indexer: indexer} +} + +// List lists all batchv1beta1.CronJob in the indexer. +func (s CronJobClusterLister) List(selector labels.Selector) (ret []*batchv1beta1.CronJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*batchv1beta1.CronJob)) + }) + return ret, err +} + +// CronJobs returns an object that can list and get batchv1beta1.CronJob. +func (s CronJobClusterLister) CronJobs(namespace string) batchv1beta1listers.CronJobNamespaceLister { + panic("Calling 'CronJobs' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get batchv1beta1.CronJob. + +func (s CronJobClusterLister) Cluster(cluster logicalcluster.Name) batchv1beta1listers.CronJobLister { + return &CronJobLister{indexer: s.indexer, cluster: cluster} +} + +// CronJobLister implements the batchv1beta1listers.CronJobLister interface. +type CronJobLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all batchv1beta1.CronJob in the indexer. +func (s CronJobLister) List(selector labels.Selector) (ret []*batchv1beta1.CronJob, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*batchv1beta1.CronJob) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// CronJobs returns an object that can list and get batchv1beta1.CronJob. +func (s CronJobLister) CronJobs(namespace string) batchv1beta1listers.CronJobNamespaceLister { + return &CronJobNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// CronJobNamespaceLister implements the batchv1beta1listers.CronJobNamespaceLister interface. +type CronJobNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all batchv1beta1.CronJob in the indexer for a given namespace. +func (s CronJobNamespaceLister) List(selector labels.Selector) (ret []*batchv1beta1.CronJob, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*batchv1beta1.CronJob) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the batchv1beta1.CronJob from the indexer for a given namespace and name. +func (s CronJobNamespaceLister) Get(name string) (*batchv1beta1.CronJob, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(batchv1beta1.Resource("CronJob"), name) + } + return obj.(*batchv1beta1.CronJob), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/certificates/v1/certificatesigningrequest.go b/staging/src/k8s.io/client-go/kcp/listers/certificates/v1/certificatesigningrequest.go new file mode 100644 index 0000000000000..dcb8cf3daa86a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + certificatesv1 "k8s.io/api/certificates/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + certificatesv1listers "k8s.io/client-go/listers/certificates/v1" + "k8s.io/client-go/tools/cache" +) + +var _ certificatesv1listers.CertificateSigningRequestLister = &CertificateSigningRequestClusterLister{} + +// CertificateSigningRequestClusterLister implements the certificatesv1listers.CertificateSigningRequestLister interface. +type CertificateSigningRequestClusterLister struct { + indexer cache.Indexer +} + +// NewCertificateSigningRequestClusterLister returns a new CertificateSigningRequestClusterLister. +func NewCertificateSigningRequestClusterLister(indexer cache.Indexer) certificatesv1listers.CertificateSigningRequestLister { + return &CertificateSigningRequestClusterLister{indexer: indexer} +} + +// List lists all certificatesv1.CertificateSigningRequest in the indexer. +func (s CertificateSigningRequestClusterLister) List(selector labels.Selector) (ret []*certificatesv1.CertificateSigningRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*certificatesv1.CertificateSigningRequest)) + }) + return ret, err +} + +// Get retrieves the certificatesv1.CertificateSigningRequest from the indexer for a given name. +func (s CertificateSigningRequestClusterLister) Get(name string) (*certificatesv1.CertificateSigningRequest, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get certificatesv1.CertificateSigningRequest. + +func (s CertificateSigningRequestClusterLister) Cluster(cluster logicalcluster.Name) certificatesv1listers.CertificateSigningRequestLister { + return &CertificateSigningRequestLister{indexer: s.indexer, cluster: cluster} +} + +// CertificateSigningRequestLister implements the certificatesv1listers.CertificateSigningRequestLister interface. +type CertificateSigningRequestLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all certificatesv1.CertificateSigningRequest in the indexer. +func (s CertificateSigningRequestLister) List(selector labels.Selector) (ret []*certificatesv1.CertificateSigningRequest, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*certificatesv1.CertificateSigningRequest) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the certificatesv1.CertificateSigningRequest from the indexer for a given name. +func (s CertificateSigningRequestLister) Get(name string) (*certificatesv1.CertificateSigningRequest, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(certificatesv1.Resource("CertificateSigningRequest"), name) + } + return obj.(*certificatesv1.CertificateSigningRequest), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/certificates/v1beta1/certificatesigningrequest.go b/staging/src/k8s.io/client-go/kcp/listers/certificates/v1beta1/certificatesigningrequest.go new file mode 100644 index 0000000000000..87439303991ea --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/certificates/v1beta1/certificatesigningrequest.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + certificatesv1beta1listers "k8s.io/client-go/listers/certificates/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ certificatesv1beta1listers.CertificateSigningRequestLister = &CertificateSigningRequestClusterLister{} + +// CertificateSigningRequestClusterLister implements the certificatesv1beta1listers.CertificateSigningRequestLister interface. +type CertificateSigningRequestClusterLister struct { + indexer cache.Indexer +} + +// NewCertificateSigningRequestClusterLister returns a new CertificateSigningRequestClusterLister. +func NewCertificateSigningRequestClusterLister(indexer cache.Indexer) certificatesv1beta1listers.CertificateSigningRequestLister { + return &CertificateSigningRequestClusterLister{indexer: indexer} +} + +// List lists all certificatesv1beta1.CertificateSigningRequest in the indexer. +func (s CertificateSigningRequestClusterLister) List(selector labels.Selector) (ret []*certificatesv1beta1.CertificateSigningRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*certificatesv1beta1.CertificateSigningRequest)) + }) + return ret, err +} + +// Get retrieves the certificatesv1beta1.CertificateSigningRequest from the indexer for a given name. +func (s CertificateSigningRequestClusterLister) Get(name string) (*certificatesv1beta1.CertificateSigningRequest, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get certificatesv1beta1.CertificateSigningRequest. + +func (s CertificateSigningRequestClusterLister) Cluster(cluster logicalcluster.Name) certificatesv1beta1listers.CertificateSigningRequestLister { + return &CertificateSigningRequestLister{indexer: s.indexer, cluster: cluster} +} + +// CertificateSigningRequestLister implements the certificatesv1beta1listers.CertificateSigningRequestLister interface. +type CertificateSigningRequestLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all certificatesv1beta1.CertificateSigningRequest in the indexer. +func (s CertificateSigningRequestLister) List(selector labels.Selector) (ret []*certificatesv1beta1.CertificateSigningRequest, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*certificatesv1beta1.CertificateSigningRequest) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the certificatesv1beta1.CertificateSigningRequest from the indexer for a given name. +func (s CertificateSigningRequestLister) Get(name string) (*certificatesv1beta1.CertificateSigningRequest, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(certificatesv1beta1.Resource("CertificateSigningRequest"), name) + } + return obj.(*certificatesv1beta1.CertificateSigningRequest), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/coordination/v1/lease.go b/staging/src/k8s.io/client-go/kcp/listers/coordination/v1/lease.go new file mode 100644 index 0000000000000..168ae3e44da23 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/coordination/v1/lease.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + coordinationv1 "k8s.io/api/coordination/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + coordinationv1listers "k8s.io/client-go/listers/coordination/v1" + "k8s.io/client-go/tools/cache" +) + +var _ coordinationv1listers.LeaseLister = &LeaseClusterLister{} + +// LeaseClusterLister implements the coordinationv1listers.LeaseLister interface. +type LeaseClusterLister struct { + indexer cache.Indexer +} + +// NewLeaseClusterLister returns a new LeaseClusterLister. +func NewLeaseClusterLister(indexer cache.Indexer) coordinationv1listers.LeaseLister { + return &LeaseClusterLister{indexer: indexer} +} + +// List lists all coordinationv1.Lease in the indexer. +func (s LeaseClusterLister) List(selector labels.Selector) (ret []*coordinationv1.Lease, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*coordinationv1.Lease)) + }) + return ret, err +} + +// Leases returns an object that can list and get coordinationv1.Lease. +func (s LeaseClusterLister) Leases(namespace string) coordinationv1listers.LeaseNamespaceLister { + panic("Calling 'Leases' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get coordinationv1.Lease. + +func (s LeaseClusterLister) Cluster(cluster logicalcluster.Name) coordinationv1listers.LeaseLister { + return &LeaseLister{indexer: s.indexer, cluster: cluster} +} + +// LeaseLister implements the coordinationv1listers.LeaseLister interface. +type LeaseLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all coordinationv1.Lease in the indexer. +func (s LeaseLister) List(selector labels.Selector) (ret []*coordinationv1.Lease, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*coordinationv1.Lease) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Leases returns an object that can list and get coordinationv1.Lease. +func (s LeaseLister) Leases(namespace string) coordinationv1listers.LeaseNamespaceLister { + return &LeaseNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// LeaseNamespaceLister implements the coordinationv1listers.LeaseNamespaceLister interface. +type LeaseNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all coordinationv1.Lease in the indexer for a given namespace. +func (s LeaseNamespaceLister) List(selector labels.Selector) (ret []*coordinationv1.Lease, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*coordinationv1.Lease) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the coordinationv1.Lease from the indexer for a given namespace and name. +func (s LeaseNamespaceLister) Get(name string) (*coordinationv1.Lease, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(coordinationv1.Resource("Lease"), name) + } + return obj.(*coordinationv1.Lease), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/coordination/v1beta1/lease.go b/staging/src/k8s.io/client-go/kcp/listers/coordination/v1beta1/lease.go new file mode 100644 index 0000000000000..a5cc9fedd9aae --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/coordination/v1beta1/lease.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + coordinationv1beta1listers "k8s.io/client-go/listers/coordination/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ coordinationv1beta1listers.LeaseLister = &LeaseClusterLister{} + +// LeaseClusterLister implements the coordinationv1beta1listers.LeaseLister interface. +type LeaseClusterLister struct { + indexer cache.Indexer +} + +// NewLeaseClusterLister returns a new LeaseClusterLister. +func NewLeaseClusterLister(indexer cache.Indexer) coordinationv1beta1listers.LeaseLister { + return &LeaseClusterLister{indexer: indexer} +} + +// List lists all coordinationv1beta1.Lease in the indexer. +func (s LeaseClusterLister) List(selector labels.Selector) (ret []*coordinationv1beta1.Lease, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*coordinationv1beta1.Lease)) + }) + return ret, err +} + +// Leases returns an object that can list and get coordinationv1beta1.Lease. +func (s LeaseClusterLister) Leases(namespace string) coordinationv1beta1listers.LeaseNamespaceLister { + panic("Calling 'Leases' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get coordinationv1beta1.Lease. + +func (s LeaseClusterLister) Cluster(cluster logicalcluster.Name) coordinationv1beta1listers.LeaseLister { + return &LeaseLister{indexer: s.indexer, cluster: cluster} +} + +// LeaseLister implements the coordinationv1beta1listers.LeaseLister interface. +type LeaseLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all coordinationv1beta1.Lease in the indexer. +func (s LeaseLister) List(selector labels.Selector) (ret []*coordinationv1beta1.Lease, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*coordinationv1beta1.Lease) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Leases returns an object that can list and get coordinationv1beta1.Lease. +func (s LeaseLister) Leases(namespace string) coordinationv1beta1listers.LeaseNamespaceLister { + return &LeaseNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// LeaseNamespaceLister implements the coordinationv1beta1listers.LeaseNamespaceLister interface. +type LeaseNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all coordinationv1beta1.Lease in the indexer for a given namespace. +func (s LeaseNamespaceLister) List(selector labels.Selector) (ret []*coordinationv1beta1.Lease, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*coordinationv1beta1.Lease) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the coordinationv1beta1.Lease from the indexer for a given namespace and name. +func (s LeaseNamespaceLister) Get(name string) (*coordinationv1beta1.Lease, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(coordinationv1beta1.Resource("Lease"), name) + } + return obj.(*coordinationv1beta1.Lease), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/componentstatus.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/componentstatus.go new file mode 100644 index 0000000000000..bde38aeda1e0c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/componentstatus.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.ComponentStatusLister = &ComponentStatusClusterLister{} + +// ComponentStatusClusterLister implements the corev1listers.ComponentStatusLister interface. +type ComponentStatusClusterLister struct { + indexer cache.Indexer +} + +// NewComponentStatusClusterLister returns a new ComponentStatusClusterLister. +func NewComponentStatusClusterLister(indexer cache.Indexer) corev1listers.ComponentStatusLister { + return &ComponentStatusClusterLister{indexer: indexer} +} + +// List lists all corev1.ComponentStatus in the indexer. +func (s ComponentStatusClusterLister) List(selector labels.Selector) (ret []*corev1.ComponentStatus, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.ComponentStatus)) + }) + return ret, err +} + +// Get retrieves the corev1.ComponentStatus from the indexer for a given name. +func (s ComponentStatusClusterLister) Get(name string) (*corev1.ComponentStatus, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.ComponentStatus. + +func (s ComponentStatusClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.ComponentStatusLister { + return &ComponentStatusLister{indexer: s.indexer, cluster: cluster} +} + +// ComponentStatusLister implements the corev1listers.ComponentStatusLister interface. +type ComponentStatusLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.ComponentStatus in the indexer. +func (s ComponentStatusLister) List(selector labels.Selector) (ret []*corev1.ComponentStatus, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ComponentStatus) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the corev1.ComponentStatus from the indexer for a given name. +func (s ComponentStatusLister) Get(name string) (*corev1.ComponentStatus, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("ComponentStatus"), name) + } + return obj.(*corev1.ComponentStatus), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/configmap.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/configmap.go new file mode 100644 index 0000000000000..e39f364c36eb2 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/configmap.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.ConfigMapLister = &ConfigMapClusterLister{} + +// ConfigMapClusterLister implements the corev1listers.ConfigMapLister interface. +type ConfigMapClusterLister struct { + indexer cache.Indexer +} + +// NewConfigMapClusterLister returns a new ConfigMapClusterLister. +func NewConfigMapClusterLister(indexer cache.Indexer) corev1listers.ConfigMapLister { + return &ConfigMapClusterLister{indexer: indexer} +} + +// List lists all corev1.ConfigMap in the indexer. +func (s ConfigMapClusterLister) List(selector labels.Selector) (ret []*corev1.ConfigMap, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.ConfigMap)) + }) + return ret, err +} + +// ConfigMaps returns an object that can list and get corev1.ConfigMap. +func (s ConfigMapClusterLister) ConfigMaps(namespace string) corev1listers.ConfigMapNamespaceLister { + panic("Calling 'ConfigMaps' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.ConfigMap. + +func (s ConfigMapClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.ConfigMapLister { + return &ConfigMapLister{indexer: s.indexer, cluster: cluster} +} + +// ConfigMapLister implements the corev1listers.ConfigMapLister interface. +type ConfigMapLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.ConfigMap in the indexer. +func (s ConfigMapLister) List(selector labels.Selector) (ret []*corev1.ConfigMap, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ConfigMap) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ConfigMaps returns an object that can list and get corev1.ConfigMap. +func (s ConfigMapLister) ConfigMaps(namespace string) corev1listers.ConfigMapNamespaceLister { + return &ConfigMapNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ConfigMapNamespaceLister implements the corev1listers.ConfigMapNamespaceLister interface. +type ConfigMapNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.ConfigMap in the indexer for a given namespace. +func (s ConfigMapNamespaceLister) List(selector labels.Selector) (ret []*corev1.ConfigMap, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ConfigMap) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.ConfigMap from the indexer for a given namespace and name. +func (s ConfigMapNamespaceLister) Get(name string) (*corev1.ConfigMap, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("ConfigMap"), name) + } + return obj.(*corev1.ConfigMap), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/endpoints.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/endpoints.go new file mode 100644 index 0000000000000..a329cef91cd60 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/endpoints.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.EndpointsLister = &EndpointsClusterLister{} + +// EndpointsClusterLister implements the corev1listers.EndpointsLister interface. +type EndpointsClusterLister struct { + indexer cache.Indexer +} + +// NewEndpointsClusterLister returns a new EndpointsClusterLister. +func NewEndpointsClusterLister(indexer cache.Indexer) corev1listers.EndpointsLister { + return &EndpointsClusterLister{indexer: indexer} +} + +// List lists all corev1.Endpoints in the indexer. +func (s EndpointsClusterLister) List(selector labels.Selector) (ret []*corev1.Endpoints, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.Endpoints)) + }) + return ret, err +} + +// Endpoints returns an object that can list and get corev1.Endpoints. +func (s EndpointsClusterLister) Endpoints(namespace string) corev1listers.EndpointsNamespaceLister { + panic("Calling 'Endpoints' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.Endpoints. + +func (s EndpointsClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.EndpointsLister { + return &EndpointsLister{indexer: s.indexer, cluster: cluster} +} + +// EndpointsLister implements the corev1listers.EndpointsLister interface. +type EndpointsLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.Endpoints in the indexer. +func (s EndpointsLister) List(selector labels.Selector) (ret []*corev1.Endpoints, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Endpoints) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Endpoints returns an object that can list and get corev1.Endpoints. +func (s EndpointsLister) Endpoints(namespace string) corev1listers.EndpointsNamespaceLister { + return &EndpointsNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// EndpointsNamespaceLister implements the corev1listers.EndpointsNamespaceLister interface. +type EndpointsNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.Endpoints in the indexer for a given namespace. +func (s EndpointsNamespaceLister) List(selector labels.Selector) (ret []*corev1.Endpoints, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Endpoints) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.Endpoints from the indexer for a given namespace and name. +func (s EndpointsNamespaceLister) Get(name string) (*corev1.Endpoints, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("Endpoints"), name) + } + return obj.(*corev1.Endpoints), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/event.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/event.go new file mode 100644 index 0000000000000..aba622b652139 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/event.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.EventLister = &EventClusterLister{} + +// EventClusterLister implements the corev1listers.EventLister interface. +type EventClusterLister struct { + indexer cache.Indexer +} + +// NewEventClusterLister returns a new EventClusterLister. +func NewEventClusterLister(indexer cache.Indexer) corev1listers.EventLister { + return &EventClusterLister{indexer: indexer} +} + +// List lists all corev1.Event in the indexer. +func (s EventClusterLister) List(selector labels.Selector) (ret []*corev1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get corev1.Event. +func (s EventClusterLister) Events(namespace string) corev1listers.EventNamespaceLister { + panic("Calling 'Events' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.Event. + +func (s EventClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.EventLister { + return &EventLister{indexer: s.indexer, cluster: cluster} +} + +// EventLister implements the corev1listers.EventLister interface. +type EventLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.Event in the indexer. +func (s EventLister) List(selector labels.Selector) (ret []*corev1.Event, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Event) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Events returns an object that can list and get corev1.Event. +func (s EventLister) Events(namespace string) corev1listers.EventNamespaceLister { + return &EventNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// EventNamespaceLister implements the corev1listers.EventNamespaceLister interface. +type EventNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.Event in the indexer for a given namespace. +func (s EventNamespaceLister) List(selector labels.Selector) (ret []*corev1.Event, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Event) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.Event from the indexer for a given namespace and name. +func (s EventNamespaceLister) Get(name string) (*corev1.Event, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("Event"), name) + } + return obj.(*corev1.Event), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/limitrange.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/limitrange.go new file mode 100644 index 0000000000000..5dba38ce05651 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/limitrange.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.LimitRangeLister = &LimitRangeClusterLister{} + +// LimitRangeClusterLister implements the corev1listers.LimitRangeLister interface. +type LimitRangeClusterLister struct { + indexer cache.Indexer +} + +// NewLimitRangeClusterLister returns a new LimitRangeClusterLister. +func NewLimitRangeClusterLister(indexer cache.Indexer) corev1listers.LimitRangeLister { + return &LimitRangeClusterLister{indexer: indexer} +} + +// List lists all corev1.LimitRange in the indexer. +func (s LimitRangeClusterLister) List(selector labels.Selector) (ret []*corev1.LimitRange, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.LimitRange)) + }) + return ret, err +} + +// LimitRanges returns an object that can list and get corev1.LimitRange. +func (s LimitRangeClusterLister) LimitRanges(namespace string) corev1listers.LimitRangeNamespaceLister { + panic("Calling 'LimitRanges' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.LimitRange. + +func (s LimitRangeClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.LimitRangeLister { + return &LimitRangeLister{indexer: s.indexer, cluster: cluster} +} + +// LimitRangeLister implements the corev1listers.LimitRangeLister interface. +type LimitRangeLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.LimitRange in the indexer. +func (s LimitRangeLister) List(selector labels.Selector) (ret []*corev1.LimitRange, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.LimitRange) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// LimitRanges returns an object that can list and get corev1.LimitRange. +func (s LimitRangeLister) LimitRanges(namespace string) corev1listers.LimitRangeNamespaceLister { + return &LimitRangeNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// LimitRangeNamespaceLister implements the corev1listers.LimitRangeNamespaceLister interface. +type LimitRangeNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.LimitRange in the indexer for a given namespace. +func (s LimitRangeNamespaceLister) List(selector labels.Selector) (ret []*corev1.LimitRange, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.LimitRange) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.LimitRange from the indexer for a given namespace and name. +func (s LimitRangeNamespaceLister) Get(name string) (*corev1.LimitRange, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("LimitRange"), name) + } + return obj.(*corev1.LimitRange), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/namespace.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/namespace.go new file mode 100644 index 0000000000000..60347189eed78 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/namespace.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.NamespaceLister = &NamespaceClusterLister{} + +// NamespaceClusterLister implements the corev1listers.NamespaceLister interface. +type NamespaceClusterLister struct { + indexer cache.Indexer +} + +// NewNamespaceClusterLister returns a new NamespaceClusterLister. +func NewNamespaceClusterLister(indexer cache.Indexer) corev1listers.NamespaceLister { + return &NamespaceClusterLister{indexer: indexer} +} + +// List lists all corev1.Namespace in the indexer. +func (s NamespaceClusterLister) List(selector labels.Selector) (ret []*corev1.Namespace, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.Namespace)) + }) + return ret, err +} + +// Get retrieves the corev1.Namespace from the indexer for a given name. +func (s NamespaceClusterLister) Get(name string) (*corev1.Namespace, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.Namespace. + +func (s NamespaceClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.NamespaceLister { + return &NamespaceLister{indexer: s.indexer, cluster: cluster} +} + +// NamespaceLister implements the corev1listers.NamespaceLister interface. +type NamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.Namespace in the indexer. +func (s NamespaceLister) List(selector labels.Selector) (ret []*corev1.Namespace, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Namespace) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the corev1.Namespace from the indexer for a given name. +func (s NamespaceLister) Get(name string) (*corev1.Namespace, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("Namespace"), name) + } + return obj.(*corev1.Namespace), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/node.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/node.go new file mode 100644 index 0000000000000..3ab446b55d3be --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/node.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.NodeLister = &NodeClusterLister{} + +// NodeClusterLister implements the corev1listers.NodeLister interface. +type NodeClusterLister struct { + indexer cache.Indexer +} + +// NewNodeClusterLister returns a new NodeClusterLister. +func NewNodeClusterLister(indexer cache.Indexer) corev1listers.NodeLister { + return &NodeClusterLister{indexer: indexer} +} + +// List lists all corev1.Node in the indexer. +func (s NodeClusterLister) List(selector labels.Selector) (ret []*corev1.Node, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.Node)) + }) + return ret, err +} + +// Get retrieves the corev1.Node from the indexer for a given name. +func (s NodeClusterLister) Get(name string) (*corev1.Node, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.Node. + +func (s NodeClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.NodeLister { + return &NodeLister{indexer: s.indexer, cluster: cluster} +} + +// NodeLister implements the corev1listers.NodeLister interface. +type NodeLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.Node in the indexer. +func (s NodeLister) List(selector labels.Selector) (ret []*corev1.Node, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Node) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the corev1.Node from the indexer for a given name. +func (s NodeLister) Get(name string) (*corev1.Node, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("Node"), name) + } + return obj.(*corev1.Node), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolume.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolume.go new file mode 100644 index 0000000000000..377ed406f71a5 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolume.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.PersistentVolumeLister = &PersistentVolumeClusterLister{} + +// PersistentVolumeClusterLister implements the corev1listers.PersistentVolumeLister interface. +type PersistentVolumeClusterLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeClusterLister returns a new PersistentVolumeClusterLister. +func NewPersistentVolumeClusterLister(indexer cache.Indexer) corev1listers.PersistentVolumeLister { + return &PersistentVolumeClusterLister{indexer: indexer} +} + +// List lists all corev1.PersistentVolume in the indexer. +func (s PersistentVolumeClusterLister) List(selector labels.Selector) (ret []*corev1.PersistentVolume, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.PersistentVolume)) + }) + return ret, err +} + +// Get retrieves the corev1.PersistentVolume from the indexer for a given name. +func (s PersistentVolumeClusterLister) Get(name string) (*corev1.PersistentVolume, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.PersistentVolume. + +func (s PersistentVolumeClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.PersistentVolumeLister { + return &PersistentVolumeLister{indexer: s.indexer, cluster: cluster} +} + +// PersistentVolumeLister implements the corev1listers.PersistentVolumeLister interface. +type PersistentVolumeLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.PersistentVolume in the indexer. +func (s PersistentVolumeLister) List(selector labels.Selector) (ret []*corev1.PersistentVolume, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.PersistentVolume) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the corev1.PersistentVolume from the indexer for a given name. +func (s PersistentVolumeLister) Get(name string) (*corev1.PersistentVolume, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("PersistentVolume"), name) + } + return obj.(*corev1.PersistentVolume), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolumeclaim.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolumeclaim.go new file mode 100644 index 0000000000000..294095034a62c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/persistentvolumeclaim.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.PersistentVolumeClaimLister = &PersistentVolumeClaimClusterLister{} + +// PersistentVolumeClaimClusterLister implements the corev1listers.PersistentVolumeClaimLister interface. +type PersistentVolumeClaimClusterLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeClaimClusterLister returns a new PersistentVolumeClaimClusterLister. +func NewPersistentVolumeClaimClusterLister(indexer cache.Indexer) corev1listers.PersistentVolumeClaimLister { + return &PersistentVolumeClaimClusterLister{indexer: indexer} +} + +// List lists all corev1.PersistentVolumeClaim in the indexer. +func (s PersistentVolumeClaimClusterLister) List(selector labels.Selector) (ret []*corev1.PersistentVolumeClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.PersistentVolumeClaim)) + }) + return ret, err +} + +// PersistentVolumeClaims returns an object that can list and get corev1.PersistentVolumeClaim. +func (s PersistentVolumeClaimClusterLister) PersistentVolumeClaims(namespace string) corev1listers.PersistentVolumeClaimNamespaceLister { + panic("Calling 'PersistentVolumeClaims' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.PersistentVolumeClaim. + +func (s PersistentVolumeClaimClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.PersistentVolumeClaimLister { + return &PersistentVolumeClaimLister{indexer: s.indexer, cluster: cluster} +} + +// PersistentVolumeClaimLister implements the corev1listers.PersistentVolumeClaimLister interface. +type PersistentVolumeClaimLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.PersistentVolumeClaim in the indexer. +func (s PersistentVolumeClaimLister) List(selector labels.Selector) (ret []*corev1.PersistentVolumeClaim, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.PersistentVolumeClaim) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// PersistentVolumeClaims returns an object that can list and get corev1.PersistentVolumeClaim. +func (s PersistentVolumeClaimLister) PersistentVolumeClaims(namespace string) corev1listers.PersistentVolumeClaimNamespaceLister { + return &PersistentVolumeClaimNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// PersistentVolumeClaimNamespaceLister implements the corev1listers.PersistentVolumeClaimNamespaceLister interface. +type PersistentVolumeClaimNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.PersistentVolumeClaim in the indexer for a given namespace. +func (s PersistentVolumeClaimNamespaceLister) List(selector labels.Selector) (ret []*corev1.PersistentVolumeClaim, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.PersistentVolumeClaim) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.PersistentVolumeClaim from the indexer for a given namespace and name. +func (s PersistentVolumeClaimNamespaceLister) Get(name string) (*corev1.PersistentVolumeClaim, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("PersistentVolumeClaim"), name) + } + return obj.(*corev1.PersistentVolumeClaim), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/pod.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/pod.go new file mode 100644 index 0000000000000..a2719317d7ec6 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/pod.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.PodLister = &PodClusterLister{} + +// PodClusterLister implements the corev1listers.PodLister interface. +type PodClusterLister struct { + indexer cache.Indexer +} + +// NewPodClusterLister returns a new PodClusterLister. +func NewPodClusterLister(indexer cache.Indexer) corev1listers.PodLister { + return &PodClusterLister{indexer: indexer} +} + +// List lists all corev1.Pod in the indexer. +func (s PodClusterLister) List(selector labels.Selector) (ret []*corev1.Pod, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.Pod)) + }) + return ret, err +} + +// Pods returns an object that can list and get corev1.Pod. +func (s PodClusterLister) Pods(namespace string) corev1listers.PodNamespaceLister { + panic("Calling 'Pods' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.Pod. + +func (s PodClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.PodLister { + return &PodLister{indexer: s.indexer, cluster: cluster} +} + +// PodLister implements the corev1listers.PodLister interface. +type PodLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.Pod in the indexer. +func (s PodLister) List(selector labels.Selector) (ret []*corev1.Pod, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Pod) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Pods returns an object that can list and get corev1.Pod. +func (s PodLister) Pods(namespace string) corev1listers.PodNamespaceLister { + return &PodNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// PodNamespaceLister implements the corev1listers.PodNamespaceLister interface. +type PodNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.Pod in the indexer for a given namespace. +func (s PodNamespaceLister) List(selector labels.Selector) (ret []*corev1.Pod, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Pod) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.Pod from the indexer for a given namespace and name. +func (s PodNamespaceLister) Get(name string) (*corev1.Pod, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("Pod"), name) + } + return obj.(*corev1.Pod), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/podtemplate.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/podtemplate.go new file mode 100644 index 0000000000000..9e6ea8a0b58d9 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/podtemplate.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.PodTemplateLister = &PodTemplateClusterLister{} + +// PodTemplateClusterLister implements the corev1listers.PodTemplateLister interface. +type PodTemplateClusterLister struct { + indexer cache.Indexer +} + +// NewPodTemplateClusterLister returns a new PodTemplateClusterLister. +func NewPodTemplateClusterLister(indexer cache.Indexer) corev1listers.PodTemplateLister { + return &PodTemplateClusterLister{indexer: indexer} +} + +// List lists all corev1.PodTemplate in the indexer. +func (s PodTemplateClusterLister) List(selector labels.Selector) (ret []*corev1.PodTemplate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.PodTemplate)) + }) + return ret, err +} + +// PodTemplates returns an object that can list and get corev1.PodTemplate. +func (s PodTemplateClusterLister) PodTemplates(namespace string) corev1listers.PodTemplateNamespaceLister { + panic("Calling 'PodTemplates' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.PodTemplate. + +func (s PodTemplateClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.PodTemplateLister { + return &PodTemplateLister{indexer: s.indexer, cluster: cluster} +} + +// PodTemplateLister implements the corev1listers.PodTemplateLister interface. +type PodTemplateLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.PodTemplate in the indexer. +func (s PodTemplateLister) List(selector labels.Selector) (ret []*corev1.PodTemplate, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.PodTemplate) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// PodTemplates returns an object that can list and get corev1.PodTemplate. +func (s PodTemplateLister) PodTemplates(namespace string) corev1listers.PodTemplateNamespaceLister { + return &PodTemplateNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// PodTemplateNamespaceLister implements the corev1listers.PodTemplateNamespaceLister interface. +type PodTemplateNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.PodTemplate in the indexer for a given namespace. +func (s PodTemplateNamespaceLister) List(selector labels.Selector) (ret []*corev1.PodTemplate, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.PodTemplate) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.PodTemplate from the indexer for a given namespace and name. +func (s PodTemplateNamespaceLister) Get(name string) (*corev1.PodTemplate, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("PodTemplate"), name) + } + return obj.(*corev1.PodTemplate), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller.go new file mode 100644 index 0000000000000..9aa6a6eaa8d74 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.ReplicationControllerLister = &ReplicationControllerClusterLister{} + +// ReplicationControllerClusterLister implements the corev1listers.ReplicationControllerLister interface. +type ReplicationControllerClusterLister struct { + indexer cache.Indexer +} + +// NewReplicationControllerClusterLister returns a new ReplicationControllerClusterLister. +func NewReplicationControllerClusterLister(indexer cache.Indexer) corev1listers.ReplicationControllerLister { + return &ReplicationControllerClusterLister{indexer: indexer} +} + +// List lists all corev1.ReplicationController in the indexer. +func (s ReplicationControllerClusterLister) List(selector labels.Selector) (ret []*corev1.ReplicationController, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.ReplicationController)) + }) + return ret, err +} + +// ReplicationControllers returns an object that can list and get corev1.ReplicationController. +func (s ReplicationControllerClusterLister) ReplicationControllers(namespace string) corev1listers.ReplicationControllerNamespaceLister { + panic("Calling 'ReplicationControllers' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.ReplicationController. + +func (s ReplicationControllerClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.ReplicationControllerLister { + return &ReplicationControllerLister{indexer: s.indexer, cluster: cluster} +} + +// ReplicationControllerLister implements the corev1listers.ReplicationControllerLister interface. +type ReplicationControllerLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.ReplicationController in the indexer. +func (s ReplicationControllerLister) List(selector labels.Selector) (ret []*corev1.ReplicationController, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ReplicationController) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ReplicationControllers returns an object that can list and get corev1.ReplicationController. +func (s ReplicationControllerLister) ReplicationControllers(namespace string) corev1listers.ReplicationControllerNamespaceLister { + return &ReplicationControllerNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ReplicationControllerNamespaceLister implements the corev1listers.ReplicationControllerNamespaceLister interface. +type ReplicationControllerNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.ReplicationController in the indexer for a given namespace. +func (s ReplicationControllerNamespaceLister) List(selector labels.Selector) (ret []*corev1.ReplicationController, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ReplicationController) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.ReplicationController from the indexer for a given namespace and name. +func (s ReplicationControllerNamespaceLister) Get(name string) (*corev1.ReplicationController, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("ReplicationController"), name) + } + return obj.(*corev1.ReplicationController), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller_expansion.go new file mode 100644 index 0000000000000..af991e293300b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/replicationcontroller_expansion.go @@ -0,0 +1,60 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *ReplicationControllerClusterLister) GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) { + panic("Calling 'GetPodControllers' is not supported before scoping lister to a workspace") +} + +// GetPodControllers returns a list of ReplicationControllers that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicationControllers are found. +func (s *ReplicationControllerLister) GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no controllers found for pod %v because it has no labels", pod.Name) + } + + items, err := s.ReplicationControllers(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var controllers []*v1.ReplicationController + for i := range items { + rc := items[i] + selector := labels.Set(rc.Spec.Selector).AsSelectorPreValidated() + + // If an rc with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + controllers = append(controllers, rc) + } + + if len(controllers) == 0 { + return nil, fmt.Errorf("could not find controller for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return controllers, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/resourcequota.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/resourcequota.go new file mode 100644 index 0000000000000..198cbf8e142c9 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/resourcequota.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.ResourceQuotaLister = &ResourceQuotaClusterLister{} + +// ResourceQuotaClusterLister implements the corev1listers.ResourceQuotaLister interface. +type ResourceQuotaClusterLister struct { + indexer cache.Indexer +} + +// NewResourceQuotaClusterLister returns a new ResourceQuotaClusterLister. +func NewResourceQuotaClusterLister(indexer cache.Indexer) corev1listers.ResourceQuotaLister { + return &ResourceQuotaClusterLister{indexer: indexer} +} + +// List lists all corev1.ResourceQuota in the indexer. +func (s ResourceQuotaClusterLister) List(selector labels.Selector) (ret []*corev1.ResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.ResourceQuota)) + }) + return ret, err +} + +// ResourceQuotas returns an object that can list and get corev1.ResourceQuota. +func (s ResourceQuotaClusterLister) ResourceQuotas(namespace string) corev1listers.ResourceQuotaNamespaceLister { + panic("Calling 'ResourceQuotas' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.ResourceQuota. + +func (s ResourceQuotaClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.ResourceQuotaLister { + return &ResourceQuotaLister{indexer: s.indexer, cluster: cluster} +} + +// ResourceQuotaLister implements the corev1listers.ResourceQuotaLister interface. +type ResourceQuotaLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.ResourceQuota in the indexer. +func (s ResourceQuotaLister) List(selector labels.Selector) (ret []*corev1.ResourceQuota, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ResourceQuota) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ResourceQuotas returns an object that can list and get corev1.ResourceQuota. +func (s ResourceQuotaLister) ResourceQuotas(namespace string) corev1listers.ResourceQuotaNamespaceLister { + return &ResourceQuotaNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ResourceQuotaNamespaceLister implements the corev1listers.ResourceQuotaNamespaceLister interface. +type ResourceQuotaNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.ResourceQuota in the indexer for a given namespace. +func (s ResourceQuotaNamespaceLister) List(selector labels.Selector) (ret []*corev1.ResourceQuota, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ResourceQuota) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.ResourceQuota from the indexer for a given namespace and name. +func (s ResourceQuotaNamespaceLister) Get(name string) (*corev1.ResourceQuota, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("ResourceQuota"), name) + } + return obj.(*corev1.ResourceQuota), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/secret.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/secret.go new file mode 100644 index 0000000000000..7cb2fd81186ba --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/secret.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.SecretLister = &SecretClusterLister{} + +// SecretClusterLister implements the corev1listers.SecretLister interface. +type SecretClusterLister struct { + indexer cache.Indexer +} + +// NewSecretClusterLister returns a new SecretClusterLister. +func NewSecretClusterLister(indexer cache.Indexer) corev1listers.SecretLister { + return &SecretClusterLister{indexer: indexer} +} + +// List lists all corev1.Secret in the indexer. +func (s SecretClusterLister) List(selector labels.Selector) (ret []*corev1.Secret, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.Secret)) + }) + return ret, err +} + +// Secrets returns an object that can list and get corev1.Secret. +func (s SecretClusterLister) Secrets(namespace string) corev1listers.SecretNamespaceLister { + panic("Calling 'Secrets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.Secret. + +func (s SecretClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.SecretLister { + return &SecretLister{indexer: s.indexer, cluster: cluster} +} + +// SecretLister implements the corev1listers.SecretLister interface. +type SecretLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.Secret in the indexer. +func (s SecretLister) List(selector labels.Selector) (ret []*corev1.Secret, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Secret) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Secrets returns an object that can list and get corev1.Secret. +func (s SecretLister) Secrets(namespace string) corev1listers.SecretNamespaceLister { + return &SecretNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// SecretNamespaceLister implements the corev1listers.SecretNamespaceLister interface. +type SecretNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.Secret in the indexer for a given namespace. +func (s SecretNamespaceLister) List(selector labels.Selector) (ret []*corev1.Secret, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Secret) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.Secret from the indexer for a given namespace and name. +func (s SecretNamespaceLister) Get(name string) (*corev1.Secret, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("Secret"), name) + } + return obj.(*corev1.Secret), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/service.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/service.go new file mode 100644 index 0000000000000..51f8bc792d379 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/service.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.ServiceLister = &ServiceClusterLister{} + +// ServiceClusterLister implements the corev1listers.ServiceLister interface. +type ServiceClusterLister struct { + indexer cache.Indexer +} + +// NewServiceClusterLister returns a new ServiceClusterLister. +func NewServiceClusterLister(indexer cache.Indexer) corev1listers.ServiceLister { + return &ServiceClusterLister{indexer: indexer} +} + +// List lists all corev1.Service in the indexer. +func (s ServiceClusterLister) List(selector labels.Selector) (ret []*corev1.Service, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.Service)) + }) + return ret, err +} + +// Services returns an object that can list and get corev1.Service. +func (s ServiceClusterLister) Services(namespace string) corev1listers.ServiceNamespaceLister { + panic("Calling 'Services' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.Service. + +func (s ServiceClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.ServiceLister { + return &ServiceLister{indexer: s.indexer, cluster: cluster} +} + +// ServiceLister implements the corev1listers.ServiceLister interface. +type ServiceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.Service in the indexer. +func (s ServiceLister) List(selector labels.Selector) (ret []*corev1.Service, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Service) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Services returns an object that can list and get corev1.Service. +func (s ServiceLister) Services(namespace string) corev1listers.ServiceNamespaceLister { + return &ServiceNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ServiceNamespaceLister implements the corev1listers.ServiceNamespaceLister interface. +type ServiceNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.Service in the indexer for a given namespace. +func (s ServiceNamespaceLister) List(selector labels.Selector) (ret []*corev1.Service, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.Service) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.Service from the indexer for a given namespace and name. +func (s ServiceNamespaceLister) Get(name string) (*corev1.Service, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("Service"), name) + } + return obj.(*corev1.Service), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/core/v1/serviceaccount.go b/staging/src/k8s.io/client-go/kcp/listers/core/v1/serviceaccount.go new file mode 100644 index 0000000000000..99d13cdb51272 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/core/v1/serviceaccount.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" +) + +var _ corev1listers.ServiceAccountLister = &ServiceAccountClusterLister{} + +// ServiceAccountClusterLister implements the corev1listers.ServiceAccountLister interface. +type ServiceAccountClusterLister struct { + indexer cache.Indexer +} + +// NewServiceAccountClusterLister returns a new ServiceAccountClusterLister. +func NewServiceAccountClusterLister(indexer cache.Indexer) corev1listers.ServiceAccountLister { + return &ServiceAccountClusterLister{indexer: indexer} +} + +// List lists all corev1.ServiceAccount in the indexer. +func (s ServiceAccountClusterLister) List(selector labels.Selector) (ret []*corev1.ServiceAccount, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*corev1.ServiceAccount)) + }) + return ret, err +} + +// ServiceAccounts returns an object that can list and get corev1.ServiceAccount. +func (s ServiceAccountClusterLister) ServiceAccounts(namespace string) corev1listers.ServiceAccountNamespaceLister { + panic("Calling 'ServiceAccounts' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get corev1.ServiceAccount. + +func (s ServiceAccountClusterLister) Cluster(cluster logicalcluster.Name) corev1listers.ServiceAccountLister { + return &ServiceAccountLister{indexer: s.indexer, cluster: cluster} +} + +// ServiceAccountLister implements the corev1listers.ServiceAccountLister interface. +type ServiceAccountLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all corev1.ServiceAccount in the indexer. +func (s ServiceAccountLister) List(selector labels.Selector) (ret []*corev1.ServiceAccount, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ServiceAccount) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ServiceAccounts returns an object that can list and get corev1.ServiceAccount. +func (s ServiceAccountLister) ServiceAccounts(namespace string) corev1listers.ServiceAccountNamespaceLister { + return &ServiceAccountNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ServiceAccountNamespaceLister implements the corev1listers.ServiceAccountNamespaceLister interface. +type ServiceAccountNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all corev1.ServiceAccount in the indexer for a given namespace. +func (s ServiceAccountNamespaceLister) List(selector labels.Selector) (ret []*corev1.ServiceAccount, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*corev1.ServiceAccount) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the corev1.ServiceAccount from the indexer for a given namespace and name. +func (s ServiceAccountNamespaceLister) Get(name string) (*corev1.ServiceAccount, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(corev1.Resource("ServiceAccount"), name) + } + return obj.(*corev1.ServiceAccount), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/discovery/v1/endpointslice.go b/staging/src/k8s.io/client-go/kcp/listers/discovery/v1/endpointslice.go new file mode 100644 index 0000000000000..c3195ca703c52 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/discovery/v1/endpointslice.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + discoveryv1 "k8s.io/api/discovery/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + discoveryv1listers "k8s.io/client-go/listers/discovery/v1" + "k8s.io/client-go/tools/cache" +) + +var _ discoveryv1listers.EndpointSliceLister = &EndpointSliceClusterLister{} + +// EndpointSliceClusterLister implements the discoveryv1listers.EndpointSliceLister interface. +type EndpointSliceClusterLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceClusterLister returns a new EndpointSliceClusterLister. +func NewEndpointSliceClusterLister(indexer cache.Indexer) discoveryv1listers.EndpointSliceLister { + return &EndpointSliceClusterLister{indexer: indexer} +} + +// List lists all discoveryv1.EndpointSlice in the indexer. +func (s EndpointSliceClusterLister) List(selector labels.Selector) (ret []*discoveryv1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*discoveryv1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get discoveryv1.EndpointSlice. +func (s EndpointSliceClusterLister) EndpointSlices(namespace string) discoveryv1listers.EndpointSliceNamespaceLister { + panic("Calling 'EndpointSlices' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get discoveryv1.EndpointSlice. + +func (s EndpointSliceClusterLister) Cluster(cluster logicalcluster.Name) discoveryv1listers.EndpointSliceLister { + return &EndpointSliceLister{indexer: s.indexer, cluster: cluster} +} + +// EndpointSliceLister implements the discoveryv1listers.EndpointSliceLister interface. +type EndpointSliceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all discoveryv1.EndpointSlice in the indexer. +func (s EndpointSliceLister) List(selector labels.Selector) (ret []*discoveryv1.EndpointSlice, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*discoveryv1.EndpointSlice) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// EndpointSlices returns an object that can list and get discoveryv1.EndpointSlice. +func (s EndpointSliceLister) EndpointSlices(namespace string) discoveryv1listers.EndpointSliceNamespaceLister { + return &EndpointSliceNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// EndpointSliceNamespaceLister implements the discoveryv1listers.EndpointSliceNamespaceLister interface. +type EndpointSliceNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all discoveryv1.EndpointSlice in the indexer for a given namespace. +func (s EndpointSliceNamespaceLister) List(selector labels.Selector) (ret []*discoveryv1.EndpointSlice, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*discoveryv1.EndpointSlice) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the discoveryv1.EndpointSlice from the indexer for a given namespace and name. +func (s EndpointSliceNamespaceLister) Get(name string) (*discoveryv1.EndpointSlice, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(discoveryv1.Resource("EndpointSlice"), name) + } + return obj.(*discoveryv1.EndpointSlice), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/discovery/v1beta1/endpointslice.go b/staging/src/k8s.io/client-go/kcp/listers/discovery/v1beta1/endpointslice.go new file mode 100644 index 0000000000000..cc804823720aa --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/discovery/v1beta1/endpointslice.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + discoveryv1beta1listers "k8s.io/client-go/listers/discovery/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ discoveryv1beta1listers.EndpointSliceLister = &EndpointSliceClusterLister{} + +// EndpointSliceClusterLister implements the discoveryv1beta1listers.EndpointSliceLister interface. +type EndpointSliceClusterLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceClusterLister returns a new EndpointSliceClusterLister. +func NewEndpointSliceClusterLister(indexer cache.Indexer) discoveryv1beta1listers.EndpointSliceLister { + return &EndpointSliceClusterLister{indexer: indexer} +} + +// List lists all discoveryv1beta1.EndpointSlice in the indexer. +func (s EndpointSliceClusterLister) List(selector labels.Selector) (ret []*discoveryv1beta1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*discoveryv1beta1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get discoveryv1beta1.EndpointSlice. +func (s EndpointSliceClusterLister) EndpointSlices(namespace string) discoveryv1beta1listers.EndpointSliceNamespaceLister { + panic("Calling 'EndpointSlices' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get discoveryv1beta1.EndpointSlice. + +func (s EndpointSliceClusterLister) Cluster(cluster logicalcluster.Name) discoveryv1beta1listers.EndpointSliceLister { + return &EndpointSliceLister{indexer: s.indexer, cluster: cluster} +} + +// EndpointSliceLister implements the discoveryv1beta1listers.EndpointSliceLister interface. +type EndpointSliceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all discoveryv1beta1.EndpointSlice in the indexer. +func (s EndpointSliceLister) List(selector labels.Selector) (ret []*discoveryv1beta1.EndpointSlice, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*discoveryv1beta1.EndpointSlice) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// EndpointSlices returns an object that can list and get discoveryv1beta1.EndpointSlice. +func (s EndpointSliceLister) EndpointSlices(namespace string) discoveryv1beta1listers.EndpointSliceNamespaceLister { + return &EndpointSliceNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// EndpointSliceNamespaceLister implements the discoveryv1beta1listers.EndpointSliceNamespaceLister interface. +type EndpointSliceNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all discoveryv1beta1.EndpointSlice in the indexer for a given namespace. +func (s EndpointSliceNamespaceLister) List(selector labels.Selector) (ret []*discoveryv1beta1.EndpointSlice, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*discoveryv1beta1.EndpointSlice) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the discoveryv1beta1.EndpointSlice from the indexer for a given namespace and name. +func (s EndpointSliceNamespaceLister) Get(name string) (*discoveryv1beta1.EndpointSlice, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(discoveryv1beta1.Resource("EndpointSlice"), name) + } + return obj.(*discoveryv1beta1.EndpointSlice), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/events/v1/event.go b/staging/src/k8s.io/client-go/kcp/listers/events/v1/event.go new file mode 100644 index 0000000000000..92391ca853b8f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/events/v1/event.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + eventsv1 "k8s.io/api/events/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + eventsv1listers "k8s.io/client-go/listers/events/v1" + "k8s.io/client-go/tools/cache" +) + +var _ eventsv1listers.EventLister = &EventClusterLister{} + +// EventClusterLister implements the eventsv1listers.EventLister interface. +type EventClusterLister struct { + indexer cache.Indexer +} + +// NewEventClusterLister returns a new EventClusterLister. +func NewEventClusterLister(indexer cache.Indexer) eventsv1listers.EventLister { + return &EventClusterLister{indexer: indexer} +} + +// List lists all eventsv1.Event in the indexer. +func (s EventClusterLister) List(selector labels.Selector) (ret []*eventsv1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*eventsv1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get eventsv1.Event. +func (s EventClusterLister) Events(namespace string) eventsv1listers.EventNamespaceLister { + panic("Calling 'Events' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get eventsv1.Event. + +func (s EventClusterLister) Cluster(cluster logicalcluster.Name) eventsv1listers.EventLister { + return &EventLister{indexer: s.indexer, cluster: cluster} +} + +// EventLister implements the eventsv1listers.EventLister interface. +type EventLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all eventsv1.Event in the indexer. +func (s EventLister) List(selector labels.Selector) (ret []*eventsv1.Event, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*eventsv1.Event) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Events returns an object that can list and get eventsv1.Event. +func (s EventLister) Events(namespace string) eventsv1listers.EventNamespaceLister { + return &EventNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// EventNamespaceLister implements the eventsv1listers.EventNamespaceLister interface. +type EventNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all eventsv1.Event in the indexer for a given namespace. +func (s EventNamespaceLister) List(selector labels.Selector) (ret []*eventsv1.Event, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*eventsv1.Event) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the eventsv1.Event from the indexer for a given namespace and name. +func (s EventNamespaceLister) Get(name string) (*eventsv1.Event, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(eventsv1.Resource("Event"), name) + } + return obj.(*eventsv1.Event), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/events/v1beta1/event.go b/staging/src/k8s.io/client-go/kcp/listers/events/v1beta1/event.go new file mode 100644 index 0000000000000..b6f916d78c7ce --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/events/v1beta1/event.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + eventsv1beta1 "k8s.io/api/events/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + eventsv1beta1listers "k8s.io/client-go/listers/events/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ eventsv1beta1listers.EventLister = &EventClusterLister{} + +// EventClusterLister implements the eventsv1beta1listers.EventLister interface. +type EventClusterLister struct { + indexer cache.Indexer +} + +// NewEventClusterLister returns a new EventClusterLister. +func NewEventClusterLister(indexer cache.Indexer) eventsv1beta1listers.EventLister { + return &EventClusterLister{indexer: indexer} +} + +// List lists all eventsv1beta1.Event in the indexer. +func (s EventClusterLister) List(selector labels.Selector) (ret []*eventsv1beta1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*eventsv1beta1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get eventsv1beta1.Event. +func (s EventClusterLister) Events(namespace string) eventsv1beta1listers.EventNamespaceLister { + panic("Calling 'Events' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get eventsv1beta1.Event. + +func (s EventClusterLister) Cluster(cluster logicalcluster.Name) eventsv1beta1listers.EventLister { + return &EventLister{indexer: s.indexer, cluster: cluster} +} + +// EventLister implements the eventsv1beta1listers.EventLister interface. +type EventLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all eventsv1beta1.Event in the indexer. +func (s EventLister) List(selector labels.Selector) (ret []*eventsv1beta1.Event, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*eventsv1beta1.Event) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Events returns an object that can list and get eventsv1beta1.Event. +func (s EventLister) Events(namespace string) eventsv1beta1listers.EventNamespaceLister { + return &EventNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// EventNamespaceLister implements the eventsv1beta1listers.EventNamespaceLister interface. +type EventNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all eventsv1beta1.Event in the indexer for a given namespace. +func (s EventNamespaceLister) List(selector labels.Selector) (ret []*eventsv1beta1.Event, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*eventsv1beta1.Event) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the eventsv1beta1.Event from the indexer for a given namespace and name. +func (s EventNamespaceLister) Get(name string) (*eventsv1beta1.Event, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(eventsv1beta1.Resource("Event"), name) + } + return obj.(*eventsv1beta1.Event), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset.go new file mode 100644 index 0000000000000..4d2e5f0edeb11 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ extensionsv1beta1listers.DaemonSetLister = &DaemonSetClusterLister{} + +// DaemonSetClusterLister implements the extensionsv1beta1listers.DaemonSetLister interface. +type DaemonSetClusterLister struct { + indexer cache.Indexer +} + +// NewDaemonSetClusterLister returns a new DaemonSetClusterLister. +func NewDaemonSetClusterLister(indexer cache.Indexer) extensionsv1beta1listers.DaemonSetLister { + return &DaemonSetClusterLister{indexer: indexer} +} + +// List lists all extensionsv1beta1.DaemonSet in the indexer. +func (s DaemonSetClusterLister) List(selector labels.Selector) (ret []*extensionsv1beta1.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*extensionsv1beta1.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get extensionsv1beta1.DaemonSet. +func (s DaemonSetClusterLister) DaemonSets(namespace string) extensionsv1beta1listers.DaemonSetNamespaceLister { + panic("Calling 'DaemonSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get extensionsv1beta1.DaemonSet. + +func (s DaemonSetClusterLister) Cluster(cluster logicalcluster.Name) extensionsv1beta1listers.DaemonSetLister { + return &DaemonSetLister{indexer: s.indexer, cluster: cluster} +} + +// DaemonSetLister implements the extensionsv1beta1listers.DaemonSetLister interface. +type DaemonSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all extensionsv1beta1.DaemonSet in the indexer. +func (s DaemonSetLister) List(selector labels.Selector) (ret []*extensionsv1beta1.DaemonSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.DaemonSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// DaemonSets returns an object that can list and get extensionsv1beta1.DaemonSet. +func (s DaemonSetLister) DaemonSets(namespace string) extensionsv1beta1listers.DaemonSetNamespaceLister { + return &DaemonSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// DaemonSetNamespaceLister implements the extensionsv1beta1listers.DaemonSetNamespaceLister interface. +type DaemonSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all extensionsv1beta1.DaemonSet in the indexer for a given namespace. +func (s DaemonSetNamespaceLister) List(selector labels.Selector) (ret []*extensionsv1beta1.DaemonSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.DaemonSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the extensionsv1beta1.DaemonSet from the indexer for a given namespace and name. +func (s DaemonSetNamespaceLister) Get(name string) (*extensionsv1beta1.DaemonSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(extensionsv1beta1.Resource("DaemonSet"), name) + } + return obj.(*extensionsv1beta1.DaemonSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset_expansion.go new file mode 100644 index 0000000000000..5b67cf54b8570 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/daemonset_expansion.go @@ -0,0 +1,112 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta1" + v1 "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *DaemonSetClusterLister) GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) { + panic("Calling 'GetPodDaemonSets' is not supported before scoping lister to a workspace") +} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *DaemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) { + var selector labels.Selector + var daemonSet *v1beta1.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*v1beta1.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +func (s *DaemonSetClusterLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) { + panic("Calling 'GetHistoryDaemonSets' is not supported before scoping lister to a workspace") +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *DaemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*v1beta1.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the history object + continue + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/deployment.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/deployment.go new file mode 100644 index 0000000000000..c7995c0af86d0 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/deployment.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ extensionsv1beta1listers.DeploymentLister = &DeploymentClusterLister{} + +// DeploymentClusterLister implements the extensionsv1beta1listers.DeploymentLister interface. +type DeploymentClusterLister struct { + indexer cache.Indexer +} + +// NewDeploymentClusterLister returns a new DeploymentClusterLister. +func NewDeploymentClusterLister(indexer cache.Indexer) extensionsv1beta1listers.DeploymentLister { + return &DeploymentClusterLister{indexer: indexer} +} + +// List lists all extensionsv1beta1.Deployment in the indexer. +func (s DeploymentClusterLister) List(selector labels.Selector) (ret []*extensionsv1beta1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*extensionsv1beta1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get extensionsv1beta1.Deployment. +func (s DeploymentClusterLister) Deployments(namespace string) extensionsv1beta1listers.DeploymentNamespaceLister { + panic("Calling 'Deployments' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get extensionsv1beta1.Deployment. + +func (s DeploymentClusterLister) Cluster(cluster logicalcluster.Name) extensionsv1beta1listers.DeploymentLister { + return &DeploymentLister{indexer: s.indexer, cluster: cluster} +} + +// DeploymentLister implements the extensionsv1beta1listers.DeploymentLister interface. +type DeploymentLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all extensionsv1beta1.Deployment in the indexer. +func (s DeploymentLister) List(selector labels.Selector) (ret []*extensionsv1beta1.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Deployments returns an object that can list and get extensionsv1beta1.Deployment. +func (s DeploymentLister) Deployments(namespace string) extensionsv1beta1listers.DeploymentNamespaceLister { + return &DeploymentNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// DeploymentNamespaceLister implements the extensionsv1beta1listers.DeploymentNamespaceLister interface. +type DeploymentNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all extensionsv1beta1.Deployment in the indexer for a given namespace. +func (s DeploymentNamespaceLister) List(selector labels.Selector) (ret []*extensionsv1beta1.Deployment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.Deployment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the extensionsv1beta1.Deployment from the indexer for a given namespace and name. +func (s DeploymentNamespaceLister) Get(name string) (*extensionsv1beta1.Deployment, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(extensionsv1beta1.Resource("Deployment"), name) + } + return obj.(*extensionsv1beta1.Deployment), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/ingress.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/ingress.go new file mode 100644 index 0000000000000..80358196c931a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/ingress.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ extensionsv1beta1listers.IngressLister = &IngressClusterLister{} + +// IngressClusterLister implements the extensionsv1beta1listers.IngressLister interface. +type IngressClusterLister struct { + indexer cache.Indexer +} + +// NewIngressClusterLister returns a new IngressClusterLister. +func NewIngressClusterLister(indexer cache.Indexer) extensionsv1beta1listers.IngressLister { + return &IngressClusterLister{indexer: indexer} +} + +// List lists all extensionsv1beta1.Ingress in the indexer. +func (s IngressClusterLister) List(selector labels.Selector) (ret []*extensionsv1beta1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*extensionsv1beta1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get extensionsv1beta1.Ingress. +func (s IngressClusterLister) Ingresses(namespace string) extensionsv1beta1listers.IngressNamespaceLister { + panic("Calling 'Ingresses' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get extensionsv1beta1.Ingress. + +func (s IngressClusterLister) Cluster(cluster logicalcluster.Name) extensionsv1beta1listers.IngressLister { + return &IngressLister{indexer: s.indexer, cluster: cluster} +} + +// IngressLister implements the extensionsv1beta1listers.IngressLister interface. +type IngressLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all extensionsv1beta1.Ingress in the indexer. +func (s IngressLister) List(selector labels.Selector) (ret []*extensionsv1beta1.Ingress, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.Ingress) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Ingresses returns an object that can list and get extensionsv1beta1.Ingress. +func (s IngressLister) Ingresses(namespace string) extensionsv1beta1listers.IngressNamespaceLister { + return &IngressNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// IngressNamespaceLister implements the extensionsv1beta1listers.IngressNamespaceLister interface. +type IngressNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all extensionsv1beta1.Ingress in the indexer for a given namespace. +func (s IngressNamespaceLister) List(selector labels.Selector) (ret []*extensionsv1beta1.Ingress, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.Ingress) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the extensionsv1beta1.Ingress from the indexer for a given namespace and name. +func (s IngressNamespaceLister) Get(name string) (*extensionsv1beta1.Ingress, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(extensionsv1beta1.Resource("Ingress"), name) + } + return obj.(*extensionsv1beta1.Ingress), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/networkpolicy.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/networkpolicy.go new file mode 100644 index 0000000000000..985a3d5438380 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/networkpolicy.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ extensionsv1beta1listers.NetworkPolicyLister = &NetworkPolicyClusterLister{} + +// NetworkPolicyClusterLister implements the extensionsv1beta1listers.NetworkPolicyLister interface. +type NetworkPolicyClusterLister struct { + indexer cache.Indexer +} + +// NewNetworkPolicyClusterLister returns a new NetworkPolicyClusterLister. +func NewNetworkPolicyClusterLister(indexer cache.Indexer) extensionsv1beta1listers.NetworkPolicyLister { + return &NetworkPolicyClusterLister{indexer: indexer} +} + +// List lists all extensionsv1beta1.NetworkPolicy in the indexer. +func (s NetworkPolicyClusterLister) List(selector labels.Selector) (ret []*extensionsv1beta1.NetworkPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*extensionsv1beta1.NetworkPolicy)) + }) + return ret, err +} + +// NetworkPolicies returns an object that can list and get extensionsv1beta1.NetworkPolicy. +func (s NetworkPolicyClusterLister) NetworkPolicies(namespace string) extensionsv1beta1listers.NetworkPolicyNamespaceLister { + panic("Calling 'NetworkPolicies' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get extensionsv1beta1.NetworkPolicy. + +func (s NetworkPolicyClusterLister) Cluster(cluster logicalcluster.Name) extensionsv1beta1listers.NetworkPolicyLister { + return &NetworkPolicyLister{indexer: s.indexer, cluster: cluster} +} + +// NetworkPolicyLister implements the extensionsv1beta1listers.NetworkPolicyLister interface. +type NetworkPolicyLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all extensionsv1beta1.NetworkPolicy in the indexer. +func (s NetworkPolicyLister) List(selector labels.Selector) (ret []*extensionsv1beta1.NetworkPolicy, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.NetworkPolicy) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// NetworkPolicies returns an object that can list and get extensionsv1beta1.NetworkPolicy. +func (s NetworkPolicyLister) NetworkPolicies(namespace string) extensionsv1beta1listers.NetworkPolicyNamespaceLister { + return &NetworkPolicyNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// NetworkPolicyNamespaceLister implements the extensionsv1beta1listers.NetworkPolicyNamespaceLister interface. +type NetworkPolicyNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all extensionsv1beta1.NetworkPolicy in the indexer for a given namespace. +func (s NetworkPolicyNamespaceLister) List(selector labels.Selector) (ret []*extensionsv1beta1.NetworkPolicy, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.NetworkPolicy) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the extensionsv1beta1.NetworkPolicy from the indexer for a given namespace and name. +func (s NetworkPolicyNamespaceLister) Get(name string) (*extensionsv1beta1.NetworkPolicy, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(extensionsv1beta1.Resource("NetworkPolicy"), name) + } + return obj.(*extensionsv1beta1.NetworkPolicy), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/podsecuritypolicy.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/podsecuritypolicy.go new file mode 100644 index 0000000000000..35afad3699e24 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/podsecuritypolicy.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ extensionsv1beta1listers.PodSecurityPolicyLister = &PodSecurityPolicyClusterLister{} + +// PodSecurityPolicyClusterLister implements the extensionsv1beta1listers.PodSecurityPolicyLister interface. +type PodSecurityPolicyClusterLister struct { + indexer cache.Indexer +} + +// NewPodSecurityPolicyClusterLister returns a new PodSecurityPolicyClusterLister. +func NewPodSecurityPolicyClusterLister(indexer cache.Indexer) extensionsv1beta1listers.PodSecurityPolicyLister { + return &PodSecurityPolicyClusterLister{indexer: indexer} +} + +// List lists all extensionsv1beta1.PodSecurityPolicy in the indexer. +func (s PodSecurityPolicyClusterLister) List(selector labels.Selector) (ret []*extensionsv1beta1.PodSecurityPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*extensionsv1beta1.PodSecurityPolicy)) + }) + return ret, err +} + +// Get retrieves the extensionsv1beta1.PodSecurityPolicy from the indexer for a given name. +func (s PodSecurityPolicyClusterLister) Get(name string) (*extensionsv1beta1.PodSecurityPolicy, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get extensionsv1beta1.PodSecurityPolicy. + +func (s PodSecurityPolicyClusterLister) Cluster(cluster logicalcluster.Name) extensionsv1beta1listers.PodSecurityPolicyLister { + return &PodSecurityPolicyLister{indexer: s.indexer, cluster: cluster} +} + +// PodSecurityPolicyLister implements the extensionsv1beta1listers.PodSecurityPolicyLister interface. +type PodSecurityPolicyLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all extensionsv1beta1.PodSecurityPolicy in the indexer. +func (s PodSecurityPolicyLister) List(selector labels.Selector) (ret []*extensionsv1beta1.PodSecurityPolicy, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.PodSecurityPolicy) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the extensionsv1beta1.PodSecurityPolicy from the indexer for a given name. +func (s PodSecurityPolicyLister) Get(name string) (*extensionsv1beta1.PodSecurityPolicy, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(extensionsv1beta1.Resource("PodSecurityPolicy"), name) + } + return obj.(*extensionsv1beta1.PodSecurityPolicy), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset.go new file mode 100644 index 0000000000000..d00c41f69460f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + extensionsv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ extensionsv1beta1listers.ReplicaSetLister = &ReplicaSetClusterLister{} + +// ReplicaSetClusterLister implements the extensionsv1beta1listers.ReplicaSetLister interface. +type ReplicaSetClusterLister struct { + indexer cache.Indexer +} + +// NewReplicaSetClusterLister returns a new ReplicaSetClusterLister. +func NewReplicaSetClusterLister(indexer cache.Indexer) extensionsv1beta1listers.ReplicaSetLister { + return &ReplicaSetClusterLister{indexer: indexer} +} + +// List lists all extensionsv1beta1.ReplicaSet in the indexer. +func (s ReplicaSetClusterLister) List(selector labels.Selector) (ret []*extensionsv1beta1.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*extensionsv1beta1.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get extensionsv1beta1.ReplicaSet. +func (s ReplicaSetClusterLister) ReplicaSets(namespace string) extensionsv1beta1listers.ReplicaSetNamespaceLister { + panic("Calling 'ReplicaSets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get extensionsv1beta1.ReplicaSet. + +func (s ReplicaSetClusterLister) Cluster(cluster logicalcluster.Name) extensionsv1beta1listers.ReplicaSetLister { + return &ReplicaSetLister{indexer: s.indexer, cluster: cluster} +} + +// ReplicaSetLister implements the extensionsv1beta1listers.ReplicaSetLister interface. +type ReplicaSetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all extensionsv1beta1.ReplicaSet in the indexer. +func (s ReplicaSetLister) List(selector labels.Selector) (ret []*extensionsv1beta1.ReplicaSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.ReplicaSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// ReplicaSets returns an object that can list and get extensionsv1beta1.ReplicaSet. +func (s ReplicaSetLister) ReplicaSets(namespace string) extensionsv1beta1listers.ReplicaSetNamespaceLister { + return &ReplicaSetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// ReplicaSetNamespaceLister implements the extensionsv1beta1listers.ReplicaSetNamespaceLister interface. +type ReplicaSetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all extensionsv1beta1.ReplicaSet in the indexer for a given namespace. +func (s ReplicaSetNamespaceLister) List(selector labels.Selector) (ret []*extensionsv1beta1.ReplicaSet, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*extensionsv1beta1.ReplicaSet) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the extensionsv1beta1.ReplicaSet from the indexer for a given namespace and name. +func (s ReplicaSetNamespaceLister) Get(name string) (*extensionsv1beta1.ReplicaSet, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(extensionsv1beta1.Resource("ReplicaSet"), name) + } + return obj.(*extensionsv1beta1.ReplicaSet), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset_expansion.go new file mode 100644 index 0000000000000..88043c0fec1ed --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/extensions/v1beta1/replicaset_expansion.go @@ -0,0 +1,68 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + extensions "k8s.io/api/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *ReplicaSetClusterLister) GetPodReplicaSets(pod *v1.Pod) ([]*extensions.ReplicaSet, error) { + panic("Calling 'GetPodReplicaSets' is not supported before scoping lister to a workspace") +} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *ReplicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*extensions.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*extensions.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/flowschema.go b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/flowschema.go new file mode 100644 index 0000000000000..f4eac4ec502f5 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/flowschema.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + flowcontrolv1alpha1listers "k8s.io/client-go/listers/flowcontrol/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ flowcontrolv1alpha1listers.FlowSchemaLister = &FlowSchemaClusterLister{} + +// FlowSchemaClusterLister implements the flowcontrolv1alpha1listers.FlowSchemaLister interface. +type FlowSchemaClusterLister struct { + indexer cache.Indexer +} + +// NewFlowSchemaClusterLister returns a new FlowSchemaClusterLister. +func NewFlowSchemaClusterLister(indexer cache.Indexer) flowcontrolv1alpha1listers.FlowSchemaLister { + return &FlowSchemaClusterLister{indexer: indexer} +} + +// List lists all flowcontrolv1alpha1.FlowSchema in the indexer. +func (s FlowSchemaClusterLister) List(selector labels.Selector) (ret []*flowcontrolv1alpha1.FlowSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*flowcontrolv1alpha1.FlowSchema)) + }) + return ret, err +} + +// Get retrieves the flowcontrolv1alpha1.FlowSchema from the indexer for a given name. +func (s FlowSchemaClusterLister) Get(name string) (*flowcontrolv1alpha1.FlowSchema, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get flowcontrolv1alpha1.FlowSchema. + +func (s FlowSchemaClusterLister) Cluster(cluster logicalcluster.Name) flowcontrolv1alpha1listers.FlowSchemaLister { + return &FlowSchemaLister{indexer: s.indexer, cluster: cluster} +} + +// FlowSchemaLister implements the flowcontrolv1alpha1listers.FlowSchemaLister interface. +type FlowSchemaLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all flowcontrolv1alpha1.FlowSchema in the indexer. +func (s FlowSchemaLister) List(selector labels.Selector) (ret []*flowcontrolv1alpha1.FlowSchema, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*flowcontrolv1alpha1.FlowSchema) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the flowcontrolv1alpha1.FlowSchema from the indexer for a given name. +func (s FlowSchemaLister) Get(name string) (*flowcontrolv1alpha1.FlowSchema, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(flowcontrolv1alpha1.Resource("FlowSchema"), name) + } + return obj.(*flowcontrolv1alpha1.FlowSchema), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go new file mode 100644 index 0000000000000..806d4d1567e1b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + flowcontrolv1alpha1listers "k8s.io/client-go/listers/flowcontrol/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ flowcontrolv1alpha1listers.PriorityLevelConfigurationLister = &PriorityLevelConfigurationClusterLister{} + +// PriorityLevelConfigurationClusterLister implements the flowcontrolv1alpha1listers.PriorityLevelConfigurationLister interface. +type PriorityLevelConfigurationClusterLister struct { + indexer cache.Indexer +} + +// NewPriorityLevelConfigurationClusterLister returns a new PriorityLevelConfigurationClusterLister. +func NewPriorityLevelConfigurationClusterLister(indexer cache.Indexer) flowcontrolv1alpha1listers.PriorityLevelConfigurationLister { + return &PriorityLevelConfigurationClusterLister{indexer: indexer} +} + +// List lists all flowcontrolv1alpha1.PriorityLevelConfiguration in the indexer. +func (s PriorityLevelConfigurationClusterLister) List(selector labels.Selector) (ret []*flowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*flowcontrolv1alpha1.PriorityLevelConfiguration)) + }) + return ret, err +} + +// Get retrieves the flowcontrolv1alpha1.PriorityLevelConfiguration from the indexer for a given name. +func (s PriorityLevelConfigurationClusterLister) Get(name string) (*flowcontrolv1alpha1.PriorityLevelConfiguration, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get flowcontrolv1alpha1.PriorityLevelConfiguration. + +func (s PriorityLevelConfigurationClusterLister) Cluster(cluster logicalcluster.Name) flowcontrolv1alpha1listers.PriorityLevelConfigurationLister { + return &PriorityLevelConfigurationLister{indexer: s.indexer, cluster: cluster} +} + +// PriorityLevelConfigurationLister implements the flowcontrolv1alpha1listers.PriorityLevelConfigurationLister interface. +type PriorityLevelConfigurationLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all flowcontrolv1alpha1.PriorityLevelConfiguration in the indexer. +func (s PriorityLevelConfigurationLister) List(selector labels.Selector) (ret []*flowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*flowcontrolv1alpha1.PriorityLevelConfiguration) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the flowcontrolv1alpha1.PriorityLevelConfiguration from the indexer for a given name. +func (s PriorityLevelConfigurationLister) Get(name string) (*flowcontrolv1alpha1.PriorityLevelConfiguration, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(flowcontrolv1alpha1.Resource("PriorityLevelConfiguration"), name) + } + return obj.(*flowcontrolv1alpha1.PriorityLevelConfiguration), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/flowschema.go b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/flowschema.go new file mode 100644 index 0000000000000..a7f0719460e09 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/flowschema.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + flowcontrolv1beta1listers "k8s.io/client-go/listers/flowcontrol/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ flowcontrolv1beta1listers.FlowSchemaLister = &FlowSchemaClusterLister{} + +// FlowSchemaClusterLister implements the flowcontrolv1beta1listers.FlowSchemaLister interface. +type FlowSchemaClusterLister struct { + indexer cache.Indexer +} + +// NewFlowSchemaClusterLister returns a new FlowSchemaClusterLister. +func NewFlowSchemaClusterLister(indexer cache.Indexer) flowcontrolv1beta1listers.FlowSchemaLister { + return &FlowSchemaClusterLister{indexer: indexer} +} + +// List lists all flowcontrolv1beta1.FlowSchema in the indexer. +func (s FlowSchemaClusterLister) List(selector labels.Selector) (ret []*flowcontrolv1beta1.FlowSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*flowcontrolv1beta1.FlowSchema)) + }) + return ret, err +} + +// Get retrieves the flowcontrolv1beta1.FlowSchema from the indexer for a given name. +func (s FlowSchemaClusterLister) Get(name string) (*flowcontrolv1beta1.FlowSchema, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get flowcontrolv1beta1.FlowSchema. + +func (s FlowSchemaClusterLister) Cluster(cluster logicalcluster.Name) flowcontrolv1beta1listers.FlowSchemaLister { + return &FlowSchemaLister{indexer: s.indexer, cluster: cluster} +} + +// FlowSchemaLister implements the flowcontrolv1beta1listers.FlowSchemaLister interface. +type FlowSchemaLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all flowcontrolv1beta1.FlowSchema in the indexer. +func (s FlowSchemaLister) List(selector labels.Selector) (ret []*flowcontrolv1beta1.FlowSchema, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*flowcontrolv1beta1.FlowSchema) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the flowcontrolv1beta1.FlowSchema from the indexer for a given name. +func (s FlowSchemaLister) Get(name string) (*flowcontrolv1beta1.FlowSchema, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(flowcontrolv1beta1.Resource("FlowSchema"), name) + } + return obj.(*flowcontrolv1beta1.FlowSchema), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go new file mode 100644 index 0000000000000..13123364fb1f2 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + flowcontrolv1beta1listers "k8s.io/client-go/listers/flowcontrol/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ flowcontrolv1beta1listers.PriorityLevelConfigurationLister = &PriorityLevelConfigurationClusterLister{} + +// PriorityLevelConfigurationClusterLister implements the flowcontrolv1beta1listers.PriorityLevelConfigurationLister interface. +type PriorityLevelConfigurationClusterLister struct { + indexer cache.Indexer +} + +// NewPriorityLevelConfigurationClusterLister returns a new PriorityLevelConfigurationClusterLister. +func NewPriorityLevelConfigurationClusterLister(indexer cache.Indexer) flowcontrolv1beta1listers.PriorityLevelConfigurationLister { + return &PriorityLevelConfigurationClusterLister{indexer: indexer} +} + +// List lists all flowcontrolv1beta1.PriorityLevelConfiguration in the indexer. +func (s PriorityLevelConfigurationClusterLister) List(selector labels.Selector) (ret []*flowcontrolv1beta1.PriorityLevelConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*flowcontrolv1beta1.PriorityLevelConfiguration)) + }) + return ret, err +} + +// Get retrieves the flowcontrolv1beta1.PriorityLevelConfiguration from the indexer for a given name. +func (s PriorityLevelConfigurationClusterLister) Get(name string) (*flowcontrolv1beta1.PriorityLevelConfiguration, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get flowcontrolv1beta1.PriorityLevelConfiguration. + +func (s PriorityLevelConfigurationClusterLister) Cluster(cluster logicalcluster.Name) flowcontrolv1beta1listers.PriorityLevelConfigurationLister { + return &PriorityLevelConfigurationLister{indexer: s.indexer, cluster: cluster} +} + +// PriorityLevelConfigurationLister implements the flowcontrolv1beta1listers.PriorityLevelConfigurationLister interface. +type PriorityLevelConfigurationLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all flowcontrolv1beta1.PriorityLevelConfiguration in the indexer. +func (s PriorityLevelConfigurationLister) List(selector labels.Selector) (ret []*flowcontrolv1beta1.PriorityLevelConfiguration, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*flowcontrolv1beta1.PriorityLevelConfiguration) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the flowcontrolv1beta1.PriorityLevelConfiguration from the indexer for a given name. +func (s PriorityLevelConfigurationLister) Get(name string) (*flowcontrolv1beta1.PriorityLevelConfiguration, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(flowcontrolv1beta1.Resource("PriorityLevelConfiguration"), name) + } + return obj.(*flowcontrolv1beta1.PriorityLevelConfiguration), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/flowschema.go b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/flowschema.go new file mode 100644 index 0000000000000..b7a9f3346b249 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/flowschema.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + flowcontrolv1beta2listers "k8s.io/client-go/listers/flowcontrol/v1beta2" + "k8s.io/client-go/tools/cache" +) + +var _ flowcontrolv1beta2listers.FlowSchemaLister = &FlowSchemaClusterLister{} + +// FlowSchemaClusterLister implements the flowcontrolv1beta2listers.FlowSchemaLister interface. +type FlowSchemaClusterLister struct { + indexer cache.Indexer +} + +// NewFlowSchemaClusterLister returns a new FlowSchemaClusterLister. +func NewFlowSchemaClusterLister(indexer cache.Indexer) flowcontrolv1beta2listers.FlowSchemaLister { + return &FlowSchemaClusterLister{indexer: indexer} +} + +// List lists all flowcontrolv1beta2.FlowSchema in the indexer. +func (s FlowSchemaClusterLister) List(selector labels.Selector) (ret []*flowcontrolv1beta2.FlowSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*flowcontrolv1beta2.FlowSchema)) + }) + return ret, err +} + +// Get retrieves the flowcontrolv1beta2.FlowSchema from the indexer for a given name. +func (s FlowSchemaClusterLister) Get(name string) (*flowcontrolv1beta2.FlowSchema, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get flowcontrolv1beta2.FlowSchema. + +func (s FlowSchemaClusterLister) Cluster(cluster logicalcluster.Name) flowcontrolv1beta2listers.FlowSchemaLister { + return &FlowSchemaLister{indexer: s.indexer, cluster: cluster} +} + +// FlowSchemaLister implements the flowcontrolv1beta2listers.FlowSchemaLister interface. +type FlowSchemaLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all flowcontrolv1beta2.FlowSchema in the indexer. +func (s FlowSchemaLister) List(selector labels.Selector) (ret []*flowcontrolv1beta2.FlowSchema, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*flowcontrolv1beta2.FlowSchema) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the flowcontrolv1beta2.FlowSchema from the indexer for a given name. +func (s FlowSchemaLister) Get(name string) (*flowcontrolv1beta2.FlowSchema, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(flowcontrolv1beta2.Resource("FlowSchema"), name) + } + return obj.(*flowcontrolv1beta2.FlowSchema), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/prioritylevelconfiguration.go b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/prioritylevelconfiguration.go new file mode 100644 index 0000000000000..f775215f87c83 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/flowcontrol/v1beta2/prioritylevelconfiguration.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta2 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + flowcontrolv1beta2listers "k8s.io/client-go/listers/flowcontrol/v1beta2" + "k8s.io/client-go/tools/cache" +) + +var _ flowcontrolv1beta2listers.PriorityLevelConfigurationLister = &PriorityLevelConfigurationClusterLister{} + +// PriorityLevelConfigurationClusterLister implements the flowcontrolv1beta2listers.PriorityLevelConfigurationLister interface. +type PriorityLevelConfigurationClusterLister struct { + indexer cache.Indexer +} + +// NewPriorityLevelConfigurationClusterLister returns a new PriorityLevelConfigurationClusterLister. +func NewPriorityLevelConfigurationClusterLister(indexer cache.Indexer) flowcontrolv1beta2listers.PriorityLevelConfigurationLister { + return &PriorityLevelConfigurationClusterLister{indexer: indexer} +} + +// List lists all flowcontrolv1beta2.PriorityLevelConfiguration in the indexer. +func (s PriorityLevelConfigurationClusterLister) List(selector labels.Selector) (ret []*flowcontrolv1beta2.PriorityLevelConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*flowcontrolv1beta2.PriorityLevelConfiguration)) + }) + return ret, err +} + +// Get retrieves the flowcontrolv1beta2.PriorityLevelConfiguration from the indexer for a given name. +func (s PriorityLevelConfigurationClusterLister) Get(name string) (*flowcontrolv1beta2.PriorityLevelConfiguration, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get flowcontrolv1beta2.PriorityLevelConfiguration. + +func (s PriorityLevelConfigurationClusterLister) Cluster(cluster logicalcluster.Name) flowcontrolv1beta2listers.PriorityLevelConfigurationLister { + return &PriorityLevelConfigurationLister{indexer: s.indexer, cluster: cluster} +} + +// PriorityLevelConfigurationLister implements the flowcontrolv1beta2listers.PriorityLevelConfigurationLister interface. +type PriorityLevelConfigurationLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all flowcontrolv1beta2.PriorityLevelConfiguration in the indexer. +func (s PriorityLevelConfigurationLister) List(selector labels.Selector) (ret []*flowcontrolv1beta2.PriorityLevelConfiguration, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*flowcontrolv1beta2.PriorityLevelConfiguration) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the flowcontrolv1beta2.PriorityLevelConfiguration from the indexer for a given name. +func (s PriorityLevelConfigurationLister) Get(name string) (*flowcontrolv1beta2.PriorityLevelConfiguration, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(flowcontrolv1beta2.Resource("PriorityLevelConfiguration"), name) + } + return obj.(*flowcontrolv1beta2.PriorityLevelConfiguration), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingress.go b/staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingress.go new file mode 100644 index 0000000000000..dde391ff9816d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingress.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + networkingv1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + networkingv1listers "k8s.io/client-go/listers/networking/v1" + "k8s.io/client-go/tools/cache" +) + +var _ networkingv1listers.IngressLister = &IngressClusterLister{} + +// IngressClusterLister implements the networkingv1listers.IngressLister interface. +type IngressClusterLister struct { + indexer cache.Indexer +} + +// NewIngressClusterLister returns a new IngressClusterLister. +func NewIngressClusterLister(indexer cache.Indexer) networkingv1listers.IngressLister { + return &IngressClusterLister{indexer: indexer} +} + +// List lists all networkingv1.Ingress in the indexer. +func (s IngressClusterLister) List(selector labels.Selector) (ret []*networkingv1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*networkingv1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get networkingv1.Ingress. +func (s IngressClusterLister) Ingresses(namespace string) networkingv1listers.IngressNamespaceLister { + panic("Calling 'Ingresses' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get networkingv1.Ingress. + +func (s IngressClusterLister) Cluster(cluster logicalcluster.Name) networkingv1listers.IngressLister { + return &IngressLister{indexer: s.indexer, cluster: cluster} +} + +// IngressLister implements the networkingv1listers.IngressLister interface. +type IngressLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all networkingv1.Ingress in the indexer. +func (s IngressLister) List(selector labels.Selector) (ret []*networkingv1.Ingress, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1.Ingress) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Ingresses returns an object that can list and get networkingv1.Ingress. +func (s IngressLister) Ingresses(namespace string) networkingv1listers.IngressNamespaceLister { + return &IngressNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// IngressNamespaceLister implements the networkingv1listers.IngressNamespaceLister interface. +type IngressNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all networkingv1.Ingress in the indexer for a given namespace. +func (s IngressNamespaceLister) List(selector labels.Selector) (ret []*networkingv1.Ingress, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1.Ingress) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the networkingv1.Ingress from the indexer for a given namespace and name. +func (s IngressNamespaceLister) Get(name string) (*networkingv1.Ingress, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(networkingv1.Resource("Ingress"), name) + } + return obj.(*networkingv1.Ingress), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingressclass.go b/staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingressclass.go new file mode 100644 index 0000000000000..07bc070eeaa83 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/networking/v1/ingressclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + networkingv1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + networkingv1listers "k8s.io/client-go/listers/networking/v1" + "k8s.io/client-go/tools/cache" +) + +var _ networkingv1listers.IngressClassLister = &IngressClassClusterLister{} + +// IngressClassClusterLister implements the networkingv1listers.IngressClassLister interface. +type IngressClassClusterLister struct { + indexer cache.Indexer +} + +// NewIngressClassClusterLister returns a new IngressClassClusterLister. +func NewIngressClassClusterLister(indexer cache.Indexer) networkingv1listers.IngressClassLister { + return &IngressClassClusterLister{indexer: indexer} +} + +// List lists all networkingv1.IngressClass in the indexer. +func (s IngressClassClusterLister) List(selector labels.Selector) (ret []*networkingv1.IngressClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*networkingv1.IngressClass)) + }) + return ret, err +} + +// Get retrieves the networkingv1.IngressClass from the indexer for a given name. +func (s IngressClassClusterLister) Get(name string) (*networkingv1.IngressClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get networkingv1.IngressClass. + +func (s IngressClassClusterLister) Cluster(cluster logicalcluster.Name) networkingv1listers.IngressClassLister { + return &IngressClassLister{indexer: s.indexer, cluster: cluster} +} + +// IngressClassLister implements the networkingv1listers.IngressClassLister interface. +type IngressClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all networkingv1.IngressClass in the indexer. +func (s IngressClassLister) List(selector labels.Selector) (ret []*networkingv1.IngressClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1.IngressClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the networkingv1.IngressClass from the indexer for a given name. +func (s IngressClassLister) Get(name string) (*networkingv1.IngressClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(networkingv1.Resource("IngressClass"), name) + } + return obj.(*networkingv1.IngressClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/networking/v1/networkpolicy.go b/staging/src/k8s.io/client-go/kcp/listers/networking/v1/networkpolicy.go new file mode 100644 index 0000000000000..e028a8848706d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/networking/v1/networkpolicy.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + networkingv1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + networkingv1listers "k8s.io/client-go/listers/networking/v1" + "k8s.io/client-go/tools/cache" +) + +var _ networkingv1listers.NetworkPolicyLister = &NetworkPolicyClusterLister{} + +// NetworkPolicyClusterLister implements the networkingv1listers.NetworkPolicyLister interface. +type NetworkPolicyClusterLister struct { + indexer cache.Indexer +} + +// NewNetworkPolicyClusterLister returns a new NetworkPolicyClusterLister. +func NewNetworkPolicyClusterLister(indexer cache.Indexer) networkingv1listers.NetworkPolicyLister { + return &NetworkPolicyClusterLister{indexer: indexer} +} + +// List lists all networkingv1.NetworkPolicy in the indexer. +func (s NetworkPolicyClusterLister) List(selector labels.Selector) (ret []*networkingv1.NetworkPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*networkingv1.NetworkPolicy)) + }) + return ret, err +} + +// NetworkPolicies returns an object that can list and get networkingv1.NetworkPolicy. +func (s NetworkPolicyClusterLister) NetworkPolicies(namespace string) networkingv1listers.NetworkPolicyNamespaceLister { + panic("Calling 'NetworkPolicies' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get networkingv1.NetworkPolicy. + +func (s NetworkPolicyClusterLister) Cluster(cluster logicalcluster.Name) networkingv1listers.NetworkPolicyLister { + return &NetworkPolicyLister{indexer: s.indexer, cluster: cluster} +} + +// NetworkPolicyLister implements the networkingv1listers.NetworkPolicyLister interface. +type NetworkPolicyLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all networkingv1.NetworkPolicy in the indexer. +func (s NetworkPolicyLister) List(selector labels.Selector) (ret []*networkingv1.NetworkPolicy, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1.NetworkPolicy) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// NetworkPolicies returns an object that can list and get networkingv1.NetworkPolicy. +func (s NetworkPolicyLister) NetworkPolicies(namespace string) networkingv1listers.NetworkPolicyNamespaceLister { + return &NetworkPolicyNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// NetworkPolicyNamespaceLister implements the networkingv1listers.NetworkPolicyNamespaceLister interface. +type NetworkPolicyNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all networkingv1.NetworkPolicy in the indexer for a given namespace. +func (s NetworkPolicyNamespaceLister) List(selector labels.Selector) (ret []*networkingv1.NetworkPolicy, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1.NetworkPolicy) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the networkingv1.NetworkPolicy from the indexer for a given namespace and name. +func (s NetworkPolicyNamespaceLister) Get(name string) (*networkingv1.NetworkPolicy, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(networkingv1.Resource("NetworkPolicy"), name) + } + return obj.(*networkingv1.NetworkPolicy), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingress.go b/staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingress.go new file mode 100644 index 0000000000000..23f56cffac83e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingress.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + networkingv1beta1 "k8s.io/api/networking/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ networkingv1beta1listers.IngressLister = &IngressClusterLister{} + +// IngressClusterLister implements the networkingv1beta1listers.IngressLister interface. +type IngressClusterLister struct { + indexer cache.Indexer +} + +// NewIngressClusterLister returns a new IngressClusterLister. +func NewIngressClusterLister(indexer cache.Indexer) networkingv1beta1listers.IngressLister { + return &IngressClusterLister{indexer: indexer} +} + +// List lists all networkingv1beta1.Ingress in the indexer. +func (s IngressClusterLister) List(selector labels.Selector) (ret []*networkingv1beta1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*networkingv1beta1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get networkingv1beta1.Ingress. +func (s IngressClusterLister) Ingresses(namespace string) networkingv1beta1listers.IngressNamespaceLister { + panic("Calling 'Ingresses' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get networkingv1beta1.Ingress. + +func (s IngressClusterLister) Cluster(cluster logicalcluster.Name) networkingv1beta1listers.IngressLister { + return &IngressLister{indexer: s.indexer, cluster: cluster} +} + +// IngressLister implements the networkingv1beta1listers.IngressLister interface. +type IngressLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all networkingv1beta1.Ingress in the indexer. +func (s IngressLister) List(selector labels.Selector) (ret []*networkingv1beta1.Ingress, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1beta1.Ingress) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Ingresses returns an object that can list and get networkingv1beta1.Ingress. +func (s IngressLister) Ingresses(namespace string) networkingv1beta1listers.IngressNamespaceLister { + return &IngressNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// IngressNamespaceLister implements the networkingv1beta1listers.IngressNamespaceLister interface. +type IngressNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all networkingv1beta1.Ingress in the indexer for a given namespace. +func (s IngressNamespaceLister) List(selector labels.Selector) (ret []*networkingv1beta1.Ingress, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1beta1.Ingress) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the networkingv1beta1.Ingress from the indexer for a given namespace and name. +func (s IngressNamespaceLister) Get(name string) (*networkingv1beta1.Ingress, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(networkingv1beta1.Resource("Ingress"), name) + } + return obj.(*networkingv1beta1.Ingress), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingressclass.go b/staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingressclass.go new file mode 100644 index 0000000000000..93c9fc9efdc91 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/networking/v1beta1/ingressclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + networkingv1beta1 "k8s.io/api/networking/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ networkingv1beta1listers.IngressClassLister = &IngressClassClusterLister{} + +// IngressClassClusterLister implements the networkingv1beta1listers.IngressClassLister interface. +type IngressClassClusterLister struct { + indexer cache.Indexer +} + +// NewIngressClassClusterLister returns a new IngressClassClusterLister. +func NewIngressClassClusterLister(indexer cache.Indexer) networkingv1beta1listers.IngressClassLister { + return &IngressClassClusterLister{indexer: indexer} +} + +// List lists all networkingv1beta1.IngressClass in the indexer. +func (s IngressClassClusterLister) List(selector labels.Selector) (ret []*networkingv1beta1.IngressClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*networkingv1beta1.IngressClass)) + }) + return ret, err +} + +// Get retrieves the networkingv1beta1.IngressClass from the indexer for a given name. +func (s IngressClassClusterLister) Get(name string) (*networkingv1beta1.IngressClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get networkingv1beta1.IngressClass. + +func (s IngressClassClusterLister) Cluster(cluster logicalcluster.Name) networkingv1beta1listers.IngressClassLister { + return &IngressClassLister{indexer: s.indexer, cluster: cluster} +} + +// IngressClassLister implements the networkingv1beta1listers.IngressClassLister interface. +type IngressClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all networkingv1beta1.IngressClass in the indexer. +func (s IngressClassLister) List(selector labels.Selector) (ret []*networkingv1beta1.IngressClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*networkingv1beta1.IngressClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the networkingv1beta1.IngressClass from the indexer for a given name. +func (s IngressClassLister) Get(name string) (*networkingv1beta1.IngressClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(networkingv1beta1.Resource("IngressClass"), name) + } + return obj.(*networkingv1beta1.IngressClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/node/v1/runtimeclass.go b/staging/src/k8s.io/client-go/kcp/listers/node/v1/runtimeclass.go new file mode 100644 index 0000000000000..ff1c1f694498f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/node/v1/runtimeclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + nodev1 "k8s.io/api/node/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + nodev1listers "k8s.io/client-go/listers/node/v1" + "k8s.io/client-go/tools/cache" +) + +var _ nodev1listers.RuntimeClassLister = &RuntimeClassClusterLister{} + +// RuntimeClassClusterLister implements the nodev1listers.RuntimeClassLister interface. +type RuntimeClassClusterLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassClusterLister returns a new RuntimeClassClusterLister. +func NewRuntimeClassClusterLister(indexer cache.Indexer) nodev1listers.RuntimeClassLister { + return &RuntimeClassClusterLister{indexer: indexer} +} + +// List lists all nodev1.RuntimeClass in the indexer. +func (s RuntimeClassClusterLister) List(selector labels.Selector) (ret []*nodev1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*nodev1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the nodev1.RuntimeClass from the indexer for a given name. +func (s RuntimeClassClusterLister) Get(name string) (*nodev1.RuntimeClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get nodev1.RuntimeClass. + +func (s RuntimeClassClusterLister) Cluster(cluster logicalcluster.Name) nodev1listers.RuntimeClassLister { + return &RuntimeClassLister{indexer: s.indexer, cluster: cluster} +} + +// RuntimeClassLister implements the nodev1listers.RuntimeClassLister interface. +type RuntimeClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all nodev1.RuntimeClass in the indexer. +func (s RuntimeClassLister) List(selector labels.Selector) (ret []*nodev1.RuntimeClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*nodev1.RuntimeClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the nodev1.RuntimeClass from the indexer for a given name. +func (s RuntimeClassLister) Get(name string) (*nodev1.RuntimeClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(nodev1.Resource("RuntimeClass"), name) + } + return obj.(*nodev1.RuntimeClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/node/v1alpha1/runtimeclass.go b/staging/src/k8s.io/client-go/kcp/listers/node/v1alpha1/runtimeclass.go new file mode 100644 index 0000000000000..5ed6e13ae785f --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/node/v1alpha1/runtimeclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + nodev1alpha1 "k8s.io/api/node/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + nodev1alpha1listers "k8s.io/client-go/listers/node/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ nodev1alpha1listers.RuntimeClassLister = &RuntimeClassClusterLister{} + +// RuntimeClassClusterLister implements the nodev1alpha1listers.RuntimeClassLister interface. +type RuntimeClassClusterLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassClusterLister returns a new RuntimeClassClusterLister. +func NewRuntimeClassClusterLister(indexer cache.Indexer) nodev1alpha1listers.RuntimeClassLister { + return &RuntimeClassClusterLister{indexer: indexer} +} + +// List lists all nodev1alpha1.RuntimeClass in the indexer. +func (s RuntimeClassClusterLister) List(selector labels.Selector) (ret []*nodev1alpha1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*nodev1alpha1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the nodev1alpha1.RuntimeClass from the indexer for a given name. +func (s RuntimeClassClusterLister) Get(name string) (*nodev1alpha1.RuntimeClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get nodev1alpha1.RuntimeClass. + +func (s RuntimeClassClusterLister) Cluster(cluster logicalcluster.Name) nodev1alpha1listers.RuntimeClassLister { + return &RuntimeClassLister{indexer: s.indexer, cluster: cluster} +} + +// RuntimeClassLister implements the nodev1alpha1listers.RuntimeClassLister interface. +type RuntimeClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all nodev1alpha1.RuntimeClass in the indexer. +func (s RuntimeClassLister) List(selector labels.Selector) (ret []*nodev1alpha1.RuntimeClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*nodev1alpha1.RuntimeClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the nodev1alpha1.RuntimeClass from the indexer for a given name. +func (s RuntimeClassLister) Get(name string) (*nodev1alpha1.RuntimeClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(nodev1alpha1.Resource("RuntimeClass"), name) + } + return obj.(*nodev1alpha1.RuntimeClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/node/v1beta1/runtimeclass.go b/staging/src/k8s.io/client-go/kcp/listers/node/v1beta1/runtimeclass.go new file mode 100644 index 0000000000000..9616a7ffba032 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/node/v1beta1/runtimeclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + nodev1beta1 "k8s.io/api/node/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + nodev1beta1listers "k8s.io/client-go/listers/node/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ nodev1beta1listers.RuntimeClassLister = &RuntimeClassClusterLister{} + +// RuntimeClassClusterLister implements the nodev1beta1listers.RuntimeClassLister interface. +type RuntimeClassClusterLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassClusterLister returns a new RuntimeClassClusterLister. +func NewRuntimeClassClusterLister(indexer cache.Indexer) nodev1beta1listers.RuntimeClassLister { + return &RuntimeClassClusterLister{indexer: indexer} +} + +// List lists all nodev1beta1.RuntimeClass in the indexer. +func (s RuntimeClassClusterLister) List(selector labels.Selector) (ret []*nodev1beta1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*nodev1beta1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the nodev1beta1.RuntimeClass from the indexer for a given name. +func (s RuntimeClassClusterLister) Get(name string) (*nodev1beta1.RuntimeClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get nodev1beta1.RuntimeClass. + +func (s RuntimeClassClusterLister) Cluster(cluster logicalcluster.Name) nodev1beta1listers.RuntimeClassLister { + return &RuntimeClassLister{indexer: s.indexer, cluster: cluster} +} + +// RuntimeClassLister implements the nodev1beta1listers.RuntimeClassLister interface. +type RuntimeClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all nodev1beta1.RuntimeClass in the indexer. +func (s RuntimeClassLister) List(selector labels.Selector) (ret []*nodev1beta1.RuntimeClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*nodev1beta1.RuntimeClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the nodev1beta1.RuntimeClass from the indexer for a given name. +func (s RuntimeClassLister) Get(name string) (*nodev1beta1.RuntimeClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(nodev1beta1.Resource("RuntimeClass"), name) + } + return obj.(*nodev1beta1.RuntimeClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget.go b/staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget.go new file mode 100644 index 0000000000000..af90d1b66bb4a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + policyv1 "k8s.io/api/policy/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + policyv1listers "k8s.io/client-go/listers/policy/v1" + "k8s.io/client-go/tools/cache" +) + +var _ policyv1listers.PodDisruptionBudgetLister = &PodDisruptionBudgetClusterLister{} + +// PodDisruptionBudgetClusterLister implements the policyv1listers.PodDisruptionBudgetLister interface. +type PodDisruptionBudgetClusterLister struct { + indexer cache.Indexer +} + +// NewPodDisruptionBudgetClusterLister returns a new PodDisruptionBudgetClusterLister. +func NewPodDisruptionBudgetClusterLister(indexer cache.Indexer) policyv1listers.PodDisruptionBudgetLister { + return &PodDisruptionBudgetClusterLister{indexer: indexer} +} + +// List lists all policyv1.PodDisruptionBudget in the indexer. +func (s PodDisruptionBudgetClusterLister) List(selector labels.Selector) (ret []*policyv1.PodDisruptionBudget, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*policyv1.PodDisruptionBudget)) + }) + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get policyv1.PodDisruptionBudget. +func (s PodDisruptionBudgetClusterLister) PodDisruptionBudgets(namespace string) policyv1listers.PodDisruptionBudgetNamespaceLister { + panic("Calling 'PodDisruptionBudgets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get policyv1.PodDisruptionBudget. + +func (s PodDisruptionBudgetClusterLister) Cluster(cluster logicalcluster.Name) policyv1listers.PodDisruptionBudgetLister { + return &PodDisruptionBudgetLister{indexer: s.indexer, cluster: cluster} +} + +// PodDisruptionBudgetLister implements the policyv1listers.PodDisruptionBudgetLister interface. +type PodDisruptionBudgetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all policyv1.PodDisruptionBudget in the indexer. +func (s PodDisruptionBudgetLister) List(selector labels.Selector) (ret []*policyv1.PodDisruptionBudget, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*policyv1.PodDisruptionBudget) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get policyv1.PodDisruptionBudget. +func (s PodDisruptionBudgetLister) PodDisruptionBudgets(namespace string) policyv1listers.PodDisruptionBudgetNamespaceLister { + return &PodDisruptionBudgetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// PodDisruptionBudgetNamespaceLister implements the policyv1listers.PodDisruptionBudgetNamespaceLister interface. +type PodDisruptionBudgetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all policyv1.PodDisruptionBudget in the indexer for a given namespace. +func (s PodDisruptionBudgetNamespaceLister) List(selector labels.Selector) (ret []*policyv1.PodDisruptionBudget, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*policyv1.PodDisruptionBudget) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the policyv1.PodDisruptionBudget from the indexer for a given namespace and name. +func (s PodDisruptionBudgetNamespaceLister) Get(name string) (*policyv1.PodDisruptionBudget, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(policyv1.Resource("PodDisruptionBudget"), name) + } + return obj.(*policyv1.PodDisruptionBudget), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget_expansion.go new file mode 100644 index 0000000000000..3458db081e792 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/policy/v1/poddisruptionbudget_expansion.go @@ -0,0 +1,62 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *PodDisruptionBudgetClusterLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + panic("Calling 'GetPodPodDisruptionBudgets' is not supported before scoping lister to a workspace") +} + +// GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. +func (s *PodDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + var selector labels.Selector + + list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var pdbList []*policy.PodDisruptionBudget + for i := range list { + pdb := list[i] + selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // Unlike the v1beta version, here we let an empty selector match everything. + if !selector.Matches(labels.Set(pod.Labels)) { + continue + } + pdbList = append(pdbList, pdb) + } + + if len(pdbList) == 0 { + return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return pdbList, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget.go b/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget.go new file mode 100644 index 0000000000000..37e920ada471e --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + policyv1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + policyv1beta1listers "k8s.io/client-go/listers/policy/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ policyv1beta1listers.PodDisruptionBudgetLister = &PodDisruptionBudgetClusterLister{} + +// PodDisruptionBudgetClusterLister implements the policyv1beta1listers.PodDisruptionBudgetLister interface. +type PodDisruptionBudgetClusterLister struct { + indexer cache.Indexer +} + +// NewPodDisruptionBudgetClusterLister returns a new PodDisruptionBudgetClusterLister. +func NewPodDisruptionBudgetClusterLister(indexer cache.Indexer) policyv1beta1listers.PodDisruptionBudgetLister { + return &PodDisruptionBudgetClusterLister{indexer: indexer} +} + +// List lists all policyv1beta1.PodDisruptionBudget in the indexer. +func (s PodDisruptionBudgetClusterLister) List(selector labels.Selector) (ret []*policyv1beta1.PodDisruptionBudget, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*policyv1beta1.PodDisruptionBudget)) + }) + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get policyv1beta1.PodDisruptionBudget. +func (s PodDisruptionBudgetClusterLister) PodDisruptionBudgets(namespace string) policyv1beta1listers.PodDisruptionBudgetNamespaceLister { + panic("Calling 'PodDisruptionBudgets' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get policyv1beta1.PodDisruptionBudget. + +func (s PodDisruptionBudgetClusterLister) Cluster(cluster logicalcluster.Name) policyv1beta1listers.PodDisruptionBudgetLister { + return &PodDisruptionBudgetLister{indexer: s.indexer, cluster: cluster} +} + +// PodDisruptionBudgetLister implements the policyv1beta1listers.PodDisruptionBudgetLister interface. +type PodDisruptionBudgetLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all policyv1beta1.PodDisruptionBudget in the indexer. +func (s PodDisruptionBudgetLister) List(selector labels.Selector) (ret []*policyv1beta1.PodDisruptionBudget, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*policyv1beta1.PodDisruptionBudget) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get policyv1beta1.PodDisruptionBudget. +func (s PodDisruptionBudgetLister) PodDisruptionBudgets(namespace string) policyv1beta1listers.PodDisruptionBudgetNamespaceLister { + return &PodDisruptionBudgetNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// PodDisruptionBudgetNamespaceLister implements the policyv1beta1listers.PodDisruptionBudgetNamespaceLister interface. +type PodDisruptionBudgetNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all policyv1beta1.PodDisruptionBudget in the indexer for a given namespace. +func (s PodDisruptionBudgetNamespaceLister) List(selector labels.Selector) (ret []*policyv1beta1.PodDisruptionBudget, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*policyv1beta1.PodDisruptionBudget) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the policyv1beta1.PodDisruptionBudget from the indexer for a given namespace and name. +func (s PodDisruptionBudgetNamespaceLister) Get(name string) (*policyv1beta1.PodDisruptionBudget, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(policyv1beta1.Resource("PodDisruptionBudget"), name) + } + return obj.(*policyv1beta1.PodDisruptionBudget), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget_expansion.go b/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget_expansion.go new file mode 100644 index 0000000000000..28efa06938a7b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/poddisruptionbudget_expansion.go @@ -0,0 +1,62 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +func (s *PodDisruptionBudgetClusterLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + panic("Calling 'GetPodPodDisruptionBudgets' is not supported before scoping lister to a workspace") +} + +// GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. Returns an error only if no matching PodDisruptionBudgets are found. +func (s *PodDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + var selector labels.Selector + + list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var pdbList []*policy.PodDisruptionBudget + for i := range list { + pdb := list[i] + selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) + if err != nil { + // This object has an invalid selector, it does not match the pod + continue + } + + // If a PDB with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + pdbList = append(pdbList, pdb) + } + + if len(pdbList) == 0 { + return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return pdbList, nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/podsecuritypolicy.go b/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/podsecuritypolicy.go new file mode 100644 index 0000000000000..a09b7e3c4bd18 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/policy/v1beta1/podsecuritypolicy.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + policyv1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + policyv1beta1listers "k8s.io/client-go/listers/policy/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ policyv1beta1listers.PodSecurityPolicyLister = &PodSecurityPolicyClusterLister{} + +// PodSecurityPolicyClusterLister implements the policyv1beta1listers.PodSecurityPolicyLister interface. +type PodSecurityPolicyClusterLister struct { + indexer cache.Indexer +} + +// NewPodSecurityPolicyClusterLister returns a new PodSecurityPolicyClusterLister. +func NewPodSecurityPolicyClusterLister(indexer cache.Indexer) policyv1beta1listers.PodSecurityPolicyLister { + return &PodSecurityPolicyClusterLister{indexer: indexer} +} + +// List lists all policyv1beta1.PodSecurityPolicy in the indexer. +func (s PodSecurityPolicyClusterLister) List(selector labels.Selector) (ret []*policyv1beta1.PodSecurityPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*policyv1beta1.PodSecurityPolicy)) + }) + return ret, err +} + +// Get retrieves the policyv1beta1.PodSecurityPolicy from the indexer for a given name. +func (s PodSecurityPolicyClusterLister) Get(name string) (*policyv1beta1.PodSecurityPolicy, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get policyv1beta1.PodSecurityPolicy. + +func (s PodSecurityPolicyClusterLister) Cluster(cluster logicalcluster.Name) policyv1beta1listers.PodSecurityPolicyLister { + return &PodSecurityPolicyLister{indexer: s.indexer, cluster: cluster} +} + +// PodSecurityPolicyLister implements the policyv1beta1listers.PodSecurityPolicyLister interface. +type PodSecurityPolicyLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all policyv1beta1.PodSecurityPolicy in the indexer. +func (s PodSecurityPolicyLister) List(selector labels.Selector) (ret []*policyv1beta1.PodSecurityPolicy, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*policyv1beta1.PodSecurityPolicy) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the policyv1beta1.PodSecurityPolicy from the indexer for a given name. +func (s PodSecurityPolicyLister) Get(name string) (*policyv1beta1.PodSecurityPolicy, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(policyv1beta1.Resource("PodSecurityPolicy"), name) + } + return obj.(*policyv1beta1.PodSecurityPolicy), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrole.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrole.go new file mode 100644 index 0000000000000..a1fb20f095ef9 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrole.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1listers.ClusterRoleLister = &ClusterRoleClusterLister{} + +// ClusterRoleClusterLister implements the rbacv1listers.ClusterRoleLister interface. +type ClusterRoleClusterLister struct { + indexer cache.Indexer +} + +// NewClusterRoleClusterLister returns a new ClusterRoleClusterLister. +func NewClusterRoleClusterLister(indexer cache.Indexer) rbacv1listers.ClusterRoleLister { + return &ClusterRoleClusterLister{indexer: indexer} +} + +// List lists all rbacv1.ClusterRole in the indexer. +func (s ClusterRoleClusterLister) List(selector labels.Selector) (ret []*rbacv1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the rbacv1.ClusterRole from the indexer for a given name. +func (s ClusterRoleClusterLister) Get(name string) (*rbacv1.ClusterRole, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1.ClusterRole. + +func (s ClusterRoleClusterLister) Cluster(cluster logicalcluster.Name) rbacv1listers.ClusterRoleLister { + return &ClusterRoleLister{indexer: s.indexer, cluster: cluster} +} + +// ClusterRoleLister implements the rbacv1listers.ClusterRoleLister interface. +type ClusterRoleLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1.ClusterRole in the indexer. +func (s ClusterRoleLister) List(selector labels.Selector) (ret []*rbacv1.ClusterRole, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1.ClusterRole) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the rbacv1.ClusterRole from the indexer for a given name. +func (s ClusterRoleLister) Get(name string) (*rbacv1.ClusterRole, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1.Resource("ClusterRole"), name) + } + return obj.(*rbacv1.ClusterRole), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrolebinding.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrolebinding.go new file mode 100644 index 0000000000000..db1b5293ac371 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1listers.ClusterRoleBindingLister = &ClusterRoleBindingClusterLister{} + +// ClusterRoleBindingClusterLister implements the rbacv1listers.ClusterRoleBindingLister interface. +type ClusterRoleBindingClusterLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingClusterLister returns a new ClusterRoleBindingClusterLister. +func NewClusterRoleBindingClusterLister(indexer cache.Indexer) rbacv1listers.ClusterRoleBindingLister { + return &ClusterRoleBindingClusterLister{indexer: indexer} +} + +// List lists all rbacv1.ClusterRoleBinding in the indexer. +func (s ClusterRoleBindingClusterLister) List(selector labels.Selector) (ret []*rbacv1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the rbacv1.ClusterRoleBinding from the indexer for a given name. +func (s ClusterRoleBindingClusterLister) Get(name string) (*rbacv1.ClusterRoleBinding, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1.ClusterRoleBinding. + +func (s ClusterRoleBindingClusterLister) Cluster(cluster logicalcluster.Name) rbacv1listers.ClusterRoleBindingLister { + return &ClusterRoleBindingLister{indexer: s.indexer, cluster: cluster} +} + +// ClusterRoleBindingLister implements the rbacv1listers.ClusterRoleBindingLister interface. +type ClusterRoleBindingLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1.ClusterRoleBinding in the indexer. +func (s ClusterRoleBindingLister) List(selector labels.Selector) (ret []*rbacv1.ClusterRoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1.ClusterRoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the rbacv1.ClusterRoleBinding from the indexer for a given name. +func (s ClusterRoleBindingLister) Get(name string) (*rbacv1.ClusterRoleBinding, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1.Resource("ClusterRoleBinding"), name) + } + return obj.(*rbacv1.ClusterRoleBinding), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/role.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/role.go new file mode 100644 index 0000000000000..a42427fbe1641 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/role.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1listers.RoleLister = &RoleClusterLister{} + +// RoleClusterLister implements the rbacv1listers.RoleLister interface. +type RoleClusterLister struct { + indexer cache.Indexer +} + +// NewRoleClusterLister returns a new RoleClusterLister. +func NewRoleClusterLister(indexer cache.Indexer) rbacv1listers.RoleLister { + return &RoleClusterLister{indexer: indexer} +} + +// List lists all rbacv1.Role in the indexer. +func (s RoleClusterLister) List(selector labels.Selector) (ret []*rbacv1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get rbacv1.Role. +func (s RoleClusterLister) Roles(namespace string) rbacv1listers.RoleNamespaceLister { + panic("Calling 'Roles' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1.Role. + +func (s RoleClusterLister) Cluster(cluster logicalcluster.Name) rbacv1listers.RoleLister { + return &RoleLister{indexer: s.indexer, cluster: cluster} +} + +// RoleLister implements the rbacv1listers.RoleLister interface. +type RoleLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1.Role in the indexer. +func (s RoleLister) List(selector labels.Selector) (ret []*rbacv1.Role, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1.Role) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Roles returns an object that can list and get rbacv1.Role. +func (s RoleLister) Roles(namespace string) rbacv1listers.RoleNamespaceLister { + return &RoleNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// RoleNamespaceLister implements the rbacv1listers.RoleNamespaceLister interface. +type RoleNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all rbacv1.Role in the indexer for a given namespace. +func (s RoleNamespaceLister) List(selector labels.Selector) (ret []*rbacv1.Role, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1.Role) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the rbacv1.Role from the indexer for a given namespace and name. +func (s RoleNamespaceLister) Get(name string) (*rbacv1.Role, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1.Resource("Role"), name) + } + return obj.(*rbacv1.Role), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/rolebinding.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/rolebinding.go new file mode 100644 index 0000000000000..b648295535cfd --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1/rolebinding.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1listers "k8s.io/client-go/listers/rbac/v1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1listers.RoleBindingLister = &RoleBindingClusterLister{} + +// RoleBindingClusterLister implements the rbacv1listers.RoleBindingLister interface. +type RoleBindingClusterLister struct { + indexer cache.Indexer +} + +// NewRoleBindingClusterLister returns a new RoleBindingClusterLister. +func NewRoleBindingClusterLister(indexer cache.Indexer) rbacv1listers.RoleBindingLister { + return &RoleBindingClusterLister{indexer: indexer} +} + +// List lists all rbacv1.RoleBinding in the indexer. +func (s RoleBindingClusterLister) List(selector labels.Selector) (ret []*rbacv1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get rbacv1.RoleBinding. +func (s RoleBindingClusterLister) RoleBindings(namespace string) rbacv1listers.RoleBindingNamespaceLister { + panic("Calling 'RoleBindings' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1.RoleBinding. + +func (s RoleBindingClusterLister) Cluster(cluster logicalcluster.Name) rbacv1listers.RoleBindingLister { + return &RoleBindingLister{indexer: s.indexer, cluster: cluster} +} + +// RoleBindingLister implements the rbacv1listers.RoleBindingLister interface. +type RoleBindingLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1.RoleBinding in the indexer. +func (s RoleBindingLister) List(selector labels.Selector) (ret []*rbacv1.RoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1.RoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// RoleBindings returns an object that can list and get rbacv1.RoleBinding. +func (s RoleBindingLister) RoleBindings(namespace string) rbacv1listers.RoleBindingNamespaceLister { + return &RoleBindingNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// RoleBindingNamespaceLister implements the rbacv1listers.RoleBindingNamespaceLister interface. +type RoleBindingNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all rbacv1.RoleBinding in the indexer for a given namespace. +func (s RoleBindingNamespaceLister) List(selector labels.Selector) (ret []*rbacv1.RoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1.RoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the rbacv1.RoleBinding from the indexer for a given namespace and name. +func (s RoleBindingNamespaceLister) Get(name string) (*rbacv1.RoleBinding, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1.Resource("RoleBinding"), name) + } + return obj.(*rbacv1.RoleBinding), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrole.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrole.go new file mode 100644 index 0000000000000..773951bc22935 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrole.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1alpha1listers.ClusterRoleLister = &ClusterRoleClusterLister{} + +// ClusterRoleClusterLister implements the rbacv1alpha1listers.ClusterRoleLister interface. +type ClusterRoleClusterLister struct { + indexer cache.Indexer +} + +// NewClusterRoleClusterLister returns a new ClusterRoleClusterLister. +func NewClusterRoleClusterLister(indexer cache.Indexer) rbacv1alpha1listers.ClusterRoleLister { + return &ClusterRoleClusterLister{indexer: indexer} +} + +// List lists all rbacv1alpha1.ClusterRole in the indexer. +func (s ClusterRoleClusterLister) List(selector labels.Selector) (ret []*rbacv1alpha1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1alpha1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the rbacv1alpha1.ClusterRole from the indexer for a given name. +func (s ClusterRoleClusterLister) Get(name string) (*rbacv1alpha1.ClusterRole, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1alpha1.ClusterRole. + +func (s ClusterRoleClusterLister) Cluster(cluster logicalcluster.Name) rbacv1alpha1listers.ClusterRoleLister { + return &ClusterRoleLister{indexer: s.indexer, cluster: cluster} +} + +// ClusterRoleLister implements the rbacv1alpha1listers.ClusterRoleLister interface. +type ClusterRoleLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1alpha1.ClusterRole in the indexer. +func (s ClusterRoleLister) List(selector labels.Selector) (ret []*rbacv1alpha1.ClusterRole, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1alpha1.ClusterRole) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the rbacv1alpha1.ClusterRole from the indexer for a given name. +func (s ClusterRoleLister) Get(name string) (*rbacv1alpha1.ClusterRole, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1alpha1.Resource("ClusterRole"), name) + } + return obj.(*rbacv1alpha1.ClusterRole), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrolebinding.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrolebinding.go new file mode 100644 index 0000000000000..921b9802c098b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/clusterrolebinding.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1alpha1listers.ClusterRoleBindingLister = &ClusterRoleBindingClusterLister{} + +// ClusterRoleBindingClusterLister implements the rbacv1alpha1listers.ClusterRoleBindingLister interface. +type ClusterRoleBindingClusterLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingClusterLister returns a new ClusterRoleBindingClusterLister. +func NewClusterRoleBindingClusterLister(indexer cache.Indexer) rbacv1alpha1listers.ClusterRoleBindingLister { + return &ClusterRoleBindingClusterLister{indexer: indexer} +} + +// List lists all rbacv1alpha1.ClusterRoleBinding in the indexer. +func (s ClusterRoleBindingClusterLister) List(selector labels.Selector) (ret []*rbacv1alpha1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1alpha1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the rbacv1alpha1.ClusterRoleBinding from the indexer for a given name. +func (s ClusterRoleBindingClusterLister) Get(name string) (*rbacv1alpha1.ClusterRoleBinding, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1alpha1.ClusterRoleBinding. + +func (s ClusterRoleBindingClusterLister) Cluster(cluster logicalcluster.Name) rbacv1alpha1listers.ClusterRoleBindingLister { + return &ClusterRoleBindingLister{indexer: s.indexer, cluster: cluster} +} + +// ClusterRoleBindingLister implements the rbacv1alpha1listers.ClusterRoleBindingLister interface. +type ClusterRoleBindingLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1alpha1.ClusterRoleBinding in the indexer. +func (s ClusterRoleBindingLister) List(selector labels.Selector) (ret []*rbacv1alpha1.ClusterRoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1alpha1.ClusterRoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the rbacv1alpha1.ClusterRoleBinding from the indexer for a given name. +func (s ClusterRoleBindingLister) Get(name string) (*rbacv1alpha1.ClusterRoleBinding, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1alpha1.Resource("ClusterRoleBinding"), name) + } + return obj.(*rbacv1alpha1.ClusterRoleBinding), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/role.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/role.go new file mode 100644 index 0000000000000..e8d58e84b3deb --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/role.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1alpha1listers.RoleLister = &RoleClusterLister{} + +// RoleClusterLister implements the rbacv1alpha1listers.RoleLister interface. +type RoleClusterLister struct { + indexer cache.Indexer +} + +// NewRoleClusterLister returns a new RoleClusterLister. +func NewRoleClusterLister(indexer cache.Indexer) rbacv1alpha1listers.RoleLister { + return &RoleClusterLister{indexer: indexer} +} + +// List lists all rbacv1alpha1.Role in the indexer. +func (s RoleClusterLister) List(selector labels.Selector) (ret []*rbacv1alpha1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1alpha1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get rbacv1alpha1.Role. +func (s RoleClusterLister) Roles(namespace string) rbacv1alpha1listers.RoleNamespaceLister { + panic("Calling 'Roles' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1alpha1.Role. + +func (s RoleClusterLister) Cluster(cluster logicalcluster.Name) rbacv1alpha1listers.RoleLister { + return &RoleLister{indexer: s.indexer, cluster: cluster} +} + +// RoleLister implements the rbacv1alpha1listers.RoleLister interface. +type RoleLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1alpha1.Role in the indexer. +func (s RoleLister) List(selector labels.Selector) (ret []*rbacv1alpha1.Role, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1alpha1.Role) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Roles returns an object that can list and get rbacv1alpha1.Role. +func (s RoleLister) Roles(namespace string) rbacv1alpha1listers.RoleNamespaceLister { + return &RoleNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// RoleNamespaceLister implements the rbacv1alpha1listers.RoleNamespaceLister interface. +type RoleNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all rbacv1alpha1.Role in the indexer for a given namespace. +func (s RoleNamespaceLister) List(selector labels.Selector) (ret []*rbacv1alpha1.Role, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1alpha1.Role) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the rbacv1alpha1.Role from the indexer for a given namespace and name. +func (s RoleNamespaceLister) Get(name string) (*rbacv1alpha1.Role, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1alpha1.Resource("Role"), name) + } + return obj.(*rbacv1alpha1.Role), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/rolebinding.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/rolebinding.go new file mode 100644 index 0000000000000..8cdfb8d0af86b --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1alpha1/rolebinding.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1alpha1listers "k8s.io/client-go/listers/rbac/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1alpha1listers.RoleBindingLister = &RoleBindingClusterLister{} + +// RoleBindingClusterLister implements the rbacv1alpha1listers.RoleBindingLister interface. +type RoleBindingClusterLister struct { + indexer cache.Indexer +} + +// NewRoleBindingClusterLister returns a new RoleBindingClusterLister. +func NewRoleBindingClusterLister(indexer cache.Indexer) rbacv1alpha1listers.RoleBindingLister { + return &RoleBindingClusterLister{indexer: indexer} +} + +// List lists all rbacv1alpha1.RoleBinding in the indexer. +func (s RoleBindingClusterLister) List(selector labels.Selector) (ret []*rbacv1alpha1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1alpha1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get rbacv1alpha1.RoleBinding. +func (s RoleBindingClusterLister) RoleBindings(namespace string) rbacv1alpha1listers.RoleBindingNamespaceLister { + panic("Calling 'RoleBindings' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1alpha1.RoleBinding. + +func (s RoleBindingClusterLister) Cluster(cluster logicalcluster.Name) rbacv1alpha1listers.RoleBindingLister { + return &RoleBindingLister{indexer: s.indexer, cluster: cluster} +} + +// RoleBindingLister implements the rbacv1alpha1listers.RoleBindingLister interface. +type RoleBindingLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1alpha1.RoleBinding in the indexer. +func (s RoleBindingLister) List(selector labels.Selector) (ret []*rbacv1alpha1.RoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1alpha1.RoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// RoleBindings returns an object that can list and get rbacv1alpha1.RoleBinding. +func (s RoleBindingLister) RoleBindings(namespace string) rbacv1alpha1listers.RoleBindingNamespaceLister { + return &RoleBindingNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// RoleBindingNamespaceLister implements the rbacv1alpha1listers.RoleBindingNamespaceLister interface. +type RoleBindingNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all rbacv1alpha1.RoleBinding in the indexer for a given namespace. +func (s RoleBindingNamespaceLister) List(selector labels.Selector) (ret []*rbacv1alpha1.RoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1alpha1.RoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the rbacv1alpha1.RoleBinding from the indexer for a given namespace and name. +func (s RoleBindingNamespaceLister) Get(name string) (*rbacv1alpha1.RoleBinding, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1alpha1.Resource("RoleBinding"), name) + } + return obj.(*rbacv1alpha1.RoleBinding), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrole.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrole.go new file mode 100644 index 0000000000000..e5a713d721f14 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrole.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1beta1listers.ClusterRoleLister = &ClusterRoleClusterLister{} + +// ClusterRoleClusterLister implements the rbacv1beta1listers.ClusterRoleLister interface. +type ClusterRoleClusterLister struct { + indexer cache.Indexer +} + +// NewClusterRoleClusterLister returns a new ClusterRoleClusterLister. +func NewClusterRoleClusterLister(indexer cache.Indexer) rbacv1beta1listers.ClusterRoleLister { + return &ClusterRoleClusterLister{indexer: indexer} +} + +// List lists all rbacv1beta1.ClusterRole in the indexer. +func (s ClusterRoleClusterLister) List(selector labels.Selector) (ret []*rbacv1beta1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1beta1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the rbacv1beta1.ClusterRole from the indexer for a given name. +func (s ClusterRoleClusterLister) Get(name string) (*rbacv1beta1.ClusterRole, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1beta1.ClusterRole. + +func (s ClusterRoleClusterLister) Cluster(cluster logicalcluster.Name) rbacv1beta1listers.ClusterRoleLister { + return &ClusterRoleLister{indexer: s.indexer, cluster: cluster} +} + +// ClusterRoleLister implements the rbacv1beta1listers.ClusterRoleLister interface. +type ClusterRoleLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1beta1.ClusterRole in the indexer. +func (s ClusterRoleLister) List(selector labels.Selector) (ret []*rbacv1beta1.ClusterRole, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1beta1.ClusterRole) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the rbacv1beta1.ClusterRole from the indexer for a given name. +func (s ClusterRoleLister) Get(name string) (*rbacv1beta1.ClusterRole, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1beta1.Resource("ClusterRole"), name) + } + return obj.(*rbacv1beta1.ClusterRole), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrolebinding.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrolebinding.go new file mode 100644 index 0000000000000..256eaba16257d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/clusterrolebinding.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1beta1listers.ClusterRoleBindingLister = &ClusterRoleBindingClusterLister{} + +// ClusterRoleBindingClusterLister implements the rbacv1beta1listers.ClusterRoleBindingLister interface. +type ClusterRoleBindingClusterLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingClusterLister returns a new ClusterRoleBindingClusterLister. +func NewClusterRoleBindingClusterLister(indexer cache.Indexer) rbacv1beta1listers.ClusterRoleBindingLister { + return &ClusterRoleBindingClusterLister{indexer: indexer} +} + +// List lists all rbacv1beta1.ClusterRoleBinding in the indexer. +func (s ClusterRoleBindingClusterLister) List(selector labels.Selector) (ret []*rbacv1beta1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1beta1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the rbacv1beta1.ClusterRoleBinding from the indexer for a given name. +func (s ClusterRoleBindingClusterLister) Get(name string) (*rbacv1beta1.ClusterRoleBinding, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1beta1.ClusterRoleBinding. + +func (s ClusterRoleBindingClusterLister) Cluster(cluster logicalcluster.Name) rbacv1beta1listers.ClusterRoleBindingLister { + return &ClusterRoleBindingLister{indexer: s.indexer, cluster: cluster} +} + +// ClusterRoleBindingLister implements the rbacv1beta1listers.ClusterRoleBindingLister interface. +type ClusterRoleBindingLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1beta1.ClusterRoleBinding in the indexer. +func (s ClusterRoleBindingLister) List(selector labels.Selector) (ret []*rbacv1beta1.ClusterRoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1beta1.ClusterRoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the rbacv1beta1.ClusterRoleBinding from the indexer for a given name. +func (s ClusterRoleBindingLister) Get(name string) (*rbacv1beta1.ClusterRoleBinding, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1beta1.Resource("ClusterRoleBinding"), name) + } + return obj.(*rbacv1beta1.ClusterRoleBinding), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/role.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/role.go new file mode 100644 index 0000000000000..98e9263d9b75a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/role.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1beta1listers.RoleLister = &RoleClusterLister{} + +// RoleClusterLister implements the rbacv1beta1listers.RoleLister interface. +type RoleClusterLister struct { + indexer cache.Indexer +} + +// NewRoleClusterLister returns a new RoleClusterLister. +func NewRoleClusterLister(indexer cache.Indexer) rbacv1beta1listers.RoleLister { + return &RoleClusterLister{indexer: indexer} +} + +// List lists all rbacv1beta1.Role in the indexer. +func (s RoleClusterLister) List(selector labels.Selector) (ret []*rbacv1beta1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1beta1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get rbacv1beta1.Role. +func (s RoleClusterLister) Roles(namespace string) rbacv1beta1listers.RoleNamespaceLister { + panic("Calling 'Roles' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1beta1.Role. + +func (s RoleClusterLister) Cluster(cluster logicalcluster.Name) rbacv1beta1listers.RoleLister { + return &RoleLister{indexer: s.indexer, cluster: cluster} +} + +// RoleLister implements the rbacv1beta1listers.RoleLister interface. +type RoleLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1beta1.Role in the indexer. +func (s RoleLister) List(selector labels.Selector) (ret []*rbacv1beta1.Role, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1beta1.Role) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Roles returns an object that can list and get rbacv1beta1.Role. +func (s RoleLister) Roles(namespace string) rbacv1beta1listers.RoleNamespaceLister { + return &RoleNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// RoleNamespaceLister implements the rbacv1beta1listers.RoleNamespaceLister interface. +type RoleNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all rbacv1beta1.Role in the indexer for a given namespace. +func (s RoleNamespaceLister) List(selector labels.Selector) (ret []*rbacv1beta1.Role, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1beta1.Role) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the rbacv1beta1.Role from the indexer for a given namespace and name. +func (s RoleNamespaceLister) Get(name string) (*rbacv1beta1.Role, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1beta1.Resource("Role"), name) + } + return obj.(*rbacv1beta1.Role), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/rolebinding.go b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/rolebinding.go new file mode 100644 index 0000000000000..97dc4d1b72d4a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/rbac/v1beta1/rolebinding.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + rbacv1beta1listers "k8s.io/client-go/listers/rbac/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ rbacv1beta1listers.RoleBindingLister = &RoleBindingClusterLister{} + +// RoleBindingClusterLister implements the rbacv1beta1listers.RoleBindingLister interface. +type RoleBindingClusterLister struct { + indexer cache.Indexer +} + +// NewRoleBindingClusterLister returns a new RoleBindingClusterLister. +func NewRoleBindingClusterLister(indexer cache.Indexer) rbacv1beta1listers.RoleBindingLister { + return &RoleBindingClusterLister{indexer: indexer} +} + +// List lists all rbacv1beta1.RoleBinding in the indexer. +func (s RoleBindingClusterLister) List(selector labels.Selector) (ret []*rbacv1beta1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*rbacv1beta1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get rbacv1beta1.RoleBinding. +func (s RoleBindingClusterLister) RoleBindings(namespace string) rbacv1beta1listers.RoleBindingNamespaceLister { + panic("Calling 'RoleBindings' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get rbacv1beta1.RoleBinding. + +func (s RoleBindingClusterLister) Cluster(cluster logicalcluster.Name) rbacv1beta1listers.RoleBindingLister { + return &RoleBindingLister{indexer: s.indexer, cluster: cluster} +} + +// RoleBindingLister implements the rbacv1beta1listers.RoleBindingLister interface. +type RoleBindingLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all rbacv1beta1.RoleBinding in the indexer. +func (s RoleBindingLister) List(selector labels.Selector) (ret []*rbacv1beta1.RoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1beta1.RoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// RoleBindings returns an object that can list and get rbacv1beta1.RoleBinding. +func (s RoleBindingLister) RoleBindings(namespace string) rbacv1beta1listers.RoleBindingNamespaceLister { + return &RoleBindingNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// RoleBindingNamespaceLister implements the rbacv1beta1listers.RoleBindingNamespaceLister interface. +type RoleBindingNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all rbacv1beta1.RoleBinding in the indexer for a given namespace. +func (s RoleBindingNamespaceLister) List(selector labels.Selector) (ret []*rbacv1beta1.RoleBinding, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*rbacv1beta1.RoleBinding) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the rbacv1beta1.RoleBinding from the indexer for a given namespace and name. +func (s RoleBindingNamespaceLister) Get(name string) (*rbacv1beta1.RoleBinding, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(rbacv1beta1.Resource("RoleBinding"), name) + } + return obj.(*rbacv1beta1.RoleBinding), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1/priorityclass.go b/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1/priorityclass.go new file mode 100644 index 0000000000000..3e1bf35428bc1 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1/priorityclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + schedulingv1 "k8s.io/api/scheduling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + schedulingv1listers "k8s.io/client-go/listers/scheduling/v1" + "k8s.io/client-go/tools/cache" +) + +var _ schedulingv1listers.PriorityClassLister = &PriorityClassClusterLister{} + +// PriorityClassClusterLister implements the schedulingv1listers.PriorityClassLister interface. +type PriorityClassClusterLister struct { + indexer cache.Indexer +} + +// NewPriorityClassClusterLister returns a new PriorityClassClusterLister. +func NewPriorityClassClusterLister(indexer cache.Indexer) schedulingv1listers.PriorityClassLister { + return &PriorityClassClusterLister{indexer: indexer} +} + +// List lists all schedulingv1.PriorityClass in the indexer. +func (s PriorityClassClusterLister) List(selector labels.Selector) (ret []*schedulingv1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*schedulingv1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the schedulingv1.PriorityClass from the indexer for a given name. +func (s PriorityClassClusterLister) Get(name string) (*schedulingv1.PriorityClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get schedulingv1.PriorityClass. + +func (s PriorityClassClusterLister) Cluster(cluster logicalcluster.Name) schedulingv1listers.PriorityClassLister { + return &PriorityClassLister{indexer: s.indexer, cluster: cluster} +} + +// PriorityClassLister implements the schedulingv1listers.PriorityClassLister interface. +type PriorityClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all schedulingv1.PriorityClass in the indexer. +func (s PriorityClassLister) List(selector labels.Selector) (ret []*schedulingv1.PriorityClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*schedulingv1.PriorityClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the schedulingv1.PriorityClass from the indexer for a given name. +func (s PriorityClassLister) Get(name string) (*schedulingv1.PriorityClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schedulingv1.Resource("PriorityClass"), name) + } + return obj.(*schedulingv1.PriorityClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1alpha1/priorityclass.go b/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1alpha1/priorityclass.go new file mode 100644 index 0000000000000..6f9d908be6701 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1alpha1/priorityclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + schedulingv1alpha1listers "k8s.io/client-go/listers/scheduling/v1alpha1" + "k8s.io/client-go/tools/cache" +) + +var _ schedulingv1alpha1listers.PriorityClassLister = &PriorityClassClusterLister{} + +// PriorityClassClusterLister implements the schedulingv1alpha1listers.PriorityClassLister interface. +type PriorityClassClusterLister struct { + indexer cache.Indexer +} + +// NewPriorityClassClusterLister returns a new PriorityClassClusterLister. +func NewPriorityClassClusterLister(indexer cache.Indexer) schedulingv1alpha1listers.PriorityClassLister { + return &PriorityClassClusterLister{indexer: indexer} +} + +// List lists all schedulingv1alpha1.PriorityClass in the indexer. +func (s PriorityClassClusterLister) List(selector labels.Selector) (ret []*schedulingv1alpha1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*schedulingv1alpha1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the schedulingv1alpha1.PriorityClass from the indexer for a given name. +func (s PriorityClassClusterLister) Get(name string) (*schedulingv1alpha1.PriorityClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get schedulingv1alpha1.PriorityClass. + +func (s PriorityClassClusterLister) Cluster(cluster logicalcluster.Name) schedulingv1alpha1listers.PriorityClassLister { + return &PriorityClassLister{indexer: s.indexer, cluster: cluster} +} + +// PriorityClassLister implements the schedulingv1alpha1listers.PriorityClassLister interface. +type PriorityClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all schedulingv1alpha1.PriorityClass in the indexer. +func (s PriorityClassLister) List(selector labels.Selector) (ret []*schedulingv1alpha1.PriorityClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*schedulingv1alpha1.PriorityClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the schedulingv1alpha1.PriorityClass from the indexer for a given name. +func (s PriorityClassLister) Get(name string) (*schedulingv1alpha1.PriorityClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schedulingv1alpha1.Resource("PriorityClass"), name) + } + return obj.(*schedulingv1alpha1.PriorityClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1beta1/priorityclass.go b/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1beta1/priorityclass.go new file mode 100644 index 0000000000000..eed18231109f8 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/scheduling/v1beta1/priorityclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + schedulingv1beta1listers "k8s.io/client-go/listers/scheduling/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ schedulingv1beta1listers.PriorityClassLister = &PriorityClassClusterLister{} + +// PriorityClassClusterLister implements the schedulingv1beta1listers.PriorityClassLister interface. +type PriorityClassClusterLister struct { + indexer cache.Indexer +} + +// NewPriorityClassClusterLister returns a new PriorityClassClusterLister. +func NewPriorityClassClusterLister(indexer cache.Indexer) schedulingv1beta1listers.PriorityClassLister { + return &PriorityClassClusterLister{indexer: indexer} +} + +// List lists all schedulingv1beta1.PriorityClass in the indexer. +func (s PriorityClassClusterLister) List(selector labels.Selector) (ret []*schedulingv1beta1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*schedulingv1beta1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the schedulingv1beta1.PriorityClass from the indexer for a given name. +func (s PriorityClassClusterLister) Get(name string) (*schedulingv1beta1.PriorityClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get schedulingv1beta1.PriorityClass. + +func (s PriorityClassClusterLister) Cluster(cluster logicalcluster.Name) schedulingv1beta1listers.PriorityClassLister { + return &PriorityClassLister{indexer: s.indexer, cluster: cluster} +} + +// PriorityClassLister implements the schedulingv1beta1listers.PriorityClassLister interface. +type PriorityClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all schedulingv1beta1.PriorityClass in the indexer. +func (s PriorityClassLister) List(selector labels.Selector) (ret []*schedulingv1beta1.PriorityClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*schedulingv1beta1.PriorityClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the schedulingv1beta1.PriorityClass from the indexer for a given name. +func (s PriorityClassLister) Get(name string) (*schedulingv1beta1.PriorityClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schedulingv1beta1.Resource("PriorityClass"), name) + } + return obj.(*schedulingv1beta1.PriorityClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csidriver.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csidriver.go new file mode 100644 index 0000000000000..2c4aaeb625c4c --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csidriver.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1listers "k8s.io/client-go/listers/storage/v1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1listers.CSIDriverLister = &CSIDriverClusterLister{} + +// CSIDriverClusterLister implements the storagev1listers.CSIDriverLister interface. +type CSIDriverClusterLister struct { + indexer cache.Indexer +} + +// NewCSIDriverClusterLister returns a new CSIDriverClusterLister. +func NewCSIDriverClusterLister(indexer cache.Indexer) storagev1listers.CSIDriverLister { + return &CSIDriverClusterLister{indexer: indexer} +} + +// List lists all storagev1.CSIDriver in the indexer. +func (s CSIDriverClusterLister) List(selector labels.Selector) (ret []*storagev1.CSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1.CSIDriver)) + }) + return ret, err +} + +// Get retrieves the storagev1.CSIDriver from the indexer for a given name. +func (s CSIDriverClusterLister) Get(name string) (*storagev1.CSIDriver, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1.CSIDriver. + +func (s CSIDriverClusterLister) Cluster(cluster logicalcluster.Name) storagev1listers.CSIDriverLister { + return &CSIDriverLister{indexer: s.indexer, cluster: cluster} +} + +// CSIDriverLister implements the storagev1listers.CSIDriverLister interface. +type CSIDriverLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1.CSIDriver in the indexer. +func (s CSIDriverLister) List(selector labels.Selector) (ret []*storagev1.CSIDriver, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1.CSIDriver) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1.CSIDriver from the indexer for a given name. +func (s CSIDriverLister) Get(name string) (*storagev1.CSIDriver, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1.Resource("CSIDriver"), name) + } + return obj.(*storagev1.CSIDriver), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csinode.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csinode.go new file mode 100644 index 0000000000000..50f3d423fda30 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csinode.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1listers "k8s.io/client-go/listers/storage/v1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1listers.CSINodeLister = &CSINodeClusterLister{} + +// CSINodeClusterLister implements the storagev1listers.CSINodeLister interface. +type CSINodeClusterLister struct { + indexer cache.Indexer +} + +// NewCSINodeClusterLister returns a new CSINodeClusterLister. +func NewCSINodeClusterLister(indexer cache.Indexer) storagev1listers.CSINodeLister { + return &CSINodeClusterLister{indexer: indexer} +} + +// List lists all storagev1.CSINode in the indexer. +func (s CSINodeClusterLister) List(selector labels.Selector) (ret []*storagev1.CSINode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1.CSINode)) + }) + return ret, err +} + +// Get retrieves the storagev1.CSINode from the indexer for a given name. +func (s CSINodeClusterLister) Get(name string) (*storagev1.CSINode, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1.CSINode. + +func (s CSINodeClusterLister) Cluster(cluster logicalcluster.Name) storagev1listers.CSINodeLister { + return &CSINodeLister{indexer: s.indexer, cluster: cluster} +} + +// CSINodeLister implements the storagev1listers.CSINodeLister interface. +type CSINodeLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1.CSINode in the indexer. +func (s CSINodeLister) List(selector labels.Selector) (ret []*storagev1.CSINode, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1.CSINode) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1.CSINode from the indexer for a given name. +func (s CSINodeLister) Get(name string) (*storagev1.CSINode, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1.Resource("CSINode"), name) + } + return obj.(*storagev1.CSINode), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csistoragecapacity.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csistoragecapacity.go new file mode 100644 index 0000000000000..6720d30ecaf52 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/csistoragecapacity.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1listers "k8s.io/client-go/listers/storage/v1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1listers.CSIStorageCapacityLister = &CSIStorageCapacityClusterLister{} + +// CSIStorageCapacityClusterLister implements the storagev1listers.CSIStorageCapacityLister interface. +type CSIStorageCapacityClusterLister struct { + indexer cache.Indexer +} + +// NewCSIStorageCapacityClusterLister returns a new CSIStorageCapacityClusterLister. +func NewCSIStorageCapacityClusterLister(indexer cache.Indexer) storagev1listers.CSIStorageCapacityLister { + return &CSIStorageCapacityClusterLister{indexer: indexer} +} + +// List lists all storagev1.CSIStorageCapacity in the indexer. +func (s CSIStorageCapacityClusterLister) List(selector labels.Selector) (ret []*storagev1.CSIStorageCapacity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1.CSIStorageCapacity)) + }) + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get storagev1.CSIStorageCapacity. +func (s CSIStorageCapacityClusterLister) CSIStorageCapacities(namespace string) storagev1listers.CSIStorageCapacityNamespaceLister { + panic("Calling 'CSIStorageCapacities' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1.CSIStorageCapacity. + +func (s CSIStorageCapacityClusterLister) Cluster(cluster logicalcluster.Name) storagev1listers.CSIStorageCapacityLister { + return &CSIStorageCapacityLister{indexer: s.indexer, cluster: cluster} +} + +// CSIStorageCapacityLister implements the storagev1listers.CSIStorageCapacityLister interface. +type CSIStorageCapacityLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1.CSIStorageCapacity in the indexer. +func (s CSIStorageCapacityLister) List(selector labels.Selector) (ret []*storagev1.CSIStorageCapacity, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1.CSIStorageCapacity) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get storagev1.CSIStorageCapacity. +func (s CSIStorageCapacityLister) CSIStorageCapacities(namespace string) storagev1listers.CSIStorageCapacityNamespaceLister { + return &CSIStorageCapacityNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// CSIStorageCapacityNamespaceLister implements the storagev1listers.CSIStorageCapacityNamespaceLister interface. +type CSIStorageCapacityNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all storagev1.CSIStorageCapacity in the indexer for a given namespace. +func (s CSIStorageCapacityNamespaceLister) List(selector labels.Selector) (ret []*storagev1.CSIStorageCapacity, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1.CSIStorageCapacity) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the storagev1.CSIStorageCapacity from the indexer for a given namespace and name. +func (s CSIStorageCapacityNamespaceLister) Get(name string) (*storagev1.CSIStorageCapacity, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1.Resource("CSIStorageCapacity"), name) + } + return obj.(*storagev1.CSIStorageCapacity), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1/storageclass.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/storageclass.go new file mode 100644 index 0000000000000..497208c82609d --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/storageclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1listers "k8s.io/client-go/listers/storage/v1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1listers.StorageClassLister = &StorageClassClusterLister{} + +// StorageClassClusterLister implements the storagev1listers.StorageClassLister interface. +type StorageClassClusterLister struct { + indexer cache.Indexer +} + +// NewStorageClassClusterLister returns a new StorageClassClusterLister. +func NewStorageClassClusterLister(indexer cache.Indexer) storagev1listers.StorageClassLister { + return &StorageClassClusterLister{indexer: indexer} +} + +// List lists all storagev1.StorageClass in the indexer. +func (s StorageClassClusterLister) List(selector labels.Selector) (ret []*storagev1.StorageClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1.StorageClass)) + }) + return ret, err +} + +// Get retrieves the storagev1.StorageClass from the indexer for a given name. +func (s StorageClassClusterLister) Get(name string) (*storagev1.StorageClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1.StorageClass. + +func (s StorageClassClusterLister) Cluster(cluster logicalcluster.Name) storagev1listers.StorageClassLister { + return &StorageClassLister{indexer: s.indexer, cluster: cluster} +} + +// StorageClassLister implements the storagev1listers.StorageClassLister interface. +type StorageClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1.StorageClass in the indexer. +func (s StorageClassLister) List(selector labels.Selector) (ret []*storagev1.StorageClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1.StorageClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1.StorageClass from the indexer for a given name. +func (s StorageClassLister) Get(name string) (*storagev1.StorageClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1.Resource("StorageClass"), name) + } + return obj.(*storagev1.StorageClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1/volumeattachment.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/volumeattachment.go new file mode 100644 index 0000000000000..bb40328549257 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1/volumeattachment.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1listers "k8s.io/client-go/listers/storage/v1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1listers.VolumeAttachmentLister = &VolumeAttachmentClusterLister{} + +// VolumeAttachmentClusterLister implements the storagev1listers.VolumeAttachmentLister interface. +type VolumeAttachmentClusterLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentClusterLister returns a new VolumeAttachmentClusterLister. +func NewVolumeAttachmentClusterLister(indexer cache.Indexer) storagev1listers.VolumeAttachmentLister { + return &VolumeAttachmentClusterLister{indexer: indexer} +} + +// List lists all storagev1.VolumeAttachment in the indexer. +func (s VolumeAttachmentClusterLister) List(selector labels.Selector) (ret []*storagev1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the storagev1.VolumeAttachment from the indexer for a given name. +func (s VolumeAttachmentClusterLister) Get(name string) (*storagev1.VolumeAttachment, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1.VolumeAttachment. + +func (s VolumeAttachmentClusterLister) Cluster(cluster logicalcluster.Name) storagev1listers.VolumeAttachmentLister { + return &VolumeAttachmentLister{indexer: s.indexer, cluster: cluster} +} + +// VolumeAttachmentLister implements the storagev1listers.VolumeAttachmentLister interface. +type VolumeAttachmentLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1.VolumeAttachment in the indexer. +func (s VolumeAttachmentLister) List(selector labels.Selector) (ret []*storagev1.VolumeAttachment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1.VolumeAttachment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1.VolumeAttachment from the indexer for a given name. +func (s VolumeAttachmentLister) Get(name string) (*storagev1.VolumeAttachment, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1.Resource("VolumeAttachment"), name) + } + return obj.(*storagev1.VolumeAttachment), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csidriver.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csidriver.go new file mode 100644 index 0000000000000..692cff99d6bc0 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csidriver.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1beta1listers.CSIDriverLister = &CSIDriverClusterLister{} + +// CSIDriverClusterLister implements the storagev1beta1listers.CSIDriverLister interface. +type CSIDriverClusterLister struct { + indexer cache.Indexer +} + +// NewCSIDriverClusterLister returns a new CSIDriverClusterLister. +func NewCSIDriverClusterLister(indexer cache.Indexer) storagev1beta1listers.CSIDriverLister { + return &CSIDriverClusterLister{indexer: indexer} +} + +// List lists all storagev1beta1.CSIDriver in the indexer. +func (s CSIDriverClusterLister) List(selector labels.Selector) (ret []*storagev1beta1.CSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1beta1.CSIDriver)) + }) + return ret, err +} + +// Get retrieves the storagev1beta1.CSIDriver from the indexer for a given name. +func (s CSIDriverClusterLister) Get(name string) (*storagev1beta1.CSIDriver, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1beta1.CSIDriver. + +func (s CSIDriverClusterLister) Cluster(cluster logicalcluster.Name) storagev1beta1listers.CSIDriverLister { + return &CSIDriverLister{indexer: s.indexer, cluster: cluster} +} + +// CSIDriverLister implements the storagev1beta1listers.CSIDriverLister interface. +type CSIDriverLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1beta1.CSIDriver in the indexer. +func (s CSIDriverLister) List(selector labels.Selector) (ret []*storagev1beta1.CSIDriver, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1beta1.CSIDriver) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1beta1.CSIDriver from the indexer for a given name. +func (s CSIDriverLister) Get(name string) (*storagev1beta1.CSIDriver, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1beta1.Resource("CSIDriver"), name) + } + return obj.(*storagev1beta1.CSIDriver), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csinode.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csinode.go new file mode 100644 index 0000000000000..fe62e70dc9666 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csinode.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1beta1listers.CSINodeLister = &CSINodeClusterLister{} + +// CSINodeClusterLister implements the storagev1beta1listers.CSINodeLister interface. +type CSINodeClusterLister struct { + indexer cache.Indexer +} + +// NewCSINodeClusterLister returns a new CSINodeClusterLister. +func NewCSINodeClusterLister(indexer cache.Indexer) storagev1beta1listers.CSINodeLister { + return &CSINodeClusterLister{indexer: indexer} +} + +// List lists all storagev1beta1.CSINode in the indexer. +func (s CSINodeClusterLister) List(selector labels.Selector) (ret []*storagev1beta1.CSINode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1beta1.CSINode)) + }) + return ret, err +} + +// Get retrieves the storagev1beta1.CSINode from the indexer for a given name. +func (s CSINodeClusterLister) Get(name string) (*storagev1beta1.CSINode, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1beta1.CSINode. + +func (s CSINodeClusterLister) Cluster(cluster logicalcluster.Name) storagev1beta1listers.CSINodeLister { + return &CSINodeLister{indexer: s.indexer, cluster: cluster} +} + +// CSINodeLister implements the storagev1beta1listers.CSINodeLister interface. +type CSINodeLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1beta1.CSINode in the indexer. +func (s CSINodeLister) List(selector labels.Selector) (ret []*storagev1beta1.CSINode, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1beta1.CSINode) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1beta1.CSINode from the indexer for a given name. +func (s CSINodeLister) Get(name string) (*storagev1beta1.CSINode, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1beta1.Resource("CSINode"), name) + } + return obj.(*storagev1beta1.CSINode), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csistoragecapacity.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csistoragecapacity.go new file mode 100644 index 0000000000000..2df85a06bc28a --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/csistoragecapacity.go @@ -0,0 +1,141 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1beta1listers.CSIStorageCapacityLister = &CSIStorageCapacityClusterLister{} + +// CSIStorageCapacityClusterLister implements the storagev1beta1listers.CSIStorageCapacityLister interface. +type CSIStorageCapacityClusterLister struct { + indexer cache.Indexer +} + +// NewCSIStorageCapacityClusterLister returns a new CSIStorageCapacityClusterLister. +func NewCSIStorageCapacityClusterLister(indexer cache.Indexer) storagev1beta1listers.CSIStorageCapacityLister { + return &CSIStorageCapacityClusterLister{indexer: indexer} +} + +// List lists all storagev1beta1.CSIStorageCapacity in the indexer. +func (s CSIStorageCapacityClusterLister) List(selector labels.Selector) (ret []*storagev1beta1.CSIStorageCapacity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1beta1.CSIStorageCapacity)) + }) + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get storagev1beta1.CSIStorageCapacity. +func (s CSIStorageCapacityClusterLister) CSIStorageCapacities(namespace string) storagev1beta1listers.CSIStorageCapacityNamespaceLister { + panic("Calling 'CSIStorageCapacities' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1beta1.CSIStorageCapacity. + +func (s CSIStorageCapacityClusterLister) Cluster(cluster logicalcluster.Name) storagev1beta1listers.CSIStorageCapacityLister { + return &CSIStorageCapacityLister{indexer: s.indexer, cluster: cluster} +} + +// CSIStorageCapacityLister implements the storagev1beta1listers.CSIStorageCapacityLister interface. +type CSIStorageCapacityLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1beta1.CSIStorageCapacity in the indexer. +func (s CSIStorageCapacityLister) List(selector labels.Selector) (ret []*storagev1beta1.CSIStorageCapacity, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1beta1.CSIStorageCapacity) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get storagev1beta1.CSIStorageCapacity. +func (s CSIStorageCapacityLister) CSIStorageCapacities(namespace string) storagev1beta1listers.CSIStorageCapacityNamespaceLister { + return &CSIStorageCapacityNamespaceLister{indexer: s.indexer, cluster: s.cluster, namespace: namespace} +} + +// CSIStorageCapacityNamespaceLister implements the storagev1beta1listers.CSIStorageCapacityNamespaceLister interface. +type CSIStorageCapacityNamespaceLister struct { + indexer cache.Indexer + cluster logicalcluster.Name + namespace string +} + +// List lists all storagev1beta1.CSIStorageCapacity in the indexer for a given namespace. +func (s CSIStorageCapacityNamespaceLister) List(selector labels.Selector) (ret []*storagev1beta1.CSIStorageCapacity, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterAndNamespaceIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1beta1.CSIStorageCapacity) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + return ret, err +} + +// Get retrieves the storagev1beta1.CSIStorageCapacity from the indexer for a given namespace and name. +func (s CSIStorageCapacityNamespaceLister) Get(name string) (*storagev1beta1.CSIStorageCapacity, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1beta1.Resource("CSIStorageCapacity"), name) + } + return obj.(*storagev1beta1.CSIStorageCapacity), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/storageclass.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/storageclass.go new file mode 100644 index 0000000000000..1d52e2e08bd89 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/storageclass.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1beta1listers.StorageClassLister = &StorageClassClusterLister{} + +// StorageClassClusterLister implements the storagev1beta1listers.StorageClassLister interface. +type StorageClassClusterLister struct { + indexer cache.Indexer +} + +// NewStorageClassClusterLister returns a new StorageClassClusterLister. +func NewStorageClassClusterLister(indexer cache.Indexer) storagev1beta1listers.StorageClassLister { + return &StorageClassClusterLister{indexer: indexer} +} + +// List lists all storagev1beta1.StorageClass in the indexer. +func (s StorageClassClusterLister) List(selector labels.Selector) (ret []*storagev1beta1.StorageClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1beta1.StorageClass)) + }) + return ret, err +} + +// Get retrieves the storagev1beta1.StorageClass from the indexer for a given name. +func (s StorageClassClusterLister) Get(name string) (*storagev1beta1.StorageClass, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1beta1.StorageClass. + +func (s StorageClassClusterLister) Cluster(cluster logicalcluster.Name) storagev1beta1listers.StorageClassLister { + return &StorageClassLister{indexer: s.indexer, cluster: cluster} +} + +// StorageClassLister implements the storagev1beta1listers.StorageClassLister interface. +type StorageClassLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1beta1.StorageClass in the indexer. +func (s StorageClassLister) List(selector labels.Selector) (ret []*storagev1beta1.StorageClass, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1beta1.StorageClass) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1beta1.StorageClass from the indexer for a given name. +func (s StorageClassLister) Get(name string) (*storagev1beta1.StorageClass, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1beta1.Resource("StorageClass"), name) + } + return obj.(*storagev1beta1.StorageClass), nil +} diff --git a/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/volumeattachment.go b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/volumeattachment.go new file mode 100644 index 0000000000000..2fc15c836e762 --- /dev/null +++ b/staging/src/k8s.io/client-go/kcp/listers/storage/v1beta1/volumeattachment.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + apimachinerycache "github.com/kcp-dev/apimachinery/pkg/cache" + "github.com/kcp-dev/logicalcluster" + storagev1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1" + "k8s.io/client-go/tools/cache" +) + +var _ storagev1beta1listers.VolumeAttachmentLister = &VolumeAttachmentClusterLister{} + +// VolumeAttachmentClusterLister implements the storagev1beta1listers.VolumeAttachmentLister interface. +type VolumeAttachmentClusterLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentClusterLister returns a new VolumeAttachmentClusterLister. +func NewVolumeAttachmentClusterLister(indexer cache.Indexer) storagev1beta1listers.VolumeAttachmentLister { + return &VolumeAttachmentClusterLister{indexer: indexer} +} + +// List lists all storagev1beta1.VolumeAttachment in the indexer. +func (s VolumeAttachmentClusterLister) List(selector labels.Selector) (ret []*storagev1beta1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*storagev1beta1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the storagev1beta1.VolumeAttachment from the indexer for a given name. +func (s VolumeAttachmentClusterLister) Get(name string) (*storagev1beta1.VolumeAttachment, error) { + panic("Calling 'Get' is not supported before scoping lister to a workspace") +} + +// Cluster returns an object that can list and get storagev1beta1.VolumeAttachment. + +func (s VolumeAttachmentClusterLister) Cluster(cluster logicalcluster.Name) storagev1beta1listers.VolumeAttachmentLister { + return &VolumeAttachmentLister{indexer: s.indexer, cluster: cluster} +} + +// VolumeAttachmentLister implements the storagev1beta1listers.VolumeAttachmentLister interface. +type VolumeAttachmentLister struct { + indexer cache.Indexer + cluster logicalcluster.Name +} + +// List lists all storagev1beta1.VolumeAttachment in the indexer. +func (s VolumeAttachmentLister) List(selector labels.Selector) (ret []*storagev1beta1.VolumeAttachment, err error) { + selectAll := selector == nil || selector.Empty() + + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", "") + list, err := s.indexer.ByIndex(apimachinerycache.ClusterIndexName, key) + if err != nil { + return nil, err + } + + for i := range list { + obj := list[i].(*storagev1beta1.VolumeAttachment) + if selectAll { + ret = append(ret, obj) + } else { + if selector.Matches(labels.Set(obj.GetLabels())) { + ret = append(ret, obj) + } + } + } + + return ret, err +} + +// Get retrieves the storagev1beta1.VolumeAttachment from the indexer for a given name. +func (s VolumeAttachmentLister) Get(name string) (*storagev1beta1.VolumeAttachment, error) { + key := apimachinerycache.ToClusterAwareKey(s.cluster.String(), "", name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(storagev1beta1.Resource("VolumeAttachment"), name) + } + return obj.(*storagev1beta1.VolumeAttachment), nil +}