diff --git a/Makefile b/Makefile index b96a2469173..708bfcd3bda 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ ifeq (, $(wildcard $(KUBEBUILDER_ASSETS)/kube-apiserver)) endif cover.out: - go test $(MOD_FLAGS) -tags "json1" -v -race -coverprofile=cover.out -covermode=atomic \ + go test $(MOD_FLAGS) -tags "json1" -race -coverprofile=cover.out -covermode=atomic \ -coverpkg ./pkg/controller/... ./pkg/... coverage: cover.out diff --git a/pkg/controller/operators/catalog/operator.go b/pkg/controller/operators/catalog/operator.go index aa7eb9668b7..8ad84dea86f 100644 --- a/pkg/controller/operators/catalog/operator.go +++ b/pkg/controller/operators/catalog/operator.go @@ -20,7 +20,6 @@ import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apiextensions-apiserver/pkg/apiserver/validation" - extinf "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -34,6 +33,9 @@ import ( "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/dynamic" "k8s.io/client-go/informers" + "k8s.io/client-go/metadata" + "k8s.io/client-go/metadata/metadatainformer" + "k8s.io/client-go/metadata/metadatalister" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/record" @@ -144,6 +146,11 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo return nil, err } + metadataClient, err := metadata.NewForConfig(config) + if err != nil { + return nil, err + } + // Create a new queueinformer-based operator. opClient, err := operatorclient.NewClientFromRestConfig(config) if err != nil { @@ -443,13 +450,23 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo return nil, err } - // Register CustomResourceDefinition QueueInformer - crdInformer := extinf.NewSharedInformerFactory(op.opClient.ApiextensionsInterface(), resyncPeriod()).Apiextensions().V1().CustomResourceDefinitions() - op.lister.APIExtensionsV1().RegisterCustomResourceDefinitionLister(crdInformer.Lister()) + // Register CustomResourceDefinition QueueInformer. Object metadata requests are used + // by this informer in order to reduce cached size. + gvr := apiextensionsv1.SchemeGroupVersion.WithResource("customresourcedefinitions") + crdInformer := metadatainformer.NewFilteredMetadataInformer( + metadataClient, + gvr, + metav1.NamespaceAll, + resyncPeriod(), + cache.Indexers{}, + nil, + ).Informer() + crdLister := metadatalister.New(crdInformer.GetIndexer(), gvr) + op.lister.APIExtensionsV1().RegisterCustomResourceDefinitionLister(crdLister) crdQueueInformer, err := queueinformer.NewQueueInformer( ctx, queueinformer.WithLogger(op.logger), - queueinformer.WithInformer(crdInformer.Informer()), + queueinformer.WithInformer(crdInformer), queueinformer.WithSyncer(queueinformer.LegacySyncHandler(op.syncObject).ToSyncerWithDelete(op.handleDeletion)), ) if err != nil { diff --git a/pkg/controller/operators/olm/operator.go b/pkg/controller/operators/olm/operator.go index 189abb6a383..83d09e41c8e 100644 --- a/pkg/controller/operators/olm/operator.go +++ b/pkg/controller/operators/olm/operator.go @@ -13,7 +13,6 @@ import ( corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - extinf "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -541,14 +540,25 @@ func newOperatorWithConfig(ctx context.Context, config *operatorConfig) (*Operat return nil, err } - // Register CustomResourceDefinition QueueInformer - crdInformer := extinf.NewSharedInformerFactory(op.opClient.ApiextensionsInterface(), config.resyncPeriod()).Apiextensions().V1().CustomResourceDefinitions() + // Register CustomResourceDefinition QueueInformer. Object metadata requests are used + // by this informer in order to reduce cached size. + gvr := apiextensionsv1.SchemeGroupVersion.WithResource("customresourcedefinitions") + crdInformer := metadatainformer.NewFilteredMetadataInformer( + config.metadataClient, + gvr, + metav1.NamespaceAll, + config.resyncPeriod(), + cache.Indexers{}, + nil, + ).Informer() + crdLister := metadatalister.New(crdInformer.GetIndexer(), gvr) informersByNamespace[metav1.NamespaceAll].CRDInformer = crdInformer - op.lister.APIExtensionsV1().RegisterCustomResourceDefinitionLister(crdInformer.Lister()) + informersByNamespace[metav1.NamespaceAll].CRDLister = crdLister + op.lister.APIExtensionsV1().RegisterCustomResourceDefinitionLister(crdLister) crdQueueInformer, err := queueinformer.NewQueueInformer( ctx, queueinformer.WithLogger(op.logger), - queueinformer.WithInformer(crdInformer.Informer()), + queueinformer.WithInformer(crdInformer), queueinformer.WithSyncer(k8sSyncer), ) if err != nil { @@ -1183,7 +1193,7 @@ func (a *Operator) handleClusterServiceVersionDeletion(obj interface{}) { } for i, crdName := range desc.ConversionCRDs { - crd, err := a.lister.APIExtensionsV1().CustomResourceDefinitionLister().Get(crdName) + crd, err := a.opClient.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), crdName, metav1.GetOptions{}) if err != nil { logger.Errorf("error getting CRD %v which was defined in CSVs spec.WebhookDefinition[%d]: %v\n", crdName, i, err) continue diff --git a/pkg/controller/operators/olm/operator_test.go b/pkg/controller/operators/olm/operator_test.go index 86e331c2aa7..d4b0c0c3a48 100644 --- a/pkg/controller/operators/olm/operator_test.go +++ b/pkg/controller/operators/olm/operator_test.go @@ -298,13 +298,14 @@ func NewFakeOperator(ctx context.Context, options ...fakeOperatorOption) (*Opera *config.actionLog = append(*config.actionLog, action) return false, nil, nil })) - config.operatorClient = operatorclient.NewClient(k8sClientFake, apiextensionsfake.NewSimpleClientset(config.extObjs...), apiregistrationfake.NewSimpleClientset(config.regObjs...)) + apiextensionsFake := apiextensionsfake.NewSimpleClientset(config.extObjs...) + config.operatorClient = operatorclient.NewClient(k8sClientFake, apiextensionsFake, apiregistrationfake.NewSimpleClientset(config.regObjs...)) config.configClient = configfake.NewSimpleClientset() metadataFake := metadatafake.NewSimpleMetadataClient(scheme, config.partialMetadata...) config.metadataClient = metadataFake // It's a travesty that we need to do this, but the fakes leave us no other option. In the API server, of course // changes to objects are transparently exposed in the metadata client. In fake-land, we need to enforce that ourselves. - externalFake.PrependReactor("*", "*", func(action clienttesting.Action) (bool, runtime.Object, error) { + propagate := func(action clienttesting.Action) (bool, runtime.Object, error) { var err error switch action.GetVerb() { case "create": @@ -320,7 +321,9 @@ func NewFakeOperator(ctx context.Context, options ...fakeOperatorOption) (*Opera err = metadataFake.Resource(action.GetResource()).Delete(context.TODO(), a.GetName(), metav1.DeleteOptions{}) } return false, nil, err - }) + } + externalFake.PrependReactor("*", "*", propagate) + apiextensionsFake.PrependReactor("*", "*", propagate) for _, ns := range config.namespaces { _, err := config.operatorClient.KubernetesInterface().CoreV1().Namespaces().Create(context.TODO(), &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ns}}, metav1.CreateOptions{}) @@ -4397,7 +4400,7 @@ func TestSyncOperatorGroups(t *testing.T) { operatorGroup *operatorsv1.OperatorGroup csvs []*v1alpha1.ClusterServiceVersion clientObjs []runtime.Object - crds []runtime.Object + crds []*apiextensionsv1.CustomResourceDefinition k8sObjs []runtime.Object apis []runtime.Object } @@ -4474,7 +4477,7 @@ func TestSyncOperatorGroups(t *testing.T) { role, roleBinding, }, - crds: []runtime.Object{crd}, + crds: []*apiextensionsv1.CustomResourceDefinition{crd}, }, expectedStatus: operatorsv1.OperatorGroupStatus{}, final: final{objects: map[string][]runtime.Object{ @@ -4553,7 +4556,7 @@ func TestSyncOperatorGroups(t *testing.T) { role, roleBinding, }, - crds: []runtime.Object{crd}, + crds: []*apiextensionsv1.CustomResourceDefinition{crd}, }, expectedStatus: operatorsv1.OperatorGroupStatus{ Namespaces: []string{operatorNamespace, targetNamespace}, @@ -4656,7 +4659,7 @@ func TestSyncOperatorGroups(t *testing.T) { role, roleBinding, }, - crds: []runtime.Object{crd}, + crds: []*apiextensionsv1.CustomResourceDefinition{crd}, }, expectedStatus: operatorsv1.OperatorGroupStatus{ Namespaces: []string{operatorNamespace, targetNamespace}, @@ -4762,7 +4765,7 @@ func TestSyncOperatorGroups(t *testing.T) { role, roleBinding, }, - crds: []runtime.Object{crd}, + crds: []*apiextensionsv1.CustomResourceDefinition{crd}, }, expectedStatus: operatorsv1.OperatorGroupStatus{ Namespaces: []string{corev1.NamespaceAll}, @@ -4925,7 +4928,7 @@ func TestSyncOperatorGroups(t *testing.T) { role, roleBinding, }, - crds: []runtime.Object{crd}, + crds: []*apiextensionsv1.CustomResourceDefinition{crd}, }, expectedStatus: operatorsv1.OperatorGroupStatus{ Namespaces: []string{corev1.NamespaceAll}, @@ -4982,7 +4985,7 @@ func TestSyncOperatorGroups(t *testing.T) { operatorGroup = tt.initial.operatorGroup.DeepCopy() clientObjs = copyObjs(append(tt.initial.clientObjs, operatorGroup)) k8sObjs = copyObjs(tt.initial.k8sObjs) - extObjs = copyObjs(tt.initial.crds) + extObjs []runtime.Object regObjs = copyObjs(tt.initial.apis) ) @@ -4992,11 +4995,25 @@ func TestSyncOperatorGroups(t *testing.T) { var partials []runtime.Object for _, csv := range tt.initial.csvs { - clientObjs = append(clientObjs, csv) + clientObjs = append(clientObjs, csv.DeepCopy()) partials = append(partials, &metav1.PartialObjectMetadata{ + TypeMeta: metav1.TypeMeta{ + Kind: "ClusterServiceVersion", + APIVersion: v1alpha1.SchemeGroupVersion.String(), + }, ObjectMeta: csv.ObjectMeta, }) } + for _, crd := range tt.initial.crds { + extObjs = append(extObjs, crd.DeepCopy()) + partials = append(partials, &metav1.PartialObjectMetadata{ + TypeMeta: metav1.TypeMeta{ + Kind: "CustomResourceDefinition", + APIVersion: apiextensionsv1.SchemeGroupVersion.String(), + }, + ObjectMeta: crd.ObjectMeta, + }) + } l := logrus.New() l.SetLevel(logrus.DebugLevel) l = l.WithField("test", tt.name).Logger @@ -5094,12 +5111,12 @@ func TestSyncOperatorGroups(t *testing.T) { t.Log("op.syncClusterServiceVersion") if err := op.syncClusterServiceVersion(&csv); err != nil { - return false, err + return false, fmt.Errorf("failed to syncClusterServiceVersion: %w", err) } t.Log("op.syncCopyCSV") if err := op.syncCopyCSV(&csv); err != nil && !tt.ignoreCopyError { - return false, err + return false, fmt.Errorf("failed to syncCopyCSV: %w", err) } } diff --git a/pkg/controller/operators/olm/plugins/operator_plugin.go b/pkg/controller/operators/olm/plugins/operator_plugin.go index cfee0e92363..2b87eb9a4b3 100644 --- a/pkg/controller/operators/olm/plugins/operator_plugin.go +++ b/pkg/controller/operators/olm/plugins/operator_plugin.go @@ -11,7 +11,6 @@ import ( "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient" "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer" "github.com/sirupsen/logrus" - extensionsv1informers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1" appsv1informers "k8s.io/client-go/informers/apps/v1" corev1informers "k8s.io/client-go/informers/core/v1" rbacv1informers "k8s.io/client-go/informers/rbac/v1" @@ -46,7 +45,8 @@ type Informers struct { ClusterRoleBindingInformer rbacv1informers.ClusterRoleBindingInformer NamespaceInformer corev1informers.NamespaceInformer APIServiceInformer apiregistrationv1informers.APIServiceInformer - CRDInformer extensionsv1informers.CustomResourceDefinitionInformer + CRDInformer cache.SharedIndexInformer + CRDLister metadatalister.Lister } // OperatorConfig gives access to required configuration from the host operator diff --git a/pkg/controller/operators/olm/requirements.go b/pkg/controller/operators/olm/requirements.go index f4d408121ca..0c288b8e360 100644 --- a/pkg/controller/operators/olm/requirements.go +++ b/pkg/controller/operators/olm/requirements.go @@ -1,6 +1,7 @@ package olm import ( + "context" "encoding/json" "fmt" "strings" @@ -94,7 +95,7 @@ func (a *Operator) requirementStatus(strategyDetailsDeployment *v1alpha1.Strateg } // check if CRD exists - this verifies group, version, and kind, so no need for GVK check via discovery - crd, err := a.lister.APIExtensionsV1().CustomResourceDefinitionLister().Get(r.Name) + crd, err := a.opClient.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), r.Name, metav1.GetOptions{}) if err != nil { status.Status = v1alpha1.RequirementStatusReasonNotPresent status.Message = "CRD is not present" diff --git a/pkg/lib/operatorlister/customresourcedefinition.go b/pkg/lib/operatorlister/customresourcedefinition.go index 07c60a9126e..69cac64e347 100644 --- a/pkg/lib/operatorlister/customresourcedefinition.go +++ b/pkg/lib/operatorlister/customresourcedefinition.go @@ -4,20 +4,30 @@ import ( "fmt" "sync" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - aextv1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/metadata/metadatalister" ) // UnionCustomResourceDefinitionLister is a custom implementation of an CustomResourceDefinition lister that allows a new -// Lister to be registered on the fly. This Lister lists both v1 and v1beta1 APIVersion (at the newer version) CRDs. +// Lister to be registered on the fly. type UnionCustomResourceDefinitionLister struct { - CustomResourceDefinitionLister aextv1.CustomResourceDefinitionLister + CustomResourceDefinitionLister metadatalister.Lister CustomResourceDefinitionLock sync.RWMutex } +func (ucl *UnionCustomResourceDefinitionLister) Namespace(namespace string) metadatalister.NamespaceLister { + ucl.CustomResourceDefinitionLock.RLock() + defer ucl.CustomResourceDefinitionLock.RUnlock() + + if ucl.CustomResourceDefinitionLister == nil { + panic(fmt.Errorf("no CustomResourceDefinition lister registered")) + } + return ucl.CustomResourceDefinitionLister.Namespace(namespace) +} + // List lists all CustomResourceDefinitions in the indexer. -func (ucl *UnionCustomResourceDefinitionLister) List(selector labels.Selector) (ret []*apiextensionsv1.CustomResourceDefinition, err error) { +func (ucl *UnionCustomResourceDefinitionLister) List(selector labels.Selector) (ret []*metav1.PartialObjectMetadata, err error) { ucl.CustomResourceDefinitionLock.RLock() defer ucl.CustomResourceDefinitionLock.RUnlock() @@ -28,7 +38,7 @@ func (ucl *UnionCustomResourceDefinitionLister) List(selector labels.Selector) ( } // Get retrieves the CustomResourceDefinition with the given name -func (ucl *UnionCustomResourceDefinitionLister) Get(name string) (*apiextensionsv1.CustomResourceDefinition, error) { +func (ucl *UnionCustomResourceDefinitionLister) Get(name string) (*metav1.PartialObjectMetadata, error) { ucl.CustomResourceDefinitionLock.RLock() defer ucl.CustomResourceDefinitionLock.RUnlock() @@ -39,17 +49,17 @@ func (ucl *UnionCustomResourceDefinitionLister) Get(name string) (*apiextensions } // RegisterCustomResourceDefinitionLister registers a new CustomResourceDefinitionLister -func (ucl *UnionCustomResourceDefinitionLister) RegisterCustomResourceDefinitionLister(lister aextv1.CustomResourceDefinitionLister) { +func (ucl *UnionCustomResourceDefinitionLister) RegisterCustomResourceDefinitionLister(lister metadatalister.Lister) { ucl.CustomResourceDefinitionLock.Lock() defer ucl.CustomResourceDefinitionLock.Unlock() ucl.CustomResourceDefinitionLister = lister } -func (l *apiExtensionsV1Lister) RegisterCustomResourceDefinitionLister(lister aextv1.CustomResourceDefinitionLister) { +func (l *apiExtensionsV1Lister) RegisterCustomResourceDefinitionLister(lister metadatalister.Lister) { l.customResourceDefinitionLister.RegisterCustomResourceDefinitionLister(lister) } -func (l *apiExtensionsV1Lister) CustomResourceDefinitionLister() aextv1.CustomResourceDefinitionLister { +func (l *apiExtensionsV1Lister) CustomResourceDefinitionLister() metadatalister.Lister { return l.customResourceDefinitionLister } diff --git a/pkg/lib/operatorlister/lister.go b/pkg/lib/operatorlister/lister.go index 0bf77a89e45..388f38ddaf6 100644 --- a/pkg/lib/operatorlister/lister.go +++ b/pkg/lib/operatorlister/lister.go @@ -1,10 +1,10 @@ package operatorlister import ( - aextv1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" appsv1 "k8s.io/client-go/listers/apps/v1" corev1 "k8s.io/client-go/listers/core/v1" rbacv1 "k8s.io/client-go/listers/rbac/v1" + "k8s.io/client-go/metadata/metadatalister" aregv1 "k8s.io/kube-aggregator/pkg/client/listers/apiregistration/v1" v1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1" @@ -88,8 +88,8 @@ type APIRegistrationV1Lister interface { //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . APIExtensionsV1Lister type APIExtensionsV1Lister interface { - RegisterCustomResourceDefinitionLister(lister aextv1.CustomResourceDefinitionLister) - CustomResourceDefinitionLister() aextv1.CustomResourceDefinitionLister + RegisterCustomResourceDefinitionLister(lister metadatalister.Lister) + CustomResourceDefinitionLister() metadatalister.Lister } //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . OperatorsV1alpha1Lister diff --git a/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1lister.go b/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1lister.go index ac6d23e8175..31bdfcab3c4 100644 --- a/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1lister.go +++ b/pkg/lib/operatorlister/operatorlisterfakes/fake_apiextensions_v1lister.go @@ -5,30 +5,30 @@ import ( "sync" "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" - v1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" + "k8s.io/client-go/metadata/metadatalister" ) type FakeAPIExtensionsV1Lister struct { - CustomResourceDefinitionListerStub func() v1.CustomResourceDefinitionLister + CustomResourceDefinitionListerStub func() metadatalister.Lister customResourceDefinitionListerMutex sync.RWMutex customResourceDefinitionListerArgsForCall []struct { } customResourceDefinitionListerReturns struct { - result1 v1.CustomResourceDefinitionLister + result1 metadatalister.Lister } customResourceDefinitionListerReturnsOnCall map[int]struct { - result1 v1.CustomResourceDefinitionLister + result1 metadatalister.Lister } - RegisterCustomResourceDefinitionListerStub func(v1.CustomResourceDefinitionLister) + RegisterCustomResourceDefinitionListerStub func(metadatalister.Lister) registerCustomResourceDefinitionListerMutex sync.RWMutex registerCustomResourceDefinitionListerArgsForCall []struct { - arg1 v1.CustomResourceDefinitionLister + arg1 metadatalister.Lister } invocations map[string][][]interface{} invocationsMutex sync.RWMutex } -func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionLister() v1.CustomResourceDefinitionLister { +func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionLister() metadatalister.Lister { fake.customResourceDefinitionListerMutex.Lock() ret, specificReturn := fake.customResourceDefinitionListerReturnsOnCall[len(fake.customResourceDefinitionListerArgsForCall)] fake.customResourceDefinitionListerArgsForCall = append(fake.customResourceDefinitionListerArgsForCall, struct { @@ -51,39 +51,39 @@ func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionListerCallCount() return len(fake.customResourceDefinitionListerArgsForCall) } -func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionListerCalls(stub func() v1.CustomResourceDefinitionLister) { +func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionListerCalls(stub func() metadatalister.Lister) { fake.customResourceDefinitionListerMutex.Lock() defer fake.customResourceDefinitionListerMutex.Unlock() fake.CustomResourceDefinitionListerStub = stub } -func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionListerReturns(result1 v1.CustomResourceDefinitionLister) { +func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionListerReturns(result1 metadatalister.Lister) { fake.customResourceDefinitionListerMutex.Lock() defer fake.customResourceDefinitionListerMutex.Unlock() fake.CustomResourceDefinitionListerStub = nil fake.customResourceDefinitionListerReturns = struct { - result1 v1.CustomResourceDefinitionLister + result1 metadatalister.Lister }{result1} } -func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionListerReturnsOnCall(i int, result1 v1.CustomResourceDefinitionLister) { +func (fake *FakeAPIExtensionsV1Lister) CustomResourceDefinitionListerReturnsOnCall(i int, result1 metadatalister.Lister) { fake.customResourceDefinitionListerMutex.Lock() defer fake.customResourceDefinitionListerMutex.Unlock() fake.CustomResourceDefinitionListerStub = nil if fake.customResourceDefinitionListerReturnsOnCall == nil { fake.customResourceDefinitionListerReturnsOnCall = make(map[int]struct { - result1 v1.CustomResourceDefinitionLister + result1 metadatalister.Lister }) } fake.customResourceDefinitionListerReturnsOnCall[i] = struct { - result1 v1.CustomResourceDefinitionLister + result1 metadatalister.Lister }{result1} } -func (fake *FakeAPIExtensionsV1Lister) RegisterCustomResourceDefinitionLister(arg1 v1.CustomResourceDefinitionLister) { +func (fake *FakeAPIExtensionsV1Lister) RegisterCustomResourceDefinitionLister(arg1 metadatalister.Lister) { fake.registerCustomResourceDefinitionListerMutex.Lock() fake.registerCustomResourceDefinitionListerArgsForCall = append(fake.registerCustomResourceDefinitionListerArgsForCall, struct { - arg1 v1.CustomResourceDefinitionLister + arg1 metadatalister.Lister }{arg1}) fake.recordInvocation("RegisterCustomResourceDefinitionLister", []interface{}{arg1}) fake.registerCustomResourceDefinitionListerMutex.Unlock() @@ -98,13 +98,13 @@ func (fake *FakeAPIExtensionsV1Lister) RegisterCustomResourceDefinitionListerCal return len(fake.registerCustomResourceDefinitionListerArgsForCall) } -func (fake *FakeAPIExtensionsV1Lister) RegisterCustomResourceDefinitionListerCalls(stub func(v1.CustomResourceDefinitionLister)) { +func (fake *FakeAPIExtensionsV1Lister) RegisterCustomResourceDefinitionListerCalls(stub func(metadatalister.Lister)) { fake.registerCustomResourceDefinitionListerMutex.Lock() defer fake.registerCustomResourceDefinitionListerMutex.Unlock() fake.RegisterCustomResourceDefinitionListerStub = stub } -func (fake *FakeAPIExtensionsV1Lister) RegisterCustomResourceDefinitionListerArgsForCall(i int) v1.CustomResourceDefinitionLister { +func (fake *FakeAPIExtensionsV1Lister) RegisterCustomResourceDefinitionListerArgsForCall(i int) metadatalister.Lister { fake.registerCustomResourceDefinitionListerMutex.RLock() defer fake.registerCustomResourceDefinitionListerMutex.RUnlock() argsForCall := fake.registerCustomResourceDefinitionListerArgsForCall[i] diff --git a/test/e2e/operator_groups_e2e_test.go b/test/e2e/operator_groups_e2e_test.go index 743f8ff37df..50b8a645b94 100644 --- a/test/e2e/operator_groups_e2e_test.go +++ b/test/e2e/operator_groups_e2e_test.go @@ -563,7 +563,7 @@ var _ = Describe("Operator Group", func() { if res == nil { return false, nil } - GinkgoT().Log("checking padmin for permission") + GinkgoT().Logf("checking padmin for permission: %s", res.Status) return res.Status.Allowed, nil }) require.NoError(GinkgoT(), err) diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/interface.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/interface.go deleted file mode 100644 index 1bdd40e26c3..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/interface.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package apiextensions - -import ( - v1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1" - v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1" - internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface -} - -type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/customresourcedefinition.go deleted file mode 100644 index 7d1b5711126..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/customresourcedefinition.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" - v1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" - 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" -) - -// CustomResourceDefinitionInformer provides access to a shared informer and lister for -// CustomResourceDefinitions. -type CustomResourceDefinitionInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.CustomResourceDefinitionLister -} - -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 clientset.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 clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.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 clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *customResourceDefinitionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiextensionsv1.CustomResourceDefinition{}, f.defaultInformer) -} - -func (f *customResourceDefinitionInformer) Lister() v1.CustomResourceDefinitionLister { - return v1.NewCustomResourceDefinitionLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/interface.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/interface.go deleted file mode 100644 index d96e2099aec..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // CustomResourceDefinitions returns a CustomResourceDefinitionInformer. - CustomResourceDefinitions() CustomResourceDefinitionInformer -} - -type version 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 &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// CustomResourceDefinitions returns a CustomResourceDefinitionInformer. -func (v *version) CustomResourceDefinitions() CustomResourceDefinitionInformer { - return &customResourceDefinitionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/customresourcedefinition.go deleted file mode 100644 index 489c87ae905..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/customresourcedefinition.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" - clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" - v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1" - v1 "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" -) - -// CustomResourceDefinitionInformer provides access to a shared informer and lister for -// CustomResourceDefinitions. -type CustomResourceDefinitionInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.CustomResourceDefinitionLister -} - -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 clientset.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 clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ApiextensionsV1beta1().CustomResourceDefinitions().List(context.TODO(), options) - }, - WatchFunc: func(options v1.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 clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *customResourceDefinitionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiextensionsv1beta1.CustomResourceDefinition{}, f.defaultInformer) -} - -func (f *customResourceDefinitionInformer) Lister() v1beta1.CustomResourceDefinitionLister { - return v1beta1.NewCustomResourceDefinitionLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/interface.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/interface.go deleted file mode 100644 index f78edbb593d..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // CustomResourceDefinitions returns a CustomResourceDefinitionInformer. - CustomResourceDefinitions() CustomResourceDefinitionInformer -} - -type version 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 &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// CustomResourceDefinitions returns a CustomResourceDefinitionInformer. -func (v *version) CustomResourceDefinitions() CustomResourceDefinitionInformer { - return &customResourceDefinitionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/factory.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/factory.go deleted file mode 100644 index e2243ef6c69..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/factory.go +++ /dev/null @@ -1,251 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - reflect "reflect" - sync "sync" - time "time" - - clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - apiextensions "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions" - internalinterfaces "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// SharedInformerOption defines the functional option type for SharedInformerFactory. -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 - - 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 - // wg tracks how many goroutines were started. - wg sync.WaitGroup - // shuttingDown is true when Shutdown has been called. It may still be running - // because it needs to wait for goroutines. - shuttingDown bool -} - -// WithCustomResyncConfig sets a custom resync period for the specified informer types. -func WithCustomResyncConfig(resyncConfig map[v1.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 clientset.Interface, defaultResync time.Duration) 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 clientset.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) -} - -// 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), - } - - // Apply all options - for _, opt := range options { - factory = opt(factory) - } - - return factory -} - -func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { - f.lock.Lock() - defer f.lock.Unlock() - - if f.shuttingDown { - return - } - - for informerType, informer := range f.informers { - if !f.startedInformers[informerType] { - f.wg.Add(1) - // We need a new variable in each loop iteration, - // otherwise the goroutine would use the loop variable - // and that keeps changing. - informer := informer - go func() { - defer f.wg.Done() - informer.Run(stopCh) - }() - f.startedInformers[informerType] = true - } - } -} - -func (f *sharedInformerFactory) Shutdown() { - f.lock.Lock() - f.shuttingDown = true - f.lock.Unlock() - - // Will return immediately if there is nothing to wait for. - f.wg.Wait() -} - -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 -} - -// SharedInformerFactory provides shared informers for resources in all known -// API group versions. -// -// It is typically used like this: -// -// ctx, cancel := context.Background() -// defer cancel() -// factory := NewSharedInformerFactory(client, resyncPeriod) -// defer factory.WaitForStop() // Returns immediately if nothing was started. -// genericInformer := factory.ForResource(resource) -// typedInformer := factory.SomeAPIGroup().V1().SomeType() -// factory.Start(ctx.Done()) // Start processing these informers. -// synced := factory.WaitForCacheSync(ctx.Done()) -// for v, ok := range synced { -// if !ok { -// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) -// return -// } -// } -// -// // Creating informers can also be created after Start, but then -// // Start must be called again: -// anotherGenericInformer := factory.ForResource(resource) -// factory.Start(ctx.Done()) -type SharedInformerFactory interface { - internalinterfaces.SharedInformerFactory - - // Start initializes all requested informers. They are handled in goroutines - // which run until the stop channel gets closed. - Start(stopCh <-chan struct{}) - - // Shutdown marks a factory as shutting down. At that point no new - // informers can be started anymore and Start will return without - // doing anything. - // - // In addition, Shutdown blocks until all goroutines have terminated. For that - // to happen, the close channel(s) that they were started with must be closed, - // either before Shutdown gets called or while it is waiting. - // - // Shutdown may be called multiple times, even concurrently. All such calls will - // block until all goroutines have terminated. - Shutdown() - - // WaitForCacheSync blocks until all started informers' caches were synced - // or the stop channel gets closed. - WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - - // ForResource gives generic access to a shared informer of the matching type. - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) - - // InternalInformerFor returns the SharedIndexInformer for obj using an internal - // client. - InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer - - Apiextensions() apiextensions.Interface -} - -func (f *sharedInformerFactory) Apiextensions() apiextensions.Interface { - return apiextensions.New(f, f.namespace, f.tweakListOptions) -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/generic.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/generic.go deleted file mode 100644 index 86f79cd4172..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/generic.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - "fmt" - - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// GenericInformer is type of SharedIndexInformer which will locate and delegate to other -// sharedInformers based on type -type GenericInformer interface { - Informer() cache.SharedIndexInformer - Lister() cache.GenericLister -} - -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 GenericLister. -func (f *genericInformer) Lister() cache.GenericLister { - return cache.NewGenericLister(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) (GenericInformer, error) { - switch resource { - // Group=apiextensions.k8s.io, Version=v1 - case v1.SchemeGroupVersion.WithResource("customresourcedefinitions"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().V1().CustomResourceDefinitions().Informer()}, nil - - // Group=apiextensions.k8s.io, Version=v1beta1 - case v1beta1.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/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go deleted file mode 100644 index da6eadaa7f9..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package internalinterfaces - -import ( - time "time" - - clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - cache "k8s.io/client-go/tools/cache" -) - -// NewInformerFunc takes clientset.Interface and time.Duration to return a SharedIndexInformer. -type NewInformerFunc func(clientset.Interface, time.Duration) cache.SharedIndexInformer - -// SharedInformerFactory a small interface to allow for adding an informer without an import cycle -type SharedInformerFactory interface { - Start(stopCh <-chan struct{}) - InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer -} - -// TweakListOptionsFunc is a function that transforms a v1.ListOptions. -type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1/customresourcedefinition.go deleted file mode 100644 index d83c58bc629..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1/customresourcedefinition.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// CustomResourceDefinitionLister helps list CustomResourceDefinitions. -// All objects returned here must be treated as read-only. -type CustomResourceDefinitionLister interface { - // List lists all CustomResourceDefinitions in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.CustomResourceDefinition, err error) - // Get retrieves the CustomResourceDefinition from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.CustomResourceDefinition, error) - CustomResourceDefinitionListerExpansion -} - -// customResourceDefinitionLister implements the CustomResourceDefinitionLister interface. -type customResourceDefinitionLister struct { - indexer cache.Indexer -} - -// NewCustomResourceDefinitionLister returns a new CustomResourceDefinitionLister. -func NewCustomResourceDefinitionLister(indexer cache.Indexer) CustomResourceDefinitionLister { - return &customResourceDefinitionLister{indexer: indexer} -} - -// List lists all CustomResourceDefinitions in the indexer. -func (s *customResourceDefinitionLister) List(selector labels.Selector) (ret []*v1.CustomResourceDefinition, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CustomResourceDefinition)) - }) - return ret, err -} - -// Get retrieves the CustomResourceDefinition from the index for a given name. -func (s *customResourceDefinitionLister) Get(name string) (*v1.CustomResourceDefinition, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("customresourcedefinition"), name) - } - return obj.(*v1.CustomResourceDefinition), nil -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1/expansion_generated.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1/expansion_generated.go deleted file mode 100644 index 609d86be39f..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1/expansion_generated.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// CustomResourceDefinitionListerExpansion allows custom methods to be added to -// CustomResourceDefinitionLister. -type CustomResourceDefinitionListerExpansion interface{} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1/customresourcedefinition.go deleted file mode 100644 index c57fd40d8fe..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1/customresourcedefinition.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// CustomResourceDefinitionLister helps list CustomResourceDefinitions. -// All objects returned here must be treated as read-only. -type CustomResourceDefinitionLister interface { - // List lists all CustomResourceDefinitions in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.CustomResourceDefinition, err error) - // Get retrieves the CustomResourceDefinition from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.CustomResourceDefinition, error) - CustomResourceDefinitionListerExpansion -} - -// customResourceDefinitionLister implements the CustomResourceDefinitionLister interface. -type customResourceDefinitionLister struct { - indexer cache.Indexer -} - -// NewCustomResourceDefinitionLister returns a new CustomResourceDefinitionLister. -func NewCustomResourceDefinitionLister(indexer cache.Indexer) CustomResourceDefinitionLister { - return &customResourceDefinitionLister{indexer: indexer} -} - -// List lists all CustomResourceDefinitions in the indexer. -func (s *customResourceDefinitionLister) List(selector labels.Selector) (ret []*v1beta1.CustomResourceDefinition, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.CustomResourceDefinition)) - }) - return ret, err -} - -// Get retrieves the CustomResourceDefinition from the index for a given name. -func (s *customResourceDefinitionLister) Get(name string) (*v1beta1.CustomResourceDefinition, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("customresourcedefinition"), name) - } - return obj.(*v1beta1.CustomResourceDefinition), nil -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1/expansion_generated.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1/expansion_generated.go deleted file mode 100644 index 429782deb0a..00000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1/expansion_generated.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -// CustomResourceDefinitionListerExpansion allows custom methods to be added to -// CustomResourceDefinitionLister. -type CustomResourceDefinitionListerExpansion interface{} diff --git a/vendor/modules.txt b/vendor/modules.txt index 055618836af..621302f3e5a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1266,13 +1266,6 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextension k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/fake k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1 k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/fake -k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions -k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions -k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1 -k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1 -k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces -k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1 -k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1 # k8s.io/apimachinery v0.27.2 ## explicit; go 1.20 k8s.io/apimachinery/pkg/api/equality