From 1bbf0a6436c3661df1fa01d2f5c16051f5ba7442 Mon Sep 17 00:00:00 2001 From: qibobo Date: Wed, 20 Jan 2021 00:21:23 +0800 Subject: [PATCH] add LabelSelector to InformerFactory so that the informers only list and watch resources with the given labels (#1940) * add filtered InformerFactory and informers which only list and watch resources with the given labels * rename to RegisterFilteredInformers * generated files * typo * update per comments * rename file * rm old files --- .../filtered/customresourcedefinition.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/customresourcedefinition.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/fake/fake_filtered_factory.go | 59 ++++++++ .../factory/filtered/filtered_factory.go | 77 ++++++++++ .../filtered/fake/fake_filtered_factory.go | 19 +++ .../factory/filtered/filtered_factory.go | 19 +++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/mutatingwebhookconfiguration.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../validatingwebhookconfiguration.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/mutatingwebhookconfiguration.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../validatingwebhookconfiguration.go | 65 ++++++++ .../filtered/controllerrevision.go | 65 ++++++++ .../controllerrevision/filtered/fake/fake.go | 52 +++++++ .../apps/v1/daemonset/filtered/daemonset.go | 65 ++++++++ .../apps/v1/daemonset/filtered/fake/fake.go | 52 +++++++ .../apps/v1/deployment/filtered/deployment.go | 65 ++++++++ .../apps/v1/deployment/filtered/fake/fake.go | 52 +++++++ .../apps/v1/replicaset/filtered/fake/fake.go | 52 +++++++ .../apps/v1/replicaset/filtered/replicaset.go | 65 ++++++++ .../apps/v1/statefulset/filtered/fake/fake.go | 52 +++++++ .../v1/statefulset/filtered/statefulset.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/horizontalpodautoscaler.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/horizontalpodautoscaler.go | 65 ++++++++ .../batch/v1/job/filtered/fake/fake.go | 52 +++++++ .../informers/batch/v1/job/filtered/job.go | 65 ++++++++ .../batch/v1beta1/cronjob/filtered/cronjob.go | 65 ++++++++ .../v1beta1/cronjob/filtered/fake/fake.go | 52 +++++++ .../v1/lease/filtered/fake/fake.go | 52 +++++++ .../coordination/v1/lease/filtered/lease.go | 65 ++++++++ .../filtered/componentstatus.go | 65 ++++++++ .../v1/componentstatus/filtered/fake/fake.go | 52 +++++++ .../core/v1/configmap/filtered/configmap.go | 65 ++++++++ .../core/v1/configmap/filtered/fake/fake.go | 52 +++++++ .../core/v1/endpoints/filtered/endpoints.go | 65 ++++++++ .../core/v1/endpoints/filtered/fake/fake.go | 52 +++++++ .../informers/core/v1/event/filtered/event.go | 65 ++++++++ .../core/v1/event/filtered/fake/fake.go | 52 +++++++ .../core/v1/limitrange/filtered/fake/fake.go | 52 +++++++ .../core/v1/limitrange/filtered/limitrange.go | 65 ++++++++ .../core/v1/namespace/filtered/fake/fake.go | 52 +++++++ .../core/v1/namespace/filtered/namespace.go | 65 ++++++++ .../core/v1/node/filtered/fake/fake.go | 52 +++++++ .../informers/core/v1/node/filtered/node.go | 65 ++++++++ .../v1/persistentvolume/filtered/fake/fake.go | 52 +++++++ .../filtered/persistentvolume.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/persistentvolumeclaim.go | 65 ++++++++ .../core/v1/pod/filtered/fake/fake.go | 52 +++++++ .../informers/core/v1/pod/filtered/pod.go | 65 ++++++++ .../core/v1/podtemplate/filtered/fake/fake.go | 52 +++++++ .../v1/podtemplate/filtered/podtemplate.go | 65 ++++++++ .../filtered/fake/fake.go | 52 +++++++ .../filtered/replicationcontroller.go | 65 ++++++++ .../v1/resourcequota/filtered/fake/fake.go | 52 +++++++ .../resourcequota/filtered/resourcequota.go | 65 ++++++++ .../core/v1/secret/filtered/fake/fake.go | 52 +++++++ .../core/v1/secret/filtered/secret.go | 65 ++++++++ .../core/v1/service/filtered/fake/fake.go | 52 +++++++ .../core/v1/service/filtered/service.go | 65 ++++++++ .../v1/serviceaccount/filtered/fake/fake.go | 52 +++++++ .../serviceaccount/filtered/serviceaccount.go | 65 ++++++++ .../filtered/fake/fake_filtered_factory.go | 59 ++++++++ .../factory/filtered/filtered_factory.go | 77 ++++++++++ .../v1/clusterrole/filtered/clusterrole.go | 65 ++++++++ .../rbac/v1/clusterrole/filtered/fake/fake.go | 52 +++++++ .../filtered/clusterrolebinding.go | 65 ++++++++ .../clusterrolebinding/filtered/fake/fake.go | 52 +++++++ .../rbac/v1/role/filtered/fake/fake.go | 52 +++++++ .../informers/rbac/v1/role/filtered/role.go | 65 ++++++++ .../rbac/v1/rolebinding/filtered/fake/fake.go | 52 +++++++ .../v1/rolebinding/filtered/rolebinding.go | 65 ++++++++ .../{fakeclient.go => fake_client.go} | 0 .../generators/{fakeduck.go => fake_duck.go} | 0 .../{fakefactory.go => fake_factory.go} | 0 .../generators/fake_filtered_factory.go | 131 ++++++++++++++++ .../generators/fake_filtered_informer.go | 133 ++++++++++++++++ .../{fakeinformer.go => fake_informer.go} | 0 .../generators/filtered_factory.go | 143 ++++++++++++++++++ .../generators/filtered_informer.go | 141 +++++++++++++++++ .../cmd/injection-gen/generators/packages.go | 104 +++++++++++++ injection/informers.go | 25 +++ injection/informers_test.go | 11 +- injection/interface.go | 16 +- 90 files changed, 5220 insertions(+), 6 deletions(-) create mode 100644 client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go create mode 100644 client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/fake/fake.go create mode 100644 client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go create mode 100644 client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/fake/fake.go create mode 100644 client/injection/apiextensions/informers/factory/filtered/fake/fake_filtered_factory.go create mode 100644 client/injection/apiextensions/informers/factory/filtered/filtered_factory.go create mode 100644 client/injection/informers/factory/filtered/fake/fake_filtered_factory.go create mode 100644 client/injection/informers/factory/filtered/filtered_factory.go create mode 100644 client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go create mode 100644 client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go create mode 100644 client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go create mode 100644 client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go create mode 100644 client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go create mode 100644 client/injection/kube/informers/apps/v1/controllerrevision/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go create mode 100644 client/injection/kube/informers/apps/v1/daemonset/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go create mode 100644 client/injection/kube/informers/apps/v1/deployment/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/apps/v1/replicaset/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go create mode 100644 client/injection/kube/informers/apps/v1/statefulset/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go create mode 100644 client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go create mode 100644 client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go create mode 100644 client/injection/kube/informers/batch/v1/job/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/batch/v1/job/filtered/job.go create mode 100644 client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go create mode 100644 client/injection/kube/informers/batch/v1beta1/cronjob/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/coordination/v1/lease/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/coordination/v1/lease/filtered/lease.go create mode 100644 client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go create mode 100644 client/injection/kube/informers/core/v1/componentstatus/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/configmap/filtered/configmap.go create mode 100644 client/injection/kube/informers/core/v1/configmap/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go create mode 100644 client/injection/kube/informers/core/v1/endpoints/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/event/filtered/event.go create mode 100644 client/injection/kube/informers/core/v1/event/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/limitrange/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go create mode 100644 client/injection/kube/informers/core/v1/namespace/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/namespace/filtered/namespace.go create mode 100644 client/injection/kube/informers/core/v1/node/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/node/filtered/node.go create mode 100644 client/injection/kube/informers/core/v1/persistentvolume/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go create mode 100644 client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go create mode 100644 client/injection/kube/informers/core/v1/pod/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/pod/filtered/pod.go create mode 100644 client/injection/kube/informers/core/v1/podtemplate/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go create mode 100644 client/injection/kube/informers/core/v1/replicationcontroller/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go create mode 100644 client/injection/kube/informers/core/v1/resourcequota/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go create mode 100644 client/injection/kube/informers/core/v1/secret/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/secret/filtered/secret.go create mode 100644 client/injection/kube/informers/core/v1/service/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/service/filtered/service.go create mode 100644 client/injection/kube/informers/core/v1/serviceaccount/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go create mode 100644 client/injection/kube/informers/factory/filtered/fake/fake_filtered_factory.go create mode 100644 client/injection/kube/informers/factory/filtered/filtered_factory.go create mode 100644 client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go create mode 100644 client/injection/kube/informers/rbac/v1/clusterrole/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go create mode 100644 client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/rbac/v1/role/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/rbac/v1/role/filtered/role.go create mode 100644 client/injection/kube/informers/rbac/v1/rolebinding/filtered/fake/fake.go create mode 100644 client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go rename codegen/cmd/injection-gen/generators/{fakeclient.go => fake_client.go} (100%) rename codegen/cmd/injection-gen/generators/{fakeduck.go => fake_duck.go} (100%) rename codegen/cmd/injection-gen/generators/{fakefactory.go => fake_factory.go} (100%) create mode 100644 codegen/cmd/injection-gen/generators/fake_filtered_factory.go create mode 100644 codegen/cmd/injection-gen/generators/fake_filtered_informer.go rename codegen/cmd/injection-gen/generators/{fakeinformer.go => fake_informer.go} (100%) create mode 100644 codegen/cmd/injection-gen/generators/filtered_factory.go create mode 100644 codegen/cmd/injection-gen/generators/filtered_informer.go diff --git a/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go new file mode 100644 index 000000000..b8160d452 --- /dev/null +++ b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1" + filtered "knative.dev/pkg/client/injection/apiextensions/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Apiextensions().V1().CustomResourceDefinitions() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.CustomResourceDefinitionInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1.CustomResourceDefinitionInformer with selector %s from context.", selector) + } + return untyped.(v1.CustomResourceDefinitionInformer) +} diff --git a/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/fake/fake.go b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/fake/fake.go new file mode 100644 index 000000000..cec8fbde9 --- /dev/null +++ b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered" + factoryfiltered "knative.dev/pkg/client/injection/apiextensions/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Apiextensions().V1().CustomResourceDefinitions() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go new file mode 100644 index 000000000..01b6889f7 --- /dev/null +++ b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1" + filtered "knative.dev/pkg/client/injection/apiextensions/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Apiextensions().V1beta1().CustomResourceDefinitions() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.CustomResourceDefinitionInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1.CustomResourceDefinitionInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.CustomResourceDefinitionInformer) +} diff --git a/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/fake/fake.go b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/fake/fake.go new file mode 100644 index 000000000..7428224f1 --- /dev/null +++ b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered" + factoryfiltered "knative.dev/pkg/client/injection/apiextensions/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Apiextensions().V1beta1().CustomResourceDefinitions() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/apiextensions/informers/factory/filtered/fake/fake_filtered_factory.go b/client/injection/apiextensions/informers/factory/filtered/fake/fake_filtered_factory.go new file mode 100644 index 000000000..1e3c469d1 --- /dev/null +++ b/client/injection/apiextensions/informers/factory/filtered/fake/fake_filtered_factory.go @@ -0,0 +1,59 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fakeFilteredFactory + +import ( + context "context" + + externalversions "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + fake "knative.dev/pkg/client/injection/apiextensions/client/fake" + filtered "knative.dev/pkg/client/injection/apiextensions/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterInformerFactory(withInformerFactory) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := fake.Get(ctx) + opts := []externalversions.SharedInformerOption{} + if injection.HasNamespaceScope(ctx) { + opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) + } + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + thisOpts := append(opts, externalversions.WithTweakListOptions(func(l *v1.ListOptions) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, + externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), thisOpts...)) + } + return ctx +} diff --git a/client/injection/apiextensions/informers/factory/filtered/filtered_factory.go b/client/injection/apiextensions/informers/factory/filtered/filtered_factory.go new file mode 100644 index 000000000..144283611 --- /dev/null +++ b/client/injection/apiextensions/informers/factory/filtered/filtered_factory.go @@ -0,0 +1,77 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filteredFactory + +import ( + context "context" + + externalversions "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + client "knative.dev/pkg/client/injection/apiextensions/client" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformerFactory(withInformerFactory) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct { + Selector string +} + +type LabelKey struct{} + +func WithSelectors(ctx context.Context, selector ...string) context.Context { + return context.WithValue(ctx, LabelKey{}, selector) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := client.Get(ctx) + opts := []externalversions.SharedInformerOption{} + if injection.HasNamespaceScope(ctx) { + opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) + } + untyped := ctx.Value(LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + thisOpts := append(opts, externalversions.WithTweakListOptions(func(l *v1.ListOptions) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, Key{Selector: selector}, + externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), thisOpts...)) + } + return ctx +} + +// Get extracts the InformerFactory from the context. +func Get(ctx context.Context, selector string) externalversions.SharedInformerFactory { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions.SharedInformerFactory with selector %s from context.", selector) + } + return untyped.(externalversions.SharedInformerFactory) +} diff --git a/client/injection/informers/factory/filtered/fake/fake_filtered_factory.go b/client/injection/informers/factory/filtered/fake/fake_filtered_factory.go new file mode 100644 index 000000000..2006cf2d6 --- /dev/null +++ b/client/injection/informers/factory/filtered/fake/fake_filtered_factory.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fakeFilteredFactory diff --git a/client/injection/informers/factory/filtered/filtered_factory.go b/client/injection/informers/factory/filtered/filtered_factory.go new file mode 100644 index 000000000..8018284a0 --- /dev/null +++ b/client/injection/informers/factory/filtered/filtered_factory.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filteredFactory diff --git a/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/fake/fake.go b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/fake/fake.go new file mode 100644 index 000000000..cb483a5b2 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Admissionregistration().V1().MutatingWebhookConfigurations() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..088d224c5 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/admissionregistration/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Admissionregistration().V1().MutatingWebhookConfigurations() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.MutatingWebhookConfigurationInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/admissionregistration/v1.MutatingWebhookConfigurationInformer with selector %s from context.", selector) + } + return untyped.(v1.MutatingWebhookConfigurationInformer) +} diff --git a/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/fake/fake.go b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/fake/fake.go new file mode 100644 index 000000000..bf41fbb42 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Admissionregistration().V1().ValidatingWebhookConfigurations() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go new file mode 100644 index 000000000..6e59ae163 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/admissionregistration/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Admissionregistration().V1().ValidatingWebhookConfigurations() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ValidatingWebhookConfigurationInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/admissionregistration/v1.ValidatingWebhookConfigurationInformer with selector %s from context.", selector) + } + return untyped.(v1.ValidatingWebhookConfigurationInformer) +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/fake/fake.go b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/fake/fake.go new file mode 100644 index 000000000..91dd328b7 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Admissionregistration().V1beta1().MutatingWebhookConfigurations() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..c86421506 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Admissionregistration().V1beta1().MutatingWebhookConfigurations() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.MutatingWebhookConfigurationInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/admissionregistration/v1beta1.MutatingWebhookConfigurationInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.MutatingWebhookConfigurationInformer) +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/fake/fake.go b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/fake/fake.go new file mode 100644 index 000000000..ab86661f8 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Admissionregistration().V1beta1().ValidatingWebhookConfigurations() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go new file mode 100644 index 000000000..f3c7211c9 --- /dev/null +++ b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Admissionregistration().V1beta1().ValidatingWebhookConfigurations() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.ValidatingWebhookConfigurationInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/admissionregistration/v1beta1.ValidatingWebhookConfigurationInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.ValidatingWebhookConfigurationInformer) +} diff --git a/client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go b/client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go new file mode 100644 index 000000000..41eb278fa --- /dev/null +++ b/client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/apps/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Apps().V1().ControllerRevisions() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ControllerRevisionInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1.ControllerRevisionInformer with selector %s from context.", selector) + } + return untyped.(v1.ControllerRevisionInformer) +} diff --git a/client/injection/kube/informers/apps/v1/controllerrevision/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1/controllerrevision/filtered/fake/fake.go new file mode 100644 index 000000000..88e1320b6 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/controllerrevision/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1/controllerrevision/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Apps().V1().ControllerRevisions() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go b/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go new file mode 100644 index 000000000..fdfc5027f --- /dev/null +++ b/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/apps/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Apps().V1().DaemonSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.DaemonSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1.DaemonSetInformer with selector %s from context.", selector) + } + return untyped.(v1.DaemonSetInformer) +} diff --git a/client/injection/kube/informers/apps/v1/daemonset/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1/daemonset/filtered/fake/fake.go new file mode 100644 index 000000000..db07a7780 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/daemonset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1/daemonset/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Apps().V1().DaemonSets() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go b/client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go new file mode 100644 index 000000000..71841ad3b --- /dev/null +++ b/client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/apps/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Apps().V1().Deployments() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.DeploymentInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1.DeploymentInformer with selector %s from context.", selector) + } + return untyped.(v1.DeploymentInformer) +} diff --git a/client/injection/kube/informers/apps/v1/deployment/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1/deployment/filtered/fake/fake.go new file mode 100644 index 000000000..3adcc9950 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/deployment/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Apps().V1().Deployments() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/apps/v1/replicaset/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1/replicaset/filtered/fake/fake.go new file mode 100644 index 000000000..80abe7f66 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/replicaset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1/replicaset/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Apps().V1().ReplicaSets() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go b/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go new file mode 100644 index 000000000..bfbddb626 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/apps/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Apps().V1().ReplicaSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ReplicaSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1.ReplicaSetInformer with selector %s from context.", selector) + } + return untyped.(v1.ReplicaSetInformer) +} diff --git a/client/injection/kube/informers/apps/v1/statefulset/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1/statefulset/filtered/fake/fake.go new file mode 100644 index 000000000..066ca8f93 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/statefulset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1/statefulset/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Apps().V1().StatefulSets() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go b/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go new file mode 100644 index 000000000..3bec7386b --- /dev/null +++ b/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/apps/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Apps().V1().StatefulSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.StatefulSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1.StatefulSetInformer with selector %s from context.", selector) + } + return untyped.(v1.StatefulSetInformer) +} diff --git a/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/fake/fake.go b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/fake/fake.go new file mode 100644 index 000000000..669618956 --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Autoscaling().V1().HorizontalPodAutoscalers() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go new file mode 100644 index 000000000..844072e52 --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/autoscaling/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Autoscaling().V1().HorizontalPodAutoscalers() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.HorizontalPodAutoscalerInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/autoscaling/v1.HorizontalPodAutoscalerInformer with selector %s from context.", selector) + } + return untyped.(v1.HorizontalPodAutoscalerInformer) +} diff --git a/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/fake/fake.go b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/fake/fake.go new file mode 100644 index 000000000..116df88cc --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Autoscaling().V2beta1().HorizontalPodAutoscalers() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go new file mode 100644 index 000000000..bd750901e --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v2beta1 "k8s.io/client-go/informers/autoscaling/v2beta1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Autoscaling().V2beta1().HorizontalPodAutoscalers() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v2beta1.HorizontalPodAutoscalerInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/autoscaling/v2beta1.HorizontalPodAutoscalerInformer with selector %s from context.", selector) + } + return untyped.(v2beta1.HorizontalPodAutoscalerInformer) +} diff --git a/client/injection/kube/informers/batch/v1/job/filtered/fake/fake.go b/client/injection/kube/informers/batch/v1/job/filtered/fake/fake.go new file mode 100644 index 000000000..e382ace96 --- /dev/null +++ b/client/injection/kube/informers/batch/v1/job/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/batch/v1/job/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Batch().V1().Jobs() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/batch/v1/job/filtered/job.go b/client/injection/kube/informers/batch/v1/job/filtered/job.go new file mode 100644 index 000000000..975bb7358 --- /dev/null +++ b/client/injection/kube/informers/batch/v1/job/filtered/job.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/batch/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Batch().V1().Jobs() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.JobInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/batch/v1.JobInformer with selector %s from context.", selector) + } + return untyped.(v1.JobInformer) +} diff --git a/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go b/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go new file mode 100644 index 000000000..ad3f9111e --- /dev/null +++ b/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1beta1 "k8s.io/client-go/informers/batch/v1beta1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Batch().V1beta1().CronJobs() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.CronJobInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/batch/v1beta1.CronJobInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.CronJobInformer) +} diff --git a/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/fake/fake.go b/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/fake/fake.go new file mode 100644 index 000000000..7faff4402 --- /dev/null +++ b/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/batch/v1beta1/cronjob/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Batch().V1beta1().CronJobs() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/coordination/v1/lease/filtered/fake/fake.go b/client/injection/kube/informers/coordination/v1/lease/filtered/fake/fake.go new file mode 100644 index 000000000..05ef57b2b --- /dev/null +++ b/client/injection/kube/informers/coordination/v1/lease/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/coordination/v1/lease/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Coordination().V1().Leases() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/coordination/v1/lease/filtered/lease.go b/client/injection/kube/informers/coordination/v1/lease/filtered/lease.go new file mode 100644 index 000000000..d0afdc8a8 --- /dev/null +++ b/client/injection/kube/informers/coordination/v1/lease/filtered/lease.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/coordination/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Coordination().V1().Leases() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.LeaseInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/coordination/v1.LeaseInformer with selector %s from context.", selector) + } + return untyped.(v1.LeaseInformer) +} diff --git a/client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go b/client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go new file mode 100644 index 000000000..05d6cec6f --- /dev/null +++ b/client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().ComponentStatuses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ComponentStatusInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.ComponentStatusInformer with selector %s from context.", selector) + } + return untyped.(v1.ComponentStatusInformer) +} diff --git a/client/injection/kube/informers/core/v1/componentstatus/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/componentstatus/filtered/fake/fake.go new file mode 100644 index 000000000..7205721c3 --- /dev/null +++ b/client/injection/kube/informers/core/v1/componentstatus/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/componentstatus/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().ComponentStatuses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/configmap/filtered/configmap.go b/client/injection/kube/informers/core/v1/configmap/filtered/configmap.go new file mode 100644 index 000000000..8d59ba8ae --- /dev/null +++ b/client/injection/kube/informers/core/v1/configmap/filtered/configmap.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().ConfigMaps() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ConfigMapInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.ConfigMapInformer with selector %s from context.", selector) + } + return untyped.(v1.ConfigMapInformer) +} diff --git a/client/injection/kube/informers/core/v1/configmap/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/configmap/filtered/fake/fake.go new file mode 100644 index 000000000..e43f3a21f --- /dev/null +++ b/client/injection/kube/informers/core/v1/configmap/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/configmap/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().ConfigMaps() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go b/client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go new file mode 100644 index 000000000..04f9543cd --- /dev/null +++ b/client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().Endpoints() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.EndpointsInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.EndpointsInformer with selector %s from context.", selector) + } + return untyped.(v1.EndpointsInformer) +} diff --git a/client/injection/kube/informers/core/v1/endpoints/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/endpoints/filtered/fake/fake.go new file mode 100644 index 000000000..b48fb96f7 --- /dev/null +++ b/client/injection/kube/informers/core/v1/endpoints/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/endpoints/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().Endpoints() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/event/filtered/event.go b/client/injection/kube/informers/core/v1/event/filtered/event.go new file mode 100644 index 000000000..3e35335fa --- /dev/null +++ b/client/injection/kube/informers/core/v1/event/filtered/event.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().Events() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.EventInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.EventInformer with selector %s from context.", selector) + } + return untyped.(v1.EventInformer) +} diff --git a/client/injection/kube/informers/core/v1/event/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/event/filtered/fake/fake.go new file mode 100644 index 000000000..456fdd982 --- /dev/null +++ b/client/injection/kube/informers/core/v1/event/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/event/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().Events() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/limitrange/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/limitrange/filtered/fake/fake.go new file mode 100644 index 000000000..2056cd013 --- /dev/null +++ b/client/injection/kube/informers/core/v1/limitrange/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/limitrange/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().LimitRanges() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go b/client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go new file mode 100644 index 000000000..2b50ec823 --- /dev/null +++ b/client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().LimitRanges() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.LimitRangeInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.LimitRangeInformer with selector %s from context.", selector) + } + return untyped.(v1.LimitRangeInformer) +} diff --git a/client/injection/kube/informers/core/v1/namespace/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/namespace/filtered/fake/fake.go new file mode 100644 index 000000000..1dd9e4195 --- /dev/null +++ b/client/injection/kube/informers/core/v1/namespace/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/namespace/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().Namespaces() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/namespace/filtered/namespace.go b/client/injection/kube/informers/core/v1/namespace/filtered/namespace.go new file mode 100644 index 000000000..3554195f3 --- /dev/null +++ b/client/injection/kube/informers/core/v1/namespace/filtered/namespace.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().Namespaces() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.NamespaceInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.NamespaceInformer with selector %s from context.", selector) + } + return untyped.(v1.NamespaceInformer) +} diff --git a/client/injection/kube/informers/core/v1/node/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/node/filtered/fake/fake.go new file mode 100644 index 000000000..db46bd4b5 --- /dev/null +++ b/client/injection/kube/informers/core/v1/node/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/node/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().Nodes() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/node/filtered/node.go b/client/injection/kube/informers/core/v1/node/filtered/node.go new file mode 100644 index 000000000..d1ce2c60f --- /dev/null +++ b/client/injection/kube/informers/core/v1/node/filtered/node.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().Nodes() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.NodeInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.NodeInformer with selector %s from context.", selector) + } + return untyped.(v1.NodeInformer) +} diff --git a/client/injection/kube/informers/core/v1/persistentvolume/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/persistentvolume/filtered/fake/fake.go new file mode 100644 index 000000000..70fdc32a4 --- /dev/null +++ b/client/injection/kube/informers/core/v1/persistentvolume/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/persistentvolume/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().PersistentVolumes() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go b/client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go new file mode 100644 index 000000000..d6ac48ae7 --- /dev/null +++ b/client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().PersistentVolumes() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.PersistentVolumeInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.PersistentVolumeInformer with selector %s from context.", selector) + } + return untyped.(v1.PersistentVolumeInformer) +} diff --git a/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/fake/fake.go new file mode 100644 index 000000000..0a97ee53d --- /dev/null +++ b/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().PersistentVolumeClaims() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go b/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go new file mode 100644 index 000000000..4c91b5968 --- /dev/null +++ b/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().PersistentVolumeClaims() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.PersistentVolumeClaimInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.PersistentVolumeClaimInformer with selector %s from context.", selector) + } + return untyped.(v1.PersistentVolumeClaimInformer) +} diff --git a/client/injection/kube/informers/core/v1/pod/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/pod/filtered/fake/fake.go new file mode 100644 index 000000000..ccf429100 --- /dev/null +++ b/client/injection/kube/informers/core/v1/pod/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/pod/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().Pods() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/pod/filtered/pod.go b/client/injection/kube/informers/core/v1/pod/filtered/pod.go new file mode 100644 index 000000000..7668965bd --- /dev/null +++ b/client/injection/kube/informers/core/v1/pod/filtered/pod.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().Pods() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.PodInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.PodInformer with selector %s from context.", selector) + } + return untyped.(v1.PodInformer) +} diff --git a/client/injection/kube/informers/core/v1/podtemplate/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/podtemplate/filtered/fake/fake.go new file mode 100644 index 000000000..f0bebbbad --- /dev/null +++ b/client/injection/kube/informers/core/v1/podtemplate/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/podtemplate/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().PodTemplates() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go b/client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go new file mode 100644 index 000000000..543b7cf4a --- /dev/null +++ b/client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().PodTemplates() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.PodTemplateInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.PodTemplateInformer with selector %s from context.", selector) + } + return untyped.(v1.PodTemplateInformer) +} diff --git a/client/injection/kube/informers/core/v1/replicationcontroller/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/fake/fake.go new file mode 100644 index 000000000..ed2a0a813 --- /dev/null +++ b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/replicationcontroller/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().ReplicationControllers() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go new file mode 100644 index 000000000..2fb62430d --- /dev/null +++ b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().ReplicationControllers() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ReplicationControllerInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.ReplicationControllerInformer with selector %s from context.", selector) + } + return untyped.(v1.ReplicationControllerInformer) +} diff --git a/client/injection/kube/informers/core/v1/resourcequota/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/resourcequota/filtered/fake/fake.go new file mode 100644 index 000000000..0144ecfa4 --- /dev/null +++ b/client/injection/kube/informers/core/v1/resourcequota/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/resourcequota/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().ResourceQuotas() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go b/client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go new file mode 100644 index 000000000..aae5e1e92 --- /dev/null +++ b/client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().ResourceQuotas() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ResourceQuotaInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.ResourceQuotaInformer with selector %s from context.", selector) + } + return untyped.(v1.ResourceQuotaInformer) +} diff --git a/client/injection/kube/informers/core/v1/secret/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/secret/filtered/fake/fake.go new file mode 100644 index 000000000..ddd26faf4 --- /dev/null +++ b/client/injection/kube/informers/core/v1/secret/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/secret/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().Secrets() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/secret/filtered/secret.go b/client/injection/kube/informers/core/v1/secret/filtered/secret.go new file mode 100644 index 000000000..44f852f0d --- /dev/null +++ b/client/injection/kube/informers/core/v1/secret/filtered/secret.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().Secrets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.SecretInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.SecretInformer with selector %s from context.", selector) + } + return untyped.(v1.SecretInformer) +} diff --git a/client/injection/kube/informers/core/v1/service/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/service/filtered/fake/fake.go new file mode 100644 index 000000000..131ece854 --- /dev/null +++ b/client/injection/kube/informers/core/v1/service/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/service/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().Services() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/service/filtered/service.go b/client/injection/kube/informers/core/v1/service/filtered/service.go new file mode 100644 index 000000000..8f5896cb8 --- /dev/null +++ b/client/injection/kube/informers/core/v1/service/filtered/service.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().Services() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ServiceInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.ServiceInformer with selector %s from context.", selector) + } + return untyped.(v1.ServiceInformer) +} diff --git a/client/injection/kube/informers/core/v1/serviceaccount/filtered/fake/fake.go b/client/injection/kube/informers/core/v1/serviceaccount/filtered/fake/fake.go new file mode 100644 index 000000000..f7bfcb9fc --- /dev/null +++ b/client/injection/kube/informers/core/v1/serviceaccount/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/filtered" + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Core().V1().ServiceAccounts() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go b/client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go new file mode 100644 index 000000000..e77a9e495 --- /dev/null +++ b/client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/core/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Core().V1().ServiceAccounts() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ServiceAccountInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/core/v1.ServiceAccountInformer with selector %s from context.", selector) + } + return untyped.(v1.ServiceAccountInformer) +} diff --git a/client/injection/kube/informers/factory/filtered/fake/fake_filtered_factory.go b/client/injection/kube/informers/factory/filtered/fake/fake_filtered_factory.go new file mode 100644 index 000000000..b22d45152 --- /dev/null +++ b/client/injection/kube/informers/factory/filtered/fake/fake_filtered_factory.go @@ -0,0 +1,59 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fakeFilteredFactory + +import ( + context "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + informers "k8s.io/client-go/informers" + fake "knative.dev/pkg/client/injection/kube/client/fake" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterInformerFactory(withInformerFactory) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := fake.Get(ctx) + opts := []informers.SharedInformerOption{} + if injection.HasNamespaceScope(ctx) { + opts = append(opts, informers.WithNamespace(injection.GetNamespaceScope(ctx))) + } + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + thisOpts := append(opts, informers.WithTweakListOptions(func(l *v1.ListOptions) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, + informers.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), thisOpts...)) + } + return ctx +} diff --git a/client/injection/kube/informers/factory/filtered/filtered_factory.go b/client/injection/kube/informers/factory/filtered/filtered_factory.go new file mode 100644 index 000000000..20a918676 --- /dev/null +++ b/client/injection/kube/informers/factory/filtered/filtered_factory.go @@ -0,0 +1,77 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filteredFactory + +import ( + context "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + informers "k8s.io/client-go/informers" + client "knative.dev/pkg/client/injection/kube/client" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformerFactory(withInformerFactory) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct { + Selector string +} + +type LabelKey struct{} + +func WithSelectors(ctx context.Context, selector ...string) context.Context { + return context.WithValue(ctx, LabelKey{}, selector) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := client.Get(ctx) + opts := []informers.SharedInformerOption{} + if injection.HasNamespaceScope(ctx) { + opts = append(opts, informers.WithNamespace(injection.GetNamespaceScope(ctx))) + } + untyped := ctx.Value(LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + thisOpts := append(opts, informers.WithTweakListOptions(func(l *v1.ListOptions) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, Key{Selector: selector}, + informers.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), thisOpts...)) + } + return ctx +} + +// Get extracts the InformerFactory from the context. +func Get(ctx context.Context, selector string) informers.SharedInformerFactory { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers.SharedInformerFactory with selector %s from context.", selector) + } + return untyped.(informers.SharedInformerFactory) +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go b/client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go new file mode 100644 index 000000000..d965ca273 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/rbac/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Rbac().V1().ClusterRoles() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ClusterRoleInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1.ClusterRoleInformer with selector %s from context.", selector) + } + return untyped.(v1.ClusterRoleInformer) +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrole/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1/clusterrole/filtered/fake/fake.go new file mode 100644 index 000000000..b8d60dea3 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/clusterrole/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + filtered "knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrole/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Rbac().V1().ClusterRoles() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go b/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go new file mode 100644 index 000000000..8ee12c2c4 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/rbac/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Rbac().V1().ClusterRoleBindings() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.ClusterRoleBindingInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1.ClusterRoleBindingInformer with selector %s from context.", selector) + } + return untyped.(v1.ClusterRoleBindingInformer) +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/fake/fake.go new file mode 100644 index 000000000..57a9a8ec3 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + filtered "knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Rbac().V1().ClusterRoleBindings() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/rbac/v1/role/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1/role/filtered/fake/fake.go new file mode 100644 index 000000000..622332c02 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/role/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + filtered "knative.dev/pkg/client/injection/kube/informers/rbac/v1/role/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Rbac().V1().Roles() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/rbac/v1/role/filtered/role.go b/client/injection/kube/informers/rbac/v1/role/filtered/role.go new file mode 100644 index 000000000..e8d171269 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/role/filtered/role.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/rbac/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Rbac().V1().Roles() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.RoleInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1.RoleInformer with selector %s from context.", selector) + } + return untyped.(v1.RoleInformer) +} diff --git a/client/injection/kube/informers/rbac/v1/rolebinding/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1/rolebinding/filtered/fake/fake.go new file mode 100644 index 000000000..5300c4a8a --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/rolebinding/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + factoryfiltered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + filtered "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Rbac().V1().RoleBindings() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go b/client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go new file mode 100644 index 000000000..c7b2048f2 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + v1 "k8s.io/client-go/informers/rbac/v1" + filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Rbac().V1().RoleBindings() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.RoleBindingInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1.RoleBindingInformer with selector %s from context.", selector) + } + return untyped.(v1.RoleBindingInformer) +} diff --git a/codegen/cmd/injection-gen/generators/fakeclient.go b/codegen/cmd/injection-gen/generators/fake_client.go similarity index 100% rename from codegen/cmd/injection-gen/generators/fakeclient.go rename to codegen/cmd/injection-gen/generators/fake_client.go diff --git a/codegen/cmd/injection-gen/generators/fakeduck.go b/codegen/cmd/injection-gen/generators/fake_duck.go similarity index 100% rename from codegen/cmd/injection-gen/generators/fakeduck.go rename to codegen/cmd/injection-gen/generators/fake_duck.go diff --git a/codegen/cmd/injection-gen/generators/fakefactory.go b/codegen/cmd/injection-gen/generators/fake_factory.go similarity index 100% rename from codegen/cmd/injection-gen/generators/fakefactory.go rename to codegen/cmd/injection-gen/generators/fake_factory.go diff --git a/codegen/cmd/injection-gen/generators/fake_filtered_factory.go b/codegen/cmd/injection-gen/generators/fake_filtered_factory.go new file mode 100644 index 000000000..153261dc4 --- /dev/null +++ b/codegen/cmd/injection-gen/generators/fake_filtered_factory.go @@ -0,0 +1,131 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 generators + +import ( + "io" + + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/gengo/types" + "k8s.io/klog" +) + +// fakeFilteredFactoryGenerator produces a file of listers for a given GroupVersion and +// type. +type fakeFilteredFactoryGenerator struct { + generator.DefaultGen + outputPackage string + imports namer.ImportTracker + filtered bool + + factoryInjectionPkg string + fakeClientInjectionPkg string + sharedInformerFactoryPackage string +} + +var _ generator.Generator = (*fakeFilteredFactoryGenerator)(nil) + +func (g *fakeFilteredFactoryGenerator) Filter(c *generator.Context, t *types.Type) bool { + // We generate a single factory, so return true once. + if !g.filtered { + g.filtered = true + return true + } + return false +} + +func (g *fakeFilteredFactoryGenerator) Namers(c *generator.Context) namer.NameSystems { + return namer.NameSystems{ + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + } +} + +func (g *fakeFilteredFactoryGenerator) Imports(c *generator.Context) (imports []string) { + imports = append(imports, g.imports.ImportLines()...) + return +} + +func (g *fakeFilteredFactoryGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + sw := generator.NewSnippetWriter(w, c, "{{", "}}") + + klog.V(5).Info("processing type ", t) + + m := map[string]interface{}{ + "factoryKey": c.Universe.Type(types.Name{Package: g.factoryInjectionPkg, Name: "Key"}), + "factoryLabelKey": c.Universe.Type(types.Name{Package: g.factoryInjectionPkg, Name: "LabelKey"}), + "factoryGet": c.Universe.Function(types.Name{Package: g.factoryInjectionPkg, Name: "Get"}), + "clientGet": c.Universe.Function(types.Name{Package: g.fakeClientInjectionPkg, Name: "Get"}), + "informersNewSharedInformerFactoryWithOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "NewSharedInformerFactoryWithOptions"}), + "informersSharedInformerOption": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "SharedInformerOption"}), + "informersWithNamespace": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithNamespace"}), + "informersWithTweakListOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithTweakListOptions"}), + "injectionRegisterInformerFactory": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/injection", + Name: "Fake.RegisterInformerFactory", + }), + "injectionHasNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "HasNamespaceScope"}), + "injectionGetNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "GetNamespaceScope"}), + "controllerGetResyncPeriod": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "GetResyncPeriod"}), + "contextContext": c.Universe.Type(types.Name{ + Package: "context", + Name: "Context", + }), + "loggingFromContext": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/logging", + Name: "FromContext", + }), + "metav1ListOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "ListOptions", + }), + } + + sw.Do(injectionFakeFilteredInformerFactory, m) + + return sw.Error() +} + +var injectionFakeFilteredInformerFactory = ` +var Get = {{.factoryGet|raw}} + +func init() { + {{.injectionRegisterInformerFactory|raw}}(withInformerFactory) +} + +func withInformerFactory(ctx {{.contextContext|raw}}) {{.contextContext|raw}} { + c := {{.clientGet|raw}}(ctx) + opts := []{{.informersSharedInformerOption|raw}}{} + if {{.injectionHasNamespace|raw}}(ctx) { + opts = append(opts, {{.informersWithNamespace|raw}}({{.injectionGetNamespace|raw}}(ctx))) + } + untyped := ctx.Value({{.factoryLabelKey|raw}}{}) + if untyped == nil { + {{.loggingFromContext|raw}}(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + thisOpts := append(opts, {{.informersWithTweakListOptions|raw}}(func(l *{{.metav1ListOptions|raw}}) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, {{.factoryKey|raw}}{Selector: selector}, + {{.informersNewSharedInformerFactoryWithOptions|raw}}(c, {{.controllerGetResyncPeriod|raw}}(ctx), thisOpts...)) + } + return ctx +} +` diff --git a/codegen/cmd/injection-gen/generators/fake_filtered_informer.go b/codegen/cmd/injection-gen/generators/fake_filtered_informer.go new file mode 100644 index 000000000..47b700884 --- /dev/null +++ b/codegen/cmd/injection-gen/generators/fake_filtered_informer.go @@ -0,0 +1,133 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 generators + +import ( + "io" + + clientgentypes "k8s.io/code-generator/cmd/client-gen/types" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/gengo/types" + "k8s.io/klog" +) + +// fakeFilteredInformerGenerator produces a file of listers for a given GroupVersion and +// type. +type fakeFilteredInformerGenerator struct { + generator.DefaultGen + outputPackage string + imports namer.ImportTracker + + typeToGenerate *types.Type + groupVersion clientgentypes.GroupVersion + groupGoName string + informerInjectionPkg string + fakeFactoryInjectionPkg string +} + +var _ generator.Generator = (*fakeFilteredInformerGenerator)(nil) + +func (g *fakeFilteredInformerGenerator) Filter(c *generator.Context, t *types.Type) bool { + // Only process the type for this informer generator. + return t == g.typeToGenerate +} + +func (g *fakeFilteredInformerGenerator) Namers(c *generator.Context) namer.NameSystems { + publicPluralNamer := &ExceptionNamer{ + Exceptions: map[string]string{ + // these exceptions are used to deconflict the generated code + // you can put your fully qualified package like + // to generate a name that doesn't conflict with your group. + // "k8s.io/apis/events/v1beta1.Event": "EventResource" + }, + KeyFunc: func(t *types.Type) string { + return t.Name.Package + "." + t.Name.Name + }, + Delegate: namer.NewPublicPluralNamer(map[string]string{ + "Endpoints": "Endpoints", + }), + } + + return namer.NameSystems{ + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + "publicPlural": publicPluralNamer, + } +} + +func (g *fakeFilteredInformerGenerator) Imports(c *generator.Context) (imports []string) { + imports = append(imports, g.imports.ImportLines()...) + return +} + +func (g *fakeFilteredInformerGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + sw := generator.NewSnippetWriter(w, c, "{{", "}}") + + klog.V(5).Info("processing type ", t) + + m := map[string]interface{}{ + "informerKey": c.Universe.Type(types.Name{Package: g.informerInjectionPkg, Name: "Key"}), + "informerGet": c.Universe.Function(types.Name{Package: g.informerInjectionPkg, Name: "Get"}), + "factoryGet": c.Universe.Function(types.Name{Package: g.fakeFactoryInjectionPkg, Name: "Get"}), + "factoryLabelKey": c.Universe.Type(types.Name{Package: g.fakeFactoryInjectionPkg, Name: "LabelKey"}), + "group": namer.IC(g.groupGoName), + "type": t, + "version": namer.IC(g.groupVersion.Version.String()), + "controllerInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "Informer"}), + "injectionRegisterFilteredInformers": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/injection", + Name: "Fake.RegisterFilteredInformers", + }), + "loggingFromContext": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/logging", + Name: "FromContext", + }), + "contextContext": c.Universe.Type(types.Name{ + Package: "context", + Name: "Context", + }), + } + + sw.Do(injectionFakeFilteredInformer, m) + + return sw.Error() +} + +var injectionFakeFilteredInformer = ` +var Get = {{.informerGet|raw}} + +func init() { + {{.injectionRegisterFilteredInformers|raw}}(withInformer) +} + +func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, []{{.controllerInformer|raw}}) { + untyped := ctx.Value({{.factoryLabelKey|raw}}{}) + if untyped == nil { + {{.loggingFromContext|raw}}(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []{{.controllerInformer|raw}}{} + for _, selector := range labelSelectors { + f := {{.factoryGet|raw}}(ctx, selector) + inf := f.{{.group}}().{{.version}}().{{.type|publicPlural}}() + ctx = context.WithValue(ctx, {{.informerKey|raw}}{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} +` diff --git a/codegen/cmd/injection-gen/generators/fakeinformer.go b/codegen/cmd/injection-gen/generators/fake_informer.go similarity index 100% rename from codegen/cmd/injection-gen/generators/fakeinformer.go rename to codegen/cmd/injection-gen/generators/fake_informer.go diff --git a/codegen/cmd/injection-gen/generators/filtered_factory.go b/codegen/cmd/injection-gen/generators/filtered_factory.go new file mode 100644 index 000000000..b036cf1cf --- /dev/null +++ b/codegen/cmd/injection-gen/generators/filtered_factory.go @@ -0,0 +1,143 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 generators + +import ( + "io" + + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/gengo/types" + + "k8s.io/klog" +) + +// factoryTestGenerator produces a file of factory injection of a given type. +type filteredFactoryGenerator struct { + generator.DefaultGen + outputPackage string + imports namer.ImportTracker + cachingClientSetPackage string + sharedInformerFactoryPackage string + filtered bool +} + +var _ generator.Generator = (*filteredFactoryGenerator)(nil) + +func (g *filteredFactoryGenerator) Filter(c *generator.Context, t *types.Type) bool { + // We generate a single factory, so return true once. + if !g.filtered { + g.filtered = true + return true + } + return false +} + +func (g *filteredFactoryGenerator) Namers(c *generator.Context) namer.NameSystems { + return namer.NameSystems{ + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + } +} + +func (g *filteredFactoryGenerator) Imports(c *generator.Context) (imports []string) { + imports = append(imports, g.imports.ImportLines()...) + return +} + +func (g *filteredFactoryGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + sw := generator.NewSnippetWriter(w, c, "{{", "}}") + + klog.V(5).Info("processing type ", t) + + m := map[string]interface{}{ + "cachingClientGet": c.Universe.Type(types.Name{Package: g.cachingClientSetPackage, Name: "Get"}), + "informersNewSharedInformerFactoryWithOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "NewSharedInformerFactoryWithOptions"}), + "informersSharedInformerOption": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "SharedInformerOption"}), + "informersWithNamespace": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithNamespace"}), + "informersWithTweakListOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithTweakListOptions"}), + "informersSharedInformerFactory": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "SharedInformerFactory"}), + "injectionRegisterInformerFactory": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterInformerFactory"}), + "injectionHasNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "HasNamespaceScope"}), + "injectionGetNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "GetNamespaceScope"}), + "controllerGetResyncPeriod": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "GetResyncPeriod"}), + "loggingFromContext": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/logging", + Name: "FromContext", + }), + "contextContext": c.Universe.Type(types.Name{ + Package: "context", + Name: "Context", + }), + "metav1ListOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "ListOptions", + }), + } + + sw.Do(injectionFilteredFactory, m) + + return sw.Error() +} + +var injectionFilteredFactory = ` +func init() { + {{.injectionRegisterInformerFactory|raw}}(withInformerFactory) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct{ + Selector string +} + +type LabelKey struct{} + +func WithSelectors(ctx {{.contextContext|raw}}, selector ...string) context.Context { + return context.WithValue(ctx, LabelKey{}, selector) +} + +func withInformerFactory(ctx {{.contextContext|raw}}) {{.contextContext|raw}} { + c := {{.cachingClientGet|raw}}(ctx) + opts := []{{.informersSharedInformerOption|raw}}{} + if {{.injectionHasNamespace|raw}}(ctx) { + opts = append(opts, {{.informersWithNamespace|raw}}({{.injectionGetNamespace|raw}}(ctx))) + } + untyped := ctx.Value(LabelKey{}) + if untyped == nil { + {{.loggingFromContext|raw}}(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + thisOpts := append(opts, {{.informersWithTweakListOptions|raw}}(func(l *{{.metav1ListOptions|raw}}) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, Key{Selector: selector}, + {{.informersNewSharedInformerFactoryWithOptions|raw}}(c, {{.controllerGetResyncPeriod|raw}}(ctx), thisOpts...)) + } + return ctx +} + +// Get extracts the InformerFactory from the context. +func Get(ctx {{.contextContext|raw}}, selector string) {{.informersSharedInformerFactory|raw}} { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + {{.loggingFromContext|raw}}(ctx).Panicf( + "Unable to fetch {{.informersSharedInformerFactory}} with selector %s from context.", selector) + } + return untyped.({{.informersSharedInformerFactory|raw}}) +} +` diff --git a/codegen/cmd/injection-gen/generators/filtered_informer.go b/codegen/cmd/injection-gen/generators/filtered_informer.go new file mode 100644 index 000000000..c82a2e59f --- /dev/null +++ b/codegen/cmd/injection-gen/generators/filtered_informer.go @@ -0,0 +1,141 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 generators + +import ( + "io" + + clientgentypes "k8s.io/code-generator/cmd/client-gen/types" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/gengo/types" + "k8s.io/klog" +) + +// injectionTestGenerator produces a file of listers for a given GroupVersion and +// type. +type filteredInjectionGenerator struct { + generator.DefaultGen + outputPackage string + groupVersion clientgentypes.GroupVersion + groupGoName string + typeToGenerate *types.Type + imports namer.ImportTracker + typedInformerPackage string + groupInformerFactoryPackage string +} + +var _ generator.Generator = (*filteredInjectionGenerator)(nil) + +func (g *filteredInjectionGenerator) Filter(c *generator.Context, t *types.Type) bool { + // Only process the type for this informer generator. + return t == g.typeToGenerate +} + +func (g *filteredInjectionGenerator) Namers(c *generator.Context) namer.NameSystems { + publicPluralNamer := &ExceptionNamer{ + Exceptions: map[string]string{ + // these exceptions are used to deconflict the generated code + // you can put your fully qualified package like + // to generate a name that doesn't conflict with your group. + // "k8s.io/apis/events/v1beta1.Event": "EventResource" + }, + KeyFunc: func(t *types.Type) string { + return t.Name.Package + "." + t.Name.Name + }, + Delegate: namer.NewPublicPluralNamer(map[string]string{ + "Endpoints": "Endpoints", + }), + } + + return namer.NameSystems{ + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + "publicPlural": publicPluralNamer, + } +} + +func (g *filteredInjectionGenerator) Imports(c *generator.Context) (imports []string) { + imports = append(imports, g.imports.ImportLines()...) + return +} + +func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + sw := generator.NewSnippetWriter(w, c, "{{", "}}") + + klog.V(5).Info("processing type ", t) + + m := map[string]interface{}{ + "group": namer.IC(g.groupGoName), + "type": t, + "version": namer.IC(g.groupVersion.Version.String()), + "injectionRegisterFilteredInformers": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterFilteredInformers"}), + "controllerInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "Informer"}), + "informersTypedInformer": c.Universe.Type(types.Name{Package: g.typedInformerPackage, Name: t.Name.Name + "Informer"}), + "factoryLabelKey": c.Universe.Type(types.Name{Package: g.groupInformerFactoryPackage, Name: "LabelKey"}), + "factoryGet": c.Universe.Function(types.Name{Package: g.groupInformerFactoryPackage, Name: "Get"}), + "loggingFromContext": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/logging", + Name: "FromContext", + }), + "contextContext": c.Universe.Type(types.Name{ + Package: "context", + Name: "Context", + }), + } + + sw.Do(filteredInjectionInformer, m) + + return sw.Error() +} + +var filteredInjectionInformer = ` +func init() { + {{.injectionRegisterFilteredInformers|raw}}(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{ + Selector string +} + +func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, []{{.controllerInformer|raw}}) { + untyped := ctx.Value({{.factoryLabelKey|raw}}{}) + if untyped == nil { + {{.loggingFromContext|raw}}(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []{{.controllerInformer|raw}}{} + for _, selector := range labelSelectors { + f := {{.factoryGet|raw}}(ctx, selector) + inf := f.{{.group}}().{{.version}}().{{.type|publicPlural}}() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +// Get extracts the typed informer from the context. +func Get(ctx {{.contextContext|raw}}, selector string) {{.informersTypedInformer|raw}} { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + {{.loggingFromContext|raw}}(ctx).Panicf( + "Unable to fetch {{.informersTypedInformer}} with selector %s from context.", selector) + } + return untyped.({{.informersTypedInformer|raw}}) +} +` diff --git a/codegen/cmd/injection-gen/generators/packages.go b/codegen/cmd/injection-gen/generators/packages.go index d1fa91e09..75dafbf1b 100644 --- a/codegen/cmd/injection-gen/generators/packages.go +++ b/codegen/cmd/injection-gen/generators/packages.go @@ -336,11 +336,61 @@ func versionFactoryPackages(basePackage string, boilerplate []byte, customArgs * return tags.NeedsInformerInjection() }, }, + + // FilterFactoryImpl + &generator.DefaultPackage{ + PackageName: "filteredFactory", + PackagePath: filepath.Join(packagePath, "filtered"), + HeaderText: boilerplate, + GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { + // Impl + generators = append(generators, &filteredFactoryGenerator{ + DefaultGen: generator.DefaultGen{ + OptionalName: "filtered_factory", + }, + outputPackage: filepath.Join(packagePath, "filtered"), + cachingClientSetPackage: filepath.Join(basePackage, "client"), + sharedInformerFactoryPackage: customArgs.ExternalVersionsInformersPackage, + imports: generator.NewImportTracker(), + }) + return generators + }, + FilterFunc: func(c *generator.Context, t *types.Type) bool { + tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) + return tags.NeedsInformerInjection() + }, + }, + // FakeFilterFactory + &generator.DefaultPackage{ + PackageName: "fakeFilteredFactory", + PackagePath: filepath.Join(packagePath, "filtered", "fake"), + HeaderText: boilerplate, + GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { + // Impl + generators = append(generators, &fakeFilteredFactoryGenerator{ + DefaultGen: generator.DefaultGen{ + OptionalName: "fake_filtered_factory", + }, + outputPackage: filepath.Join(packagePath, "filtered", "fake"), + factoryInjectionPkg: filepath.Join(packagePath, "filtered"), + fakeClientInjectionPkg: filepath.Join(basePackage, "client", "fake"), + sharedInformerFactoryPackage: customArgs.ExternalVersionsInformersPackage, + imports: generator.NewImportTracker(), + }) + return generators + }, + FilterFunc: func(c *generator.Context, t *types.Type) bool { + tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) + return tags.NeedsInformerInjection() + }, + }, } } func versionInformerPackages(basePackage string, groupPkgName string, gv clientgentypes.GroupVersion, groupGoName string, boilerplate []byte, typesToGenerate []*types.Type, customArgs *informergenargs.CustomArgs) []generator.Package { factoryPackagePath := filepath.Join(basePackage, "informers", "factory") + filteredFactoryPackagePath := filepath.Join(basePackage, "informers", "factory", "filtered") + packagePath := filepath.Join(basePackage, "informers", groupPkgName, strings.ToLower(gv.Version.NonEmpty())) vers := make([]generator.Package, 0, 2*len(typesToGenerate)) @@ -404,6 +454,60 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg return tags.NeedsInformerInjection() }, }) + // FilteredInformer + vers = append(vers, &generator.DefaultPackage{ + PackageName: "filtered", + PackagePath: filepath.Join(packagePath, "filtered"), + HeaderText: boilerplate, + GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { + // Impl + generators = append(generators, &filteredInjectionGenerator{ + DefaultGen: generator.DefaultGen{ + OptionalName: strings.ToLower(t.Name.Name), + }, + outputPackage: filepath.Join(packagePath, "filtered"), + groupVersion: gv, + groupGoName: groupGoName, + typeToGenerate: t, + imports: generator.NewImportTracker(), + typedInformerPackage: typedInformerPackage, + groupInformerFactoryPackage: filteredFactoryPackagePath, + }) + return generators + }, + FilterFunc: func(c *generator.Context, t *types.Type) bool { + tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) + return tags.NeedsInformerInjection() + }, + }) + + // FakeFilteredInformer + vers = append(vers, &generator.DefaultPackage{ + PackageName: "fake", + PackagePath: filepath.Join(packagePath, "filtered", "fake"), + HeaderText: boilerplate, + GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { + // Impl + generators = append(generators, &fakeFilteredInformerGenerator{ + DefaultGen: generator.DefaultGen{ + OptionalName: "fake", + }, + outputPackage: filepath.Join(packagePath, "filtered", "fake"), + imports: generator.NewImportTracker(), + typeToGenerate: t, + groupVersion: gv, + groupGoName: groupGoName, + informerInjectionPkg: filepath.Join(packagePath, "filtered"), + fakeFactoryInjectionPkg: filteredFactoryPackagePath, + }) + return generators + }, + FilterFunc: func(c *generator.Context, t *types.Type) bool { + tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) + return tags.NeedsInformerInjection() + }, + }) + } return vers } diff --git a/injection/informers.go b/injection/informers.go index 1140174d1..9356f8d7f 100644 --- a/injection/informers.go +++ b/injection/informers.go @@ -28,6 +28,10 @@ import ( // informer type to a context. type InformerInjector func(context.Context) (context.Context, controller.Informer) +// FilteredInformersInjector holds the type of a callback that attaches a set of particular +// filtered informers type to a context. +type FilteredInformersInjector func(context.Context) (context.Context, []controller.Informer) + func (i *impl) RegisterInformer(ii InformerInjector) { i.m.Lock() defer i.m.Unlock() @@ -35,6 +39,13 @@ func (i *impl) RegisterInformer(ii InformerInjector) { i.informers = append(i.informers, ii) } +func (i *impl) RegisterFilteredInformers(fii FilteredInformersInjector) { + i.m.Lock() + defer i.m.Unlock() + + i.filteredInformers = append(i.filteredInformers, fii) +} + func (i *impl) GetInformers() []InformerInjector { i.m.RLock() defer i.m.RUnlock() @@ -43,6 +54,14 @@ func (i *impl) GetInformers() []InformerInjector { return append(i.informers[:0:0], i.informers...) } +func (i *impl) GetFilteredInformers() []FilteredInformersInjector { + i.m.RLock() + defer i.m.RUnlock() + + // Copy the slice before returning. + return append(i.filteredInformers[:0:0], i.filteredInformers...) +} + func (i *impl) SetupInformers(ctx context.Context, cfg *rest.Config) (context.Context, []controller.Informer) { // Based on the reconcilers we have linked, build up a set of clients and inject // them onto the context. @@ -65,10 +84,16 @@ func (i *impl) SetupInformers(ctx context.Context, cfg *rest.Config) (context.Co // Based on the reconcilers we have linked, build up a set of informers // and inject them onto the context. var inf controller.Informer + var filteredinfs []controller.Informer informers := make([]controller.Informer, 0, len(i.GetInformers())) for _, ii := range i.GetInformers() { ctx, inf = ii(ctx) informers = append(informers, inf) } + for _, fii := range i.GetFilteredInformers() { + ctx, filteredinfs = fii(ctx) + informers = append(informers, filteredinfs...) + + } return ctx, informers } diff --git a/injection/informers_test.go b/injection/informers_test.go index daf721264..b5f48b684 100644 --- a/injection/informers_test.go +++ b/injection/informers_test.go @@ -45,6 +45,10 @@ func injectBarInformer(ctx context.Context) (context.Context, controller.Informe return ctx, nil } +func injectFooFilteredInformers(ctx context.Context) (context.Context, []controller.Informer) { + return ctx, []controller.Informer{nil, nil} +} + func TestRegisterInformersAndSetup(t *testing.T) { i := &impl{} @@ -61,9 +65,12 @@ func TestRegisterInformersAndSetup(t *testing.T) { i.RegisterInformer(injectFooInformer) i.RegisterInformer(injectBarInformer) - _, infs := i.SetupInformers(context.Background(), &rest.Config{}) + i.RegisterFilteredInformers(injectFooFilteredInformers) - if want, got := 2, len(infs); got != want { + _, infs := i.SetupInformers(context.Background(), &rest.Config{}) + // 2 nil informers injectFooInformer and injectBarInformer are registered by RegisterInformer, + // and another 2 nil informers are registered by injectFooFilteredInformers + if want, got := 4, len(infs); got != want { t.Errorf("SetupInformers() = %d, wanted %d", want, got) } } diff --git a/injection/interface.go b/injection/interface.go index 85955db58..7d2764cdc 100644 --- a/injection/interface.go +++ b/injection/interface.go @@ -53,9 +53,16 @@ type Interface interface { // a new informer with a context. RegisterInformer(InformerInjector) + // RegisterFilteredInformers registers a new filtered informer injector callback for associating + // a new set of informers with a context. + RegisterFilteredInformers(FilteredInformersInjector) + // GetInformers fetches all of the registered informer injectors. GetInformers() []InformerInjector + // GetFilteredInformers fetches all of the registered filtered informer injectors. + GetFilteredInformers() []FilteredInformersInjector + // SetupInformers runs all of the injectors against a context, starting with // the clients and the given rest.Config. The resulting context is returned // along with a list of the .Informer() for each of the injected informers, @@ -84,8 +91,9 @@ var ( type impl struct { m sync.RWMutex - clients []ClientInjector - factories []InformerFactoryInjector - informers []InformerInjector - ducks []DuckFactoryInjector + clients []ClientInjector + factories []InformerFactoryInjector + informers []InformerInjector + filteredInformers []FilteredInformersInjector + ducks []DuckFactoryInjector }