diff --git a/client/injection/apiextensions/client/client.go b/client/injection/apiextensions/client/client.go index e8831fe6dc..9c8d95a7c4 100644 --- a/client/injection/apiextensions/client/client.go +++ b/client/injection/apiextensions/client/client.go @@ -20,27 +20,48 @@ package client import ( context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + typedapiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1" + typedapiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + discovery "k8s.io/client-go/discovery" + dynamic "k8s.io/client-go/dynamic" rest "k8s.io/client-go/rest" injection "knative.dev/pkg/injection" + dynamicclient "knative.dev/pkg/injection/clients/dynamicclient" logging "knative.dev/pkg/logging" ) func init() { - injection.Default.RegisterClient(withClient) + injection.Default.RegisterClient(withClientFromConfig) injection.Default.RegisterClientFetcher(func(ctx context.Context) interface{} { return Get(ctx) }) + injection.Dynamic.RegisterDynamicClient(withClientFromDynamic) } // Key is used as the key for associating information with a context.Context. type Key struct{} -func withClient(ctx context.Context, cfg *rest.Config) context.Context { +func withClientFromConfig(ctx context.Context, cfg *rest.Config) context.Context { return context.WithValue(ctx, Key{}, clientset.NewForConfigOrDie(cfg)) } +func withClientFromDynamic(ctx context.Context) context.Context { + return context.WithValue(ctx, Key{}, &wrapClient{dyn: dynamicclient.Get(ctx)}) +} + // Get extracts the clientset.Interface client from the context. func Get(ctx context.Context) clientset.Interface { untyped := ctx.Value(Key{}) @@ -55,3 +76,308 @@ func Get(ctx context.Context) clientset.Interface { } return untyped.(clientset.Interface) } + +type wrapClient struct { + dyn dynamic.Interface +} + +var _ clientset.Interface = (*wrapClient)(nil) + +func (w *wrapClient) Discovery() discovery.DiscoveryInterface { + panic("Discovery called on dynamic client!") +} + +func convert(from interface{}, to runtime.Object) error { + bs, err := json.Marshal(from) + if err != nil { + return fmt.Errorf("Marshal() = %w", err) + } + if err := json.Unmarshal(bs, to); err != nil { + return fmt.Errorf("Unmarshal() = %w", err) + } + return nil +} + +// ApiextensionsV1beta1 retrieves the ApiextensionsV1beta1Client +func (w *wrapClient) ApiextensionsV1beta1() typedapiextensionsv1beta1.ApiextensionsV1beta1Interface { + return &wrapApiextensionsV1beta1{ + dyn: w.dyn, + } +} + +type wrapApiextensionsV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapApiextensionsV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapApiextensionsV1beta1) CustomResourceDefinitions() typedapiextensionsv1beta1.CustomResourceDefinitionInterface { + return &wrapApiextensionsV1beta1CustomResourceDefinitionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apiextensions.k8s.io", + Version: "v1beta1", + Resource: "customresourcedefinitions", + }), + } +} + +type wrapApiextensionsV1beta1CustomResourceDefinitionImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedapiextensionsv1beta1.CustomResourceDefinitionInterface = (*wrapApiextensionsV1beta1CustomResourceDefinitionImpl)(nil) + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) Create(ctx context.Context, in *v1beta1.CustomResourceDefinition, opts v1.CreateOptions) (*v1beta1.CustomResourceDefinition, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apiextensions.k8s.io", + Version: "v1beta1", + Kind: "CustomResourceDefinition", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.CustomResourceDefinition, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) List(ctx context.Context, opts v1.ListOptions) (*v1beta1.CustomResourceDefinitionList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta1.CustomResourceDefinitionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CustomResourceDefinition, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) Update(ctx context.Context, in *v1beta1.CustomResourceDefinition, opts v1.UpdateOptions) (*v1beta1.CustomResourceDefinition, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apiextensions.k8s.io", + Version: "v1beta1", + Kind: "CustomResourceDefinition", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) UpdateStatus(ctx context.Context, in *v1beta1.CustomResourceDefinition, opts v1.UpdateOptions) (*v1beta1.CustomResourceDefinition, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apiextensions.k8s.io", + Version: "v1beta1", + Kind: "CustomResourceDefinition", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1beta1CustomResourceDefinitionImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// ApiextensionsV1 retrieves the ApiextensionsV1Client +func (w *wrapClient) ApiextensionsV1() typedapiextensionsv1.ApiextensionsV1Interface { + return &wrapApiextensionsV1{ + dyn: w.dyn, + } +} + +type wrapApiextensionsV1 struct { + dyn dynamic.Interface +} + +func (w *wrapApiextensionsV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapApiextensionsV1) CustomResourceDefinitions() typedapiextensionsv1.CustomResourceDefinitionInterface { + return &wrapApiextensionsV1CustomResourceDefinitionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apiextensions.k8s.io", + Version: "v1", + Resource: "customresourcedefinitions", + }), + } +} + +type wrapApiextensionsV1CustomResourceDefinitionImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedapiextensionsv1.CustomResourceDefinitionInterface = (*wrapApiextensionsV1CustomResourceDefinitionImpl)(nil) + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) Create(ctx context.Context, in *apiextensionsv1.CustomResourceDefinition, opts v1.CreateOptions) (*apiextensionsv1.CustomResourceDefinition, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apiextensions.k8s.io", + Version: "v1", + Kind: "CustomResourceDefinition", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*apiextensionsv1.CustomResourceDefinition, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) List(ctx context.Context, opts v1.ListOptions) (*apiextensionsv1.CustomResourceDefinitionList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1.CustomResourceDefinitionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apiextensionsv1.CustomResourceDefinition, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) Update(ctx context.Context, in *apiextensionsv1.CustomResourceDefinition, opts v1.UpdateOptions) (*apiextensionsv1.CustomResourceDefinition, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apiextensions.k8s.io", + Version: "v1", + Kind: "CustomResourceDefinition", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1.CustomResourceDefinition, opts v1.UpdateOptions) (*apiextensionsv1.CustomResourceDefinition, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apiextensions.k8s.io", + Version: "v1", + Kind: "CustomResourceDefinition", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1.CustomResourceDefinition{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapApiextensionsV1CustomResourceDefinitionImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} diff --git a/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/customresourcedefinition.go b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/customresourcedefinition.go index 7dbb4f5b3c..4c27f2e375 100644 --- a/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/customresourcedefinition.go +++ b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/customresourcedefinition.go @@ -21,7 +21,14 @@ package customresourcedefinition import ( context "context" + apisapiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" v1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/apiextensions/client" factory "knative.dev/pkg/client/injection/apiextensions/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.CustomResourceDefinitionInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.CustomResourceDefinitionInformer { } return untyped.(v1.CustomResourceDefinitionInformer) } + +type wrapper struct { + client clientset.Interface +} + +var _ v1.CustomResourceDefinitionInformer = (*wrapper)(nil) +var _ apiextensionsv1.CustomResourceDefinitionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apisapiextensionsv1.CustomResourceDefinition{}, 0, nil) +} + +func (w *wrapper) Lister() apiextensionsv1.CustomResourceDefinitionLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apisapiextensionsv1.CustomResourceDefinition, err error) { + lo, err := w.client.ApiextensionsV1().CustomResourceDefinitions().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apisapiextensionsv1.CustomResourceDefinition, error) { + return w.client.ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go index 670f708884..5d1132b75c 100644 --- a/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go +++ b/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/filtered/customresourcedefinition.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apisapiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" v1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/apiextensions/client" filtered "knative.dev/pkg/client/injection/apiextensions/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.CustomResourceDefinitionInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.CustomResourceDefinitionInform } return untyped.(v1.CustomResourceDefinitionInformer) } + +type wrapper struct { + client clientset.Interface + + selector string +} + +var _ v1.CustomResourceDefinitionInformer = (*wrapper)(nil) +var _ apiextensionsv1.CustomResourceDefinitionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apisapiextensionsv1.CustomResourceDefinition{}, 0, nil) +} + +func (w *wrapper) Lister() apiextensionsv1.CustomResourceDefinitionLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apisapiextensionsv1.CustomResourceDefinition, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ApiextensionsV1().CustomResourceDefinitions().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apisapiextensionsv1.CustomResourceDefinition, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/customresourcedefinition.go b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/customresourcedefinition.go index ede1bf0c94..aa97fd670b 100644 --- a/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/customresourcedefinition.go +++ b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/customresourcedefinition.go @@ -21,7 +21,14 @@ package customresourcedefinition import ( context "context" + apisapiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1" + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/apiextensions/client" factory "knative.dev/pkg/client/injection/apiextensions/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1beta1.CustomResourceDefinitionInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1beta1.CustomResourceDefinitionInformer { } return untyped.(v1beta1.CustomResourceDefinitionInformer) } + +type wrapper struct { + client clientset.Interface +} + +var _ v1beta1.CustomResourceDefinitionInformer = (*wrapper)(nil) +var _ apiextensionsv1beta1.CustomResourceDefinitionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apisapiextensionsv1beta1.CustomResourceDefinition{}, 0, nil) +} + +func (w *wrapper) Lister() apiextensionsv1beta1.CustomResourceDefinitionLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apisapiextensionsv1beta1.CustomResourceDefinition, err error) { + lo, err := w.client.ApiextensionsV1beta1().CustomResourceDefinitions().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apisapiextensionsv1beta1.CustomResourceDefinition, error) { + return w.client.ApiextensionsV1beta1().CustomResourceDefinitions().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go index ff2eb1dd72..c38ee4acb2 100644 --- a/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go +++ b/client/injection/apiextensions/informers/apiextensions/v1beta1/customresourcedefinition/filtered/customresourcedefinition.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apisapiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" v1beta1 "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensions/v1beta1" + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/apiextensions/client" filtered "knative.dev/pkg/client/injection/apiextensions/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1beta1.CustomResourceDefinitionInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1beta1.CustomResourceDefinitionI } return untyped.(v1beta1.CustomResourceDefinitionInformer) } + +type wrapper struct { + client clientset.Interface + + selector string +} + +var _ v1beta1.CustomResourceDefinitionInformer = (*wrapper)(nil) +var _ apiextensionsv1beta1.CustomResourceDefinitionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apisapiextensionsv1beta1.CustomResourceDefinition{}, 0, nil) +} + +func (w *wrapper) Lister() apiextensionsv1beta1.CustomResourceDefinitionLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apisapiextensionsv1beta1.CustomResourceDefinition, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ApiextensionsV1beta1().CustomResourceDefinitions().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apisapiextensionsv1beta1.CustomResourceDefinition, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ApiextensionsV1beta1().CustomResourceDefinitions().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/client/client.go b/client/injection/kube/client/client.go index 2c7be6d313..f37e29290f 100644 --- a/client/injection/kube/client/client.go +++ b/client/injection/kube/client/client.go @@ -20,27 +20,130 @@ package client import ( context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + v1 "k8s.io/api/admissionregistration/v1" + v1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + appsv1 "k8s.io/api/apps/v1" + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1beta2 "k8s.io/api/apps/v1beta2" + authenticationv1 "k8s.io/api/authentication/v1" + authenticationv1beta1 "k8s.io/api/authentication/v1beta1" + authorizationv1 "k8s.io/api/authorization/v1" + authorizationv1beta1 "k8s.io/api/authorization/v1beta1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + v2beta1 "k8s.io/api/autoscaling/v2beta1" + v2beta2 "k8s.io/api/autoscaling/v2beta2" + batchv1 "k8s.io/api/batch/v1" + batchv1beta1 "k8s.io/api/batch/v1beta1" + v2alpha1 "k8s.io/api/batch/v2alpha1" + certificatesv1 "k8s.io/api/certificates/v1" + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + coordinationv1 "k8s.io/api/coordination/v1" + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + corev1 "k8s.io/api/core/v1" + discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + eventsv1 "k8s.io/api/events/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + networkingv1 "k8s.io/api/networking/v1" + networkingv1beta1 "k8s.io/api/networking/v1beta1" + nodev1 "k8s.io/api/node/v1" + nodev1alpha1 "k8s.io/api/node/v1alpha1" + nodev1beta1 "k8s.io/api/node/v1beta1" + policyv1beta1 "k8s.io/api/policy/v1beta1" + rbacv1 "k8s.io/api/rbac/v1" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + schedulingv1 "k8s.io/api/scheduling/v1" + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + storagev1 "k8s.io/api/storage/v1" + storagev1alpha1 "k8s.io/api/storage/v1alpha1" + storagev1beta1 "k8s.io/api/storage/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + discovery "k8s.io/client-go/discovery" + dynamic "k8s.io/client-go/dynamic" kubernetes "k8s.io/client-go/kubernetes" + typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1" + typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1" + typedinternalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1" + typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" + typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1" + typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2" + typedauthenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1" + typedauthenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1" + typedauthorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1" + typedauthorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1" + typedautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1" + typedautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" + typedautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" + typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" + typedbatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" + typedbatchv2alpha1 "k8s.io/client-go/kubernetes/typed/batch/v2alpha1" + typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" + typedcertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1" + typedcoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1" + typedcoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1" + typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" + typeddiscoveryv1alpha1 "k8s.io/client-go/kubernetes/typed/discovery/v1alpha1" + typeddiscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" + typedeventsv1 "k8s.io/client-go/kubernetes/typed/events/v1" + typedeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1" + typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" + typedflowcontrolv1alpha1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1" + typedflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1" + typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" + typednetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" + typednodev1 "k8s.io/client-go/kubernetes/typed/node/v1" + typednodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1" + typednodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1" + typedpolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" + typedrbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1" + typedrbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1" + typedrbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" + typedschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" + typedschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" + typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1" + typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" + typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" rest "k8s.io/client-go/rest" injection "knative.dev/pkg/injection" + dynamicclient "knative.dev/pkg/injection/clients/dynamicclient" logging "knative.dev/pkg/logging" ) func init() { - injection.Default.RegisterClient(withClient) + injection.Default.RegisterClient(withClientFromConfig) injection.Default.RegisterClientFetcher(func(ctx context.Context) interface{} { return Get(ctx) }) + injection.Dynamic.RegisterDynamicClient(withClientFromDynamic) } // Key is used as the key for associating information with a context.Context. type Key struct{} -func withClient(ctx context.Context, cfg *rest.Config) context.Context { +func withClientFromConfig(ctx context.Context, cfg *rest.Config) context.Context { return context.WithValue(ctx, Key{}, kubernetes.NewForConfigOrDie(cfg)) } +func withClientFromDynamic(ctx context.Context) context.Context { + return context.WithValue(ctx, Key{}, &wrapClient{dyn: dynamicclient.Get(ctx)}) +} + // Get extracts the kubernetes.Interface client from the context. func Get(ctx context.Context) kubernetes.Interface { untyped := ctx.Value(Key{}) @@ -55,3 +158,13154 @@ func Get(ctx context.Context) kubernetes.Interface { } return untyped.(kubernetes.Interface) } + +type wrapClient struct { + dyn dynamic.Interface +} + +var _ kubernetes.Interface = (*wrapClient)(nil) + +func (w *wrapClient) Discovery() discovery.DiscoveryInterface { + panic("Discovery called on dynamic client!") +} + +func convert(from interface{}, to runtime.Object) error { + bs, err := json.Marshal(from) + if err != nil { + return fmt.Errorf("Marshal() = %w", err) + } + if err := json.Unmarshal(bs, to); err != nil { + return fmt.Errorf("Unmarshal() = %w", err) + } + return nil +} + +// AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client +func (w *wrapClient) AdmissionregistrationV1() typedadmissionregistrationv1.AdmissionregistrationV1Interface { + return &wrapAdmissionregistrationV1{ + dyn: w.dyn, + } +} + +type wrapAdmissionregistrationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAdmissionregistrationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAdmissionregistrationV1) MutatingWebhookConfigurations() typedadmissionregistrationv1.MutatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Resource: "mutatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *v1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*v1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.MutatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1.MutatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1.MutatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MutatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Update(ctx context.Context, in *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAdmissionregistrationV1) ValidatingWebhookConfigurations() typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Resource: "validatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *v1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*v1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ValidatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1.ValidatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1.ValidatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ValidatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Update(ctx context.Context, in *v1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *v1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AdmissionregistrationV1beta1 retrieves the AdmissionregistrationV1beta1Client +func (w *wrapClient) AdmissionregistrationV1beta1() typedadmissionregistrationv1beta1.AdmissionregistrationV1beta1Interface { + return &wrapAdmissionregistrationV1beta1{ + dyn: w.dyn, + } +} + +type wrapAdmissionregistrationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAdmissionregistrationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAdmissionregistrationV1beta1) MutatingWebhookConfigurations() typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Resource: "mutatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *v1beta1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*v1beta1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta1.MutatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1beta1.MutatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta1.MutatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta1.MutatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Update(ctx context.Context, in *v1beta1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1beta1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *v1beta1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1beta1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAdmissionregistrationV1beta1) ValidatingWebhookConfigurations() typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Resource: "validatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *v1beta1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*v1beta1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta1.ValidatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1beta1.ValidatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta1.ValidatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta1.ValidatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Update(ctx context.Context, in *v1beta1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1beta1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *v1beta1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1beta1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// InternalV1alpha1 retrieves the InternalV1alpha1Client +func (w *wrapClient) InternalV1alpha1() typedinternalv1alpha1.InternalV1alpha1Interface { + return &wrapInternalV1alpha1{ + dyn: w.dyn, + } +} + +type wrapInternalV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapInternalV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapInternalV1alpha1) StorageVersions() typedinternalv1alpha1.StorageVersionInterface { + return &wrapInternalV1alpha1StorageVersionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Resource: "storageversions", + }), + } +} + +type wrapInternalV1alpha1StorageVersionImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedinternalv1alpha1.StorageVersionInterface = (*wrapInternalV1alpha1StorageVersionImpl)(nil) + +func (w *wrapInternalV1alpha1StorageVersionImpl) Create(ctx context.Context, in *v1alpha1.StorageVersion, opts metav1.CreateOptions) (*v1alpha1.StorageVersion, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "StorageVersion", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1alpha1.StorageVersion, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1alpha1.StorageVersionList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.StorageVersionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1alpha1.StorageVersion, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Update(ctx context.Context, in *v1alpha1.StorageVersion, opts metav1.UpdateOptions) (*v1alpha1.StorageVersion, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "StorageVersion", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) UpdateStatus(ctx context.Context, in *v1alpha1.StorageVersion, opts metav1.UpdateOptions) (*v1alpha1.StorageVersion, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "StorageVersion", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AppsV1 retrieves the AppsV1Client +func (w *wrapClient) AppsV1() typedappsv1.AppsV1Interface { + return &wrapAppsV1{ + dyn: w.dyn, + } +} + +type wrapAppsV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAppsV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAppsV1) ControllerRevisions(namespace string) typedappsv1.ControllerRevisionInterface { + return &wrapAppsV1ControllerRevisionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "controllerrevisions", + }), + + namespace: namespace, + } +} + +type wrapAppsV1ControllerRevisionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.ControllerRevisionInterface = (*wrapAppsV1ControllerRevisionImpl)(nil) + +func (w *wrapAppsV1ControllerRevisionImpl) Create(ctx context.Context, in *appsv1.ControllerRevision, opts metav1.CreateOptions) (*appsv1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1.ControllerRevision, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1.ControllerRevisionList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1.ControllerRevisionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1.ControllerRevision, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Update(ctx context.Context, in *appsv1.ControllerRevision, opts metav1.UpdateOptions) (*appsv1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *appsv1.ControllerRevision, opts metav1.UpdateOptions) (*appsv1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1) DaemonSets(namespace string) typedappsv1.DaemonSetInterface { + return &wrapAppsV1DaemonSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "daemonsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1DaemonSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.DaemonSetInterface = (*wrapAppsV1DaemonSetImpl)(nil) + +func (w *wrapAppsV1DaemonSetImpl) Create(ctx context.Context, in *appsv1.DaemonSet, opts metav1.CreateOptions) (*appsv1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1.DaemonSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1.DaemonSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1.DaemonSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1.DaemonSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Update(ctx context.Context, in *appsv1.DaemonSet, opts metav1.UpdateOptions) (*appsv1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) UpdateStatus(ctx context.Context, in *appsv1.DaemonSet, opts metav1.UpdateOptions) (*appsv1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1) Deployments(namespace string) typedappsv1.DeploymentInterface { + return &wrapAppsV1DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapAppsV1DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.DeploymentInterface = (*wrapAppsV1DeploymentImpl)(nil) + +func (w *wrapAppsV1DeploymentImpl) Create(ctx context.Context, in *appsv1.Deployment, opts metav1.CreateOptions) (*appsv1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Update(ctx context.Context, in *appsv1.Deployment, opts metav1.UpdateOptions) (*appsv1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) UpdateStatus(ctx context.Context, in *appsv1.Deployment, opts metav1.UpdateOptions) (*appsv1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1DeploymentImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1DeploymentImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1) ReplicaSets(namespace string) typedappsv1.ReplicaSetInterface { + return &wrapAppsV1ReplicaSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "replicasets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1ReplicaSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.ReplicaSetInterface = (*wrapAppsV1ReplicaSetImpl)(nil) + +func (w *wrapAppsV1ReplicaSetImpl) Create(ctx context.Context, in *appsv1.ReplicaSet, opts metav1.CreateOptions) (*appsv1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1.ReplicaSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1.ReplicaSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1.ReplicaSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1.ReplicaSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Update(ctx context.Context, in *appsv1.ReplicaSet, opts metav1.UpdateOptions) (*appsv1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) UpdateStatus(ctx context.Context, in *appsv1.ReplicaSet, opts metav1.UpdateOptions) (*appsv1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1ReplicaSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1ReplicaSetImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1) StatefulSets(namespace string) typedappsv1.StatefulSetInterface { + return &wrapAppsV1StatefulSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "statefulsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1StatefulSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.StatefulSetInterface = (*wrapAppsV1StatefulSetImpl)(nil) + +func (w *wrapAppsV1StatefulSetImpl) Create(ctx context.Context, in *appsv1.StatefulSet, opts metav1.CreateOptions) (*appsv1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1.StatefulSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1.StatefulSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1.StatefulSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1.StatefulSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Update(ctx context.Context, in *appsv1.StatefulSet, opts metav1.UpdateOptions) (*appsv1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) UpdateStatus(ctx context.Context, in *appsv1.StatefulSet, opts metav1.UpdateOptions) (*appsv1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1StatefulSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1StatefulSetImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +// AppsV1beta1 retrieves the AppsV1beta1Client +func (w *wrapClient) AppsV1beta1() typedappsv1beta1.AppsV1beta1Interface { + return &wrapAppsV1beta1{ + dyn: w.dyn, + } +} + +type wrapAppsV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAppsV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAppsV1beta1) ControllerRevisions(namespace string) typedappsv1beta1.ControllerRevisionInterface { + return &wrapAppsV1beta1ControllerRevisionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta1", + Resource: "controllerrevisions", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta1ControllerRevisionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta1.ControllerRevisionInterface = (*wrapAppsV1beta1ControllerRevisionImpl)(nil) + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Create(ctx context.Context, in *appsv1beta1.ControllerRevision, opts metav1.CreateOptions) (*appsv1beta1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta1.ControllerRevision, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta1.ControllerRevisionList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.ControllerRevisionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta1.ControllerRevision, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Update(ctx context.Context, in *appsv1beta1.ControllerRevision, opts metav1.UpdateOptions) (*appsv1beta1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *appsv1beta1.ControllerRevision, opts metav1.UpdateOptions) (*appsv1beta1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta1) Deployments(namespace string) typedappsv1beta1.DeploymentInterface { + return &wrapAppsV1beta1DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta1", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta1DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta1.DeploymentInterface = (*wrapAppsV1beta1DeploymentImpl)(nil) + +func (w *wrapAppsV1beta1DeploymentImpl) Create(ctx context.Context, in *appsv1beta1.Deployment, opts metav1.CreateOptions) (*appsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta1.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta1.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta1.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Update(ctx context.Context, in *appsv1beta1.Deployment, opts metav1.UpdateOptions) (*appsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) UpdateStatus(ctx context.Context, in *appsv1beta1.Deployment, opts metav1.UpdateOptions) (*appsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta1) StatefulSets(namespace string) typedappsv1beta1.StatefulSetInterface { + return &wrapAppsV1beta1StatefulSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta1", + Resource: "statefulsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta1StatefulSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta1.StatefulSetInterface = (*wrapAppsV1beta1StatefulSetImpl)(nil) + +func (w *wrapAppsV1beta1StatefulSetImpl) Create(ctx context.Context, in *appsv1beta1.StatefulSet, opts metav1.CreateOptions) (*appsv1beta1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta1StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta1.StatefulSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta1.StatefulSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.StatefulSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta1.StatefulSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Update(ctx context.Context, in *appsv1beta1.StatefulSet, opts metav1.UpdateOptions) (*appsv1beta1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) UpdateStatus(ctx context.Context, in *appsv1beta1.StatefulSet, opts metav1.UpdateOptions) (*appsv1beta1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AppsV1beta2 retrieves the AppsV1beta2Client +func (w *wrapClient) AppsV1beta2() typedappsv1beta2.AppsV1beta2Interface { + return &wrapAppsV1beta2{ + dyn: w.dyn, + } +} + +type wrapAppsV1beta2 struct { + dyn dynamic.Interface +} + +func (w *wrapAppsV1beta2) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAppsV1beta2) ControllerRevisions(namespace string) typedappsv1beta2.ControllerRevisionInterface { + return &wrapAppsV1beta2ControllerRevisionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "controllerrevisions", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2ControllerRevisionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.ControllerRevisionInterface = (*wrapAppsV1beta2ControllerRevisionImpl)(nil) + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Create(ctx context.Context, in *v1beta2.ControllerRevision, opts metav1.CreateOptions) (*v1beta2.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta2.ControllerRevision, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1beta2.ControllerRevisionList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ControllerRevisionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta2.ControllerRevision, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Update(ctx context.Context, in *v1beta2.ControllerRevision, opts metav1.UpdateOptions) (*v1beta2.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *v1beta2.ControllerRevision, opts metav1.UpdateOptions) (*v1beta2.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) DaemonSets(namespace string) typedappsv1beta2.DaemonSetInterface { + return &wrapAppsV1beta2DaemonSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "daemonsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2DaemonSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.DaemonSetInterface = (*wrapAppsV1beta2DaemonSetImpl)(nil) + +func (w *wrapAppsV1beta2DaemonSetImpl) Create(ctx context.Context, in *v1beta2.DaemonSet, opts metav1.CreateOptions) (*v1beta2.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta2.DaemonSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1beta2.DaemonSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta2.DaemonSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta2.DaemonSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Update(ctx context.Context, in *v1beta2.DaemonSet, opts metav1.UpdateOptions) (*v1beta2.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) UpdateStatus(ctx context.Context, in *v1beta2.DaemonSet, opts metav1.UpdateOptions) (*v1beta2.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) Deployments(namespace string) typedappsv1beta2.DeploymentInterface { + return &wrapAppsV1beta2DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.DeploymentInterface = (*wrapAppsV1beta2DeploymentImpl)(nil) + +func (w *wrapAppsV1beta2DeploymentImpl) Create(ctx context.Context, in *v1beta2.Deployment, opts metav1.CreateOptions) (*v1beta2.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta2.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1beta2.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta2.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta2.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Update(ctx context.Context, in *v1beta2.Deployment, opts metav1.UpdateOptions) (*v1beta2.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) UpdateStatus(ctx context.Context, in *v1beta2.Deployment, opts metav1.UpdateOptions) (*v1beta2.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) ReplicaSets(namespace string) typedappsv1beta2.ReplicaSetInterface { + return &wrapAppsV1beta2ReplicaSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "replicasets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2ReplicaSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.ReplicaSetInterface = (*wrapAppsV1beta2ReplicaSetImpl)(nil) + +func (w *wrapAppsV1beta2ReplicaSetImpl) Create(ctx context.Context, in *v1beta2.ReplicaSet, opts metav1.CreateOptions) (*v1beta2.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta2.ReplicaSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1beta2.ReplicaSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ReplicaSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta2.ReplicaSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Update(ctx context.Context, in *v1beta2.ReplicaSet, opts metav1.UpdateOptions) (*v1beta2.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) UpdateStatus(ctx context.Context, in *v1beta2.ReplicaSet, opts metav1.UpdateOptions) (*v1beta2.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) StatefulSets(namespace string) typedappsv1beta2.StatefulSetInterface { + return &wrapAppsV1beta2StatefulSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "statefulsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2StatefulSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.StatefulSetInterface = (*wrapAppsV1beta2StatefulSetImpl)(nil) + +func (w *wrapAppsV1beta2StatefulSetImpl) Create(ctx context.Context, in *v1beta2.StatefulSet, opts metav1.CreateOptions) (*v1beta2.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta2.StatefulSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*v1beta2.StatefulSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1beta2.StatefulSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta2.StatefulSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Update(ctx context.Context, in *v1beta2.StatefulSet, opts metav1.UpdateOptions) (*v1beta2.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) UpdateStatus(ctx context.Context, in *v1beta2.StatefulSet, opts metav1.UpdateOptions) (*v1beta2.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2StatefulSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta2.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2StatefulSetImpl) UpdateScale(ctx context.Context, _ string, in *v1beta2.Scale, opts metav1.UpdateOptions) (*v1beta2.Scale, error) { + panic("NYI") +} + +// AuthenticationV1 retrieves the AuthenticationV1Client +func (w *wrapClient) AuthenticationV1() typedauthenticationv1.AuthenticationV1Interface { + return &wrapAuthenticationV1{ + dyn: w.dyn, + } +} + +type wrapAuthenticationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthenticationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthenticationV1) TokenReviews() typedauthenticationv1.TokenReviewInterface { + return &wrapAuthenticationV1TokenReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authentication.k8s.io", + Version: "v1", + Resource: "tokenreviews", + }), + } +} + +type wrapAuthenticationV1TokenReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthenticationv1.TokenReviewInterface = (*wrapAuthenticationV1TokenReviewImpl)(nil) + +func (w *wrapAuthenticationV1TokenReviewImpl) Create(ctx context.Context, in *authenticationv1.TokenReview, opts metav1.CreateOptions) (*authenticationv1.TokenReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authentication.k8s.io", + Version: "v1", + Kind: "TokenReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authenticationv1.TokenReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AuthenticationV1beta1 retrieves the AuthenticationV1beta1Client +func (w *wrapClient) AuthenticationV1beta1() typedauthenticationv1beta1.AuthenticationV1beta1Interface { + return &wrapAuthenticationV1beta1{ + dyn: w.dyn, + } +} + +type wrapAuthenticationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthenticationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthenticationV1beta1) TokenReviews() typedauthenticationv1beta1.TokenReviewInterface { + return &wrapAuthenticationV1beta1TokenReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authentication.k8s.io", + Version: "v1beta1", + Resource: "tokenreviews", + }), + } +} + +type wrapAuthenticationV1beta1TokenReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthenticationv1beta1.TokenReviewInterface = (*wrapAuthenticationV1beta1TokenReviewImpl)(nil) + +func (w *wrapAuthenticationV1beta1TokenReviewImpl) Create(ctx context.Context, in *authenticationv1beta1.TokenReview, opts metav1.CreateOptions) (*authenticationv1beta1.TokenReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authentication.k8s.io", + Version: "v1beta1", + Kind: "TokenReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authenticationv1beta1.TokenReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (w *wrapClient) AuthorizationV1() typedauthorizationv1.AuthorizationV1Interface { + return &wrapAuthorizationV1{ + dyn: w.dyn, + } +} + +type wrapAuthorizationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthorizationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthorizationV1) LocalSubjectAccessReviews(namespace string) typedauthorizationv1.LocalSubjectAccessReviewInterface { + return &wrapAuthorizationV1LocalSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "localsubjectaccessreviews", + }), + + namespace: namespace, + } +} + +type wrapAuthorizationV1LocalSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedauthorizationv1.LocalSubjectAccessReviewInterface = (*wrapAuthorizationV1LocalSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1LocalSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.LocalSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.LocalSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "LocalSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.LocalSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1) SelfSubjectAccessReviews() typedauthorizationv1.SelfSubjectAccessReviewInterface { + return &wrapAuthorizationV1SelfSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "selfsubjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1SelfSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1.SelfSubjectAccessReviewInterface = (*wrapAuthorizationV1SelfSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1SelfSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.SelfSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.SelfSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "SelfSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.SelfSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1) SelfSubjectRulesReviews() typedauthorizationv1.SelfSubjectRulesReviewInterface { + return &wrapAuthorizationV1SelfSubjectRulesReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "selfsubjectrulesreviews", + }), + } +} + +type wrapAuthorizationV1SelfSubjectRulesReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1.SelfSubjectRulesReviewInterface = (*wrapAuthorizationV1SelfSubjectRulesReviewImpl)(nil) + +func (w *wrapAuthorizationV1SelfSubjectRulesReviewImpl) Create(ctx context.Context, in *authorizationv1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*authorizationv1.SelfSubjectRulesReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "SelfSubjectRulesReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.SelfSubjectRulesReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1) SubjectAccessReviews() typedauthorizationv1.SubjectAccessReviewInterface { + return &wrapAuthorizationV1SubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "subjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1SubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1.SubjectAccessReviewInterface = (*wrapAuthorizationV1SubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1SubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.SubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.SubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "SubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.SubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AuthorizationV1beta1 retrieves the AuthorizationV1beta1Client +func (w *wrapClient) AuthorizationV1beta1() typedauthorizationv1beta1.AuthorizationV1beta1Interface { + return &wrapAuthorizationV1beta1{ + dyn: w.dyn, + } +} + +type wrapAuthorizationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthorizationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthorizationV1beta1) LocalSubjectAccessReviews(namespace string) typedauthorizationv1beta1.LocalSubjectAccessReviewInterface { + return &wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "localsubjectaccessreviews", + }), + + namespace: namespace, + } +} + +type wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedauthorizationv1beta1.LocalSubjectAccessReviewInterface = (*wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.LocalSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.LocalSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "LocalSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.LocalSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1beta1) SelfSubjectAccessReviews() typedauthorizationv1beta1.SelfSubjectAccessReviewInterface { + return &wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "selfsubjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1beta1.SelfSubjectAccessReviewInterface = (*wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SelfSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.SelfSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "SelfSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.SelfSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1beta1) SelfSubjectRulesReviews() typedauthorizationv1beta1.SelfSubjectRulesReviewInterface { + return &wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "selfsubjectrulesreviews", + }), + } +} + +type wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1beta1.SelfSubjectRulesReviewInterface = (*wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*authorizationv1beta1.SelfSubjectRulesReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "SelfSubjectRulesReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.SelfSubjectRulesReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1beta1) SubjectAccessReviews() typedauthorizationv1beta1.SubjectAccessReviewInterface { + return &wrapAuthorizationV1beta1SubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "subjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1beta1SubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1beta1.SubjectAccessReviewInterface = (*wrapAuthorizationV1beta1SubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1SubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.SubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "SubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.SubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AutoscalingV1 retrieves the AutoscalingV1Client +func (w *wrapClient) AutoscalingV1() typedautoscalingv1.AutoscalingV1Interface { + return &wrapAutoscalingV1{ + dyn: w.dyn, + } +} + +type wrapAutoscalingV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAutoscalingV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAutoscalingV1) HorizontalPodAutoscalers(namespace string) typedautoscalingv1.HorizontalPodAutoscalerInterface { + return &wrapAutoscalingV1HorizontalPodAutoscalerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "autoscaling", + Version: "v1", + Resource: "horizontalpodautoscalers", + }), + + namespace: namespace, + } +} + +type wrapAutoscalingV1HorizontalPodAutoscalerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedautoscalingv1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV1HorizontalPodAutoscalerImpl)(nil) + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv1.HorizontalPodAutoscalerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscalerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client +func (w *wrapClient) AutoscalingV2beta1() typedautoscalingv2beta1.AutoscalingV2beta1Interface { + return &wrapAutoscalingV2beta1{ + dyn: w.dyn, + } +} + +type wrapAutoscalingV2beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAutoscalingV2beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) typedautoscalingv2beta1.HorizontalPodAutoscalerInterface { + return &wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "autoscaling", + Version: "v2beta1", + Resource: "horizontalpodautoscalers", + }), + + namespace: namespace, + } +} + +type wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedautoscalingv2beta1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl)(nil) + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *v2beta1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*v2beta1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v2beta1.HorizontalPodAutoscaler, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*v2beta1.HorizontalPodAutoscalerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v2beta1.HorizontalPodAutoscalerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v2beta1.HorizontalPodAutoscaler, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *v2beta1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*v2beta1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *v2beta1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*v2beta1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client +func (w *wrapClient) AutoscalingV2beta2() typedautoscalingv2beta2.AutoscalingV2beta2Interface { + return &wrapAutoscalingV2beta2{ + dyn: w.dyn, + } +} + +type wrapAutoscalingV2beta2 struct { + dyn dynamic.Interface +} + +func (w *wrapAutoscalingV2beta2) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAutoscalingV2beta2) HorizontalPodAutoscalers(namespace string) typedautoscalingv2beta2.HorizontalPodAutoscalerInterface { + return &wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "autoscaling", + Version: "v2beta2", + Resource: "horizontalpodautoscalers", + }), + + namespace: namespace, + } +} + +type wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedautoscalingv2beta2.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl)(nil) + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *v2beta2.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*v2beta2.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta2", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v2beta2.HorizontalPodAutoscaler, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*v2beta2.HorizontalPodAutoscalerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v2beta2.HorizontalPodAutoscalerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v2beta2.HorizontalPodAutoscaler, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *v2beta2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*v2beta2.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta2", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *v2beta2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*v2beta2.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta2", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// BatchV1 retrieves the BatchV1Client +func (w *wrapClient) BatchV1() typedbatchv1.BatchV1Interface { + return &wrapBatchV1{ + dyn: w.dyn, + } +} + +type wrapBatchV1 struct { + dyn dynamic.Interface +} + +func (w *wrapBatchV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapBatchV1) Jobs(namespace string) typedbatchv1.JobInterface { + return &wrapBatchV1JobImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "batch", + Version: "v1", + Resource: "jobs", + }), + + namespace: namespace, + } +} + +type wrapBatchV1JobImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedbatchv1.JobInterface = (*wrapBatchV1JobImpl)(nil) + +func (w *wrapBatchV1JobImpl) Create(ctx context.Context, in *batchv1.Job, opts metav1.CreateOptions) (*batchv1.Job, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "Job", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &batchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapBatchV1JobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapBatchV1JobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*batchv1.Job, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &batchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) List(ctx context.Context, opts metav1.ListOptions) (*batchv1.JobList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &batchv1.JobList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *batchv1.Job, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &batchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Update(ctx context.Context, in *batchv1.Job, opts metav1.UpdateOptions) (*batchv1.Job, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "Job", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &batchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) UpdateStatus(ctx context.Context, in *batchv1.Job, opts metav1.UpdateOptions) (*batchv1.Job, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "Job", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &batchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// BatchV1beta1 retrieves the BatchV1beta1Client +func (w *wrapClient) BatchV1beta1() typedbatchv1beta1.BatchV1beta1Interface { + return &wrapBatchV1beta1{ + dyn: w.dyn, + } +} + +type wrapBatchV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapBatchV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapBatchV1beta1) CronJobs(namespace string) typedbatchv1beta1.CronJobInterface { + return &wrapBatchV1beta1CronJobImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "batch", + Version: "v1beta1", + Resource: "cronjobs", + }), + + namespace: namespace, + } +} + +type wrapBatchV1beta1CronJobImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedbatchv1beta1.CronJobInterface = (*wrapBatchV1beta1CronJobImpl)(nil) + +func (w *wrapBatchV1beta1CronJobImpl) Create(ctx context.Context, in *batchv1beta1.CronJob, opts metav1.CreateOptions) (*batchv1beta1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1beta1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &batchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapBatchV1beta1CronJobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapBatchV1beta1CronJobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*batchv1beta1.CronJob, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &batchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) List(ctx context.Context, opts metav1.ListOptions) (*batchv1beta1.CronJobList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &batchv1beta1.CronJobList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *batchv1beta1.CronJob, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &batchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Update(ctx context.Context, in *batchv1beta1.CronJob, opts metav1.UpdateOptions) (*batchv1beta1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1beta1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &batchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) UpdateStatus(ctx context.Context, in *batchv1beta1.CronJob, opts metav1.UpdateOptions) (*batchv1beta1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1beta1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &batchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// BatchV2alpha1 retrieves the BatchV2alpha1Client +func (w *wrapClient) BatchV2alpha1() typedbatchv2alpha1.BatchV2alpha1Interface { + return &wrapBatchV2alpha1{ + dyn: w.dyn, + } +} + +type wrapBatchV2alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapBatchV2alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapBatchV2alpha1) CronJobs(namespace string) typedbatchv2alpha1.CronJobInterface { + return &wrapBatchV2alpha1CronJobImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "batch", + Version: "v2alpha1", + Resource: "cronjobs", + }), + + namespace: namespace, + } +} + +type wrapBatchV2alpha1CronJobImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedbatchv2alpha1.CronJobInterface = (*wrapBatchV2alpha1CronJobImpl)(nil) + +func (w *wrapBatchV2alpha1CronJobImpl) Create(ctx context.Context, in *v2alpha1.CronJob, opts metav1.CreateOptions) (*v2alpha1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v2alpha1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2alpha1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV2alpha1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapBatchV2alpha1CronJobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapBatchV2alpha1CronJobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v2alpha1.CronJob, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v2alpha1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV2alpha1CronJobImpl) List(ctx context.Context, opts metav1.ListOptions) (*v2alpha1.CronJobList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v2alpha1.CronJobList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV2alpha1CronJobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v2alpha1.CronJob, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v2alpha1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV2alpha1CronJobImpl) Update(ctx context.Context, in *v2alpha1.CronJob, opts metav1.UpdateOptions) (*v2alpha1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v2alpha1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2alpha1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV2alpha1CronJobImpl) UpdateStatus(ctx context.Context, in *v2alpha1.CronJob, opts metav1.UpdateOptions) (*v2alpha1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v2alpha1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v2alpha1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV2alpha1CronJobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CertificatesV1 retrieves the CertificatesV1Client +func (w *wrapClient) CertificatesV1() typedcertificatesv1.CertificatesV1Interface { + return &wrapCertificatesV1{ + dyn: w.dyn, + } +} + +type wrapCertificatesV1 struct { + dyn dynamic.Interface +} + +func (w *wrapCertificatesV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCertificatesV1) CertificateSigningRequests() typedcertificatesv1.CertificateSigningRequestInterface { + return &wrapCertificatesV1CertificateSigningRequestImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "certificates.k8s.io", + Version: "v1", + Resource: "certificatesigningrequests", + }), + } +} + +type wrapCertificatesV1CertificateSigningRequestImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcertificatesv1.CertificateSigningRequestInterface = (*wrapCertificatesV1CertificateSigningRequestImpl)(nil) + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Create(ctx context.Context, in *certificatesv1.CertificateSigningRequest, opts metav1.CreateOptions) (*certificatesv1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &certificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*certificatesv1.CertificateSigningRequest, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &certificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) List(ctx context.Context, opts metav1.ListOptions) (*certificatesv1.CertificateSigningRequestList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &certificatesv1.CertificateSigningRequestList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *certificatesv1.CertificateSigningRequest, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &certificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Update(ctx context.Context, in *certificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*certificatesv1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &certificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) UpdateStatus(ctx context.Context, in *certificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*certificatesv1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &certificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) UpdateApproval(ctx context.Context, _ string, in *certificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*certificatesv1.CertificateSigningRequest, error) { + panic("NYI") +} + +// CertificatesV1beta1 retrieves the CertificatesV1beta1Client +func (w *wrapClient) CertificatesV1beta1() typedcertificatesv1beta1.CertificatesV1beta1Interface { + return &wrapCertificatesV1beta1{ + dyn: w.dyn, + } +} + +type wrapCertificatesV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapCertificatesV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCertificatesV1beta1) CertificateSigningRequests() typedcertificatesv1beta1.CertificateSigningRequestInterface { + return &wrapCertificatesV1beta1CertificateSigningRequestImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Resource: "certificatesigningrequests", + }), + } +} + +type wrapCertificatesV1beta1CertificateSigningRequestImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcertificatesv1beta1.CertificateSigningRequestInterface = (*wrapCertificatesV1beta1CertificateSigningRequestImpl)(nil) + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Create(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequest, opts metav1.CreateOptions) (*certificatesv1beta1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &certificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*certificatesv1beta1.CertificateSigningRequest, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &certificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) List(ctx context.Context, opts metav1.ListOptions) (*certificatesv1beta1.CertificateSigningRequestList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &certificatesv1beta1.CertificateSigningRequestList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *certificatesv1beta1.CertificateSigningRequest, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &certificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Update(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequest, opts metav1.UpdateOptions) (*certificatesv1beta1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &certificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) UpdateStatus(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequest, opts metav1.UpdateOptions) (*certificatesv1beta1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &certificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CoordinationV1 retrieves the CoordinationV1Client +func (w *wrapClient) CoordinationV1() typedcoordinationv1.CoordinationV1Interface { + return &wrapCoordinationV1{ + dyn: w.dyn, + } +} + +type wrapCoordinationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapCoordinationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCoordinationV1) Leases(namespace string) typedcoordinationv1.LeaseInterface { + return &wrapCoordinationV1LeaseImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "coordination.k8s.io", + Version: "v1", + Resource: "leases", + }), + + namespace: namespace, + } +} + +type wrapCoordinationV1LeaseImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcoordinationv1.LeaseInterface = (*wrapCoordinationV1LeaseImpl)(nil) + +func (w *wrapCoordinationV1LeaseImpl) Create(ctx context.Context, in *coordinationv1.Lease, opts metav1.CreateOptions) (*coordinationv1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &coordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoordinationV1LeaseImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoordinationV1LeaseImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*coordinationv1.Lease, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &coordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) List(ctx context.Context, opts metav1.ListOptions) (*coordinationv1.LeaseList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &coordinationv1.LeaseList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *coordinationv1.Lease, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &coordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Update(ctx context.Context, in *coordinationv1.Lease, opts metav1.UpdateOptions) (*coordinationv1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &coordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) UpdateStatus(ctx context.Context, in *coordinationv1.Lease, opts metav1.UpdateOptions) (*coordinationv1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &coordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CoordinationV1beta1 retrieves the CoordinationV1beta1Client +func (w *wrapClient) CoordinationV1beta1() typedcoordinationv1beta1.CoordinationV1beta1Interface { + return &wrapCoordinationV1beta1{ + dyn: w.dyn, + } +} + +type wrapCoordinationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapCoordinationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCoordinationV1beta1) Leases(namespace string) typedcoordinationv1beta1.LeaseInterface { + return &wrapCoordinationV1beta1LeaseImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Resource: "leases", + }), + + namespace: namespace, + } +} + +type wrapCoordinationV1beta1LeaseImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcoordinationv1beta1.LeaseInterface = (*wrapCoordinationV1beta1LeaseImpl)(nil) + +func (w *wrapCoordinationV1beta1LeaseImpl) Create(ctx context.Context, in *coordinationv1beta1.Lease, opts metav1.CreateOptions) (*coordinationv1beta1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &coordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoordinationV1beta1LeaseImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*coordinationv1beta1.Lease, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &coordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) List(ctx context.Context, opts metav1.ListOptions) (*coordinationv1beta1.LeaseList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &coordinationv1beta1.LeaseList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *coordinationv1beta1.Lease, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &coordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Update(ctx context.Context, in *coordinationv1beta1.Lease, opts metav1.UpdateOptions) (*coordinationv1beta1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &coordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) UpdateStatus(ctx context.Context, in *coordinationv1beta1.Lease, opts metav1.UpdateOptions) (*coordinationv1beta1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &coordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CoreV1 retrieves the CoreV1Client +func (w *wrapClient) CoreV1() typedcorev1.CoreV1Interface { + return &wrapCoreV1{ + dyn: w.dyn, + } +} + +type wrapCoreV1 struct { + dyn dynamic.Interface +} + +func (w *wrapCoreV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCoreV1) ComponentStatuses() typedcorev1.ComponentStatusInterface { + return &wrapCoreV1ComponentStatusImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "componentstatuses", + }), + } +} + +type wrapCoreV1ComponentStatusImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.ComponentStatusInterface = (*wrapCoreV1ComponentStatusImpl)(nil) + +func (w *wrapCoreV1ComponentStatusImpl) Create(ctx context.Context, in *corev1.ComponentStatus, opts metav1.CreateOptions) (*corev1.ComponentStatus, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ComponentStatus", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ComponentStatusImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ComponentStatusImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ComponentStatus, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.ComponentStatusList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.ComponentStatusList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.ComponentStatus, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Update(ctx context.Context, in *corev1.ComponentStatus, opts metav1.UpdateOptions) (*corev1.ComponentStatus, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ComponentStatus", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) UpdateStatus(ctx context.Context, in *corev1.ComponentStatus, opts metav1.UpdateOptions) (*corev1.ComponentStatus, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ComponentStatus", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) ConfigMaps(namespace string) typedcorev1.ConfigMapInterface { + return &wrapCoreV1ConfigMapImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "configmaps", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ConfigMapImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ConfigMapInterface = (*wrapCoreV1ConfigMapImpl)(nil) + +func (w *wrapCoreV1ConfigMapImpl) Create(ctx context.Context, in *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ConfigMap", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ConfigMapImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ConfigMapImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ConfigMap, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.ConfigMapList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.ConfigMapList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.ConfigMap, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Update(ctx context.Context, in *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ConfigMap", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) UpdateStatus(ctx context.Context, in *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ConfigMap", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Endpoints(namespace string) typedcorev1.EndpointsInterface { + return &wrapCoreV1EndpointsImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "endpoints", + }), + + namespace: namespace, + } +} + +type wrapCoreV1EndpointsImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.EndpointsInterface = (*wrapCoreV1EndpointsImpl)(nil) + +func (w *wrapCoreV1EndpointsImpl) Create(ctx context.Context, in *corev1.Endpoints, opts metav1.CreateOptions) (*corev1.Endpoints, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Endpoints", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1EndpointsImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1EndpointsImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Endpoints, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.EndpointsList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.EndpointsList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Endpoints, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Update(ctx context.Context, in *corev1.Endpoints, opts metav1.UpdateOptions) (*corev1.Endpoints, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Endpoints", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) UpdateStatus(ctx context.Context, in *corev1.Endpoints, opts metav1.UpdateOptions) (*corev1.Endpoints, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Endpoints", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Events(namespace string) typedcorev1.EventInterface { + return &wrapCoreV1EventImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "events", + }), + + namespace: namespace, + } +} + +type wrapCoreV1EventImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.EventInterface = (*wrapCoreV1EventImpl)(nil) + +func (w *wrapCoreV1EventImpl) Create(ctx context.Context, in *corev1.Event, opts metav1.CreateOptions) (*corev1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Event, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.EventList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.EventList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Event, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Update(ctx context.Context, in *corev1.Event, opts metav1.UpdateOptions) (*corev1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) UpdateStatus(ctx context.Context, in *corev1.Event, opts metav1.UpdateOptions) (*corev1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) LimitRanges(namespace string) typedcorev1.LimitRangeInterface { + return &wrapCoreV1LimitRangeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "limitranges", + }), + + namespace: namespace, + } +} + +type wrapCoreV1LimitRangeImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.LimitRangeInterface = (*wrapCoreV1LimitRangeImpl)(nil) + +func (w *wrapCoreV1LimitRangeImpl) Create(ctx context.Context, in *corev1.LimitRange, opts metav1.CreateOptions) (*corev1.LimitRange, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "LimitRange", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1LimitRangeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1LimitRangeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.LimitRange, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.LimitRangeList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.LimitRangeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.LimitRange, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Update(ctx context.Context, in *corev1.LimitRange, opts metav1.UpdateOptions) (*corev1.LimitRange, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "LimitRange", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) UpdateStatus(ctx context.Context, in *corev1.LimitRange, opts metav1.UpdateOptions) (*corev1.LimitRange, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "LimitRange", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Namespaces() typedcorev1.NamespaceInterface { + return &wrapCoreV1NamespaceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "namespaces", + }), + } +} + +type wrapCoreV1NamespaceImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.NamespaceInterface = (*wrapCoreV1NamespaceImpl)(nil) + +func (w *wrapCoreV1NamespaceImpl) Create(ctx context.Context, in *corev1.Namespace, opts metav1.CreateOptions) (*corev1.Namespace, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Namespace", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1NamespaceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Namespace, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.NamespaceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Namespace, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Update(ctx context.Context, in *corev1.Namespace, opts metav1.UpdateOptions) (*corev1.Namespace, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Namespace", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) UpdateStatus(ctx context.Context, in *corev1.Namespace, opts metav1.UpdateOptions) (*corev1.Namespace, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Namespace", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Nodes() typedcorev1.NodeInterface { + return &wrapCoreV1NodeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "nodes", + }), + } +} + +type wrapCoreV1NodeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.NodeInterface = (*wrapCoreV1NodeImpl)(nil) + +func (w *wrapCoreV1NodeImpl) Create(ctx context.Context, in *corev1.Node, opts metav1.CreateOptions) (*corev1.Node, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Node", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1NodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1NodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Node, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.NodeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.NodeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Node, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Update(ctx context.Context, in *corev1.Node, opts metav1.UpdateOptions) (*corev1.Node, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Node", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) UpdateStatus(ctx context.Context, in *corev1.Node, opts metav1.UpdateOptions) (*corev1.Node, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Node", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) PersistentVolumes() typedcorev1.PersistentVolumeInterface { + return &wrapCoreV1PersistentVolumeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "persistentvolumes", + }), + } +} + +type wrapCoreV1PersistentVolumeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.PersistentVolumeInterface = (*wrapCoreV1PersistentVolumeImpl)(nil) + +func (w *wrapCoreV1PersistentVolumeImpl) Create(ctx context.Context, in *corev1.PersistentVolume, opts metav1.CreateOptions) (*corev1.PersistentVolume, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolume", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PersistentVolumeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PersistentVolumeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.PersistentVolume, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.PersistentVolumeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolumeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.PersistentVolume, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Update(ctx context.Context, in *corev1.PersistentVolume, opts metav1.UpdateOptions) (*corev1.PersistentVolume, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolume", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) UpdateStatus(ctx context.Context, in *corev1.PersistentVolume, opts metav1.UpdateOptions) (*corev1.PersistentVolume, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolume", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) PersistentVolumeClaims(namespace string) typedcorev1.PersistentVolumeClaimInterface { + return &wrapCoreV1PersistentVolumeClaimImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "persistentvolumeclaims", + }), + + namespace: namespace, + } +} + +type wrapCoreV1PersistentVolumeClaimImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.PersistentVolumeClaimInterface = (*wrapCoreV1PersistentVolumeClaimImpl)(nil) + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Create(ctx context.Context, in *corev1.PersistentVolumeClaim, opts metav1.CreateOptions) (*corev1.PersistentVolumeClaim, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolumeClaim", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.PersistentVolumeClaim, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.PersistentVolumeClaimList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolumeClaimList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.PersistentVolumeClaim, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Update(ctx context.Context, in *corev1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*corev1.PersistentVolumeClaim, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolumeClaim", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) UpdateStatus(ctx context.Context, in *corev1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*corev1.PersistentVolumeClaim, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolumeClaim", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Pods(namespace string) typedcorev1.PodInterface { + return &wrapCoreV1PodImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "pods", + }), + + namespace: namespace, + } +} + +type wrapCoreV1PodImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.PodInterface = (*wrapCoreV1PodImpl)(nil) + +func (w *wrapCoreV1PodImpl) Create(ctx context.Context, in *corev1.Pod, opts metav1.CreateOptions) (*corev1.Pod, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Pod", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PodImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PodImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Pod, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.PodList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.PodList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Pod, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Update(ctx context.Context, in *corev1.Pod, opts metav1.UpdateOptions) (*corev1.Pod, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Pod", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) UpdateStatus(ctx context.Context, in *corev1.Pod, opts metav1.UpdateOptions) (*corev1.Pod, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Pod", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1PodImpl) GetEphemeralContainers(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.EphemeralContainers, error) { + panic("NYI") +} + +func (w *wrapCoreV1PodImpl) UpdateEphemeralContainers(ctx context.Context, _ string, in *corev1.EphemeralContainers, opts metav1.UpdateOptions) (*corev1.EphemeralContainers, error) { + panic("NYI") +} + +func (w *wrapCoreV1) PodTemplates(namespace string) typedcorev1.PodTemplateInterface { + return &wrapCoreV1PodTemplateImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "podtemplates", + }), + + namespace: namespace, + } +} + +type wrapCoreV1PodTemplateImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.PodTemplateInterface = (*wrapCoreV1PodTemplateImpl)(nil) + +func (w *wrapCoreV1PodTemplateImpl) Create(ctx context.Context, in *corev1.PodTemplate, opts metav1.CreateOptions) (*corev1.PodTemplate, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PodTemplate", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PodTemplateImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PodTemplateImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.PodTemplate, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.PodTemplateList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.PodTemplateList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.PodTemplate, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Update(ctx context.Context, in *corev1.PodTemplate, opts metav1.UpdateOptions) (*corev1.PodTemplate, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PodTemplate", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) UpdateStatus(ctx context.Context, in *corev1.PodTemplate, opts metav1.UpdateOptions) (*corev1.PodTemplate, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PodTemplate", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) ReplicationControllers(namespace string) typedcorev1.ReplicationControllerInterface { + return &wrapCoreV1ReplicationControllerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "replicationcontrollers", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ReplicationControllerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ReplicationControllerInterface = (*wrapCoreV1ReplicationControllerImpl)(nil) + +func (w *wrapCoreV1ReplicationControllerImpl) Create(ctx context.Context, in *corev1.ReplicationController, opts metav1.CreateOptions) (*corev1.ReplicationController, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ReplicationController", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ReplicationControllerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ReplicationControllerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ReplicationController, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.ReplicationControllerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.ReplicationControllerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.ReplicationController, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Update(ctx context.Context, in *corev1.ReplicationController, opts metav1.UpdateOptions) (*corev1.ReplicationController, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ReplicationController", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) UpdateStatus(ctx context.Context, in *corev1.ReplicationController, opts metav1.UpdateOptions) (*corev1.ReplicationController, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ReplicationController", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1ReplicationControllerImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapCoreV1ReplicationControllerImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapCoreV1) ResourceQuotas(namespace string) typedcorev1.ResourceQuotaInterface { + return &wrapCoreV1ResourceQuotaImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "resourcequotas", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ResourceQuotaImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ResourceQuotaInterface = (*wrapCoreV1ResourceQuotaImpl)(nil) + +func (w *wrapCoreV1ResourceQuotaImpl) Create(ctx context.Context, in *corev1.ResourceQuota, opts metav1.CreateOptions) (*corev1.ResourceQuota, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ResourceQuota", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ResourceQuotaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ResourceQuotaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ResourceQuota, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.ResourceQuotaList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.ResourceQuotaList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.ResourceQuota, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Update(ctx context.Context, in *corev1.ResourceQuota, opts metav1.UpdateOptions) (*corev1.ResourceQuota, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ResourceQuota", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) UpdateStatus(ctx context.Context, in *corev1.ResourceQuota, opts metav1.UpdateOptions) (*corev1.ResourceQuota, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ResourceQuota", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Secrets(namespace string) typedcorev1.SecretInterface { + return &wrapCoreV1SecretImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "secrets", + }), + + namespace: namespace, + } +} + +type wrapCoreV1SecretImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.SecretInterface = (*wrapCoreV1SecretImpl)(nil) + +func (w *wrapCoreV1SecretImpl) Create(ctx context.Context, in *corev1.Secret, opts metav1.CreateOptions) (*corev1.Secret, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Secret", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1SecretImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1SecretImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Secret, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.SecretList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.SecretList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Secret, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Update(ctx context.Context, in *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Secret", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) UpdateStatus(ctx context.Context, in *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Secret", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Services(namespace string) typedcorev1.ServiceInterface { + return &wrapCoreV1ServiceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "services", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ServiceImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ServiceInterface = (*wrapCoreV1ServiceImpl)(nil) + +func (w *wrapCoreV1ServiceImpl) Create(ctx context.Context, in *corev1.Service, opts metav1.CreateOptions) (*corev1.Service, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ServiceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Service, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.ServiceList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.ServiceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.Service, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Update(ctx context.Context, in *corev1.Service, opts metav1.UpdateOptions) (*corev1.Service, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) UpdateStatus(ctx context.Context, in *corev1.Service, opts metav1.UpdateOptions) (*corev1.Service, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) ServiceAccounts(namespace string) typedcorev1.ServiceAccountInterface { + return &wrapCoreV1ServiceAccountImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "serviceaccounts", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ServiceAccountImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ServiceAccountInterface = (*wrapCoreV1ServiceAccountImpl)(nil) + +func (w *wrapCoreV1ServiceAccountImpl) Create(ctx context.Context, in *corev1.ServiceAccount, opts metav1.CreateOptions) (*corev1.ServiceAccount, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ServiceAccount", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ServiceAccountImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ServiceAccountImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ServiceAccount, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &corev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) List(ctx context.Context, opts metav1.ListOptions) (*corev1.ServiceAccountList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &corev1.ServiceAccountList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *corev1.ServiceAccount, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &corev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Update(ctx context.Context, in *corev1.ServiceAccount, opts metav1.UpdateOptions) (*corev1.ServiceAccount, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ServiceAccount", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) UpdateStatus(ctx context.Context, in *corev1.ServiceAccount, opts metav1.UpdateOptions) (*corev1.ServiceAccount, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ServiceAccount", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &corev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1ServiceAccountImpl) CreateToken(ctx context.Context, _ string, in *authenticationv1.TokenRequest, opts metav1.CreateOptions) (*authenticationv1.TokenRequest, error) { + panic("NYI") +} + +// DiscoveryV1alpha1 retrieves the DiscoveryV1alpha1Client +func (w *wrapClient) DiscoveryV1alpha1() typeddiscoveryv1alpha1.DiscoveryV1alpha1Interface { + return &wrapDiscoveryV1alpha1{ + dyn: w.dyn, + } +} + +type wrapDiscoveryV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapDiscoveryV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapDiscoveryV1alpha1) EndpointSlices(namespace string) typeddiscoveryv1alpha1.EndpointSliceInterface { + return &wrapDiscoveryV1alpha1EndpointSliceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "discovery.k8s.io", + Version: "v1alpha1", + Resource: "endpointslices", + }), + + namespace: namespace, + } +} + +type wrapDiscoveryV1alpha1EndpointSliceImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typeddiscoveryv1alpha1.EndpointSliceInterface = (*wrapDiscoveryV1alpha1EndpointSliceImpl)(nil) + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) Create(ctx context.Context, in *discoveryv1alpha1.EndpointSlice, opts metav1.CreateOptions) (*discoveryv1alpha1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1alpha1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &discoveryv1alpha1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*discoveryv1alpha1.EndpointSlice, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &discoveryv1alpha1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) List(ctx context.Context, opts metav1.ListOptions) (*discoveryv1alpha1.EndpointSliceList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &discoveryv1alpha1.EndpointSliceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *discoveryv1alpha1.EndpointSlice, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &discoveryv1alpha1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) Update(ctx context.Context, in *discoveryv1alpha1.EndpointSlice, opts metav1.UpdateOptions) (*discoveryv1alpha1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1alpha1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &discoveryv1alpha1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) UpdateStatus(ctx context.Context, in *discoveryv1alpha1.EndpointSlice, opts metav1.UpdateOptions) (*discoveryv1alpha1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1alpha1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &discoveryv1alpha1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1alpha1EndpointSliceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client +func (w *wrapClient) DiscoveryV1beta1() typeddiscoveryv1beta1.DiscoveryV1beta1Interface { + return &wrapDiscoveryV1beta1{ + dyn: w.dyn, + } +} + +type wrapDiscoveryV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapDiscoveryV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapDiscoveryV1beta1) EndpointSlices(namespace string) typeddiscoveryv1beta1.EndpointSliceInterface { + return &wrapDiscoveryV1beta1EndpointSliceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Resource: "endpointslices", + }), + + namespace: namespace, + } +} + +type wrapDiscoveryV1beta1EndpointSliceImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typeddiscoveryv1beta1.EndpointSliceInterface = (*wrapDiscoveryV1beta1EndpointSliceImpl)(nil) + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Create(ctx context.Context, in *discoveryv1beta1.EndpointSlice, opts metav1.CreateOptions) (*discoveryv1beta1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &discoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*discoveryv1beta1.EndpointSlice, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &discoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) List(ctx context.Context, opts metav1.ListOptions) (*discoveryv1beta1.EndpointSliceList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &discoveryv1beta1.EndpointSliceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *discoveryv1beta1.EndpointSlice, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &discoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Update(ctx context.Context, in *discoveryv1beta1.EndpointSlice, opts metav1.UpdateOptions) (*discoveryv1beta1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &discoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) UpdateStatus(ctx context.Context, in *discoveryv1beta1.EndpointSlice, opts metav1.UpdateOptions) (*discoveryv1beta1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &discoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// EventsV1 retrieves the EventsV1Client +func (w *wrapClient) EventsV1() typedeventsv1.EventsV1Interface { + return &wrapEventsV1{ + dyn: w.dyn, + } +} + +type wrapEventsV1 struct { + dyn dynamic.Interface +} + +func (w *wrapEventsV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapEventsV1) Events(namespace string) typedeventsv1.EventInterface { + return &wrapEventsV1EventImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "events.k8s.io", + Version: "v1", + Resource: "events", + }), + + namespace: namespace, + } +} + +type wrapEventsV1EventImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedeventsv1.EventInterface = (*wrapEventsV1EventImpl)(nil) + +func (w *wrapEventsV1EventImpl) Create(ctx context.Context, in *eventsv1.Event, opts metav1.CreateOptions) (*eventsv1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &eventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapEventsV1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapEventsV1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*eventsv1.Event, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &eventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*eventsv1.EventList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &eventsv1.EventList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *eventsv1.Event, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &eventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Update(ctx context.Context, in *eventsv1.Event, opts metav1.UpdateOptions) (*eventsv1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &eventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) UpdateStatus(ctx context.Context, in *eventsv1.Event, opts metav1.UpdateOptions) (*eventsv1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &eventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// EventsV1beta1 retrieves the EventsV1beta1Client +func (w *wrapClient) EventsV1beta1() typedeventsv1beta1.EventsV1beta1Interface { + return &wrapEventsV1beta1{ + dyn: w.dyn, + } +} + +type wrapEventsV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapEventsV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapEventsV1beta1) Events(namespace string) typedeventsv1beta1.EventInterface { + return &wrapEventsV1beta1EventImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "events.k8s.io", + Version: "v1beta1", + Resource: "events", + }), + + namespace: namespace, + } +} + +type wrapEventsV1beta1EventImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedeventsv1beta1.EventInterface = (*wrapEventsV1beta1EventImpl)(nil) + +func (w *wrapEventsV1beta1EventImpl) Create(ctx context.Context, in *eventsv1beta1.Event, opts metav1.CreateOptions) (*eventsv1beta1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1beta1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &eventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapEventsV1beta1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapEventsV1beta1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*eventsv1beta1.Event, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &eventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*eventsv1beta1.EventList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &eventsv1beta1.EventList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *eventsv1beta1.Event, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &eventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Update(ctx context.Context, in *eventsv1beta1.Event, opts metav1.UpdateOptions) (*eventsv1beta1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1beta1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &eventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) UpdateStatus(ctx context.Context, in *eventsv1beta1.Event, opts metav1.UpdateOptions) (*eventsv1beta1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1beta1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &eventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client +func (w *wrapClient) ExtensionsV1beta1() typedextensionsv1beta1.ExtensionsV1beta1Interface { + return &wrapExtensionsV1beta1{ + dyn: w.dyn, + } +} + +type wrapExtensionsV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapExtensionsV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapExtensionsV1beta1) DaemonSets(namespace string) typedextensionsv1beta1.DaemonSetInterface { + return &wrapExtensionsV1beta1DaemonSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "daemonsets", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1DaemonSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.DaemonSetInterface = (*wrapExtensionsV1beta1DaemonSetImpl)(nil) + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Create(ctx context.Context, in *extensionsv1beta1.DaemonSet, opts metav1.CreateOptions) (*extensionsv1beta1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.DaemonSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*extensionsv1beta1.DaemonSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.DaemonSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *extensionsv1beta1.DaemonSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Update(ctx context.Context, in *extensionsv1beta1.DaemonSet, opts metav1.UpdateOptions) (*extensionsv1beta1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) UpdateStatus(ctx context.Context, in *extensionsv1beta1.DaemonSet, opts metav1.UpdateOptions) (*extensionsv1beta1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) Deployments(namespace string) typedextensionsv1beta1.DeploymentInterface { + return &wrapExtensionsV1beta1DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.DeploymentInterface = (*wrapExtensionsV1beta1DeploymentImpl)(nil) + +func (w *wrapExtensionsV1beta1DeploymentImpl) Create(ctx context.Context, in *extensionsv1beta1.Deployment, opts metav1.CreateOptions) (*extensionsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*extensionsv1beta1.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *extensionsv1beta1.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Update(ctx context.Context, in *extensionsv1beta1.Deployment, opts metav1.UpdateOptions) (*extensionsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) UpdateStatus(ctx context.Context, in *extensionsv1beta1.Deployment, opts metav1.UpdateOptions) (*extensionsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.Scale, error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) UpdateScale(ctx context.Context, _ string, in *extensionsv1beta1.Scale, opts metav1.UpdateOptions) (*extensionsv1beta1.Scale, error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1) Ingresses(namespace string) typedextensionsv1beta1.IngressInterface { + return &wrapExtensionsV1beta1IngressImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "ingresses", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1IngressImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.IngressInterface = (*wrapExtensionsV1beta1IngressImpl)(nil) + +func (w *wrapExtensionsV1beta1IngressImpl) Create(ctx context.Context, in *extensionsv1beta1.Ingress, opts metav1.CreateOptions) (*extensionsv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.Ingress, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*extensionsv1beta1.IngressList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.IngressList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *extensionsv1beta1.Ingress, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Update(ctx context.Context, in *extensionsv1beta1.Ingress, opts metav1.UpdateOptions) (*extensionsv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) UpdateStatus(ctx context.Context, in *extensionsv1beta1.Ingress, opts metav1.UpdateOptions) (*extensionsv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) NetworkPolicies(namespace string) typedextensionsv1beta1.NetworkPolicyInterface { + return &wrapExtensionsV1beta1NetworkPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "networkpolicies", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1NetworkPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.NetworkPolicyInterface = (*wrapExtensionsV1beta1NetworkPolicyImpl)(nil) + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Create(ctx context.Context, in *extensionsv1beta1.NetworkPolicy, opts metav1.CreateOptions) (*extensionsv1beta1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.NetworkPolicy, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*extensionsv1beta1.NetworkPolicyList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.NetworkPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *extensionsv1beta1.NetworkPolicy, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Update(ctx context.Context, in *extensionsv1beta1.NetworkPolicy, opts metav1.UpdateOptions) (*extensionsv1beta1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) UpdateStatus(ctx context.Context, in *extensionsv1beta1.NetworkPolicy, opts metav1.UpdateOptions) (*extensionsv1beta1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) PodSecurityPolicies() typedextensionsv1beta1.PodSecurityPolicyInterface { + return &wrapExtensionsV1beta1PodSecurityPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "podsecuritypolicies", + }), + } +} + +type wrapExtensionsV1beta1PodSecurityPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedextensionsv1beta1.PodSecurityPolicyInterface = (*wrapExtensionsV1beta1PodSecurityPolicyImpl)(nil) + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*extensionsv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.PodSecurityPolicy, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*extensionsv1beta1.PodSecurityPolicyList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.PodSecurityPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *extensionsv1beta1.PodSecurityPolicy, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Update(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*extensionsv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) UpdateStatus(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*extensionsv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) ReplicaSets(namespace string) typedextensionsv1beta1.ReplicaSetInterface { + return &wrapExtensionsV1beta1ReplicaSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "replicasets", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1ReplicaSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.ReplicaSetInterface = (*wrapExtensionsV1beta1ReplicaSetImpl)(nil) + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Create(ctx context.Context, in *extensionsv1beta1.ReplicaSet, opts metav1.CreateOptions) (*extensionsv1beta1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.ReplicaSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*extensionsv1beta1.ReplicaSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.ReplicaSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *extensionsv1beta1.ReplicaSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Update(ctx context.Context, in *extensionsv1beta1.ReplicaSet, opts metav1.UpdateOptions) (*extensionsv1beta1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) UpdateStatus(ctx context.Context, in *extensionsv1beta1.ReplicaSet, opts metav1.UpdateOptions) (*extensionsv1beta1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &extensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*extensionsv1beta1.Scale, error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) UpdateScale(ctx context.Context, _ string, in *extensionsv1beta1.Scale, opts metav1.UpdateOptions) (*extensionsv1beta1.Scale, error) { + panic("NYI") +} + +// FlowcontrolV1alpha1 retrieves the FlowcontrolV1alpha1Client +func (w *wrapClient) FlowcontrolV1alpha1() typedflowcontrolv1alpha1.FlowcontrolV1alpha1Interface { + return &wrapFlowcontrolV1alpha1{ + dyn: w.dyn, + } +} + +type wrapFlowcontrolV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapFlowcontrolV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapFlowcontrolV1alpha1) FlowSchemas() typedflowcontrolv1alpha1.FlowSchemaInterface { + return &wrapFlowcontrolV1alpha1FlowSchemaImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Resource: "flowschemas", + }), + } +} + +type wrapFlowcontrolV1alpha1FlowSchemaImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1alpha1.FlowSchemaInterface = (*wrapFlowcontrolV1alpha1FlowSchemaImpl)(nil) + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Create(ctx context.Context, in *flowcontrolv1alpha1.FlowSchema, opts metav1.CreateOptions) (*flowcontrolv1alpha1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*flowcontrolv1alpha1.FlowSchema, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) List(ctx context.Context, opts metav1.ListOptions) (*flowcontrolv1alpha1.FlowSchemaList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.FlowSchemaList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *flowcontrolv1alpha1.FlowSchema, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Update(ctx context.Context, in *flowcontrolv1alpha1.FlowSchema, opts metav1.UpdateOptions) (*flowcontrolv1alpha1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) UpdateStatus(ctx context.Context, in *flowcontrolv1alpha1.FlowSchema, opts metav1.UpdateOptions) (*flowcontrolv1alpha1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapFlowcontrolV1alpha1) PriorityLevelConfigurations() typedflowcontrolv1alpha1.PriorityLevelConfigurationInterface { + return &wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Resource: "prioritylevelconfigurations", + }), + } +} + +type wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1alpha1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl)(nil) + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*flowcontrolv1alpha1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*flowcontrolv1alpha1.PriorityLevelConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*flowcontrolv1alpha1.PriorityLevelConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.PriorityLevelConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *flowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Update(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*flowcontrolv1alpha1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) UpdateStatus(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*flowcontrolv1alpha1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client +func (w *wrapClient) FlowcontrolV1beta1() typedflowcontrolv1beta1.FlowcontrolV1beta1Interface { + return &wrapFlowcontrolV1beta1{ + dyn: w.dyn, + } +} + +type wrapFlowcontrolV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapFlowcontrolV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapFlowcontrolV1beta1) FlowSchemas() typedflowcontrolv1beta1.FlowSchemaInterface { + return &wrapFlowcontrolV1beta1FlowSchemaImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Resource: "flowschemas", + }), + } +} + +type wrapFlowcontrolV1beta1FlowSchemaImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1beta1.FlowSchemaInterface = (*wrapFlowcontrolV1beta1FlowSchemaImpl)(nil) + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Create(ctx context.Context, in *flowcontrolv1beta1.FlowSchema, opts metav1.CreateOptions) (*flowcontrolv1beta1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*flowcontrolv1beta1.FlowSchema, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) List(ctx context.Context, opts metav1.ListOptions) (*flowcontrolv1beta1.FlowSchemaList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.FlowSchemaList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *flowcontrolv1beta1.FlowSchema, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Update(ctx context.Context, in *flowcontrolv1beta1.FlowSchema, opts metav1.UpdateOptions) (*flowcontrolv1beta1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) UpdateStatus(ctx context.Context, in *flowcontrolv1beta1.FlowSchema, opts metav1.UpdateOptions) (*flowcontrolv1beta1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapFlowcontrolV1beta1) PriorityLevelConfigurations() typedflowcontrolv1beta1.PriorityLevelConfigurationInterface { + return &wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Resource: "prioritylevelconfigurations", + }), + } +} + +type wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1beta1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl)(nil) + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*flowcontrolv1beta1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*flowcontrolv1beta1.PriorityLevelConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*flowcontrolv1beta1.PriorityLevelConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.PriorityLevelConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *flowcontrolv1beta1.PriorityLevelConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Update(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*flowcontrolv1beta1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) UpdateStatus(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*flowcontrolv1beta1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &flowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NetworkingV1 retrieves the NetworkingV1Client +func (w *wrapClient) NetworkingV1() typednetworkingv1.NetworkingV1Interface { + return &wrapNetworkingV1{ + dyn: w.dyn, + } +} + +type wrapNetworkingV1 struct { + dyn dynamic.Interface +} + +func (w *wrapNetworkingV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNetworkingV1) Ingresses(namespace string) typednetworkingv1.IngressInterface { + return &wrapNetworkingV1IngressImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1", + Resource: "ingresses", + }), + + namespace: namespace, + } +} + +type wrapNetworkingV1IngressImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typednetworkingv1.IngressInterface = (*wrapNetworkingV1IngressImpl)(nil) + +func (w *wrapNetworkingV1IngressImpl) Create(ctx context.Context, in *networkingv1.Ingress, opts metav1.CreateOptions) (*networkingv1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*networkingv1.Ingress, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &networkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*networkingv1.IngressList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &networkingv1.IngressList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *networkingv1.Ingress, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &networkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Update(ctx context.Context, in *networkingv1.Ingress, opts metav1.UpdateOptions) (*networkingv1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) UpdateStatus(ctx context.Context, in *networkingv1.Ingress, opts metav1.UpdateOptions) (*networkingv1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapNetworkingV1) IngressClasses() typednetworkingv1.IngressClassInterface { + return &wrapNetworkingV1IngressClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1", + Resource: "ingressclasses", + }), + } +} + +type wrapNetworkingV1IngressClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednetworkingv1.IngressClassInterface = (*wrapNetworkingV1IngressClassImpl)(nil) + +func (w *wrapNetworkingV1IngressClassImpl) Create(ctx context.Context, in *networkingv1.IngressClass, opts metav1.CreateOptions) (*networkingv1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1IngressClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1IngressClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*networkingv1.IngressClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &networkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*networkingv1.IngressClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &networkingv1.IngressClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *networkingv1.IngressClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &networkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Update(ctx context.Context, in *networkingv1.IngressClass, opts metav1.UpdateOptions) (*networkingv1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) UpdateStatus(ctx context.Context, in *networkingv1.IngressClass, opts metav1.UpdateOptions) (*networkingv1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapNetworkingV1) NetworkPolicies(namespace string) typednetworkingv1.NetworkPolicyInterface { + return &wrapNetworkingV1NetworkPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1", + Resource: "networkpolicies", + }), + + namespace: namespace, + } +} + +type wrapNetworkingV1NetworkPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typednetworkingv1.NetworkPolicyInterface = (*wrapNetworkingV1NetworkPolicyImpl)(nil) + +func (w *wrapNetworkingV1NetworkPolicyImpl) Create(ctx context.Context, in *networkingv1.NetworkPolicy, opts metav1.CreateOptions) (*networkingv1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*networkingv1.NetworkPolicy, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &networkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*networkingv1.NetworkPolicyList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &networkingv1.NetworkPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *networkingv1.NetworkPolicy, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &networkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Update(ctx context.Context, in *networkingv1.NetworkPolicy, opts metav1.UpdateOptions) (*networkingv1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) UpdateStatus(ctx context.Context, in *networkingv1.NetworkPolicy, opts metav1.UpdateOptions) (*networkingv1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NetworkingV1beta1 retrieves the NetworkingV1beta1Client +func (w *wrapClient) NetworkingV1beta1() typednetworkingv1beta1.NetworkingV1beta1Interface { + return &wrapNetworkingV1beta1{ + dyn: w.dyn, + } +} + +type wrapNetworkingV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapNetworkingV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNetworkingV1beta1) Ingresses(namespace string) typednetworkingv1beta1.IngressInterface { + return &wrapNetworkingV1beta1IngressImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1beta1", + Resource: "ingresses", + }), + + namespace: namespace, + } +} + +type wrapNetworkingV1beta1IngressImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typednetworkingv1beta1.IngressInterface = (*wrapNetworkingV1beta1IngressImpl)(nil) + +func (w *wrapNetworkingV1beta1IngressImpl) Create(ctx context.Context, in *networkingv1beta1.Ingress, opts metav1.CreateOptions) (*networkingv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1beta1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1beta1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*networkingv1beta1.Ingress, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*networkingv1beta1.IngressList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.IngressList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *networkingv1beta1.Ingress, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Update(ctx context.Context, in *networkingv1beta1.Ingress, opts metav1.UpdateOptions) (*networkingv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) UpdateStatus(ctx context.Context, in *networkingv1beta1.Ingress, opts metav1.UpdateOptions) (*networkingv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapNetworkingV1beta1) IngressClasses() typednetworkingv1beta1.IngressClassInterface { + return &wrapNetworkingV1beta1IngressClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1beta1", + Resource: "ingressclasses", + }), + } +} + +type wrapNetworkingV1beta1IngressClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednetworkingv1beta1.IngressClassInterface = (*wrapNetworkingV1beta1IngressClassImpl)(nil) + +func (w *wrapNetworkingV1beta1IngressClassImpl) Create(ctx context.Context, in *networkingv1beta1.IngressClass, opts metav1.CreateOptions) (*networkingv1beta1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*networkingv1beta1.IngressClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*networkingv1beta1.IngressClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.IngressClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *networkingv1beta1.IngressClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Update(ctx context.Context, in *networkingv1beta1.IngressClass, opts metav1.UpdateOptions) (*networkingv1beta1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) UpdateStatus(ctx context.Context, in *networkingv1beta1.IngressClass, opts metav1.UpdateOptions) (*networkingv1beta1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &networkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NodeV1 retrieves the NodeV1Client +func (w *wrapClient) NodeV1() typednodev1.NodeV1Interface { + return &wrapNodeV1{ + dyn: w.dyn, + } +} + +type wrapNodeV1 struct { + dyn dynamic.Interface +} + +func (w *wrapNodeV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNodeV1) RuntimeClasses() typednodev1.RuntimeClassInterface { + return &wrapNodeV1RuntimeClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "node.k8s.io", + Version: "v1", + Resource: "runtimeclasses", + }), + } +} + +type wrapNodeV1RuntimeClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednodev1.RuntimeClassInterface = (*wrapNodeV1RuntimeClassImpl)(nil) + +func (w *wrapNodeV1RuntimeClassImpl) Create(ctx context.Context, in *nodev1.RuntimeClass, opts metav1.CreateOptions) (*nodev1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNodeV1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNodeV1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*nodev1.RuntimeClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &nodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*nodev1.RuntimeClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &nodev1.RuntimeClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *nodev1.RuntimeClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &nodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Update(ctx context.Context, in *nodev1.RuntimeClass, opts metav1.UpdateOptions) (*nodev1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *nodev1.RuntimeClass, opts metav1.UpdateOptions) (*nodev1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NodeV1alpha1 retrieves the NodeV1alpha1Client +func (w *wrapClient) NodeV1alpha1() typednodev1alpha1.NodeV1alpha1Interface { + return &wrapNodeV1alpha1{ + dyn: w.dyn, + } +} + +type wrapNodeV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapNodeV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNodeV1alpha1) RuntimeClasses() typednodev1alpha1.RuntimeClassInterface { + return &wrapNodeV1alpha1RuntimeClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "node.k8s.io", + Version: "v1alpha1", + Resource: "runtimeclasses", + }), + } +} + +type wrapNodeV1alpha1RuntimeClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednodev1alpha1.RuntimeClassInterface = (*wrapNodeV1alpha1RuntimeClassImpl)(nil) + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Create(ctx context.Context, in *nodev1alpha1.RuntimeClass, opts metav1.CreateOptions) (*nodev1alpha1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1alpha1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*nodev1alpha1.RuntimeClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &nodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*nodev1alpha1.RuntimeClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &nodev1alpha1.RuntimeClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *nodev1alpha1.RuntimeClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &nodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Update(ctx context.Context, in *nodev1alpha1.RuntimeClass, opts metav1.UpdateOptions) (*nodev1alpha1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1alpha1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *nodev1alpha1.RuntimeClass, opts metav1.UpdateOptions) (*nodev1alpha1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1alpha1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NodeV1beta1 retrieves the NodeV1beta1Client +func (w *wrapClient) NodeV1beta1() typednodev1beta1.NodeV1beta1Interface { + return &wrapNodeV1beta1{ + dyn: w.dyn, + } +} + +type wrapNodeV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapNodeV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNodeV1beta1) RuntimeClasses() typednodev1beta1.RuntimeClassInterface { + return &wrapNodeV1beta1RuntimeClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "node.k8s.io", + Version: "v1beta1", + Resource: "runtimeclasses", + }), + } +} + +type wrapNodeV1beta1RuntimeClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednodev1beta1.RuntimeClassInterface = (*wrapNodeV1beta1RuntimeClassImpl)(nil) + +func (w *wrapNodeV1beta1RuntimeClassImpl) Create(ctx context.Context, in *nodev1beta1.RuntimeClass, opts metav1.CreateOptions) (*nodev1beta1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1beta1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*nodev1beta1.RuntimeClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &nodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*nodev1beta1.RuntimeClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &nodev1beta1.RuntimeClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *nodev1beta1.RuntimeClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &nodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Update(ctx context.Context, in *nodev1beta1.RuntimeClass, opts metav1.UpdateOptions) (*nodev1beta1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1beta1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *nodev1beta1.RuntimeClass, opts metav1.UpdateOptions) (*nodev1beta1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1beta1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &nodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// PolicyV1beta1 retrieves the PolicyV1beta1Client +func (w *wrapClient) PolicyV1beta1() typedpolicyv1beta1.PolicyV1beta1Interface { + return &wrapPolicyV1beta1{ + dyn: w.dyn, + } +} + +type wrapPolicyV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapPolicyV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapPolicyV1beta1) Evictions(namespace string) typedpolicyv1beta1.EvictionInterface { + return &wrapPolicyV1beta1EvictionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "policy", + Version: "v1beta1", + Resource: "evictions", + }), + + namespace: namespace, + } +} + +type wrapPolicyV1beta1EvictionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedpolicyv1beta1.EvictionInterface = (*wrapPolicyV1beta1EvictionImpl)(nil) + +func (w *wrapPolicyV1beta1) PodDisruptionBudgets(namespace string) typedpolicyv1beta1.PodDisruptionBudgetInterface { + return &wrapPolicyV1beta1PodDisruptionBudgetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "policy", + Version: "v1beta1", + Resource: "poddisruptionbudgets", + }), + + namespace: namespace, + } +} + +type wrapPolicyV1beta1PodDisruptionBudgetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedpolicyv1beta1.PodDisruptionBudgetInterface = (*wrapPolicyV1beta1PodDisruptionBudgetImpl)(nil) + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Create(ctx context.Context, in *policyv1beta1.PodDisruptionBudget, opts metav1.CreateOptions) (*policyv1beta1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*policyv1beta1.PodDisruptionBudget, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) List(ctx context.Context, opts metav1.ListOptions) (*policyv1beta1.PodDisruptionBudgetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodDisruptionBudgetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *policyv1beta1.PodDisruptionBudget, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Update(ctx context.Context, in *policyv1beta1.PodDisruptionBudget, opts metav1.UpdateOptions) (*policyv1beta1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) UpdateStatus(ctx context.Context, in *policyv1beta1.PodDisruptionBudget, opts metav1.UpdateOptions) (*policyv1beta1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapPolicyV1beta1) PodSecurityPolicies() typedpolicyv1beta1.PodSecurityPolicyInterface { + return &wrapPolicyV1beta1PodSecurityPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "policy", + Version: "v1beta1", + Resource: "podsecuritypolicies", + }), + } +} + +type wrapPolicyV1beta1PodSecurityPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedpolicyv1beta1.PodSecurityPolicyInterface = (*wrapPolicyV1beta1PodSecurityPolicyImpl)(nil) + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *policyv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*policyv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*policyv1beta1.PodSecurityPolicy, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*policyv1beta1.PodSecurityPolicyList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodSecurityPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *policyv1beta1.PodSecurityPolicy, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Update(ctx context.Context, in *policyv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*policyv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) UpdateStatus(ctx context.Context, in *policyv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*policyv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &policyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// RbacV1 retrieves the RbacV1Client +func (w *wrapClient) RbacV1() typedrbacv1.RbacV1Interface { + return &wrapRbacV1{ + dyn: w.dyn, + } +} + +type wrapRbacV1 struct { + dyn dynamic.Interface +} + +func (w *wrapRbacV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapRbacV1) ClusterRoles() typedrbacv1.ClusterRoleInterface { + return &wrapRbacV1ClusterRoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "clusterroles", + }), + } +} + +type wrapRbacV1ClusterRoleImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1.ClusterRoleInterface = (*wrapRbacV1ClusterRoleImpl)(nil) + +func (w *wrapRbacV1ClusterRoleImpl) Create(ctx context.Context, in *rbacv1.ClusterRole, opts metav1.CreateOptions) (*rbacv1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1.ClusterRole, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.ClusterRoleList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1.ClusterRole, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Update(ctx context.Context, in *rbacv1.ClusterRole, opts metav1.UpdateOptions) (*rbacv1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *rbacv1.ClusterRole, opts metav1.UpdateOptions) (*rbacv1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1) ClusterRoleBindings() typedrbacv1.ClusterRoleBindingInterface { + return &wrapRbacV1ClusterRoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "clusterrolebindings", + }), + } +} + +type wrapRbacV1ClusterRoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1.ClusterRoleBindingInterface = (*wrapRbacV1ClusterRoleBindingImpl)(nil) + +func (w *wrapRbacV1ClusterRoleBindingImpl) Create(ctx context.Context, in *rbacv1.ClusterRoleBinding, opts metav1.CreateOptions) (*rbacv1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1.ClusterRoleBinding, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.ClusterRoleBindingList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1.ClusterRoleBinding, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Update(ctx context.Context, in *rbacv1.ClusterRoleBinding, opts metav1.UpdateOptions) (*rbacv1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *rbacv1.ClusterRoleBinding, opts metav1.UpdateOptions) (*rbacv1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1) Roles(namespace string) typedrbacv1.RoleInterface { + return &wrapRbacV1RoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "roles", + }), + + namespace: namespace, + } +} + +type wrapRbacV1RoleImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1.RoleInterface = (*wrapRbacV1RoleImpl)(nil) + +func (w *wrapRbacV1RoleImpl) Create(ctx context.Context, in *rbacv1.Role, opts metav1.CreateOptions) (*rbacv1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1.Role, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.RoleList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1.RoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1.Role, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Update(ctx context.Context, in *rbacv1.Role, opts metav1.UpdateOptions) (*rbacv1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) UpdateStatus(ctx context.Context, in *rbacv1.Role, opts metav1.UpdateOptions) (*rbacv1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1) RoleBindings(namespace string) typedrbacv1.RoleBindingInterface { + return &wrapRbacV1RoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "rolebindings", + }), + + namespace: namespace, + } +} + +type wrapRbacV1RoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1.RoleBindingInterface = (*wrapRbacV1RoleBindingImpl)(nil) + +func (w *wrapRbacV1RoleBindingImpl) Create(ctx context.Context, in *rbacv1.RoleBinding, opts metav1.CreateOptions) (*rbacv1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1.RoleBinding, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.RoleBindingList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1.RoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1.RoleBinding, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Update(ctx context.Context, in *rbacv1.RoleBinding, opts metav1.UpdateOptions) (*rbacv1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) UpdateStatus(ctx context.Context, in *rbacv1.RoleBinding, opts metav1.UpdateOptions) (*rbacv1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// RbacV1alpha1 retrieves the RbacV1alpha1Client +func (w *wrapClient) RbacV1alpha1() typedrbacv1alpha1.RbacV1alpha1Interface { + return &wrapRbacV1alpha1{ + dyn: w.dyn, + } +} + +type wrapRbacV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapRbacV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapRbacV1alpha1) ClusterRoles() typedrbacv1alpha1.ClusterRoleInterface { + return &wrapRbacV1alpha1ClusterRoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "clusterroles", + }), + } +} + +type wrapRbacV1alpha1ClusterRoleImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1alpha1.ClusterRoleInterface = (*wrapRbacV1alpha1ClusterRoleImpl)(nil) + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Create(ctx context.Context, in *rbacv1alpha1.ClusterRole, opts metav1.CreateOptions) (*rbacv1alpha1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1alpha1.ClusterRole, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1alpha1.ClusterRoleList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1alpha1.ClusterRole, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Update(ctx context.Context, in *rbacv1alpha1.ClusterRole, opts metav1.UpdateOptions) (*rbacv1alpha1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *rbacv1alpha1.ClusterRole, opts metav1.UpdateOptions) (*rbacv1alpha1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1alpha1) ClusterRoleBindings() typedrbacv1alpha1.ClusterRoleBindingInterface { + return &wrapRbacV1alpha1ClusterRoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "clusterrolebindings", + }), + } +} + +type wrapRbacV1alpha1ClusterRoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1alpha1.ClusterRoleBindingInterface = (*wrapRbacV1alpha1ClusterRoleBindingImpl)(nil) + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Create(ctx context.Context, in *rbacv1alpha1.ClusterRoleBinding, opts metav1.CreateOptions) (*rbacv1alpha1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1alpha1.ClusterRoleBinding, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1alpha1.ClusterRoleBindingList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1alpha1.ClusterRoleBinding, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Update(ctx context.Context, in *rbacv1alpha1.ClusterRoleBinding, opts metav1.UpdateOptions) (*rbacv1alpha1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *rbacv1alpha1.ClusterRoleBinding, opts metav1.UpdateOptions) (*rbacv1alpha1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1alpha1) Roles(namespace string) typedrbacv1alpha1.RoleInterface { + return &wrapRbacV1alpha1RoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "roles", + }), + + namespace: namespace, + } +} + +type wrapRbacV1alpha1RoleImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1alpha1.RoleInterface = (*wrapRbacV1alpha1RoleImpl)(nil) + +func (w *wrapRbacV1alpha1RoleImpl) Create(ctx context.Context, in *rbacv1alpha1.Role, opts metav1.CreateOptions) (*rbacv1alpha1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1alpha1.Role, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1alpha1.RoleList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.RoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1alpha1.Role, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Update(ctx context.Context, in *rbacv1alpha1.Role, opts metav1.UpdateOptions) (*rbacv1alpha1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) UpdateStatus(ctx context.Context, in *rbacv1alpha1.Role, opts metav1.UpdateOptions) (*rbacv1alpha1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1alpha1) RoleBindings(namespace string) typedrbacv1alpha1.RoleBindingInterface { + return &wrapRbacV1alpha1RoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "rolebindings", + }), + + namespace: namespace, + } +} + +type wrapRbacV1alpha1RoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1alpha1.RoleBindingInterface = (*wrapRbacV1alpha1RoleBindingImpl)(nil) + +func (w *wrapRbacV1alpha1RoleBindingImpl) Create(ctx context.Context, in *rbacv1alpha1.RoleBinding, opts metav1.CreateOptions) (*rbacv1alpha1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1alpha1.RoleBinding, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1alpha1.RoleBindingList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.RoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1alpha1.RoleBinding, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Update(ctx context.Context, in *rbacv1alpha1.RoleBinding, opts metav1.UpdateOptions) (*rbacv1alpha1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) UpdateStatus(ctx context.Context, in *rbacv1alpha1.RoleBinding, opts metav1.UpdateOptions) (*rbacv1alpha1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// RbacV1beta1 retrieves the RbacV1beta1Client +func (w *wrapClient) RbacV1beta1() typedrbacv1beta1.RbacV1beta1Interface { + return &wrapRbacV1beta1{ + dyn: w.dyn, + } +} + +type wrapRbacV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapRbacV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapRbacV1beta1) ClusterRoles() typedrbacv1beta1.ClusterRoleInterface { + return &wrapRbacV1beta1ClusterRoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "clusterroles", + }), + } +} + +type wrapRbacV1beta1ClusterRoleImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1beta1.ClusterRoleInterface = (*wrapRbacV1beta1ClusterRoleImpl)(nil) + +func (w *wrapRbacV1beta1ClusterRoleImpl) Create(ctx context.Context, in *rbacv1beta1.ClusterRole, opts metav1.CreateOptions) (*rbacv1beta1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1beta1.ClusterRole, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1beta1.ClusterRoleList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1beta1.ClusterRole, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Update(ctx context.Context, in *rbacv1beta1.ClusterRole, opts metav1.UpdateOptions) (*rbacv1beta1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *rbacv1beta1.ClusterRole, opts metav1.UpdateOptions) (*rbacv1beta1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1beta1) ClusterRoleBindings() typedrbacv1beta1.ClusterRoleBindingInterface { + return &wrapRbacV1beta1ClusterRoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "clusterrolebindings", + }), + } +} + +type wrapRbacV1beta1ClusterRoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1beta1.ClusterRoleBindingInterface = (*wrapRbacV1beta1ClusterRoleBindingImpl)(nil) + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Create(ctx context.Context, in *rbacv1beta1.ClusterRoleBinding, opts metav1.CreateOptions) (*rbacv1beta1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1beta1.ClusterRoleBinding, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1beta1.ClusterRoleBindingList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1beta1.ClusterRoleBinding, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Update(ctx context.Context, in *rbacv1beta1.ClusterRoleBinding, opts metav1.UpdateOptions) (*rbacv1beta1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *rbacv1beta1.ClusterRoleBinding, opts metav1.UpdateOptions) (*rbacv1beta1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1beta1) Roles(namespace string) typedrbacv1beta1.RoleInterface { + return &wrapRbacV1beta1RoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "roles", + }), + + namespace: namespace, + } +} + +type wrapRbacV1beta1RoleImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1beta1.RoleInterface = (*wrapRbacV1beta1RoleImpl)(nil) + +func (w *wrapRbacV1beta1RoleImpl) Create(ctx context.Context, in *rbacv1beta1.Role, opts metav1.CreateOptions) (*rbacv1beta1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1beta1.Role, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1beta1.RoleList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.RoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1beta1.Role, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Update(ctx context.Context, in *rbacv1beta1.Role, opts metav1.UpdateOptions) (*rbacv1beta1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) UpdateStatus(ctx context.Context, in *rbacv1beta1.Role, opts metav1.UpdateOptions) (*rbacv1beta1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1beta1) RoleBindings(namespace string) typedrbacv1beta1.RoleBindingInterface { + return &wrapRbacV1beta1RoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "rolebindings", + }), + + namespace: namespace, + } +} + +type wrapRbacV1beta1RoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1beta1.RoleBindingInterface = (*wrapRbacV1beta1RoleBindingImpl)(nil) + +func (w *wrapRbacV1beta1RoleBindingImpl) Create(ctx context.Context, in *rbacv1beta1.RoleBinding, opts metav1.CreateOptions) (*rbacv1beta1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1beta1.RoleBinding, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*rbacv1beta1.RoleBindingList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.RoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1beta1.RoleBinding, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Update(ctx context.Context, in *rbacv1beta1.RoleBinding, opts metav1.UpdateOptions) (*rbacv1beta1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) UpdateStatus(ctx context.Context, in *rbacv1beta1.RoleBinding, opts metav1.UpdateOptions) (*rbacv1beta1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &rbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// SchedulingV1 retrieves the SchedulingV1Client +func (w *wrapClient) SchedulingV1() typedschedulingv1.SchedulingV1Interface { + return &wrapSchedulingV1{ + dyn: w.dyn, + } +} + +type wrapSchedulingV1 struct { + dyn dynamic.Interface +} + +func (w *wrapSchedulingV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapSchedulingV1) PriorityClasses() typedschedulingv1.PriorityClassInterface { + return &wrapSchedulingV1PriorityClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "scheduling.k8s.io", + Version: "v1", + Resource: "priorityclasses", + }), + } +} + +type wrapSchedulingV1PriorityClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedschedulingv1.PriorityClassInterface = (*wrapSchedulingV1PriorityClassImpl)(nil) + +func (w *wrapSchedulingV1PriorityClassImpl) Create(ctx context.Context, in *schedulingv1.PriorityClass, opts metav1.CreateOptions) (*schedulingv1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapSchedulingV1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapSchedulingV1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*schedulingv1.PriorityClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &schedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*schedulingv1.PriorityClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &schedulingv1.PriorityClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *schedulingv1.PriorityClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &schedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Update(ctx context.Context, in *schedulingv1.PriorityClass, opts metav1.UpdateOptions) (*schedulingv1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) UpdateStatus(ctx context.Context, in *schedulingv1.PriorityClass, opts metav1.UpdateOptions) (*schedulingv1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client +func (w *wrapClient) SchedulingV1alpha1() typedschedulingv1alpha1.SchedulingV1alpha1Interface { + return &wrapSchedulingV1alpha1{ + dyn: w.dyn, + } +} + +type wrapSchedulingV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapSchedulingV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapSchedulingV1alpha1) PriorityClasses() typedschedulingv1alpha1.PriorityClassInterface { + return &wrapSchedulingV1alpha1PriorityClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Resource: "priorityclasses", + }), + } +} + +type wrapSchedulingV1alpha1PriorityClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedschedulingv1alpha1.PriorityClassInterface = (*wrapSchedulingV1alpha1PriorityClassImpl)(nil) + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Create(ctx context.Context, in *schedulingv1alpha1.PriorityClass, opts metav1.CreateOptions) (*schedulingv1alpha1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*schedulingv1alpha1.PriorityClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &schedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*schedulingv1alpha1.PriorityClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &schedulingv1alpha1.PriorityClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *schedulingv1alpha1.PriorityClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &schedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Update(ctx context.Context, in *schedulingv1alpha1.PriorityClass, opts metav1.UpdateOptions) (*schedulingv1alpha1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) UpdateStatus(ctx context.Context, in *schedulingv1alpha1.PriorityClass, opts metav1.UpdateOptions) (*schedulingv1alpha1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// SchedulingV1beta1 retrieves the SchedulingV1beta1Client +func (w *wrapClient) SchedulingV1beta1() typedschedulingv1beta1.SchedulingV1beta1Interface { + return &wrapSchedulingV1beta1{ + dyn: w.dyn, + } +} + +type wrapSchedulingV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapSchedulingV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapSchedulingV1beta1) PriorityClasses() typedschedulingv1beta1.PriorityClassInterface { + return &wrapSchedulingV1beta1PriorityClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Resource: "priorityclasses", + }), + } +} + +type wrapSchedulingV1beta1PriorityClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedschedulingv1beta1.PriorityClassInterface = (*wrapSchedulingV1beta1PriorityClassImpl)(nil) + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Create(ctx context.Context, in *schedulingv1beta1.PriorityClass, opts metav1.CreateOptions) (*schedulingv1beta1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*schedulingv1beta1.PriorityClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &schedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*schedulingv1beta1.PriorityClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &schedulingv1beta1.PriorityClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *schedulingv1beta1.PriorityClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &schedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Update(ctx context.Context, in *schedulingv1beta1.PriorityClass, opts metav1.UpdateOptions) (*schedulingv1beta1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) UpdateStatus(ctx context.Context, in *schedulingv1beta1.PriorityClass, opts metav1.UpdateOptions) (*schedulingv1beta1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &schedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// StorageV1 retrieves the StorageV1Client +func (w *wrapClient) StorageV1() typedstoragev1.StorageV1Interface { + return &wrapStorageV1{ + dyn: w.dyn, + } +} + +type wrapStorageV1 struct { + dyn dynamic.Interface +} + +func (w *wrapStorageV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapStorageV1) CSIDrivers() typedstoragev1.CSIDriverInterface { + return &wrapStorageV1CSIDriverImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "csidrivers", + }), + } +} + +type wrapStorageV1CSIDriverImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.CSIDriverInterface = (*wrapStorageV1CSIDriverImpl)(nil) + +func (w *wrapStorageV1CSIDriverImpl) Create(ctx context.Context, in *storagev1.CSIDriver, opts metav1.CreateOptions) (*storagev1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1CSIDriverImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1CSIDriverImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1.CSIDriver, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1.CSIDriverList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSIDriverList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1.CSIDriver, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Update(ctx context.Context, in *storagev1.CSIDriver, opts metav1.UpdateOptions) (*storagev1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) UpdateStatus(ctx context.Context, in *storagev1.CSIDriver, opts metav1.UpdateOptions) (*storagev1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1) CSINodes() typedstoragev1.CSINodeInterface { + return &wrapStorageV1CSINodeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "csinodes", + }), + } +} + +type wrapStorageV1CSINodeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.CSINodeInterface = (*wrapStorageV1CSINodeImpl)(nil) + +func (w *wrapStorageV1CSINodeImpl) Create(ctx context.Context, in *storagev1.CSINode, opts metav1.CreateOptions) (*storagev1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1CSINodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1CSINodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1.CSINode, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1.CSINodeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSINodeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1.CSINode, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Update(ctx context.Context, in *storagev1.CSINode, opts metav1.UpdateOptions) (*storagev1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) UpdateStatus(ctx context.Context, in *storagev1.CSINode, opts metav1.UpdateOptions) (*storagev1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1) StorageClasses() typedstoragev1.StorageClassInterface { + return &wrapStorageV1StorageClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "storageclasses", + }), + } +} + +type wrapStorageV1StorageClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.StorageClassInterface = (*wrapStorageV1StorageClassImpl)(nil) + +func (w *wrapStorageV1StorageClassImpl) Create(ctx context.Context, in *storagev1.StorageClass, opts metav1.CreateOptions) (*storagev1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1StorageClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1StorageClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1.StorageClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1.StorageClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1.StorageClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1.StorageClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Update(ctx context.Context, in *storagev1.StorageClass, opts metav1.UpdateOptions) (*storagev1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) UpdateStatus(ctx context.Context, in *storagev1.StorageClass, opts metav1.UpdateOptions) (*storagev1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1) VolumeAttachments() typedstoragev1.VolumeAttachmentInterface { + return &wrapStorageV1VolumeAttachmentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "volumeattachments", + }), + } +} + +type wrapStorageV1VolumeAttachmentImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.VolumeAttachmentInterface = (*wrapStorageV1VolumeAttachmentImpl)(nil) + +func (w *wrapStorageV1VolumeAttachmentImpl) Create(ctx context.Context, in *storagev1.VolumeAttachment, opts metav1.CreateOptions) (*storagev1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1.VolumeAttachment, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1.VolumeAttachmentList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1.VolumeAttachmentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1.VolumeAttachment, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Update(ctx context.Context, in *storagev1.VolumeAttachment, opts metav1.UpdateOptions) (*storagev1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *storagev1.VolumeAttachment, opts metav1.UpdateOptions) (*storagev1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// StorageV1alpha1 retrieves the StorageV1alpha1Client +func (w *wrapClient) StorageV1alpha1() typedstoragev1alpha1.StorageV1alpha1Interface { + return &wrapStorageV1alpha1{ + dyn: w.dyn, + } +} + +type wrapStorageV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapStorageV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapStorageV1alpha1) CSIStorageCapacities(namespace string) typedstoragev1alpha1.CSIStorageCapacityInterface { + return &wrapStorageV1alpha1CSIStorageCapacityImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Resource: "csistoragecapacities", + }), + + namespace: namespace, + } +} + +type wrapStorageV1alpha1CSIStorageCapacityImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedstoragev1alpha1.CSIStorageCapacityInterface = (*wrapStorageV1alpha1CSIStorageCapacityImpl)(nil) + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Create(ctx context.Context, in *storagev1alpha1.CSIStorageCapacity, opts metav1.CreateOptions) (*storagev1alpha1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1alpha1.CSIStorageCapacity, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1alpha1.CSIStorageCapacityList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.CSIStorageCapacityList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1alpha1.CSIStorageCapacity, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Update(ctx context.Context, in *storagev1alpha1.CSIStorageCapacity, opts metav1.UpdateOptions) (*storagev1alpha1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) UpdateStatus(ctx context.Context, in *storagev1alpha1.CSIStorageCapacity, opts metav1.UpdateOptions) (*storagev1alpha1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1alpha1) VolumeAttachments() typedstoragev1alpha1.VolumeAttachmentInterface { + return &wrapStorageV1alpha1VolumeAttachmentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Resource: "volumeattachments", + }), + } +} + +type wrapStorageV1alpha1VolumeAttachmentImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1alpha1.VolumeAttachmentInterface = (*wrapStorageV1alpha1VolumeAttachmentImpl)(nil) + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Create(ctx context.Context, in *storagev1alpha1.VolumeAttachment, opts metav1.CreateOptions) (*storagev1alpha1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1alpha1.VolumeAttachment, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1alpha1.VolumeAttachmentList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.VolumeAttachmentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1alpha1.VolumeAttachment, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Update(ctx context.Context, in *storagev1alpha1.VolumeAttachment, opts metav1.UpdateOptions) (*storagev1alpha1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *storagev1alpha1.VolumeAttachment, opts metav1.UpdateOptions) (*storagev1alpha1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// StorageV1beta1 retrieves the StorageV1beta1Client +func (w *wrapClient) StorageV1beta1() typedstoragev1beta1.StorageV1beta1Interface { + return &wrapStorageV1beta1{ + dyn: w.dyn, + } +} + +type wrapStorageV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapStorageV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapStorageV1beta1) CSIDrivers() typedstoragev1beta1.CSIDriverInterface { + return &wrapStorageV1beta1CSIDriverImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "csidrivers", + }), + } +} + +type wrapStorageV1beta1CSIDriverImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.CSIDriverInterface = (*wrapStorageV1beta1CSIDriverImpl)(nil) + +func (w *wrapStorageV1beta1CSIDriverImpl) Create(ctx context.Context, in *storagev1beta1.CSIDriver, opts metav1.CreateOptions) (*storagev1beta1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1CSIDriverImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1beta1.CSIDriver, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1beta1.CSIDriverList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSIDriverList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1beta1.CSIDriver, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Update(ctx context.Context, in *storagev1beta1.CSIDriver, opts metav1.UpdateOptions) (*storagev1beta1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) UpdateStatus(ctx context.Context, in *storagev1beta1.CSIDriver, opts metav1.UpdateOptions) (*storagev1beta1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1beta1) CSINodes() typedstoragev1beta1.CSINodeInterface { + return &wrapStorageV1beta1CSINodeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "csinodes", + }), + } +} + +type wrapStorageV1beta1CSINodeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.CSINodeInterface = (*wrapStorageV1beta1CSINodeImpl)(nil) + +func (w *wrapStorageV1beta1CSINodeImpl) Create(ctx context.Context, in *storagev1beta1.CSINode, opts metav1.CreateOptions) (*storagev1beta1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1CSINodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1CSINodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1beta1.CSINode, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1beta1.CSINodeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSINodeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1beta1.CSINode, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Update(ctx context.Context, in *storagev1beta1.CSINode, opts metav1.UpdateOptions) (*storagev1beta1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) UpdateStatus(ctx context.Context, in *storagev1beta1.CSINode, opts metav1.UpdateOptions) (*storagev1beta1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1beta1) StorageClasses() typedstoragev1beta1.StorageClassInterface { + return &wrapStorageV1beta1StorageClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "storageclasses", + }), + } +} + +type wrapStorageV1beta1StorageClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.StorageClassInterface = (*wrapStorageV1beta1StorageClassImpl)(nil) + +func (w *wrapStorageV1beta1StorageClassImpl) Create(ctx context.Context, in *storagev1beta1.StorageClass, opts metav1.CreateOptions) (*storagev1beta1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1StorageClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1StorageClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1beta1.StorageClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1beta1.StorageClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.StorageClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1beta1.StorageClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Update(ctx context.Context, in *storagev1beta1.StorageClass, opts metav1.UpdateOptions) (*storagev1beta1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) UpdateStatus(ctx context.Context, in *storagev1beta1.StorageClass, opts metav1.UpdateOptions) (*storagev1beta1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1beta1) VolumeAttachments() typedstoragev1beta1.VolumeAttachmentInterface { + return &wrapStorageV1beta1VolumeAttachmentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "volumeattachments", + }), + } +} + +type wrapStorageV1beta1VolumeAttachmentImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.VolumeAttachmentInterface = (*wrapStorageV1beta1VolumeAttachmentImpl)(nil) + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Create(ctx context.Context, in *storagev1beta1.VolumeAttachment, opts metav1.CreateOptions) (*storagev1beta1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*storagev1beta1.VolumeAttachment, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*storagev1beta1.VolumeAttachmentList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.VolumeAttachmentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *storagev1beta1.VolumeAttachment, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Update(ctx context.Context, in *storagev1beta1.VolumeAttachment, opts metav1.UpdateOptions) (*storagev1beta1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *storagev1beta1.VolumeAttachment, opts metav1.UpdateOptions) (*storagev1beta1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &storagev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} diff --git a/client/injection/kube/client/client_expansion.go b/client/injection/kube/client/client_expansion.go new file mode 100644 index 0000000000..feb358db36 --- /dev/null +++ b/client/injection/kube/client/client_expansion.go @@ -0,0 +1,103 @@ +/* +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 client + +import ( + context "context" + + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + corev1 "k8s.io/api/core/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + policyv1beta1 "k8s.io/api/policy/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + restclient "k8s.io/client-go/rest" +) + +func (*wrapCoreV1NamespaceImpl) Finalize(context.Context, *corev1.Namespace, metav1.UpdateOptions) (*corev1.Namespace, error) { + panic("NYI") +} + +func (*wrapCoreV1ServiceImpl) ProxyGet(string, string, string, string, map[string]string) restclient.ResponseWrapper { + panic("NYI") +} + +func (*wrapEventsV1beta1EventImpl) CreateWithEventNamespace(*eventsv1beta1.Event) (*eventsv1beta1.Event, error) { + panic("NYI") +} + +func (*wrapEventsV1beta1EventImpl) UpdateWithEventNamespace(*eventsv1beta1.Event) (*eventsv1beta1.Event, error) { + panic("NYI") +} + +func (*wrapEventsV1beta1EventImpl) PatchWithEventNamespace(*eventsv1beta1.Event, []byte) (*eventsv1beta1.Event, error) { + panic("NYI") +} + +func (*wrapCoreV1EventImpl) CreateWithEventNamespace(*corev1.Event) (*corev1.Event, error) { + panic("NYI") +} + +func (*wrapCoreV1EventImpl) UpdateWithEventNamespace(*corev1.Event) (*corev1.Event, error) { + panic("NYI") +} + +func (*wrapCoreV1EventImpl) PatchWithEventNamespace(*corev1.Event, []byte) (*corev1.Event, error) { + panic("NYI") +} + +func (*wrapCoreV1EventImpl) Search(*runtime.Scheme, runtime.Object) (*corev1.EventList, error) { + panic("NYI") +} + +func (*wrapCoreV1EventImpl) GetFieldSelector(*string, *string, *string, *string) fields.Selector { + panic("NYI") +} + +func (*wrapCoreV1NodeImpl) PatchStatus(context.Context, string, []byte) (*corev1.Node, error) { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) Bind(context.Context, *corev1.Binding, metav1.CreateOptions) error { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) Evict(context.Context, *policyv1beta1.Eviction) error { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) GetLogs(string, *corev1.PodLogOptions) *restclient.Request { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) ProxyGet(string, string, string, string, map[string]string) restclient.ResponseWrapper { + panic("NYI") +} + +func (*wrapExtensionsV1beta1DeploymentImpl) Rollback(context.Context, *extensionsv1beta1.DeploymentRollback, metav1.CreateOptions) error { + panic("NYI") +} + +func (*wrapPolicyV1beta1EvictionImpl) Evict(context.Context, *policyv1beta1.Eviction) error { + panic("NYI") +} + +func (*wrapCertificatesV1beta1CertificateSigningRequestImpl) UpdateApproval(context.Context, *certificatesv1beta1.CertificateSigningRequest, metav1.UpdateOptions) (*certificatesv1beta1.CertificateSigningRequest, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go index 62c7557837..05d8170a3c 100644 --- a/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/admissionregistration/v1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.MutatingWebhookConfigurationInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.MutatingWebhookConfigurationIn } return untyped.(v1.MutatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.MutatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1.MutatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1.MutatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1.MutatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1.MutatingWebhookConfiguration, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1.MutatingWebhookConfiguration, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AdmissionregistrationV1().MutatingWebhookConfigurations().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go index 981a47b4a3..44a6d885bb 100644 --- a/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package mutatingwebhookconfiguration import ( context "context" + apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/admissionregistration/v1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.MutatingWebhookConfigurationInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.MutatingWebhookConfigurationInformer { } return untyped.(v1.MutatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.MutatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1.MutatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1.MutatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1.MutatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1.MutatingWebhookConfiguration, err error) { + lo, err := w.client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1.MutatingWebhookConfiguration, error) { + return w.client.AdmissionregistrationV1().MutatingWebhookConfigurations().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go index bc8a1bb0ed..2ed08bd89b 100644 --- a/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/admissionregistration/v1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ValidatingWebhookConfigurationInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.ValidatingWebhookConfiguration } return untyped.(v1.ValidatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.ValidatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1.ValidatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1.ValidatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1.ValidatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1.ValidatingWebhookConfiguration, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1.ValidatingWebhookConfiguration, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go index 08c3ac2bba..80499f1757 100644 --- a/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package validatingwebhookconfiguration import ( context "context" + apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/admissionregistration/v1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ValidatingWebhookConfigurationInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.ValidatingWebhookConfigurationInformer { } return untyped.(v1.ValidatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.ValidatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1.ValidatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1.ValidatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1.ValidatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1.ValidatingWebhookConfiguration, err error) { + lo, err := w.client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1.ValidatingWebhookConfiguration, error) { + return w.client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go index 12826bd231..b2be49e62c 100644 --- a/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/filtered/mutatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1beta1.MutatingWebhookConfigurationInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1beta1.MutatingWebhookConfigurat } return untyped.(v1beta1.MutatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.MutatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1beta1.MutatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1beta1.MutatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1beta1.MutatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go index 15a9440f26..bc4dc14745 100644 --- a/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package mutatingwebhookconfiguration import ( context "context" + apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1beta1.MutatingWebhookConfigurationInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1beta1.MutatingWebhookConfigurationInformer { } return untyped.(v1beta1.MutatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.MutatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1beta1.MutatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1beta1.MutatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1beta1.MutatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { + lo, err := w.client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + return w.client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go index b596624ce3..8509407731 100644 --- a/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/filtered/validatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1beta1.ValidatingWebhookConfigurationInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1beta1.ValidatingWebhookConfigur } return untyped.(v1beta1.ValidatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.ValidatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1beta1.ValidatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1beta1.ValidatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/validatingwebhookconfiguration.go b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/validatingwebhookconfiguration.go index 32ca4a90fa..2b3177257d 100644 --- a/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/validatingwebhookconfiguration.go +++ b/client/injection/kube/informers/admissionregistration/v1beta1/validatingwebhookconfiguration/validatingwebhookconfiguration.go @@ -21,7 +21,14 @@ package validatingwebhookconfiguration import ( context "context" + apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1beta1.ValidatingWebhookConfigurationInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1beta1.ValidatingWebhookConfigurationInformer { } return untyped.(v1beta1.ValidatingWebhookConfigurationInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.ValidatingWebhookConfigurationInformer = (*wrapper)(nil) +var _ admissionregistrationv1beta1.ValidatingWebhookConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() admissionregistrationv1beta1.ValidatingWebhookConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { + lo, err := w.client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + return w.client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/fake/fake.go b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/fake/fake.go new file mode 100644 index 0000000000..cf14ca9644 --- /dev/null +++ b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + storageversion "knative.dev/pkg/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = storageversion.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Internal().V1alpha1().StorageVersions() + return context.WithValue(ctx, storageversion.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/filtered/fake/fake.go b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/filtered/fake/fake.go new file mode 100644 index 0000000000..4ac9f92c74 --- /dev/null +++ b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/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.Internal().V1alpha1().StorageVersions() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/filtered/storageversion.go b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/filtered/storageversion.go new file mode 100644 index 0000000000..9dd92f1b9e --- /dev/null +++ b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/filtered/storageversion.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiapiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/apiserverinternal/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + apiserverinternalv1alpha1 "k8s.io/client-go/listers/apiserverinternal/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Internal().V1alpha1().StorageVersions() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.StorageVersionInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apiserverinternal/v1alpha1.StorageVersionInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.StorageVersionInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.StorageVersionInformer = (*wrapper)(nil) +var _ apiserverinternalv1alpha1.StorageVersionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiapiserverinternalv1alpha1.StorageVersion{}, 0, nil) +} + +func (w *wrapper) Lister() apiserverinternalv1alpha1.StorageVersionLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiapiserverinternalv1alpha1.StorageVersion, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.InternalV1alpha1().StorageVersions().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiapiserverinternalv1alpha1.StorageVersion, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.InternalV1alpha1().StorageVersions().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/storageversion.go b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/storageversion.go new file mode 100644 index 0000000000..cfef3ced50 --- /dev/null +++ b/client/injection/kube/informers/apiserverinternal/v1alpha1/storageversion/storageversion.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package storageversion + +import ( + context "context" + + apiapiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/apiserverinternal/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + apiserverinternalv1alpha1 "k8s.io/client-go/listers/apiserverinternal/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Internal().V1alpha1().StorageVersions() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.StorageVersionInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apiserverinternal/v1alpha1.StorageVersionInformer from context.") + } + return untyped.(v1alpha1.StorageVersionInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.StorageVersionInformer = (*wrapper)(nil) +var _ apiserverinternalv1alpha1.StorageVersionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiapiserverinternalv1alpha1.StorageVersion{}, 0, nil) +} + +func (w *wrapper) Lister() apiserverinternalv1alpha1.StorageVersionLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiapiserverinternalv1alpha1.StorageVersion, err error) { + lo, err := w.client.InternalV1alpha1().StorageVersions().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiapiserverinternalv1alpha1.StorageVersion, error) { + return w.client.InternalV1alpha1().StorageVersions().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/controllerrevision/controllerrevision.go b/client/injection/kube/informers/apps/v1/controllerrevision/controllerrevision.go index ca1a7ca284..500778bc90 100644 --- a/client/injection/kube/informers/apps/v1/controllerrevision/controllerrevision.go +++ b/client/injection/kube/informers/apps/v1/controllerrevision/controllerrevision.go @@ -21,7 +21,14 @@ package controllerrevision import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ControllerRevisionInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.ControllerRevisionInformer { } return untyped.(v1.ControllerRevisionInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.ControllerRevisionInformer = (*wrapper)(nil) +var _ appsv1.ControllerRevisionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.ControllerRevision{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.ControllerRevisionLister { + return w +} + +func (w *wrapper) ControllerRevisions(namespace string) appsv1.ControllerRevisionNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.ControllerRevision, err error) { + lo, err := w.client.AppsV1().ControllerRevisions(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.ControllerRevision, error) { + return w.client.AppsV1().ControllerRevisions(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go b/client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go index 43fbce0ff8..f73c184f87 100644 --- a/client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go +++ b/client/injection/kube/informers/apps/v1/controllerrevision/filtered/controllerrevision.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ControllerRevisionInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.ControllerRevisionInformer { } return untyped.(v1.ControllerRevisionInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.ControllerRevisionInformer = (*wrapper)(nil) +var _ appsv1.ControllerRevisionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.ControllerRevision{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.ControllerRevisionLister { + return w +} + +func (w *wrapper) ControllerRevisions(namespace string) appsv1.ControllerRevisionNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.ControllerRevision, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1().ControllerRevisions(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.ControllerRevision, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1().ControllerRevisions(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/daemonset/daemonset.go b/client/injection/kube/informers/apps/v1/daemonset/daemonset.go index 8f0e87f6c4..91cba37fed 100644 --- a/client/injection/kube/informers/apps/v1/daemonset/daemonset.go +++ b/client/injection/kube/informers/apps/v1/daemonset/daemonset.go @@ -21,7 +21,14 @@ package daemonset import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.DaemonSetInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.DaemonSetInformer { } return untyped.(v1.DaemonSetInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.DaemonSetInformer = (*wrapper)(nil) +var _ appsv1.DaemonSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.DaemonSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.DaemonSetLister { + return w +} + +func (w *wrapper) DaemonSets(namespace string) appsv1.DaemonSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.DaemonSet, err error) { + lo, err := w.client.AppsV1().DaemonSets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.DaemonSet, error) { + return w.client.AppsV1().DaemonSets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/daemonset/daemonset_expansion.go b/client/injection/kube/informers/apps/v1/daemonset/daemonset_expansion.go new file mode 100644 index 0000000000..b882083dc5 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/daemonset/daemonset_expansion.go @@ -0,0 +1,30 @@ +/* +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 daemonset + +import ( + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + panic("NYI") +} + +func (w *wrapper) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go b/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go index fecd9e26ec..9ca8bf6394 100644 --- a/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go +++ b/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.DaemonSetInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.DaemonSetInformer { } return untyped.(v1.DaemonSetInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.DaemonSetInformer = (*wrapper)(nil) +var _ appsv1.DaemonSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.DaemonSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.DaemonSetLister { + return w +} + +func (w *wrapper) DaemonSets(namespace string) appsv1.DaemonSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.DaemonSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1().DaemonSets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.DaemonSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1().DaemonSets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset_expansion.go b/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset_expansion.go new file mode 100644 index 0000000000..1ee0ae0ddc --- /dev/null +++ b/client/injection/kube/informers/apps/v1/daemonset/filtered/daemonset_expansion.go @@ -0,0 +1,30 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + panic("NYI") +} + +func (w *wrapper) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1/deployment/deployment.go b/client/injection/kube/informers/apps/v1/deployment/deployment.go index de9ff5c8c6..cd9ce21b15 100644 --- a/client/injection/kube/informers/apps/v1/deployment/deployment.go +++ b/client/injection/kube/informers/apps/v1/deployment/deployment.go @@ -21,7 +21,14 @@ package deployment import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.DeploymentInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.DeploymentInformer { } return untyped.(v1.DeploymentInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.DeploymentInformer = (*wrapper)(nil) +var _ appsv1.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) appsv1.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.Deployment, err error) { + lo, err := w.client.AppsV1().Deployments(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.Deployment, error) { + return w.client.AppsV1().Deployments(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go b/client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go index 1c73951e35..7e3f947034 100644 --- a/client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go +++ b/client/injection/kube/informers/apps/v1/deployment/filtered/deployment.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.DeploymentInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.DeploymentInformer { } return untyped.(v1.DeploymentInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.DeploymentInformer = (*wrapper)(nil) +var _ appsv1.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) appsv1.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.Deployment, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1().Deployments(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.Deployment, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1().Deployments(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go b/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go index 4386b6fb53..2487ced03f 100644 --- a/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go +++ b/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ReplicaSetInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.ReplicaSetInformer { } return untyped.(v1.ReplicaSetInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.ReplicaSetInformer = (*wrapper)(nil) +var _ appsv1.ReplicaSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.ReplicaSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.ReplicaSetLister { + return w +} + +func (w *wrapper) ReplicaSets(namespace string) appsv1.ReplicaSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.ReplicaSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1().ReplicaSets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.ReplicaSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1().ReplicaSets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset_expansion.go b/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset_expansion.go new file mode 100644 index 0000000000..53755fc468 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/replicaset/filtered/replicaset_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1/replicaset/replicaset.go b/client/injection/kube/informers/apps/v1/replicaset/replicaset.go index 6b3143fb6a..f1258c895b 100644 --- a/client/injection/kube/informers/apps/v1/replicaset/replicaset.go +++ b/client/injection/kube/informers/apps/v1/replicaset/replicaset.go @@ -21,7 +21,14 @@ package replicaset import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ReplicaSetInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.ReplicaSetInformer { } return untyped.(v1.ReplicaSetInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.ReplicaSetInformer = (*wrapper)(nil) +var _ appsv1.ReplicaSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.ReplicaSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.ReplicaSetLister { + return w +} + +func (w *wrapper) ReplicaSets(namespace string) appsv1.ReplicaSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.ReplicaSet, err error) { + lo, err := w.client.AppsV1().ReplicaSets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.ReplicaSet, error) { + return w.client.AppsV1().ReplicaSets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/replicaset/replicaset_expansion.go b/client/injection/kube/informers/apps/v1/replicaset/replicaset_expansion.go new file mode 100644 index 0000000000..345d91661f --- /dev/null +++ b/client/injection/kube/informers/apps/v1/replicaset/replicaset_expansion.go @@ -0,0 +1,26 @@ +/* +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 replicaset + +import ( + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go b/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go index a41cfc9284..b0c72f4db9 100644 --- a/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go +++ b/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.StatefulSetInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.StatefulSetInformer { } return untyped.(v1.StatefulSetInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.StatefulSetInformer = (*wrapper)(nil) +var _ appsv1.StatefulSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.StatefulSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.StatefulSetLister { + return w +} + +func (w *wrapper) StatefulSets(namespace string) appsv1.StatefulSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.StatefulSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1().StatefulSets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.StatefulSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1().StatefulSets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset_expansion.go b/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset_expansion.go new file mode 100644 index 0000000000..de388a1fcb --- /dev/null +++ b/client/injection/kube/informers/apps/v1/statefulset/filtered/statefulset_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1/statefulset/statefulset.go b/client/injection/kube/informers/apps/v1/statefulset/statefulset.go index d1aae06b75..877b76ffb6 100644 --- a/client/injection/kube/informers/apps/v1/statefulset/statefulset.go +++ b/client/injection/kube/informers/apps/v1/statefulset/statefulset.go @@ -21,7 +21,14 @@ package statefulset import ( context "context" + apiappsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.StatefulSetInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.StatefulSetInformer { } return untyped.(v1.StatefulSetInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.StatefulSetInformer = (*wrapper)(nil) +var _ appsv1.StatefulSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1.StatefulSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1.StatefulSetLister { + return w +} + +func (w *wrapper) StatefulSets(namespace string) appsv1.StatefulSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.StatefulSet, err error) { + lo, err := w.client.AppsV1().StatefulSets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1.StatefulSet, error) { + return w.client.AppsV1().StatefulSets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1/statefulset/statefulset_expansion.go b/client/injection/kube/informers/apps/v1/statefulset/statefulset_expansion.go new file mode 100644 index 0000000000..699b311d04 --- /dev/null +++ b/client/injection/kube/informers/apps/v1/statefulset/statefulset_expansion.go @@ -0,0 +1,26 @@ +/* +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 statefulset + +import ( + apps "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta1/controllerrevision/controllerrevision.go b/client/injection/kube/informers/apps/v1beta1/controllerrevision/controllerrevision.go new file mode 100644 index 0000000000..32d3b36fa1 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/controllerrevision/controllerrevision.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package controllerrevision + +import ( + context "context" + + apiappsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta1().ControllerRevisions() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.ControllerRevisionInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta1.ControllerRevisionInformer from context.") + } + return untyped.(v1beta1.ControllerRevisionInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.ControllerRevisionInformer = (*wrapper)(nil) +var _ appsv1beta1.ControllerRevisionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta1.ControllerRevision{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta1.ControllerRevisionLister { + return w +} + +func (w *wrapper) ControllerRevisions(namespace string) appsv1beta1.ControllerRevisionNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta1.ControllerRevision, err error) { + lo, err := w.client.AppsV1beta1().ControllerRevisions(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta1.ControllerRevision, error) { + return w.client.AppsV1beta1().ControllerRevisions(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta1/controllerrevision/fake/fake.go b/client/injection/kube/informers/apps/v1beta1/controllerrevision/fake/fake.go new file mode 100644 index 0000000000..9233a3bec9 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/controllerrevision/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + controllerrevision "knative.dev/pkg/client/injection/kube/informers/apps/v1beta1/controllerrevision" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = controllerrevision.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta1().ControllerRevisions() + return context.WithValue(ctx, controllerrevision.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta1/controllerrevision/filtered/controllerrevision.go b/client/injection/kube/informers/apps/v1beta1/controllerrevision/filtered/controllerrevision.go new file mode 100644 index 0000000000..f1d9f99389 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/controllerrevision/filtered/controllerrevision.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().ControllerRevisions() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.ControllerRevisionInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta1.ControllerRevisionInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.ControllerRevisionInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.ControllerRevisionInformer = (*wrapper)(nil) +var _ appsv1beta1.ControllerRevisionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta1.ControllerRevision{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta1.ControllerRevisionLister { + return w +} + +func (w *wrapper) ControllerRevisions(namespace string) appsv1beta1.ControllerRevisionNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta1.ControllerRevision, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta1().ControllerRevisions(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta1.ControllerRevision, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta1().ControllerRevisions(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta1/controllerrevision/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta1/controllerrevision/filtered/fake/fake.go new file mode 100644 index 0000000000..02e746abc7 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/controllerrevision/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta1/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().V1beta1().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/v1beta1/deployment/deployment.go b/client/injection/kube/informers/apps/v1beta1/deployment/deployment.go new file mode 100644 index 0000000000..006ab33e7d --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/deployment/deployment.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + + apiappsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta1().Deployments() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.DeploymentInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta1.DeploymentInformer from context.") + } + return untyped.(v1beta1.DeploymentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.DeploymentInformer = (*wrapper)(nil) +var _ appsv1beta1.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta1.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta1.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) appsv1beta1.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta1.Deployment, err error) { + lo, err := w.client.AppsV1beta1().Deployments(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta1.Deployment, error) { + return w.client.AppsV1beta1().Deployments(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta1/deployment/fake/fake.go b/client/injection/kube/informers/apps/v1beta1/deployment/fake/fake.go new file mode 100644 index 0000000000..cf754b29c1 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/deployment/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + deployment "knative.dev/pkg/client/injection/kube/informers/apps/v1beta1/deployment" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = deployment.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta1().Deployments() + return context.WithValue(ctx, deployment.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta1/deployment/filtered/deployment.go b/client/injection/kube/informers/apps/v1beta1/deployment/filtered/deployment.go new file mode 100644 index 0000000000..dd7cf3b40c --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/deployment/filtered/deployment.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().Deployments() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.DeploymentInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta1.DeploymentInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.DeploymentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.DeploymentInformer = (*wrapper)(nil) +var _ appsv1beta1.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta1.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta1.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) appsv1beta1.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta1.Deployment, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta1().Deployments(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta1.Deployment, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta1().Deployments(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta1/deployment/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta1/deployment/filtered/fake/fake.go new file mode 100644 index 0000000000..5bd7e11015 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/deployment/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta1/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().V1beta1().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/v1beta1/statefulset/fake/fake.go b/client/injection/kube/informers/apps/v1beta1/statefulset/fake/fake.go new file mode 100644 index 0000000000..20873468f1 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/statefulset/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + statefulset "knative.dev/pkg/client/injection/kube/informers/apps/v1beta1/statefulset" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = statefulset.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta1().StatefulSets() + return context.WithValue(ctx, statefulset.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/fake/fake.go new file mode 100644 index 0000000000..5f8166407f --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta1/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().V1beta1().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/v1beta1/statefulset/filtered/statefulset.go b/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/statefulset.go new file mode 100644 index 0000000000..1be469079b --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/statefulset.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().StatefulSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.StatefulSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta1.StatefulSetInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.StatefulSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.StatefulSetInformer = (*wrapper)(nil) +var _ appsv1beta1.StatefulSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta1.StatefulSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta1.StatefulSetLister { + return w +} + +func (w *wrapper) StatefulSets(namespace string) appsv1beta1.StatefulSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta1.StatefulSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta1().StatefulSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta1.StatefulSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta1().StatefulSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/statefulset_expansion.go b/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/statefulset_expansion.go new file mode 100644 index 0000000000..c486a01d34 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/statefulset/filtered/statefulset_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1beta1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta1/statefulset/statefulset.go b/client/injection/kube/informers/apps/v1beta1/statefulset/statefulset.go new file mode 100644 index 0000000000..cec806d3be --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/statefulset/statefulset.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package statefulset + +import ( + context "context" + + apiappsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta1().StatefulSets() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.StatefulSetInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta1.StatefulSetInformer from context.") + } + return untyped.(v1beta1.StatefulSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.StatefulSetInformer = (*wrapper)(nil) +var _ appsv1beta1.StatefulSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta1.StatefulSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta1.StatefulSetLister { + return w +} + +func (w *wrapper) StatefulSets(namespace string) appsv1beta1.StatefulSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta1.StatefulSet, err error) { + lo, err := w.client.AppsV1beta1().StatefulSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta1.StatefulSet, error) { + return w.client.AppsV1beta1().StatefulSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta1/statefulset/statefulset_expansion.go b/client/injection/kube/informers/apps/v1beta1/statefulset/statefulset_expansion.go new file mode 100644 index 0000000000..db868e9029 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta1/statefulset/statefulset_expansion.go @@ -0,0 +1,26 @@ +/* +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 statefulset + +import ( + apps "k8s.io/api/apps/v1beta1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta2/controllerrevision/controllerrevision.go b/client/injection/kube/informers/apps/v1beta2/controllerrevision/controllerrevision.go new file mode 100644 index 0000000000..8047f1fde8 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/controllerrevision/controllerrevision.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package controllerrevision + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta2().ControllerRevisions() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta2.ControllerRevisionInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.ControllerRevisionInformer from context.") + } + return untyped.(v1beta2.ControllerRevisionInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta2.ControllerRevisionInformer = (*wrapper)(nil) +var _ appsv1beta2.ControllerRevisionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.ControllerRevision{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.ControllerRevisionLister { + return w +} + +func (w *wrapper) ControllerRevisions(namespace string) appsv1beta2.ControllerRevisionNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.ControllerRevision, err error) { + lo, err := w.client.AppsV1beta2().ControllerRevisions(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.ControllerRevision, error) { + return w.client.AppsV1beta2().ControllerRevisions(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/controllerrevision/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/controllerrevision/fake/fake.go new file mode 100644 index 0000000000..1b726e5fb5 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/controllerrevision/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + controllerrevision "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/controllerrevision" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = controllerrevision.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta2().ControllerRevisions() + return context.WithValue(ctx, controllerrevision.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta2/controllerrevision/filtered/controllerrevision.go b/client/injection/kube/informers/apps/v1beta2/controllerrevision/filtered/controllerrevision.go new file mode 100644 index 0000000000..410fa88c13 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/controllerrevision/filtered/controllerrevision.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta2().ControllerRevisions() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta2.ControllerRevisionInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.ControllerRevisionInformer with selector %s from context.", selector) + } + return untyped.(v1beta2.ControllerRevisionInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta2.ControllerRevisionInformer = (*wrapper)(nil) +var _ appsv1beta2.ControllerRevisionLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.ControllerRevision{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.ControllerRevisionLister { + return w +} + +func (w *wrapper) ControllerRevisions(namespace string) appsv1beta2.ControllerRevisionNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.ControllerRevision, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta2().ControllerRevisions(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.ControllerRevision, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta2().ControllerRevisions(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/controllerrevision/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/controllerrevision/filtered/fake/fake.go new file mode 100644 index 0000000000..515d3795cc --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/controllerrevision/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/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().V1beta2().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/v1beta2/daemonset/daemonset.go b/client/injection/kube/informers/apps/v1beta2/daemonset/daemonset.go new file mode 100644 index 0000000000..de79da0f42 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/daemonset/daemonset.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package daemonset + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta2().DaemonSets() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta2.DaemonSetInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.DaemonSetInformer from context.") + } + return untyped.(v1beta2.DaemonSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta2.DaemonSetInformer = (*wrapper)(nil) +var _ appsv1beta2.DaemonSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.DaemonSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.DaemonSetLister { + return w +} + +func (w *wrapper) DaemonSets(namespace string) appsv1beta2.DaemonSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.DaemonSet, err error) { + lo, err := w.client.AppsV1beta2().DaemonSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.DaemonSet, error) { + return w.client.AppsV1beta2().DaemonSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/daemonset/daemonset_expansion.go b/client/injection/kube/informers/apps/v1beta2/daemonset/daemonset_expansion.go new file mode 100644 index 0000000000..b781af3de9 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/daemonset/daemonset_expansion.go @@ -0,0 +1,30 @@ +/* +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 daemonset + +import ( + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + panic("NYI") +} + +func (w *wrapper) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta2/daemonset/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/daemonset/fake/fake.go new file mode 100644 index 0000000000..0c10a5c2de --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/daemonset/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + daemonset "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/daemonset" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = daemonset.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta2().DaemonSets() + return context.WithValue(ctx, daemonset.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/daemonset.go b/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/daemonset.go new file mode 100644 index 0000000000..dde874333c --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/daemonset.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta2().DaemonSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta2.DaemonSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.DaemonSetInformer with selector %s from context.", selector) + } + return untyped.(v1beta2.DaemonSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta2.DaemonSetInformer = (*wrapper)(nil) +var _ appsv1beta2.DaemonSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.DaemonSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.DaemonSetLister { + return w +} + +func (w *wrapper) DaemonSets(namespace string) appsv1beta2.DaemonSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.DaemonSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta2().DaemonSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.DaemonSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta2().DaemonSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/daemonset_expansion.go b/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/daemonset_expansion.go new file mode 100644 index 0000000000..34ce2cfe63 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/daemonset_expansion.go @@ -0,0 +1,30 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + panic("NYI") +} + +func (w *wrapper) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/fake/fake.go new file mode 100644 index 0000000000..648ddf9b76 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/daemonset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/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().V1beta2().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/v1beta2/deployment/deployment.go b/client/injection/kube/informers/apps/v1beta2/deployment/deployment.go new file mode 100644 index 0000000000..6fcb7c1bed --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/deployment/deployment.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta2().Deployments() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta2.DeploymentInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.DeploymentInformer from context.") + } + return untyped.(v1beta2.DeploymentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta2.DeploymentInformer = (*wrapper)(nil) +var _ appsv1beta2.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) appsv1beta2.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.Deployment, err error) { + lo, err := w.client.AppsV1beta2().Deployments(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.Deployment, error) { + return w.client.AppsV1beta2().Deployments(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/deployment/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/deployment/fake/fake.go new file mode 100644 index 0000000000..c24ceb5c69 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/deployment/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + deployment "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/deployment" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = deployment.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta2().Deployments() + return context.WithValue(ctx, deployment.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta2/deployment/filtered/deployment.go b/client/injection/kube/informers/apps/v1beta2/deployment/filtered/deployment.go new file mode 100644 index 0000000000..67eee3e2aa --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/deployment/filtered/deployment.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta2().Deployments() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta2.DeploymentInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.DeploymentInformer with selector %s from context.", selector) + } + return untyped.(v1beta2.DeploymentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta2.DeploymentInformer = (*wrapper)(nil) +var _ appsv1beta2.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) appsv1beta2.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.Deployment, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta2().Deployments(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.Deployment, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta2().Deployments(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/deployment/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/deployment/filtered/fake/fake.go new file mode 100644 index 0000000000..61047a3003 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/deployment/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/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().V1beta2().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/v1beta2/replicaset/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/replicaset/fake/fake.go new file mode 100644 index 0000000000..949ed5b169 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/replicaset/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + replicaset "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/replicaset" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = replicaset.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta2().ReplicaSets() + return context.WithValue(ctx, replicaset.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/fake/fake.go new file mode 100644 index 0000000000..a4e7d30894 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/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().V1beta2().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/v1beta2/replicaset/filtered/replicaset.go b/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/replicaset.go new file mode 100644 index 0000000000..cc0f513ceb --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/replicaset.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta2().ReplicaSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta2.ReplicaSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.ReplicaSetInformer with selector %s from context.", selector) + } + return untyped.(v1beta2.ReplicaSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta2.ReplicaSetInformer = (*wrapper)(nil) +var _ appsv1beta2.ReplicaSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.ReplicaSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.ReplicaSetLister { + return w +} + +func (w *wrapper) ReplicaSets(namespace string) appsv1beta2.ReplicaSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.ReplicaSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta2().ReplicaSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.ReplicaSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta2().ReplicaSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/replicaset_expansion.go b/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/replicaset_expansion.go new file mode 100644 index 0000000000..ca8f008fdc --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/replicaset/filtered/replicaset_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta2/replicaset/replicaset.go b/client/injection/kube/informers/apps/v1beta2/replicaset/replicaset.go new file mode 100644 index 0000000000..999d78fe8b --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/replicaset/replicaset.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package replicaset + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta2().ReplicaSets() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta2.ReplicaSetInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.ReplicaSetInformer from context.") + } + return untyped.(v1beta2.ReplicaSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta2.ReplicaSetInformer = (*wrapper)(nil) +var _ appsv1beta2.ReplicaSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.ReplicaSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.ReplicaSetLister { + return w +} + +func (w *wrapper) ReplicaSets(namespace string) appsv1beta2.ReplicaSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.ReplicaSet, err error) { + lo, err := w.client.AppsV1beta2().ReplicaSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.ReplicaSet, error) { + return w.client.AppsV1beta2().ReplicaSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/replicaset/replicaset_expansion.go b/client/injection/kube/informers/apps/v1beta2/replicaset/replicaset_expansion.go new file mode 100644 index 0000000000..562d51287b --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/replicaset/replicaset_expansion.go @@ -0,0 +1,26 @@ +/* +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 replicaset + +import ( + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta2/statefulset/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/statefulset/fake/fake.go new file mode 100644 index 0000000000..cbb2c5eca0 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/statefulset/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + statefulset "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/statefulset" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = statefulset.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Apps().V1beta2().StatefulSets() + return context.WithValue(ctx, statefulset.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/fake/fake.go b/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/fake/fake.go new file mode 100644 index 0000000000..ac399b3299 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/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().V1beta2().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/v1beta2/statefulset/filtered/statefulset.go b/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/statefulset.go new file mode 100644 index 0000000000..b8a54faa71 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/statefulset.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta2().StatefulSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta2.StatefulSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.StatefulSetInformer with selector %s from context.", selector) + } + return untyped.(v1beta2.StatefulSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta2.StatefulSetInformer = (*wrapper)(nil) +var _ appsv1beta2.StatefulSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.StatefulSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.StatefulSetLister { + return w +} + +func (w *wrapper) StatefulSets(namespace string) appsv1beta2.StatefulSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.StatefulSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AppsV1beta2().StatefulSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.StatefulSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AppsV1beta2().StatefulSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/statefulset_expansion.go b/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/statefulset_expansion.go new file mode 100644 index 0000000000..e45058d8c5 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/statefulset/filtered/statefulset_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/apps/v1beta2/statefulset/statefulset.go b/client/injection/kube/informers/apps/v1beta2/statefulset/statefulset.go new file mode 100644 index 0000000000..57090a4f52 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/statefulset/statefulset.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package statefulset + +import ( + context "context" + + apiappsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Apps().V1beta2().StatefulSets() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta2.StatefulSetInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/apps/v1beta2.StatefulSetInformer from context.") + } + return untyped.(v1beta2.StatefulSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta2.StatefulSetInformer = (*wrapper)(nil) +var _ appsv1beta2.StatefulSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiappsv1beta2.StatefulSet{}, 0, nil) +} + +func (w *wrapper) Lister() appsv1beta2.StatefulSetLister { + return w +} + +func (w *wrapper) StatefulSets(namespace string) appsv1beta2.StatefulSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1beta2.StatefulSet, err error) { + lo, err := w.client.AppsV1beta2().StatefulSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiappsv1beta2.StatefulSet, error) { + return w.client.AppsV1beta2().StatefulSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/apps/v1beta2/statefulset/statefulset_expansion.go b/client/injection/kube/informers/apps/v1beta2/statefulset/statefulset_expansion.go new file mode 100644 index 0000000000..7349d88ba9 --- /dev/null +++ b/client/injection/kube/informers/apps/v1beta2/statefulset/statefulset_expansion.go @@ -0,0 +1,26 @@ +/* +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 statefulset + +import ( + apps "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go index 2bef34ad93..746966d11e 100644 --- a/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go +++ b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiautoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/autoscaling/v1" + kubernetes "k8s.io/client-go/kubernetes" + autoscalingv1 "k8s.io/client-go/listers/autoscaling/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.HorizontalPodAutoscalerInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.HorizontalPodAutoscalerInforme } return untyped.(v1.HorizontalPodAutoscalerInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.HorizontalPodAutoscalerInformer = (*wrapper)(nil) +var _ autoscalingv1.HorizontalPodAutoscalerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiautoscalingv1.HorizontalPodAutoscaler{}, 0, nil) +} + +func (w *wrapper) Lister() autoscalingv1.HorizontalPodAutoscalerLister { + return w +} + +func (w *wrapper) HorizontalPodAutoscalers(namespace string) autoscalingv1.HorizontalPodAutoscalerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiautoscalingv1.HorizontalPodAutoscaler, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AutoscalingV1().HorizontalPodAutoscalers(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiautoscalingv1.HorizontalPodAutoscaler, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AutoscalingV1().HorizontalPodAutoscalers(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/horizontalpodautoscaler.go index ecaca9a53e..e0eec04f05 100644 --- a/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/horizontalpodautoscaler.go +++ b/client/injection/kube/informers/autoscaling/v1/horizontalpodautoscaler/horizontalpodautoscaler.go @@ -21,7 +21,14 @@ package horizontalpodautoscaler import ( context "context" + apiautoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/autoscaling/v1" + kubernetes "k8s.io/client-go/kubernetes" + autoscalingv1 "k8s.io/client-go/listers/autoscaling/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.HorizontalPodAutoscalerInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.HorizontalPodAutoscalerInformer { } return untyped.(v1.HorizontalPodAutoscalerInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.HorizontalPodAutoscalerInformer = (*wrapper)(nil) +var _ autoscalingv1.HorizontalPodAutoscalerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiautoscalingv1.HorizontalPodAutoscaler{}, 0, nil) +} + +func (w *wrapper) Lister() autoscalingv1.HorizontalPodAutoscalerLister { + return w +} + +func (w *wrapper) HorizontalPodAutoscalers(namespace string) autoscalingv1.HorizontalPodAutoscalerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiautoscalingv1.HorizontalPodAutoscaler, err error) { + lo, err := w.client.AutoscalingV1().HorizontalPodAutoscalers(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiautoscalingv1.HorizontalPodAutoscaler, error) { + return w.client.AutoscalingV1().HorizontalPodAutoscalers(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go index d5063f6537..67c9ce518e 100644 --- a/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go +++ b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apiautoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v2beta1 "k8s.io/client-go/informers/autoscaling/v2beta1" + kubernetes "k8s.io/client-go/kubernetes" + autoscalingv2beta1 "k8s.io/client-go/listers/autoscaling/v2beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v2beta1.HorizontalPodAutoscalerInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v2beta1.HorizontalPodAutoscalerIn } return untyped.(v2beta1.HorizontalPodAutoscalerInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v2beta1.HorizontalPodAutoscalerInformer = (*wrapper)(nil) +var _ autoscalingv2beta1.HorizontalPodAutoscalerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiautoscalingv2beta1.HorizontalPodAutoscaler{}, 0, nil) +} + +func (w *wrapper) Lister() autoscalingv2beta1.HorizontalPodAutoscalerLister { + return w +} + +func (w *wrapper) HorizontalPodAutoscalers(namespace string) autoscalingv2beta1.HorizontalPodAutoscalerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiautoscalingv2beta1.HorizontalPodAutoscaler, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AutoscalingV2beta1().HorizontalPodAutoscalers(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiautoscalingv2beta1.HorizontalPodAutoscaler, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AutoscalingV2beta1().HorizontalPodAutoscalers(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/horizontalpodautoscaler.go index 4d7822e958..eb57f4be69 100644 --- a/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/horizontalpodautoscaler.go +++ b/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler/horizontalpodautoscaler.go @@ -21,7 +21,14 @@ package horizontalpodautoscaler import ( context "context" + apiautoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v2beta1 "k8s.io/client-go/informers/autoscaling/v2beta1" + kubernetes "k8s.io/client-go/kubernetes" + autoscalingv2beta1 "k8s.io/client-go/listers/autoscaling/v2beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v2beta1.HorizontalPodAutoscalerInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v2beta1.HorizontalPodAutoscalerInformer { } return untyped.(v2beta1.HorizontalPodAutoscalerInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v2beta1.HorizontalPodAutoscalerInformer = (*wrapper)(nil) +var _ autoscalingv2beta1.HorizontalPodAutoscalerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiautoscalingv2beta1.HorizontalPodAutoscaler{}, 0, nil) +} + +func (w *wrapper) Lister() autoscalingv2beta1.HorizontalPodAutoscalerLister { + return w +} + +func (w *wrapper) HorizontalPodAutoscalers(namespace string) autoscalingv2beta1.HorizontalPodAutoscalerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiautoscalingv2beta1.HorizontalPodAutoscaler, err error) { + lo, err := w.client.AutoscalingV2beta1().HorizontalPodAutoscalers(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiautoscalingv2beta1.HorizontalPodAutoscaler, error) { + return w.client.AutoscalingV2beta1().HorizontalPodAutoscalers(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/fake/fake.go b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/fake/fake.go new file mode 100644 index 0000000000..216057f63d --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + horizontalpodautoscaler "knative.dev/pkg/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = horizontalpodautoscaler.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Autoscaling().V2beta2().HorizontalPodAutoscalers() + return context.WithValue(ctx, horizontalpodautoscaler.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/filtered/fake/fake.go b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/filtered/fake/fake.go new file mode 100644 index 0000000000..035cf2c6cd --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/autoscaling/v2beta2/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().V2beta2().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/v2beta2/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go new file mode 100644 index 0000000000..588680155f --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/filtered/horizontalpodautoscaler.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiautoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v2beta2 "k8s.io/client-go/informers/autoscaling/v2beta2" + kubernetes "k8s.io/client-go/kubernetes" + autoscalingv2beta2 "k8s.io/client-go/listers/autoscaling/v2beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V2beta2().HorizontalPodAutoscalers() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v2beta2.HorizontalPodAutoscalerInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/autoscaling/v2beta2.HorizontalPodAutoscalerInformer with selector %s from context.", selector) + } + return untyped.(v2beta2.HorizontalPodAutoscalerInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v2beta2.HorizontalPodAutoscalerInformer = (*wrapper)(nil) +var _ autoscalingv2beta2.HorizontalPodAutoscalerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiautoscalingv2beta2.HorizontalPodAutoscaler{}, 0, nil) +} + +func (w *wrapper) Lister() autoscalingv2beta2.HorizontalPodAutoscalerLister { + return w +} + +func (w *wrapper) HorizontalPodAutoscalers(namespace string) autoscalingv2beta2.HorizontalPodAutoscalerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiautoscalingv2beta2.HorizontalPodAutoscaler, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.AutoscalingV2beta2().HorizontalPodAutoscalers(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiautoscalingv2beta2.HorizontalPodAutoscaler, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.AutoscalingV2beta2().HorizontalPodAutoscalers(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/horizontalpodautoscaler.go b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/horizontalpodautoscaler.go new file mode 100644 index 0000000000..0a0b4aae0c --- /dev/null +++ b/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler/horizontalpodautoscaler.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package horizontalpodautoscaler + +import ( + context "context" + + apiautoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v2beta2 "k8s.io/client-go/informers/autoscaling/v2beta2" + kubernetes "k8s.io/client-go/kubernetes" + autoscalingv2beta2 "k8s.io/client-go/listers/autoscaling/v2beta2" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Autoscaling().V2beta2().HorizontalPodAutoscalers() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v2beta2.HorizontalPodAutoscalerInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/autoscaling/v2beta2.HorizontalPodAutoscalerInformer from context.") + } + return untyped.(v2beta2.HorizontalPodAutoscalerInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v2beta2.HorizontalPodAutoscalerInformer = (*wrapper)(nil) +var _ autoscalingv2beta2.HorizontalPodAutoscalerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiautoscalingv2beta2.HorizontalPodAutoscaler{}, 0, nil) +} + +func (w *wrapper) Lister() autoscalingv2beta2.HorizontalPodAutoscalerLister { + return w +} + +func (w *wrapper) HorizontalPodAutoscalers(namespace string) autoscalingv2beta2.HorizontalPodAutoscalerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiautoscalingv2beta2.HorizontalPodAutoscaler, err error) { + lo, err := w.client.AutoscalingV2beta2().HorizontalPodAutoscalers(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiautoscalingv2beta2.HorizontalPodAutoscaler, error) { + return w.client.AutoscalingV2beta2().HorizontalPodAutoscalers(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/batch/v1/job/filtered/job.go b/client/injection/kube/informers/batch/v1/job/filtered/job.go index 28370b3cd7..881a9302c2 100644 --- a/client/injection/kube/informers/batch/v1/job/filtered/job.go +++ b/client/injection/kube/informers/batch/v1/job/filtered/job.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apibatchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/batch/v1" + kubernetes "k8s.io/client-go/kubernetes" + batchv1 "k8s.io/client-go/listers/batch/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.JobInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.JobInformer { } return untyped.(v1.JobInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.JobInformer = (*wrapper)(nil) +var _ batchv1.JobLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apibatchv1.Job{}, 0, nil) +} + +func (w *wrapper) Lister() batchv1.JobLister { + return w +} + +func (w *wrapper) Jobs(namespace string) batchv1.JobNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apibatchv1.Job, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.BatchV1().Jobs(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apibatchv1.Job, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.BatchV1().Jobs(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/batch/v1/job/filtered/job_expansion.go b/client/injection/kube/informers/batch/v1/job/filtered/job_expansion.go new file mode 100644 index 0000000000..548113bd31 --- /dev/null +++ b/client/injection/kube/informers/batch/v1/job/filtered/job_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + batch "k8s.io/api/batch/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodJobs(pod *v1.Pod) ([]batch.Job, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/batch/v1/job/job.go b/client/injection/kube/informers/batch/v1/job/job.go index 90a3652772..78b675760e 100644 --- a/client/injection/kube/informers/batch/v1/job/job.go +++ b/client/injection/kube/informers/batch/v1/job/job.go @@ -21,7 +21,14 @@ package job import ( context "context" + apibatchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/batch/v1" + kubernetes "k8s.io/client-go/kubernetes" + batchv1 "k8s.io/client-go/listers/batch/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.JobInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.JobInformer { } return untyped.(v1.JobInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.JobInformer = (*wrapper)(nil) +var _ batchv1.JobLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apibatchv1.Job{}, 0, nil) +} + +func (w *wrapper) Lister() batchv1.JobLister { + return w +} + +func (w *wrapper) Jobs(namespace string) batchv1.JobNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apibatchv1.Job, err error) { + lo, err := w.client.BatchV1().Jobs(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apibatchv1.Job, error) { + return w.client.BatchV1().Jobs(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/batch/v1/job/job_expansion.go b/client/injection/kube/informers/batch/v1/job/job_expansion.go new file mode 100644 index 0000000000..4a1fde18b8 --- /dev/null +++ b/client/injection/kube/informers/batch/v1/job/job_expansion.go @@ -0,0 +1,26 @@ +/* +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 job + +import ( + batch "k8s.io/api/batch/v1" + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodJobs(pod *v1.Pod) ([]batch.Job, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/batch/v1beta1/cronjob/cronjob.go b/client/injection/kube/informers/batch/v1beta1/cronjob/cronjob.go index 7b7ecfbe58..5e5ed5aff5 100644 --- a/client/injection/kube/informers/batch/v1beta1/cronjob/cronjob.go +++ b/client/injection/kube/informers/batch/v1beta1/cronjob/cronjob.go @@ -21,7 +21,14 @@ package cronjob import ( context "context" + apibatchv1beta1 "k8s.io/api/batch/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1beta1 "k8s.io/client-go/informers/batch/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + batchv1beta1 "k8s.io/client-go/listers/batch/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1beta1.CronJobInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1beta1.CronJobInformer { } return untyped.(v1beta1.CronJobInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.CronJobInformer = (*wrapper)(nil) +var _ batchv1beta1.CronJobLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apibatchv1beta1.CronJob{}, 0, nil) +} + +func (w *wrapper) Lister() batchv1beta1.CronJobLister { + return w +} + +func (w *wrapper) CronJobs(namespace string) batchv1beta1.CronJobNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apibatchv1beta1.CronJob, err error) { + lo, err := w.client.BatchV1beta1().CronJobs(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apibatchv1beta1.CronJob, error) { + return w.client.BatchV1beta1().CronJobs(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go b/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go index 0618ad1581..c3b2432fe0 100644 --- a/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go +++ b/client/injection/kube/informers/batch/v1beta1/cronjob/filtered/cronjob.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apibatchv1beta1 "k8s.io/api/batch/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1beta1 "k8s.io/client-go/informers/batch/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + batchv1beta1 "k8s.io/client-go/listers/batch/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1beta1.CronJobInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1beta1.CronJobInformer { } return untyped.(v1beta1.CronJobInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.CronJobInformer = (*wrapper)(nil) +var _ batchv1beta1.CronJobLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apibatchv1beta1.CronJob{}, 0, nil) +} + +func (w *wrapper) Lister() batchv1beta1.CronJobLister { + return w +} + +func (w *wrapper) CronJobs(namespace string) batchv1beta1.CronJobNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apibatchv1beta1.CronJob, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.BatchV1beta1().CronJobs(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apibatchv1beta1.CronJob, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.BatchV1beta1().CronJobs(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/batch/v2alpha1/cronjob/cronjob.go b/client/injection/kube/informers/batch/v2alpha1/cronjob/cronjob.go new file mode 100644 index 0000000000..3b9deeada6 --- /dev/null +++ b/client/injection/kube/informers/batch/v2alpha1/cronjob/cronjob.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package cronjob + +import ( + context "context" + + apibatchv2alpha1 "k8s.io/api/batch/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v2alpha1 "k8s.io/client-go/informers/batch/v2alpha1" + kubernetes "k8s.io/client-go/kubernetes" + batchv2alpha1 "k8s.io/client-go/listers/batch/v2alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Batch().V2alpha1().CronJobs() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v2alpha1.CronJobInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/batch/v2alpha1.CronJobInformer from context.") + } + return untyped.(v2alpha1.CronJobInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v2alpha1.CronJobInformer = (*wrapper)(nil) +var _ batchv2alpha1.CronJobLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apibatchv2alpha1.CronJob{}, 0, nil) +} + +func (w *wrapper) Lister() batchv2alpha1.CronJobLister { + return w +} + +func (w *wrapper) CronJobs(namespace string) batchv2alpha1.CronJobNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apibatchv2alpha1.CronJob, err error) { + lo, err := w.client.BatchV2alpha1().CronJobs(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apibatchv2alpha1.CronJob, error) { + return w.client.BatchV2alpha1().CronJobs(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/batch/v2alpha1/cronjob/fake/fake.go b/client/injection/kube/informers/batch/v2alpha1/cronjob/fake/fake.go new file mode 100644 index 0000000000..49f43769b9 --- /dev/null +++ b/client/injection/kube/informers/batch/v2alpha1/cronjob/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + cronjob "knative.dev/pkg/client/injection/kube/informers/batch/v2alpha1/cronjob" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = cronjob.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Batch().V2alpha1().CronJobs() + return context.WithValue(ctx, cronjob.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/batch/v2alpha1/cronjob/filtered/cronjob.go b/client/injection/kube/informers/batch/v2alpha1/cronjob/filtered/cronjob.go new file mode 100644 index 0000000000..6109d11ec1 --- /dev/null +++ b/client/injection/kube/informers/batch/v2alpha1/cronjob/filtered/cronjob.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apibatchv2alpha1 "k8s.io/api/batch/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v2alpha1 "k8s.io/client-go/informers/batch/v2alpha1" + kubernetes "k8s.io/client-go/kubernetes" + batchv2alpha1 "k8s.io/client-go/listers/batch/v2alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V2alpha1().CronJobs() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v2alpha1.CronJobInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/batch/v2alpha1.CronJobInformer with selector %s from context.", selector) + } + return untyped.(v2alpha1.CronJobInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v2alpha1.CronJobInformer = (*wrapper)(nil) +var _ batchv2alpha1.CronJobLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apibatchv2alpha1.CronJob{}, 0, nil) +} + +func (w *wrapper) Lister() batchv2alpha1.CronJobLister { + return w +} + +func (w *wrapper) CronJobs(namespace string) batchv2alpha1.CronJobNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apibatchv2alpha1.CronJob, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.BatchV2alpha1().CronJobs(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apibatchv2alpha1.CronJob, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.BatchV2alpha1().CronJobs(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/batch/v2alpha1/cronjob/filtered/fake/fake.go b/client/injection/kube/informers/batch/v2alpha1/cronjob/filtered/fake/fake.go new file mode 100644 index 0000000000..900cfb18ca --- /dev/null +++ b/client/injection/kube/informers/batch/v2alpha1/cronjob/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/batch/v2alpha1/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().V2alpha1().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/certificates/v1/certificatesigningrequest/certificatesigningrequest.go b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/certificatesigningrequest.go new file mode 100644 index 0000000000..fb50db4afd --- /dev/null +++ b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/certificatesigningrequest.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package certificatesigningrequest + +import ( + context "context" + + apicertificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/certificates/v1" + kubernetes "k8s.io/client-go/kubernetes" + certificatesv1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Certificates().V1().CertificateSigningRequests() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.CertificateSigningRequestInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/certificates/v1.CertificateSigningRequestInformer from context.") + } + return untyped.(v1.CertificateSigningRequestInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.CertificateSigningRequestInformer = (*wrapper)(nil) +var _ certificatesv1.CertificateSigningRequestLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicertificatesv1.CertificateSigningRequest{}, 0, nil) +} + +func (w *wrapper) Lister() certificatesv1.CertificateSigningRequestLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicertificatesv1.CertificateSigningRequest, err error) { + lo, err := w.client.CertificatesV1().CertificateSigningRequests().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicertificatesv1.CertificateSigningRequest, error) { + return w.client.CertificatesV1().CertificateSigningRequests().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/certificates/v1/certificatesigningrequest/fake/fake.go b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/fake/fake.go new file mode 100644 index 0000000000..58130c0fae --- /dev/null +++ b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + certificatesigningrequest "knative.dev/pkg/client/injection/kube/informers/certificates/v1/certificatesigningrequest" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = certificatesigningrequest.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Certificates().V1().CertificateSigningRequests() + return context.WithValue(ctx, certificatesigningrequest.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/certificates/v1/certificatesigningrequest/filtered/certificatesigningrequest.go b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/filtered/certificatesigningrequest.go new file mode 100644 index 0000000000..a19bada6ad --- /dev/null +++ b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/filtered/certificatesigningrequest.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apicertificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/certificates/v1" + kubernetes "k8s.io/client-go/kubernetes" + certificatesv1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Certificates().V1().CertificateSigningRequests() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.CertificateSigningRequestInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/certificates/v1.CertificateSigningRequestInformer with selector %s from context.", selector) + } + return untyped.(v1.CertificateSigningRequestInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.CertificateSigningRequestInformer = (*wrapper)(nil) +var _ certificatesv1.CertificateSigningRequestLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicertificatesv1.CertificateSigningRequest{}, 0, nil) +} + +func (w *wrapper) Lister() certificatesv1.CertificateSigningRequestLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicertificatesv1.CertificateSigningRequest, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CertificatesV1().CertificateSigningRequests().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicertificatesv1.CertificateSigningRequest, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CertificatesV1().CertificateSigningRequests().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/certificates/v1/certificatesigningrequest/filtered/fake/fake.go b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/filtered/fake/fake.go new file mode 100644 index 0000000000..9e9532c490 --- /dev/null +++ b/client/injection/kube/informers/certificates/v1/certificatesigningrequest/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/certificates/v1/certificatesigningrequest/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.Certificates().V1().CertificateSigningRequests() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/certificatesigningrequest.go b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/certificatesigningrequest.go new file mode 100644 index 0000000000..e00fe81b09 --- /dev/null +++ b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/certificatesigningrequest.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package certificatesigningrequest + +import ( + context "context" + + apicertificatesv1beta1 "k8s.io/api/certificates/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/certificates/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + certificatesv1beta1 "k8s.io/client-go/listers/certificates/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Certificates().V1beta1().CertificateSigningRequests() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.CertificateSigningRequestInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/certificates/v1beta1.CertificateSigningRequestInformer from context.") + } + return untyped.(v1beta1.CertificateSigningRequestInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.CertificateSigningRequestInformer = (*wrapper)(nil) +var _ certificatesv1beta1.CertificateSigningRequestLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicertificatesv1beta1.CertificateSigningRequest{}, 0, nil) +} + +func (w *wrapper) Lister() certificatesv1beta1.CertificateSigningRequestLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicertificatesv1beta1.CertificateSigningRequest, err error) { + lo, err := w.client.CertificatesV1beta1().CertificateSigningRequests().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicertificatesv1beta1.CertificateSigningRequest, error) { + return w.client.CertificatesV1beta1().CertificateSigningRequests().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/fake/fake.go b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/fake/fake.go new file mode 100644 index 0000000000..432853d823 --- /dev/null +++ b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + certificatesigningrequest "knative.dev/pkg/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = certificatesigningrequest.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Certificates().V1beta1().CertificateSigningRequests() + return context.WithValue(ctx, certificatesigningrequest.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/filtered/certificatesigningrequest.go b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/filtered/certificatesigningrequest.go new file mode 100644 index 0000000000..ad65389c71 --- /dev/null +++ b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/filtered/certificatesigningrequest.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apicertificatesv1beta1 "k8s.io/api/certificates/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/certificates/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + certificatesv1beta1 "k8s.io/client-go/listers/certificates/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Certificates().V1beta1().CertificateSigningRequests() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.CertificateSigningRequestInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/certificates/v1beta1.CertificateSigningRequestInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.CertificateSigningRequestInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.CertificateSigningRequestInformer = (*wrapper)(nil) +var _ certificatesv1beta1.CertificateSigningRequestLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicertificatesv1beta1.CertificateSigningRequest{}, 0, nil) +} + +func (w *wrapper) Lister() certificatesv1beta1.CertificateSigningRequestLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicertificatesv1beta1.CertificateSigningRequest, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CertificatesV1beta1().CertificateSigningRequests().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicertificatesv1beta1.CertificateSigningRequest, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CertificatesV1beta1().CertificateSigningRequests().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/filtered/fake/fake.go b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/filtered/fake/fake.go new file mode 100644 index 0000000000..f16ba16dc8 --- /dev/null +++ b/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/certificates/v1beta1/certificatesigningrequest/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.Certificates().V1beta1().CertificateSigningRequests() + 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 index 0e727e7b9f..d20234ff31 100644 --- a/client/injection/kube/informers/coordination/v1/lease/filtered/lease.go +++ b/client/injection/kube/informers/coordination/v1/lease/filtered/lease.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicoordinationv1 "k8s.io/api/coordination/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/coordination/v1" + kubernetes "k8s.io/client-go/kubernetes" + coordinationv1 "k8s.io/client-go/listers/coordination/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.LeaseInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.LeaseInformer { } return untyped.(v1.LeaseInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.LeaseInformer = (*wrapper)(nil) +var _ coordinationv1.LeaseLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicoordinationv1.Lease{}, 0, nil) +} + +func (w *wrapper) Lister() coordinationv1.LeaseLister { + return w +} + +func (w *wrapper) Leases(namespace string) coordinationv1.LeaseNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicoordinationv1.Lease, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoordinationV1().Leases(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicoordinationv1.Lease, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoordinationV1().Leases(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/coordination/v1/lease/lease.go b/client/injection/kube/informers/coordination/v1/lease/lease.go index deb89931a1..410d43ce7e 100644 --- a/client/injection/kube/informers/coordination/v1/lease/lease.go +++ b/client/injection/kube/informers/coordination/v1/lease/lease.go @@ -21,7 +21,14 @@ package lease import ( context "context" + apicoordinationv1 "k8s.io/api/coordination/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/coordination/v1" + kubernetes "k8s.io/client-go/kubernetes" + coordinationv1 "k8s.io/client-go/listers/coordination/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.LeaseInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.LeaseInformer { } return untyped.(v1.LeaseInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.LeaseInformer = (*wrapper)(nil) +var _ coordinationv1.LeaseLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicoordinationv1.Lease{}, 0, nil) +} + +func (w *wrapper) Lister() coordinationv1.LeaseLister { + return w +} + +func (w *wrapper) Leases(namespace string) coordinationv1.LeaseNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicoordinationv1.Lease, err error) { + lo, err := w.client.CoordinationV1().Leases(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicoordinationv1.Lease, error) { + return w.client.CoordinationV1().Leases(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/coordination/v1beta1/lease/fake/fake.go b/client/injection/kube/informers/coordination/v1beta1/lease/fake/fake.go new file mode 100644 index 0000000000..0ffcafff25 --- /dev/null +++ b/client/injection/kube/informers/coordination/v1beta1/lease/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + lease "knative.dev/pkg/client/injection/kube/informers/coordination/v1beta1/lease" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = lease.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Coordination().V1beta1().Leases() + return context.WithValue(ctx, lease.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/coordination/v1beta1/lease/filtered/fake/fake.go b/client/injection/kube/informers/coordination/v1beta1/lease/filtered/fake/fake.go new file mode 100644 index 0000000000..2789532654 --- /dev/null +++ b/client/injection/kube/informers/coordination/v1beta1/lease/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/coordination/v1beta1/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().V1beta1().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/v1beta1/lease/filtered/lease.go b/client/injection/kube/informers/coordination/v1beta1/lease/filtered/lease.go new file mode 100644 index 0000000000..407abeb6de --- /dev/null +++ b/client/injection/kube/informers/coordination/v1beta1/lease/filtered/lease.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apicoordinationv1beta1 "k8s.io/api/coordination/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/coordination/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + coordinationv1beta1 "k8s.io/client-go/listers/coordination/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().Leases() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.LeaseInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/coordination/v1beta1.LeaseInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.LeaseInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.LeaseInformer = (*wrapper)(nil) +var _ coordinationv1beta1.LeaseLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicoordinationv1beta1.Lease{}, 0, nil) +} + +func (w *wrapper) Lister() coordinationv1beta1.LeaseLister { + return w +} + +func (w *wrapper) Leases(namespace string) coordinationv1beta1.LeaseNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicoordinationv1beta1.Lease, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoordinationV1beta1().Leases(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicoordinationv1beta1.Lease, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoordinationV1beta1().Leases(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/coordination/v1beta1/lease/lease.go b/client/injection/kube/informers/coordination/v1beta1/lease/lease.go new file mode 100644 index 0000000000..59fe12aa0d --- /dev/null +++ b/client/injection/kube/informers/coordination/v1beta1/lease/lease.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package lease + +import ( + context "context" + + apicoordinationv1beta1 "k8s.io/api/coordination/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/coordination/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + coordinationv1beta1 "k8s.io/client-go/listers/coordination/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Coordination().V1beta1().Leases() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.LeaseInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/coordination/v1beta1.LeaseInformer from context.") + } + return untyped.(v1beta1.LeaseInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.LeaseInformer = (*wrapper)(nil) +var _ coordinationv1beta1.LeaseLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicoordinationv1beta1.Lease{}, 0, nil) +} + +func (w *wrapper) Lister() coordinationv1beta1.LeaseLister { + return w +} + +func (w *wrapper) Leases(namespace string) coordinationv1beta1.LeaseNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicoordinationv1beta1.Lease, err error) { + lo, err := w.client.CoordinationV1beta1().Leases(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicoordinationv1beta1.Lease, error) { + return w.client.CoordinationV1beta1().Leases(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/componentstatus/componentstatus.go b/client/injection/kube/informers/core/v1/componentstatus/componentstatus.go index 38f41c5885..fba3b6b1ec 100644 --- a/client/injection/kube/informers/core/v1/componentstatus/componentstatus.go +++ b/client/injection/kube/informers/core/v1/componentstatus/componentstatus.go @@ -21,7 +21,14 @@ package componentstatus import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ComponentStatusInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.ComponentStatusInformer { } return untyped.(v1.ComponentStatusInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.ComponentStatusInformer = (*wrapper)(nil) +var _ corev1.ComponentStatusLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ComponentStatus{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ComponentStatusLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ComponentStatus, err error) { + lo, err := w.client.CoreV1().ComponentStatuses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ComponentStatus, error) { + return w.client.CoreV1().ComponentStatuses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go b/client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go index 4dc1ff0634..b14bde77e4 100644 --- a/client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go +++ b/client/injection/kube/informers/core/v1/componentstatus/filtered/componentstatus.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ComponentStatusInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.ComponentStatusInformer { } return untyped.(v1.ComponentStatusInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.ComponentStatusInformer = (*wrapper)(nil) +var _ corev1.ComponentStatusLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ComponentStatus{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ComponentStatusLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ComponentStatus, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().ComponentStatuses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ComponentStatus, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().ComponentStatuses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/configmap/configmap.go b/client/injection/kube/informers/core/v1/configmap/configmap.go index 35eb9fc71c..f939fee7d8 100644 --- a/client/injection/kube/informers/core/v1/configmap/configmap.go +++ b/client/injection/kube/informers/core/v1/configmap/configmap.go @@ -21,7 +21,14 @@ package configmap import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ConfigMapInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.ConfigMapInformer { } return untyped.(v1.ConfigMapInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.ConfigMapInformer = (*wrapper)(nil) +var _ corev1.ConfigMapLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ConfigMap{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ConfigMapLister { + return w +} + +func (w *wrapper) ConfigMaps(namespace string) corev1.ConfigMapNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ConfigMap, err error) { + lo, err := w.client.CoreV1().ConfigMaps(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ConfigMap, error) { + return w.client.CoreV1().ConfigMaps(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/configmap/filtered/configmap.go b/client/injection/kube/informers/core/v1/configmap/filtered/configmap.go index 04ab49659c..6fd0abf406 100644 --- a/client/injection/kube/informers/core/v1/configmap/filtered/configmap.go +++ b/client/injection/kube/informers/core/v1/configmap/filtered/configmap.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ConfigMapInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.ConfigMapInformer { } return untyped.(v1.ConfigMapInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.ConfigMapInformer = (*wrapper)(nil) +var _ corev1.ConfigMapLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ConfigMap{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ConfigMapLister { + return w +} + +func (w *wrapper) ConfigMaps(namespace string) corev1.ConfigMapNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ConfigMap, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().ConfigMaps(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ConfigMap, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().ConfigMaps(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/endpoints/endpoints.go b/client/injection/kube/informers/core/v1/endpoints/endpoints.go index daa392ae0e..b59f5e7e25 100644 --- a/client/injection/kube/informers/core/v1/endpoints/endpoints.go +++ b/client/injection/kube/informers/core/v1/endpoints/endpoints.go @@ -21,7 +21,14 @@ package endpoints import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.EndpointsInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.EndpointsInformer { } return untyped.(v1.EndpointsInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.EndpointsInformer = (*wrapper)(nil) +var _ corev1.EndpointsLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Endpoints{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.EndpointsLister { + return w +} + +func (w *wrapper) Endpoints(namespace string) corev1.EndpointsNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Endpoints, err error) { + lo, err := w.client.CoreV1().Endpoints(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Endpoints, error) { + return w.client.CoreV1().Endpoints(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go b/client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go index 596334ea3a..06be7b3663 100644 --- a/client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go +++ b/client/injection/kube/informers/core/v1/endpoints/filtered/endpoints.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.EndpointsInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.EndpointsInformer { } return untyped.(v1.EndpointsInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.EndpointsInformer = (*wrapper)(nil) +var _ corev1.EndpointsLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Endpoints{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.EndpointsLister { + return w +} + +func (w *wrapper) Endpoints(namespace string) corev1.EndpointsNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Endpoints, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().Endpoints(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Endpoints, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().Endpoints(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/event/event.go b/client/injection/kube/informers/core/v1/event/event.go index 34818be109..cfa001953f 100644 --- a/client/injection/kube/informers/core/v1/event/event.go +++ b/client/injection/kube/informers/core/v1/event/event.go @@ -21,7 +21,14 @@ package event import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.EventInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.EventInformer { } return untyped.(v1.EventInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.EventInformer = (*wrapper)(nil) +var _ corev1.EventLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Event{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.EventLister { + return w +} + +func (w *wrapper) Events(namespace string) corev1.EventNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Event, err error) { + lo, err := w.client.CoreV1().Events(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Event, error) { + return w.client.CoreV1().Events(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/event/filtered/event.go b/client/injection/kube/informers/core/v1/event/filtered/event.go index 13775f0ea1..d5f81922ef 100644 --- a/client/injection/kube/informers/core/v1/event/filtered/event.go +++ b/client/injection/kube/informers/core/v1/event/filtered/event.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.EventInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.EventInformer { } return untyped.(v1.EventInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.EventInformer = (*wrapper)(nil) +var _ corev1.EventLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Event{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.EventLister { + return w +} + +func (w *wrapper) Events(namespace string) corev1.EventNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Event, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().Events(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Event, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().Events(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go b/client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go index a0ee89d3bd..3065b025e0 100644 --- a/client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go +++ b/client/injection/kube/informers/core/v1/limitrange/filtered/limitrange.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.LimitRangeInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.LimitRangeInformer { } return untyped.(v1.LimitRangeInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.LimitRangeInformer = (*wrapper)(nil) +var _ corev1.LimitRangeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.LimitRange{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.LimitRangeLister { + return w +} + +func (w *wrapper) LimitRanges(namespace string) corev1.LimitRangeNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.LimitRange, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().LimitRanges(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.LimitRange, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().LimitRanges(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/limitrange/limitrange.go b/client/injection/kube/informers/core/v1/limitrange/limitrange.go index 0b4a9d20b5..d86077f7db 100644 --- a/client/injection/kube/informers/core/v1/limitrange/limitrange.go +++ b/client/injection/kube/informers/core/v1/limitrange/limitrange.go @@ -21,7 +21,14 @@ package limitrange import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.LimitRangeInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.LimitRangeInformer { } return untyped.(v1.LimitRangeInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.LimitRangeInformer = (*wrapper)(nil) +var _ corev1.LimitRangeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.LimitRange{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.LimitRangeLister { + return w +} + +func (w *wrapper) LimitRanges(namespace string) corev1.LimitRangeNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.LimitRange, err error) { + lo, err := w.client.CoreV1().LimitRanges(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.LimitRange, error) { + return w.client.CoreV1().LimitRanges(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/namespace/filtered/namespace.go b/client/injection/kube/informers/core/v1/namespace/filtered/namespace.go index 06ca2b947d..03f6549e7c 100644 --- a/client/injection/kube/informers/core/v1/namespace/filtered/namespace.go +++ b/client/injection/kube/informers/core/v1/namespace/filtered/namespace.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.NamespaceInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.NamespaceInformer { } return untyped.(v1.NamespaceInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.NamespaceInformer = (*wrapper)(nil) +var _ corev1.NamespaceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Namespace{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.NamespaceLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Namespace, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Namespace, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/namespace/namespace.go b/client/injection/kube/informers/core/v1/namespace/namespace.go index 0029809035..3dd1ff4683 100644 --- a/client/injection/kube/informers/core/v1/namespace/namespace.go +++ b/client/injection/kube/informers/core/v1/namespace/namespace.go @@ -21,7 +21,14 @@ package namespace import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.NamespaceInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.NamespaceInformer { } return untyped.(v1.NamespaceInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.NamespaceInformer = (*wrapper)(nil) +var _ corev1.NamespaceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Namespace{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.NamespaceLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Namespace, err error) { + lo, err := w.client.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Namespace, error) { + return w.client.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/node/filtered/node.go b/client/injection/kube/informers/core/v1/node/filtered/node.go index 125afdcbf1..735aa0236f 100644 --- a/client/injection/kube/informers/core/v1/node/filtered/node.go +++ b/client/injection/kube/informers/core/v1/node/filtered/node.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.NodeInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.NodeInformer { } return untyped.(v1.NodeInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.NodeInformer = (*wrapper)(nil) +var _ corev1.NodeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Node{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.NodeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Node, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Node, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().Nodes().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/node/node.go b/client/injection/kube/informers/core/v1/node/node.go index 776fcc415d..d07fdfa484 100644 --- a/client/injection/kube/informers/core/v1/node/node.go +++ b/client/injection/kube/informers/core/v1/node/node.go @@ -21,7 +21,14 @@ package node import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.NodeInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.NodeInformer { } return untyped.(v1.NodeInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.NodeInformer = (*wrapper)(nil) +var _ corev1.NodeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Node{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.NodeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Node, err error) { + lo, err := w.client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Node, error) { + return w.client.CoreV1().Nodes().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go b/client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go index 593aa4cf2a..cce57509e6 100644 --- a/client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go +++ b/client/injection/kube/informers/core/v1/persistentvolume/filtered/persistentvolume.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.PersistentVolumeInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.PersistentVolumeInformer { } return untyped.(v1.PersistentVolumeInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.PersistentVolumeInformer = (*wrapper)(nil) +var _ corev1.PersistentVolumeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.PersistentVolume{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PersistentVolumeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.PersistentVolume, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().PersistentVolumes().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.PersistentVolume, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().PersistentVolumes().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/persistentvolume/persistentvolume.go b/client/injection/kube/informers/core/v1/persistentvolume/persistentvolume.go index 1d7db77683..2399741da6 100644 --- a/client/injection/kube/informers/core/v1/persistentvolume/persistentvolume.go +++ b/client/injection/kube/informers/core/v1/persistentvolume/persistentvolume.go @@ -21,7 +21,14 @@ package persistentvolume import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.PersistentVolumeInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.PersistentVolumeInformer { } return untyped.(v1.PersistentVolumeInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.PersistentVolumeInformer = (*wrapper)(nil) +var _ corev1.PersistentVolumeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.PersistentVolume{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PersistentVolumeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.PersistentVolume, err error) { + lo, err := w.client.CoreV1().PersistentVolumes().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.PersistentVolume, error) { + return w.client.CoreV1().PersistentVolumes().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go b/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go index 81a05b4abe..ade2bf2175 100644 --- a/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go +++ b/client/injection/kube/informers/core/v1/persistentvolumeclaim/filtered/persistentvolumeclaim.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.PersistentVolumeClaimInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.PersistentVolumeClaimInformer } return untyped.(v1.PersistentVolumeClaimInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.PersistentVolumeClaimInformer = (*wrapper)(nil) +var _ corev1.PersistentVolumeClaimLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.PersistentVolumeClaim{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PersistentVolumeClaimLister { + return w +} + +func (w *wrapper) PersistentVolumeClaims(namespace string) corev1.PersistentVolumeClaimNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.PersistentVolumeClaim, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().PersistentVolumeClaims(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.PersistentVolumeClaim, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().PersistentVolumeClaims(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/persistentvolumeclaim/persistentvolumeclaim.go b/client/injection/kube/informers/core/v1/persistentvolumeclaim/persistentvolumeclaim.go index 22d96a8bf4..60c75d4ef2 100644 --- a/client/injection/kube/informers/core/v1/persistentvolumeclaim/persistentvolumeclaim.go +++ b/client/injection/kube/informers/core/v1/persistentvolumeclaim/persistentvolumeclaim.go @@ -21,7 +21,14 @@ package persistentvolumeclaim import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.PersistentVolumeClaimInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.PersistentVolumeClaimInformer { } return untyped.(v1.PersistentVolumeClaimInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.PersistentVolumeClaimInformer = (*wrapper)(nil) +var _ corev1.PersistentVolumeClaimLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.PersistentVolumeClaim{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PersistentVolumeClaimLister { + return w +} + +func (w *wrapper) PersistentVolumeClaims(namespace string) corev1.PersistentVolumeClaimNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.PersistentVolumeClaim, err error) { + lo, err := w.client.CoreV1().PersistentVolumeClaims(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.PersistentVolumeClaim, error) { + return w.client.CoreV1().PersistentVolumeClaims(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/pod/filtered/pod.go b/client/injection/kube/informers/core/v1/pod/filtered/pod.go index c5c805a5fa..48803cac23 100644 --- a/client/injection/kube/informers/core/v1/pod/filtered/pod.go +++ b/client/injection/kube/informers/core/v1/pod/filtered/pod.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.PodInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.PodInformer { } return untyped.(v1.PodInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.PodInformer = (*wrapper)(nil) +var _ corev1.PodLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Pod{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PodLister { + return w +} + +func (w *wrapper) Pods(namespace string) corev1.PodNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Pod, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().Pods(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Pod, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().Pods(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/pod/pod.go b/client/injection/kube/informers/core/v1/pod/pod.go index 0742ab1b09..ec1a61b933 100644 --- a/client/injection/kube/informers/core/v1/pod/pod.go +++ b/client/injection/kube/informers/core/v1/pod/pod.go @@ -21,7 +21,14 @@ package pod import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.PodInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.PodInformer { } return untyped.(v1.PodInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.PodInformer = (*wrapper)(nil) +var _ corev1.PodLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Pod{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PodLister { + return w +} + +func (w *wrapper) Pods(namespace string) corev1.PodNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Pod, err error) { + lo, err := w.client.CoreV1().Pods(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Pod, error) { + return w.client.CoreV1().Pods(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go b/client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go index 9259f84b3a..0016c979f0 100644 --- a/client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go +++ b/client/injection/kube/informers/core/v1/podtemplate/filtered/podtemplate.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.PodTemplateInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.PodTemplateInformer { } return untyped.(v1.PodTemplateInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.PodTemplateInformer = (*wrapper)(nil) +var _ corev1.PodTemplateLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.PodTemplate{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PodTemplateLister { + return w +} + +func (w *wrapper) PodTemplates(namespace string) corev1.PodTemplateNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.PodTemplate, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().PodTemplates(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.PodTemplate, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().PodTemplates(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/podtemplate/podtemplate.go b/client/injection/kube/informers/core/v1/podtemplate/podtemplate.go index d57a78a607..6f12ed852a 100644 --- a/client/injection/kube/informers/core/v1/podtemplate/podtemplate.go +++ b/client/injection/kube/informers/core/v1/podtemplate/podtemplate.go @@ -21,7 +21,14 @@ package podtemplate import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.PodTemplateInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.PodTemplateInformer { } return untyped.(v1.PodTemplateInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.PodTemplateInformer = (*wrapper)(nil) +var _ corev1.PodTemplateLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.PodTemplate{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.PodTemplateLister { + return w +} + +func (w *wrapper) PodTemplates(namespace string) corev1.PodTemplateNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.PodTemplate, err error) { + lo, err := w.client.CoreV1().PodTemplates(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.PodTemplate, error) { + return w.client.CoreV1().PodTemplates(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go index 6ed0940325..c57c873ded 100644 --- a/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go +++ b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ReplicationControllerInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.ReplicationControllerInformer } return untyped.(v1.ReplicationControllerInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.ReplicationControllerInformer = (*wrapper)(nil) +var _ corev1.ReplicationControllerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ReplicationController{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ReplicationControllerLister { + return w +} + +func (w *wrapper) ReplicationControllers(namespace string) corev1.ReplicationControllerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ReplicationController, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().ReplicationControllers(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ReplicationController, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().ReplicationControllers(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller_expansion.go b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller_expansion.go new file mode 100644 index 0000000000..405ea2644a --- /dev/null +++ b/client/injection/kube/informers/core/v1/replicationcontroller/filtered/replicationcontroller_expansion.go @@ -0,0 +1,25 @@ +/* +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 filtered + +import ( + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/core/v1/replicationcontroller/replicationcontroller.go b/client/injection/kube/informers/core/v1/replicationcontroller/replicationcontroller.go index c861a9af42..81ea838b18 100644 --- a/client/injection/kube/informers/core/v1/replicationcontroller/replicationcontroller.go +++ b/client/injection/kube/informers/core/v1/replicationcontroller/replicationcontroller.go @@ -21,7 +21,14 @@ package replicationcontroller import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ReplicationControllerInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.ReplicationControllerInformer { } return untyped.(v1.ReplicationControllerInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.ReplicationControllerInformer = (*wrapper)(nil) +var _ corev1.ReplicationControllerLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ReplicationController{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ReplicationControllerLister { + return w +} + +func (w *wrapper) ReplicationControllers(namespace string) corev1.ReplicationControllerNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ReplicationController, err error) { + lo, err := w.client.CoreV1().ReplicationControllers(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ReplicationController, error) { + return w.client.CoreV1().ReplicationControllers(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/replicationcontroller/replicationcontroller_expansion.go b/client/injection/kube/informers/core/v1/replicationcontroller/replicationcontroller_expansion.go new file mode 100644 index 0000000000..426f7a8c4d --- /dev/null +++ b/client/injection/kube/informers/core/v1/replicationcontroller/replicationcontroller_expansion.go @@ -0,0 +1,25 @@ +/* +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 replicationcontroller + +import ( + v1 "k8s.io/api/core/v1" +) + +func (w *wrapper) GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go b/client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go index 0960ab3956..8859faaa77 100644 --- a/client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go +++ b/client/injection/kube/informers/core/v1/resourcequota/filtered/resourcequota.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ResourceQuotaInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.ResourceQuotaInformer { } return untyped.(v1.ResourceQuotaInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.ResourceQuotaInformer = (*wrapper)(nil) +var _ corev1.ResourceQuotaLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ResourceQuota{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ResourceQuotaLister { + return w +} + +func (w *wrapper) ResourceQuotas(namespace string) corev1.ResourceQuotaNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ResourceQuota, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().ResourceQuotas(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ResourceQuota, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().ResourceQuotas(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/resourcequota/resourcequota.go b/client/injection/kube/informers/core/v1/resourcequota/resourcequota.go index 06400ca283..4987768e49 100644 --- a/client/injection/kube/informers/core/v1/resourcequota/resourcequota.go +++ b/client/injection/kube/informers/core/v1/resourcequota/resourcequota.go @@ -21,7 +21,14 @@ package resourcequota import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ResourceQuotaInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.ResourceQuotaInformer { } return untyped.(v1.ResourceQuotaInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.ResourceQuotaInformer = (*wrapper)(nil) +var _ corev1.ResourceQuotaLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ResourceQuota{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ResourceQuotaLister { + return w +} + +func (w *wrapper) ResourceQuotas(namespace string) corev1.ResourceQuotaNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ResourceQuota, err error) { + lo, err := w.client.CoreV1().ResourceQuotas(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ResourceQuota, error) { + return w.client.CoreV1().ResourceQuotas(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/secret/filtered/secret.go b/client/injection/kube/informers/core/v1/secret/filtered/secret.go index c4f5652a08..73bd40e1b9 100644 --- a/client/injection/kube/informers/core/v1/secret/filtered/secret.go +++ b/client/injection/kube/informers/core/v1/secret/filtered/secret.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.SecretInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.SecretInformer { } return untyped.(v1.SecretInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.SecretInformer = (*wrapper)(nil) +var _ corev1.SecretLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Secret{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.SecretLister { + return w +} + +func (w *wrapper) Secrets(namespace string) corev1.SecretNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Secret, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().Secrets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Secret, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().Secrets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/secret/secret.go b/client/injection/kube/informers/core/v1/secret/secret.go index 8f0880f582..9e1a96c225 100644 --- a/client/injection/kube/informers/core/v1/secret/secret.go +++ b/client/injection/kube/informers/core/v1/secret/secret.go @@ -21,7 +21,14 @@ package secret import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.SecretInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.SecretInformer { } return untyped.(v1.SecretInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.SecretInformer = (*wrapper)(nil) +var _ corev1.SecretLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Secret{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.SecretLister { + return w +} + +func (w *wrapper) Secrets(namespace string) corev1.SecretNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Secret, err error) { + lo, err := w.client.CoreV1().Secrets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Secret, error) { + return w.client.CoreV1().Secrets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/service/filtered/service.go b/client/injection/kube/informers/core/v1/service/filtered/service.go index ac7a6525a9..a4684f4df2 100644 --- a/client/injection/kube/informers/core/v1/service/filtered/service.go +++ b/client/injection/kube/informers/core/v1/service/filtered/service.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ServiceInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.ServiceInformer { } return untyped.(v1.ServiceInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.ServiceInformer = (*wrapper)(nil) +var _ corev1.ServiceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Service{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ServiceLister { + return w +} + +func (w *wrapper) Services(namespace string) corev1.ServiceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Service, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().Services(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Service, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().Services(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/service/service.go b/client/injection/kube/informers/core/v1/service/service.go index 1bc4a32b3f..3921df6b24 100644 --- a/client/injection/kube/informers/core/v1/service/service.go +++ b/client/injection/kube/informers/core/v1/service/service.go @@ -21,7 +21,14 @@ package service import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ServiceInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.ServiceInformer { } return untyped.(v1.ServiceInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.ServiceInformer = (*wrapper)(nil) +var _ corev1.ServiceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Service{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ServiceLister { + return w +} + +func (w *wrapper) Services(namespace string) corev1.ServiceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Service, err error) { + lo, err := w.client.CoreV1().Services(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Service, error) { + return w.client.CoreV1().Services(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go b/client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go index 69203690ee..24b334c12e 100644 --- a/client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go +++ b/client/injection/kube/informers/core/v1/serviceaccount/filtered/serviceaccount.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ServiceAccountInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.ServiceAccountInformer { } return untyped.(v1.ServiceAccountInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.ServiceAccountInformer = (*wrapper)(nil) +var _ corev1.ServiceAccountLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ServiceAccount{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ServiceAccountLister { + return w +} + +func (w *wrapper) ServiceAccounts(namespace string) corev1.ServiceAccountNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ServiceAccount, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.CoreV1().ServiceAccounts(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ServiceAccount, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.CoreV1().ServiceAccounts(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go b/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go index 2b9595654c..d8f5cd0884 100644 --- a/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go +++ b/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go @@ -21,7 +21,14 @@ package serviceaccount import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ServiceAccountInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.ServiceAccountInformer { } return untyped.(v1.ServiceAccountInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.ServiceAccountInformer = (*wrapper)(nil) +var _ corev1.ServiceAccountLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.ServiceAccount{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.ServiceAccountLister { + return w +} + +func (w *wrapper) ServiceAccounts(namespace string) corev1.ServiceAccountNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ServiceAccount, err error) { + lo, err := w.client.CoreV1().ServiceAccounts(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.ServiceAccount, error) { + return w.client.CoreV1().ServiceAccounts(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/discovery/v1alpha1/endpointslice/endpointslice.go b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/endpointslice.go new file mode 100644 index 0000000000..c80c163e1b --- /dev/null +++ b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/endpointslice.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package endpointslice + +import ( + context "context" + + apidiscoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/discovery/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + discoveryv1alpha1 "k8s.io/client-go/listers/discovery/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Discovery().V1alpha1().EndpointSlices() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.EndpointSliceInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/discovery/v1alpha1.EndpointSliceInformer from context.") + } + return untyped.(v1alpha1.EndpointSliceInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1alpha1.EndpointSliceInformer = (*wrapper)(nil) +var _ discoveryv1alpha1.EndpointSliceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apidiscoveryv1alpha1.EndpointSlice{}, 0, nil) +} + +func (w *wrapper) Lister() discoveryv1alpha1.EndpointSliceLister { + return w +} + +func (w *wrapper) EndpointSlices(namespace string) discoveryv1alpha1.EndpointSliceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apidiscoveryv1alpha1.EndpointSlice, err error) { + lo, err := w.client.DiscoveryV1alpha1().EndpointSlices(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apidiscoveryv1alpha1.EndpointSlice, error) { + return w.client.DiscoveryV1alpha1().EndpointSlices(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/discovery/v1alpha1/endpointslice/fake/fake.go b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/fake/fake.go new file mode 100644 index 0000000000..775ca5830d --- /dev/null +++ b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + endpointslice "knative.dev/pkg/client/injection/kube/informers/discovery/v1alpha1/endpointslice" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = endpointslice.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Discovery().V1alpha1().EndpointSlices() + return context.WithValue(ctx, endpointslice.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/discovery/v1alpha1/endpointslice/filtered/endpointslice.go b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/filtered/endpointslice.go new file mode 100644 index 0000000000..8bba920944 --- /dev/null +++ b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/filtered/endpointslice.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apidiscoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/discovery/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + discoveryv1alpha1 "k8s.io/client-go/listers/discovery/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Discovery().V1alpha1().EndpointSlices() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.EndpointSliceInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/discovery/v1alpha1.EndpointSliceInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.EndpointSliceInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1alpha1.EndpointSliceInformer = (*wrapper)(nil) +var _ discoveryv1alpha1.EndpointSliceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apidiscoveryv1alpha1.EndpointSlice{}, 0, nil) +} + +func (w *wrapper) Lister() discoveryv1alpha1.EndpointSliceLister { + return w +} + +func (w *wrapper) EndpointSlices(namespace string) discoveryv1alpha1.EndpointSliceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apidiscoveryv1alpha1.EndpointSlice, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.DiscoveryV1alpha1().EndpointSlices(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apidiscoveryv1alpha1.EndpointSlice, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.DiscoveryV1alpha1().EndpointSlices(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/discovery/v1alpha1/endpointslice/filtered/fake/fake.go b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/filtered/fake/fake.go new file mode 100644 index 0000000000..07d6d88f66 --- /dev/null +++ b/client/injection/kube/informers/discovery/v1alpha1/endpointslice/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/discovery/v1alpha1/endpointslice/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.Discovery().V1alpha1().EndpointSlices() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/discovery/v1beta1/endpointslice/endpointslice.go b/client/injection/kube/informers/discovery/v1beta1/endpointslice/endpointslice.go new file mode 100644 index 0000000000..1688e861f0 --- /dev/null +++ b/client/injection/kube/informers/discovery/v1beta1/endpointslice/endpointslice.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package endpointslice + +import ( + context "context" + + apidiscoveryv1beta1 "k8s.io/api/discovery/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/discovery/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + discoveryv1beta1 "k8s.io/client-go/listers/discovery/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Discovery().V1beta1().EndpointSlices() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.EndpointSliceInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/discovery/v1beta1.EndpointSliceInformer from context.") + } + return untyped.(v1beta1.EndpointSliceInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.EndpointSliceInformer = (*wrapper)(nil) +var _ discoveryv1beta1.EndpointSliceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apidiscoveryv1beta1.EndpointSlice{}, 0, nil) +} + +func (w *wrapper) Lister() discoveryv1beta1.EndpointSliceLister { + return w +} + +func (w *wrapper) EndpointSlices(namespace string) discoveryv1beta1.EndpointSliceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apidiscoveryv1beta1.EndpointSlice, err error) { + lo, err := w.client.DiscoveryV1beta1().EndpointSlices(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apidiscoveryv1beta1.EndpointSlice, error) { + return w.client.DiscoveryV1beta1().EndpointSlices(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/discovery/v1beta1/endpointslice/fake/fake.go b/client/injection/kube/informers/discovery/v1beta1/endpointslice/fake/fake.go new file mode 100644 index 0000000000..567a0f7c63 --- /dev/null +++ b/client/injection/kube/informers/discovery/v1beta1/endpointslice/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + endpointslice "knative.dev/pkg/client/injection/kube/informers/discovery/v1beta1/endpointslice" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = endpointslice.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Discovery().V1beta1().EndpointSlices() + return context.WithValue(ctx, endpointslice.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/discovery/v1beta1/endpointslice/filtered/endpointslice.go b/client/injection/kube/informers/discovery/v1beta1/endpointslice/filtered/endpointslice.go new file mode 100644 index 0000000000..36fd020ae4 --- /dev/null +++ b/client/injection/kube/informers/discovery/v1beta1/endpointslice/filtered/endpointslice.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apidiscoveryv1beta1 "k8s.io/api/discovery/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/discovery/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + discoveryv1beta1 "k8s.io/client-go/listers/discovery/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Discovery().V1beta1().EndpointSlices() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.EndpointSliceInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/discovery/v1beta1.EndpointSliceInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.EndpointSliceInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.EndpointSliceInformer = (*wrapper)(nil) +var _ discoveryv1beta1.EndpointSliceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apidiscoveryv1beta1.EndpointSlice{}, 0, nil) +} + +func (w *wrapper) Lister() discoveryv1beta1.EndpointSliceLister { + return w +} + +func (w *wrapper) EndpointSlices(namespace string) discoveryv1beta1.EndpointSliceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apidiscoveryv1beta1.EndpointSlice, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.DiscoveryV1beta1().EndpointSlices(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apidiscoveryv1beta1.EndpointSlice, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.DiscoveryV1beta1().EndpointSlices(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/discovery/v1beta1/endpointslice/filtered/fake/fake.go b/client/injection/kube/informers/discovery/v1beta1/endpointslice/filtered/fake/fake.go new file mode 100644 index 0000000000..0a63c7184e --- /dev/null +++ b/client/injection/kube/informers/discovery/v1beta1/endpointslice/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/discovery/v1beta1/endpointslice/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.Discovery().V1beta1().EndpointSlices() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/events/v1/event/event.go b/client/injection/kube/informers/events/v1/event/event.go new file mode 100644 index 0000000000..50a999ff4f --- /dev/null +++ b/client/injection/kube/informers/events/v1/event/event.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package event + +import ( + context "context" + + apieventsv1 "k8s.io/api/events/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/events/v1" + kubernetes "k8s.io/client-go/kubernetes" + eventsv1 "k8s.io/client-go/listers/events/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Events().V1().Events() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.EventInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/events/v1.EventInformer from context.") + } + return untyped.(v1.EventInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.EventInformer = (*wrapper)(nil) +var _ eventsv1.EventLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apieventsv1.Event{}, 0, nil) +} + +func (w *wrapper) Lister() eventsv1.EventLister { + return w +} + +func (w *wrapper) Events(namespace string) eventsv1.EventNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apieventsv1.Event, err error) { + lo, err := w.client.EventsV1().Events(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apieventsv1.Event, error) { + return w.client.EventsV1().Events(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/events/v1/event/fake/fake.go b/client/injection/kube/informers/events/v1/event/fake/fake.go new file mode 100644 index 0000000000..de5a2d9e7d --- /dev/null +++ b/client/injection/kube/informers/events/v1/event/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + event "knative.dev/pkg/client/injection/kube/informers/events/v1/event" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = event.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Events().V1().Events() + return context.WithValue(ctx, event.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/events/v1/event/filtered/event.go b/client/injection/kube/informers/events/v1/event/filtered/event.go new file mode 100644 index 0000000000..4799067ada --- /dev/null +++ b/client/injection/kube/informers/events/v1/event/filtered/event.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apieventsv1 "k8s.io/api/events/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/events/v1" + kubernetes "k8s.io/client-go/kubernetes" + eventsv1 "k8s.io/client-go/listers/events/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Events().V1().Events() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// 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/events/v1.EventInformer with selector %s from context.", selector) + } + return untyped.(v1.EventInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.EventInformer = (*wrapper)(nil) +var _ eventsv1.EventLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apieventsv1.Event{}, 0, nil) +} + +func (w *wrapper) Lister() eventsv1.EventLister { + return w +} + +func (w *wrapper) Events(namespace string) eventsv1.EventNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apieventsv1.Event, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.EventsV1().Events(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apieventsv1.Event, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.EventsV1().Events(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/events/v1/event/filtered/fake/fake.go b/client/injection/kube/informers/events/v1/event/filtered/fake/fake.go new file mode 100644 index 0000000000..38496c58cb --- /dev/null +++ b/client/injection/kube/informers/events/v1/event/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/events/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.Events().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/events/v1beta1/event/event.go b/client/injection/kube/informers/events/v1beta1/event/event.go new file mode 100644 index 0000000000..615dcc397f --- /dev/null +++ b/client/injection/kube/informers/events/v1beta1/event/event.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package event + +import ( + context "context" + + apieventsv1beta1 "k8s.io/api/events/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/events/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + eventsv1beta1 "k8s.io/client-go/listers/events/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Events().V1beta1().Events() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.EventInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/events/v1beta1.EventInformer from context.") + } + return untyped.(v1beta1.EventInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.EventInformer = (*wrapper)(nil) +var _ eventsv1beta1.EventLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apieventsv1beta1.Event{}, 0, nil) +} + +func (w *wrapper) Lister() eventsv1beta1.EventLister { + return w +} + +func (w *wrapper) Events(namespace string) eventsv1beta1.EventNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apieventsv1beta1.Event, err error) { + lo, err := w.client.EventsV1beta1().Events(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apieventsv1beta1.Event, error) { + return w.client.EventsV1beta1().Events(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/events/v1beta1/event/fake/fake.go b/client/injection/kube/informers/events/v1beta1/event/fake/fake.go new file mode 100644 index 0000000000..d00d5b39e8 --- /dev/null +++ b/client/injection/kube/informers/events/v1beta1/event/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + event "knative.dev/pkg/client/injection/kube/informers/events/v1beta1/event" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = event.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Events().V1beta1().Events() + return context.WithValue(ctx, event.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/events/v1beta1/event/filtered/event.go b/client/injection/kube/informers/events/v1beta1/event/filtered/event.go new file mode 100644 index 0000000000..03406c4bff --- /dev/null +++ b/client/injection/kube/informers/events/v1beta1/event/filtered/event.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apieventsv1beta1 "k8s.io/api/events/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/events/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + eventsv1beta1 "k8s.io/client-go/listers/events/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Events().V1beta1().Events() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.EventInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/events/v1beta1.EventInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.EventInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.EventInformer = (*wrapper)(nil) +var _ eventsv1beta1.EventLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apieventsv1beta1.Event{}, 0, nil) +} + +func (w *wrapper) Lister() eventsv1beta1.EventLister { + return w +} + +func (w *wrapper) Events(namespace string) eventsv1beta1.EventNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apieventsv1beta1.Event, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.EventsV1beta1().Events(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apieventsv1beta1.Event, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.EventsV1beta1().Events(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/events/v1beta1/event/filtered/fake/fake.go b/client/injection/kube/informers/events/v1beta1/event/filtered/fake/fake.go new file mode 100644 index 0000000000..40d98cc773 --- /dev/null +++ b/client/injection/kube/informers/events/v1beta1/event/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/events/v1beta1/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.Events().V1beta1().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/extensions/v1beta1/daemonset/daemonset.go b/client/injection/kube/informers/extensions/v1beta1/daemonset/daemonset.go new file mode 100644 index 0000000000..94164d8aea --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/daemonset/daemonset.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package daemonset + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Extensions().V1beta1().DaemonSets() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.DaemonSetInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.DaemonSetInformer from context.") + } + return untyped.(v1beta1.DaemonSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.DaemonSetInformer = (*wrapper)(nil) +var _ extensionsv1beta1.DaemonSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.DaemonSet{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.DaemonSetLister { + return w +} + +func (w *wrapper) DaemonSets(namespace string) extensionsv1beta1.DaemonSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.DaemonSet, err error) { + lo, err := w.client.ExtensionsV1beta1().DaemonSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.DaemonSet, error) { + return w.client.ExtensionsV1beta1().DaemonSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/daemonset/daemonset_expansion.go b/client/injection/kube/informers/extensions/v1beta1/daemonset/daemonset_expansion.go new file mode 100644 index 0000000000..10ebeaa5cc --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/daemonset/daemonset_expansion.go @@ -0,0 +1,31 @@ +/* +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 daemonset + +import ( + apps "k8s.io/api/apps/v1beta1" + v1 "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" +) + +func (w *wrapper) GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) { + panic("NYI") +} + +func (w *wrapper) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/extensions/v1beta1/daemonset/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/daemonset/fake/fake.go new file mode 100644 index 0000000000..389b7f934c --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/daemonset/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + daemonset "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/daemonset" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = daemonset.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Extensions().V1beta1().DaemonSets() + return context.WithValue(ctx, daemonset.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/daemonset.go b/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/daemonset.go new file mode 100644 index 0000000000..39837ad915 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/daemonset.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Extensions().V1beta1().DaemonSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.DaemonSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.DaemonSetInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.DaemonSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.DaemonSetInformer = (*wrapper)(nil) +var _ extensionsv1beta1.DaemonSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.DaemonSet{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.DaemonSetLister { + return w +} + +func (w *wrapper) DaemonSets(namespace string) extensionsv1beta1.DaemonSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.DaemonSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ExtensionsV1beta1().DaemonSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.DaemonSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ExtensionsV1beta1().DaemonSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/daemonset_expansion.go b/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/daemonset_expansion.go new file mode 100644 index 0000000000..3fa2b48c51 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/daemonset_expansion.go @@ -0,0 +1,31 @@ +/* +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 filtered + +import ( + apps "k8s.io/api/apps/v1beta1" + v1 "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" +) + +func (w *wrapper) GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) { + panic("NYI") +} + +func (w *wrapper) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/fake/fake.go new file mode 100644 index 0000000000..02e959c7d4 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/daemonset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/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.Extensions().V1beta1().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/extensions/v1beta1/deployment/deployment.go b/client/injection/kube/informers/extensions/v1beta1/deployment/deployment.go new file mode 100644 index 0000000000..e82b4a4d87 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/deployment/deployment.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Extensions().V1beta1().Deployments() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.DeploymentInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.DeploymentInformer from context.") + } + return untyped.(v1beta1.DeploymentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.DeploymentInformer = (*wrapper)(nil) +var _ extensionsv1beta1.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) extensionsv1beta1.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.Deployment, err error) { + lo, err := w.client.ExtensionsV1beta1().Deployments(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.Deployment, error) { + return w.client.ExtensionsV1beta1().Deployments(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/deployment/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/deployment/fake/fake.go new file mode 100644 index 0000000000..063da8c9b6 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/deployment/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + deployment "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/deployment" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = deployment.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Extensions().V1beta1().Deployments() + return context.WithValue(ctx, deployment.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/extensions/v1beta1/deployment/filtered/deployment.go b/client/injection/kube/informers/extensions/v1beta1/deployment/filtered/deployment.go new file mode 100644 index 0000000000..cc187d5600 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/deployment/filtered/deployment.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Extensions().V1beta1().Deployments() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.DeploymentInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.DeploymentInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.DeploymentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.DeploymentInformer = (*wrapper)(nil) +var _ extensionsv1beta1.DeploymentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.Deployment{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.DeploymentLister { + return w +} + +func (w *wrapper) Deployments(namespace string) extensionsv1beta1.DeploymentNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.Deployment, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ExtensionsV1beta1().Deployments(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.Deployment, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ExtensionsV1beta1().Deployments(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/deployment/filtered/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/deployment/filtered/fake/fake.go new file mode 100644 index 0000000000..463d76a720 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/deployment/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/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.Extensions().V1beta1().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/extensions/v1beta1/ingress/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/ingress/fake/fake.go new file mode 100644 index 0000000000..14eb7069ce --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/ingress/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + ingress "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/ingress" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = ingress.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Extensions().V1beta1().Ingresses() + return context.WithValue(ctx, ingress.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/extensions/v1beta1/ingress/filtered/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/ingress/filtered/fake/fake.go new file mode 100644 index 0000000000..fbdf072866 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/ingress/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/ingress/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.Extensions().V1beta1().Ingresses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/extensions/v1beta1/ingress/filtered/ingress.go b/client/injection/kube/informers/extensions/v1beta1/ingress/filtered/ingress.go new file mode 100644 index 0000000000..0440eebf69 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/ingress/filtered/ingress.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Extensions().V1beta1().Ingresses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.IngressInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.IngressInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.IngressInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.IngressInformer = (*wrapper)(nil) +var _ extensionsv1beta1.IngressLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.Ingress{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.IngressLister { + return w +} + +func (w *wrapper) Ingresses(namespace string) extensionsv1beta1.IngressNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.Ingress, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ExtensionsV1beta1().Ingresses(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.Ingress, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ExtensionsV1beta1().Ingresses(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/ingress/ingress.go b/client/injection/kube/informers/extensions/v1beta1/ingress/ingress.go new file mode 100644 index 0000000000..467fdc2c99 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/ingress/ingress.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package ingress + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Extensions().V1beta1().Ingresses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.IngressInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.IngressInformer from context.") + } + return untyped.(v1beta1.IngressInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.IngressInformer = (*wrapper)(nil) +var _ extensionsv1beta1.IngressLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.Ingress{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.IngressLister { + return w +} + +func (w *wrapper) Ingresses(namespace string) extensionsv1beta1.IngressNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.Ingress, err error) { + lo, err := w.client.ExtensionsV1beta1().Ingresses(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.Ingress, error) { + return w.client.ExtensionsV1beta1().Ingresses(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/networkpolicy/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/fake/fake.go new file mode 100644 index 0000000000..907878de5d --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + networkpolicy "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/networkpolicy" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = networkpolicy.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Extensions().V1beta1().NetworkPolicies() + return context.WithValue(ctx, networkpolicy.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/extensions/v1beta1/networkpolicy/filtered/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/filtered/fake/fake.go new file mode 100644 index 0000000000..6ddd238189 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/networkpolicy/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.Extensions().V1beta1().NetworkPolicies() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/extensions/v1beta1/networkpolicy/filtered/networkpolicy.go b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/filtered/networkpolicy.go new file mode 100644 index 0000000000..522c61b0dd --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/filtered/networkpolicy.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Extensions().V1beta1().NetworkPolicies() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.NetworkPolicyInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.NetworkPolicyInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.NetworkPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.NetworkPolicyInformer = (*wrapper)(nil) +var _ extensionsv1beta1.NetworkPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.NetworkPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.NetworkPolicyLister { + return w +} + +func (w *wrapper) NetworkPolicies(namespace string) extensionsv1beta1.NetworkPolicyNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.NetworkPolicy, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ExtensionsV1beta1().NetworkPolicies(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.NetworkPolicy, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ExtensionsV1beta1().NetworkPolicies(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/networkpolicy/networkpolicy.go b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/networkpolicy.go new file mode 100644 index 0000000000..e697bd96cc --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/networkpolicy/networkpolicy.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package networkpolicy + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Extensions().V1beta1().NetworkPolicies() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.NetworkPolicyInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.NetworkPolicyInformer from context.") + } + return untyped.(v1beta1.NetworkPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.NetworkPolicyInformer = (*wrapper)(nil) +var _ extensionsv1beta1.NetworkPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.NetworkPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.NetworkPolicyLister { + return w +} + +func (w *wrapper) NetworkPolicies(namespace string) extensionsv1beta1.NetworkPolicyNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.NetworkPolicy, err error) { + lo, err := w.client.ExtensionsV1beta1().NetworkPolicies(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.NetworkPolicy, error) { + return w.client.ExtensionsV1beta1().NetworkPolicies(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/fake/fake.go new file mode 100644 index 0000000000..69cf87d132 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + podsecuritypolicy "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = podsecuritypolicy.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Extensions().V1beta1().PodSecurityPolicies() + return context.WithValue(ctx, podsecuritypolicy.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/filtered/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/filtered/fake/fake.go new file mode 100644 index 0000000000..f9a300878f --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/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.Extensions().V1beta1().PodSecurityPolicies() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/filtered/podsecuritypolicy.go b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/filtered/podsecuritypolicy.go new file mode 100644 index 0000000000..5adaf19f30 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/filtered/podsecuritypolicy.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Extensions().V1beta1().PodSecurityPolicies() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.PodSecurityPolicyInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.PodSecurityPolicyInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.PodSecurityPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.PodSecurityPolicyInformer = (*wrapper)(nil) +var _ extensionsv1beta1.PodSecurityPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.PodSecurityPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.PodSecurityPolicyLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.PodSecurityPolicy, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ExtensionsV1beta1().PodSecurityPolicies().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.PodSecurityPolicy, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ExtensionsV1beta1().PodSecurityPolicies().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/podsecuritypolicy.go b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/podsecuritypolicy.go new file mode 100644 index 0000000000..21aeb0528f --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/podsecuritypolicy/podsecuritypolicy.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package podsecuritypolicy + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Extensions().V1beta1().PodSecurityPolicies() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.PodSecurityPolicyInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.PodSecurityPolicyInformer from context.") + } + return untyped.(v1beta1.PodSecurityPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.PodSecurityPolicyInformer = (*wrapper)(nil) +var _ extensionsv1beta1.PodSecurityPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.PodSecurityPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.PodSecurityPolicyLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.PodSecurityPolicy, err error) { + lo, err := w.client.ExtensionsV1beta1().PodSecurityPolicies().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.PodSecurityPolicy, error) { + return w.client.ExtensionsV1beta1().PodSecurityPolicies().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/replicaset/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/replicaset/fake/fake.go new file mode 100644 index 0000000000..f1dea7ae2a --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/replicaset/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + replicaset "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/replicaset" + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = replicaset.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Extensions().V1beta1().ReplicaSets() + return context.WithValue(ctx, replicaset.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/fake/fake.go b/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/fake/fake.go new file mode 100644 index 0000000000..2c3a80350d --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + filtered "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/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.Extensions().V1beta1().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/extensions/v1beta1/replicaset/filtered/replicaset.go b/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/replicaset.go new file mode 100644 index 0000000000..f3d907c971 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/replicaset.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Extensions().V1beta1().ReplicaSets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.ReplicaSetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.ReplicaSetInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.ReplicaSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.ReplicaSetInformer = (*wrapper)(nil) +var _ extensionsv1beta1.ReplicaSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.ReplicaSet{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.ReplicaSetLister { + return w +} + +func (w *wrapper) ReplicaSets(namespace string) extensionsv1beta1.ReplicaSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.ReplicaSet, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.ExtensionsV1beta1().ReplicaSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.ReplicaSet, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.ExtensionsV1beta1().ReplicaSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/replicaset_expansion.go b/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/replicaset_expansion.go new file mode 100644 index 0000000000..1f84e5beb9 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/replicaset/filtered/replicaset_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" +) + +func (w *wrapper) GetPodReplicaSets(pod *v1.Pod) ([]*v1beta1.ReplicaSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/extensions/v1beta1/replicaset/replicaset.go b/client/injection/kube/informers/extensions/v1beta1/replicaset/replicaset.go new file mode 100644 index 0000000000..bc31a36551 --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/replicaset/replicaset.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package replicaset + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Extensions().V1beta1().ReplicaSets() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.ReplicaSetInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/extensions/v1beta1.ReplicaSetInformer from context.") + } + return untyped.(v1beta1.ReplicaSetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.ReplicaSetInformer = (*wrapper)(nil) +var _ extensionsv1beta1.ReplicaSetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiextensionsv1beta1.ReplicaSet{}, 0, nil) +} + +func (w *wrapper) Lister() extensionsv1beta1.ReplicaSetLister { + return w +} + +func (w *wrapper) ReplicaSets(namespace string) extensionsv1beta1.ReplicaSetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiextensionsv1beta1.ReplicaSet, err error) { + lo, err := w.client.ExtensionsV1beta1().ReplicaSets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiextensionsv1beta1.ReplicaSet, error) { + return w.client.ExtensionsV1beta1().ReplicaSets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/extensions/v1beta1/replicaset/replicaset_expansion.go b/client/injection/kube/informers/extensions/v1beta1/replicaset/replicaset_expansion.go new file mode 100644 index 0000000000..3a2d0fd0cd --- /dev/null +++ b/client/injection/kube/informers/extensions/v1beta1/replicaset/replicaset_expansion.go @@ -0,0 +1,26 @@ +/* +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 replicaset + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" +) + +func (w *wrapper) GetPodReplicaSets(pod *v1.Pod) ([]*v1beta1.ReplicaSet, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/fake/fake.go new file mode 100644 index 0000000000..8455233df0 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + flowschema "knative.dev/pkg/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = flowschema.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Flowcontrol().V1alpha1().FlowSchemas() + return context.WithValue(ctx, flowschema.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/filtered/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/filtered/fake/fake.go new file mode 100644 index 0000000000..05f4611b4b --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/flowcontrol/v1alpha1/flowschema/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.Flowcontrol().V1alpha1().FlowSchemas() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/filtered/flowschema.go b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/filtered/flowschema.go new file mode 100644 index 0000000000..0d4f762667 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/filtered/flowschema.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiflowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/flowcontrol/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Flowcontrol().V1alpha1().FlowSchemas() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.FlowSchemaInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1alpha1.FlowSchemaInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.FlowSchemaInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.FlowSchemaInformer = (*wrapper)(nil) +var _ flowcontrolv1alpha1.FlowSchemaLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1alpha1.FlowSchema{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1alpha1.FlowSchemaLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1alpha1.FlowSchema, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.FlowcontrolV1alpha1().FlowSchemas().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1alpha1.FlowSchema, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.FlowcontrolV1alpha1().FlowSchemas().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/flowschema.go b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/flowschema.go new file mode 100644 index 0000000000..518653244e --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/flowschema/flowschema.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package flowschema + +import ( + context "context" + + apiflowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/flowcontrol/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Flowcontrol().V1alpha1().FlowSchemas() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.FlowSchemaInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1alpha1.FlowSchemaInformer from context.") + } + return untyped.(v1alpha1.FlowSchemaInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.FlowSchemaInformer = (*wrapper)(nil) +var _ flowcontrolv1alpha1.FlowSchemaLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1alpha1.FlowSchema{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1alpha1.FlowSchemaLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1alpha1.FlowSchema, err error) { + lo, err := w.client.FlowcontrolV1alpha1().FlowSchemas().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1alpha1.FlowSchema, error) { + return w.client.FlowcontrolV1alpha1().FlowSchemas().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/fake/fake.go new file mode 100644 index 0000000000..10f9554487 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + prioritylevelconfiguration "knative.dev/pkg/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = prioritylevelconfiguration.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Flowcontrol().V1alpha1().PriorityLevelConfigurations() + return context.WithValue(ctx, prioritylevelconfiguration.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/filtered/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/filtered/fake/fake.go new file mode 100644 index 0000000000..70d0c32c5c --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/flowcontrol/v1alpha1/prioritylevelconfiguration/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.Flowcontrol().V1alpha1().PriorityLevelConfigurations() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/filtered/prioritylevelconfiguration.go b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/filtered/prioritylevelconfiguration.go new file mode 100644 index 0000000000..ef9ce92c14 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/filtered/prioritylevelconfiguration.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiflowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/flowcontrol/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Flowcontrol().V1alpha1().PriorityLevelConfigurations() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.PriorityLevelConfigurationInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1alpha1.PriorityLevelConfigurationInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.PriorityLevelConfigurationInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.PriorityLevelConfigurationInformer = (*wrapper)(nil) +var _ flowcontrolv1alpha1.PriorityLevelConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1alpha1.PriorityLevelConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1alpha1.PriorityLevelConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.FlowcontrolV1alpha1().PriorityLevelConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.FlowcontrolV1alpha1().PriorityLevelConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/prioritylevelconfiguration.go b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/prioritylevelconfiguration.go new file mode 100644 index 0000000000..5a20ccdcca --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1alpha1/prioritylevelconfiguration/prioritylevelconfiguration.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package prioritylevelconfiguration + +import ( + context "context" + + apiflowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/flowcontrol/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Flowcontrol().V1alpha1().PriorityLevelConfigurations() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.PriorityLevelConfigurationInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1alpha1.PriorityLevelConfigurationInformer from context.") + } + return untyped.(v1alpha1.PriorityLevelConfigurationInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.PriorityLevelConfigurationInformer = (*wrapper)(nil) +var _ flowcontrolv1alpha1.PriorityLevelConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1alpha1.PriorityLevelConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1alpha1.PriorityLevelConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + lo, err := w.client.FlowcontrolV1alpha1().PriorityLevelConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { + return w.client.FlowcontrolV1alpha1().PriorityLevelConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/fake/fake.go new file mode 100644 index 0000000000..1336850c9a --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + flowschema "knative.dev/pkg/client/injection/kube/informers/flowcontrol/v1beta1/flowschema" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = flowschema.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Flowcontrol().V1beta1().FlowSchemas() + return context.WithValue(ctx, flowschema.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/filtered/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/filtered/fake/fake.go new file mode 100644 index 0000000000..0ed3319f02 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/flowcontrol/v1beta1/flowschema/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.Flowcontrol().V1beta1().FlowSchemas() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/filtered/flowschema.go b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/filtered/flowschema.go new file mode 100644 index 0000000000..1cbbb2d1a2 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/filtered/flowschema.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Flowcontrol().V1beta1().FlowSchemas() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.FlowSchemaInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1beta1.FlowSchemaInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.FlowSchemaInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.FlowSchemaInformer = (*wrapper)(nil) +var _ flowcontrolv1beta1.FlowSchemaLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1beta1.FlowSchema{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1beta1.FlowSchemaLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1beta1.FlowSchema, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.FlowcontrolV1beta1().FlowSchemas().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1beta1.FlowSchema, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.FlowcontrolV1beta1().FlowSchemas().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/flowschema.go b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/flowschema.go new file mode 100644 index 0000000000..07e74bc3c5 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/flowschema/flowschema.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package flowschema + +import ( + context "context" + + apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Flowcontrol().V1beta1().FlowSchemas() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.FlowSchemaInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1beta1.FlowSchemaInformer from context.") + } + return untyped.(v1beta1.FlowSchemaInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.FlowSchemaInformer = (*wrapper)(nil) +var _ flowcontrolv1beta1.FlowSchemaLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1beta1.FlowSchema{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1beta1.FlowSchemaLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1beta1.FlowSchema, err error) { + lo, err := w.client.FlowcontrolV1beta1().FlowSchemas().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1beta1.FlowSchema, error) { + return w.client.FlowcontrolV1beta1().FlowSchemas().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/fake/fake.go new file mode 100644 index 0000000000..c8fbef4d90 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + prioritylevelconfiguration "knative.dev/pkg/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = prioritylevelconfiguration.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Flowcontrol().V1beta1().PriorityLevelConfigurations() + return context.WithValue(ctx, prioritylevelconfiguration.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/filtered/fake/fake.go b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/filtered/fake/fake.go new file mode 100644 index 0000000000..96ab4d4bdd --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/flowcontrol/v1beta1/prioritylevelconfiguration/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.Flowcontrol().V1beta1().PriorityLevelConfigurations() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/filtered/prioritylevelconfiguration.go b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/filtered/prioritylevelconfiguration.go new file mode 100644 index 0000000000..37ce2bd764 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/filtered/prioritylevelconfiguration.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Flowcontrol().V1beta1().PriorityLevelConfigurations() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.PriorityLevelConfigurationInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1beta1.PriorityLevelConfigurationInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.PriorityLevelConfigurationInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.PriorityLevelConfigurationInformer = (*wrapper)(nil) +var _ flowcontrolv1beta1.PriorityLevelConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1beta1.PriorityLevelConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1beta1.PriorityLevelConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.FlowcontrolV1beta1().PriorityLevelConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/prioritylevelconfiguration.go b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/prioritylevelconfiguration.go new file mode 100644 index 0000000000..fe5f07a399 --- /dev/null +++ b/client/injection/kube/informers/flowcontrol/v1beta1/prioritylevelconfiguration/prioritylevelconfiguration.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package prioritylevelconfiguration + +import ( + context "context" + + apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + flowcontrolv1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Flowcontrol().V1beta1().PriorityLevelConfigurations() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.PriorityLevelConfigurationInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/flowcontrol/v1beta1.PriorityLevelConfigurationInformer from context.") + } + return untyped.(v1beta1.PriorityLevelConfigurationInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.PriorityLevelConfigurationInformer = (*wrapper)(nil) +var _ flowcontrolv1beta1.PriorityLevelConfigurationLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apiflowcontrolv1beta1.PriorityLevelConfiguration{}, 0, nil) +} + +func (w *wrapper) Lister() flowcontrolv1beta1.PriorityLevelConfigurationLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { + lo, err := w.client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { + return w.client.FlowcontrolV1beta1().PriorityLevelConfigurations().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1/ingress/fake/fake.go b/client/injection/kube/informers/networking/v1/ingress/fake/fake.go new file mode 100644 index 0000000000..7cf7a9cc1e --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingress/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + ingress "knative.dev/pkg/client/injection/kube/informers/networking/v1/ingress" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = ingress.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Networking().V1().Ingresses() + return context.WithValue(ctx, ingress.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/networking/v1/ingress/filtered/fake/fake.go b/client/injection/kube/informers/networking/v1/ingress/filtered/fake/fake.go new file mode 100644 index 0000000000..68211ceaf6 --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingress/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/networking/v1/ingress/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.Networking().V1().Ingresses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/networking/v1/ingress/filtered/ingress.go b/client/injection/kube/informers/networking/v1/ingress/filtered/ingress.go new file mode 100644 index 0000000000..d658d985a9 --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingress/filtered/ingress.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinetworkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/networking/v1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Networking().V1().Ingresses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.IngressInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/networking/v1.IngressInformer with selector %s from context.", selector) + } + return untyped.(v1.IngressInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.IngressInformer = (*wrapper)(nil) +var _ networkingv1.IngressLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1.Ingress{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1.IngressLister { + return w +} + +func (w *wrapper) Ingresses(namespace string) networkingv1.IngressNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1.Ingress, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NetworkingV1().Ingresses(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1.Ingress, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NetworkingV1().Ingresses(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1/ingress/ingress.go b/client/injection/kube/informers/networking/v1/ingress/ingress.go new file mode 100644 index 0000000000..ef447705aa --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingress/ingress.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package ingress + +import ( + context "context" + + apinetworkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/networking/v1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Networking().V1().Ingresses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.IngressInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/networking/v1.IngressInformer from context.") + } + return untyped.(v1.IngressInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.IngressInformer = (*wrapper)(nil) +var _ networkingv1.IngressLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1.Ingress{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1.IngressLister { + return w +} + +func (w *wrapper) Ingresses(namespace string) networkingv1.IngressNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1.Ingress, err error) { + lo, err := w.client.NetworkingV1().Ingresses(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1.Ingress, error) { + return w.client.NetworkingV1().Ingresses(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1/ingressclass/fake/fake.go b/client/injection/kube/informers/networking/v1/ingressclass/fake/fake.go new file mode 100644 index 0000000000..0784154d5a --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingressclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + ingressclass "knative.dev/pkg/client/injection/kube/informers/networking/v1/ingressclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = ingressclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Networking().V1().IngressClasses() + return context.WithValue(ctx, ingressclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/networking/v1/ingressclass/filtered/fake/fake.go b/client/injection/kube/informers/networking/v1/ingressclass/filtered/fake/fake.go new file mode 100644 index 0000000000..bb0329ac65 --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingressclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/networking/v1/ingressclass/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.Networking().V1().IngressClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/networking/v1/ingressclass/filtered/ingressclass.go b/client/injection/kube/informers/networking/v1/ingressclass/filtered/ingressclass.go new file mode 100644 index 0000000000..26a7e0fcef --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingressclass/filtered/ingressclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinetworkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/networking/v1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Networking().V1().IngressClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.IngressClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/networking/v1.IngressClassInformer with selector %s from context.", selector) + } + return untyped.(v1.IngressClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.IngressClassInformer = (*wrapper)(nil) +var _ networkingv1.IngressClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1.IngressClass{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1.IngressClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1.IngressClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NetworkingV1().IngressClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1.IngressClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NetworkingV1().IngressClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1/ingressclass/ingressclass.go b/client/injection/kube/informers/networking/v1/ingressclass/ingressclass.go new file mode 100644 index 0000000000..f94780ebd3 --- /dev/null +++ b/client/injection/kube/informers/networking/v1/ingressclass/ingressclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package ingressclass + +import ( + context "context" + + apinetworkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/networking/v1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Networking().V1().IngressClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.IngressClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/networking/v1.IngressClassInformer from context.") + } + return untyped.(v1.IngressClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.IngressClassInformer = (*wrapper)(nil) +var _ networkingv1.IngressClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1.IngressClass{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1.IngressClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1.IngressClass, err error) { + lo, err := w.client.NetworkingV1().IngressClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1.IngressClass, error) { + return w.client.NetworkingV1().IngressClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1/networkpolicy/fake/fake.go b/client/injection/kube/informers/networking/v1/networkpolicy/fake/fake.go new file mode 100644 index 0000000000..fa4b895a0a --- /dev/null +++ b/client/injection/kube/informers/networking/v1/networkpolicy/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + networkpolicy "knative.dev/pkg/client/injection/kube/informers/networking/v1/networkpolicy" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = networkpolicy.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Networking().V1().NetworkPolicies() + return context.WithValue(ctx, networkpolicy.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/networking/v1/networkpolicy/filtered/fake/fake.go b/client/injection/kube/informers/networking/v1/networkpolicy/filtered/fake/fake.go new file mode 100644 index 0000000000..faf6ccb240 --- /dev/null +++ b/client/injection/kube/informers/networking/v1/networkpolicy/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/networking/v1/networkpolicy/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.Networking().V1().NetworkPolicies() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/networking/v1/networkpolicy/filtered/networkpolicy.go b/client/injection/kube/informers/networking/v1/networkpolicy/filtered/networkpolicy.go new file mode 100644 index 0000000000..1484bd25a2 --- /dev/null +++ b/client/injection/kube/informers/networking/v1/networkpolicy/filtered/networkpolicy.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinetworkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/networking/v1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Networking().V1().NetworkPolicies() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.NetworkPolicyInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/networking/v1.NetworkPolicyInformer with selector %s from context.", selector) + } + return untyped.(v1.NetworkPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.NetworkPolicyInformer = (*wrapper)(nil) +var _ networkingv1.NetworkPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1.NetworkPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1.NetworkPolicyLister { + return w +} + +func (w *wrapper) NetworkPolicies(namespace string) networkingv1.NetworkPolicyNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1.NetworkPolicy, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NetworkingV1().NetworkPolicies(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1.NetworkPolicy, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NetworkingV1().NetworkPolicies(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1/networkpolicy/networkpolicy.go b/client/injection/kube/informers/networking/v1/networkpolicy/networkpolicy.go new file mode 100644 index 0000000000..f23e9f1633 --- /dev/null +++ b/client/injection/kube/informers/networking/v1/networkpolicy/networkpolicy.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package networkpolicy + +import ( + context "context" + + apinetworkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/networking/v1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Networking().V1().NetworkPolicies() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.NetworkPolicyInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/networking/v1.NetworkPolicyInformer from context.") + } + return untyped.(v1.NetworkPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.NetworkPolicyInformer = (*wrapper)(nil) +var _ networkingv1.NetworkPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1.NetworkPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1.NetworkPolicyLister { + return w +} + +func (w *wrapper) NetworkPolicies(namespace string) networkingv1.NetworkPolicyNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1.NetworkPolicy, err error) { + lo, err := w.client.NetworkingV1().NetworkPolicies(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1.NetworkPolicy, error) { + return w.client.NetworkingV1().NetworkPolicies(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingress/fake/fake.go b/client/injection/kube/informers/networking/v1beta1/ingress/fake/fake.go new file mode 100644 index 0000000000..7899555d1d --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingress/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + ingress "knative.dev/pkg/client/injection/kube/informers/networking/v1beta1/ingress" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = ingress.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Networking().V1beta1().Ingresses() + return context.WithValue(ctx, ingress.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingress/filtered/fake/fake.go b/client/injection/kube/informers/networking/v1beta1/ingress/filtered/fake/fake.go new file mode 100644 index 0000000000..b33f957ca8 --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingress/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/networking/v1beta1/ingress/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.Networking().V1beta1().Ingresses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingress/filtered/ingress.go b/client/injection/kube/informers/networking/v1beta1/ingress/filtered/ingress.go new file mode 100644 index 0000000000..1ddc8916d4 --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingress/filtered/ingress.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/networking/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Networking().V1beta1().Ingresses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.IngressInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/networking/v1beta1.IngressInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.IngressInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.IngressInformer = (*wrapper)(nil) +var _ networkingv1beta1.IngressLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1beta1.Ingress{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1beta1.IngressLister { + return w +} + +func (w *wrapper) Ingresses(namespace string) networkingv1beta1.IngressNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1beta1.Ingress, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NetworkingV1beta1().Ingresses(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1beta1.Ingress, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NetworkingV1beta1().Ingresses(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingress/ingress.go b/client/injection/kube/informers/networking/v1beta1/ingress/ingress.go new file mode 100644 index 0000000000..b29e95c67b --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingress/ingress.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package ingress + +import ( + context "context" + + apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/networking/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Networking().V1beta1().Ingresses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.IngressInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/networking/v1beta1.IngressInformer from context.") + } + return untyped.(v1beta1.IngressInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.IngressInformer = (*wrapper)(nil) +var _ networkingv1beta1.IngressLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1beta1.Ingress{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1beta1.IngressLister { + return w +} + +func (w *wrapper) Ingresses(namespace string) networkingv1beta1.IngressNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1beta1.Ingress, err error) { + lo, err := w.client.NetworkingV1beta1().Ingresses(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1beta1.Ingress, error) { + return w.client.NetworkingV1beta1().Ingresses(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingressclass/fake/fake.go b/client/injection/kube/informers/networking/v1beta1/ingressclass/fake/fake.go new file mode 100644 index 0000000000..c2f3b6f001 --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingressclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + ingressclass "knative.dev/pkg/client/injection/kube/informers/networking/v1beta1/ingressclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = ingressclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Networking().V1beta1().IngressClasses() + return context.WithValue(ctx, ingressclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingressclass/filtered/fake/fake.go b/client/injection/kube/informers/networking/v1beta1/ingressclass/filtered/fake/fake.go new file mode 100644 index 0000000000..86997ba0f0 --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingressclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/networking/v1beta1/ingressclass/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.Networking().V1beta1().IngressClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingressclass/filtered/ingressclass.go b/client/injection/kube/informers/networking/v1beta1/ingressclass/filtered/ingressclass.go new file mode 100644 index 0000000000..26020227f5 --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingressclass/filtered/ingressclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/networking/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Networking().V1beta1().IngressClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.IngressClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/networking/v1beta1.IngressClassInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.IngressClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.IngressClassInformer = (*wrapper)(nil) +var _ networkingv1beta1.IngressClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1beta1.IngressClass{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1beta1.IngressClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1beta1.IngressClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NetworkingV1beta1().IngressClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1beta1.IngressClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NetworkingV1beta1().IngressClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/networking/v1beta1/ingressclass/ingressclass.go b/client/injection/kube/informers/networking/v1beta1/ingressclass/ingressclass.go new file mode 100644 index 0000000000..0d6c1e0d62 --- /dev/null +++ b/client/injection/kube/informers/networking/v1beta1/ingressclass/ingressclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package ingressclass + +import ( + context "context" + + apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/networking/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + networkingv1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Networking().V1beta1().IngressClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.IngressClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/networking/v1beta1.IngressClassInformer from context.") + } + return untyped.(v1beta1.IngressClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.IngressClassInformer = (*wrapper)(nil) +var _ networkingv1beta1.IngressClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinetworkingv1beta1.IngressClass{}, 0, nil) +} + +func (w *wrapper) Lister() networkingv1beta1.IngressClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinetworkingv1beta1.IngressClass, err error) { + lo, err := w.client.NetworkingV1beta1().IngressClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinetworkingv1beta1.IngressClass, error) { + return w.client.NetworkingV1beta1().IngressClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/node/v1/runtimeclass/fake/fake.go b/client/injection/kube/informers/node/v1/runtimeclass/fake/fake.go new file mode 100644 index 0000000000..46a2f01d3d --- /dev/null +++ b/client/injection/kube/informers/node/v1/runtimeclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + runtimeclass "knative.dev/pkg/client/injection/kube/informers/node/v1/runtimeclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = runtimeclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Node().V1().RuntimeClasses() + return context.WithValue(ctx, runtimeclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/node/v1/runtimeclass/filtered/fake/fake.go b/client/injection/kube/informers/node/v1/runtimeclass/filtered/fake/fake.go new file mode 100644 index 0000000000..94df2f3a47 --- /dev/null +++ b/client/injection/kube/informers/node/v1/runtimeclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/node/v1/runtimeclass/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.Node().V1().RuntimeClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/node/v1/runtimeclass/filtered/runtimeclass.go b/client/injection/kube/informers/node/v1/runtimeclass/filtered/runtimeclass.go new file mode 100644 index 0000000000..f6b4492580 --- /dev/null +++ b/client/injection/kube/informers/node/v1/runtimeclass/filtered/runtimeclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinodev1 "k8s.io/api/node/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/node/v1" + kubernetes "k8s.io/client-go/kubernetes" + nodev1 "k8s.io/client-go/listers/node/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Node().V1().RuntimeClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.RuntimeClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/node/v1.RuntimeClassInformer with selector %s from context.", selector) + } + return untyped.(v1.RuntimeClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.RuntimeClassInformer = (*wrapper)(nil) +var _ nodev1.RuntimeClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinodev1.RuntimeClass{}, 0, nil) +} + +func (w *wrapper) Lister() nodev1.RuntimeClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinodev1.RuntimeClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NodeV1().RuntimeClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinodev1.RuntimeClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NodeV1().RuntimeClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/node/v1/runtimeclass/runtimeclass.go b/client/injection/kube/informers/node/v1/runtimeclass/runtimeclass.go new file mode 100644 index 0000000000..9cc4193e70 --- /dev/null +++ b/client/injection/kube/informers/node/v1/runtimeclass/runtimeclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package runtimeclass + +import ( + context "context" + + apinodev1 "k8s.io/api/node/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/node/v1" + kubernetes "k8s.io/client-go/kubernetes" + nodev1 "k8s.io/client-go/listers/node/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Node().V1().RuntimeClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.RuntimeClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/node/v1.RuntimeClassInformer from context.") + } + return untyped.(v1.RuntimeClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.RuntimeClassInformer = (*wrapper)(nil) +var _ nodev1.RuntimeClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinodev1.RuntimeClass{}, 0, nil) +} + +func (w *wrapper) Lister() nodev1.RuntimeClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinodev1.RuntimeClass, err error) { + lo, err := w.client.NodeV1().RuntimeClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinodev1.RuntimeClass, error) { + return w.client.NodeV1().RuntimeClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/node/v1alpha1/runtimeclass/fake/fake.go b/client/injection/kube/informers/node/v1alpha1/runtimeclass/fake/fake.go new file mode 100644 index 0000000000..e320f71749 --- /dev/null +++ b/client/injection/kube/informers/node/v1alpha1/runtimeclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + runtimeclass "knative.dev/pkg/client/injection/kube/informers/node/v1alpha1/runtimeclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = runtimeclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Node().V1alpha1().RuntimeClasses() + return context.WithValue(ctx, runtimeclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/node/v1alpha1/runtimeclass/filtered/fake/fake.go b/client/injection/kube/informers/node/v1alpha1/runtimeclass/filtered/fake/fake.go new file mode 100644 index 0000000000..43c3ec9bd3 --- /dev/null +++ b/client/injection/kube/informers/node/v1alpha1/runtimeclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/node/v1alpha1/runtimeclass/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.Node().V1alpha1().RuntimeClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/node/v1alpha1/runtimeclass/filtered/runtimeclass.go b/client/injection/kube/informers/node/v1alpha1/runtimeclass/filtered/runtimeclass.go new file mode 100644 index 0000000000..a6aea24693 --- /dev/null +++ b/client/injection/kube/informers/node/v1alpha1/runtimeclass/filtered/runtimeclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinodev1alpha1 "k8s.io/api/node/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/node/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + nodev1alpha1 "k8s.io/client-go/listers/node/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Node().V1alpha1().RuntimeClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.RuntimeClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/node/v1alpha1.RuntimeClassInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.RuntimeClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.RuntimeClassInformer = (*wrapper)(nil) +var _ nodev1alpha1.RuntimeClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinodev1alpha1.RuntimeClass{}, 0, nil) +} + +func (w *wrapper) Lister() nodev1alpha1.RuntimeClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinodev1alpha1.RuntimeClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NodeV1alpha1().RuntimeClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinodev1alpha1.RuntimeClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NodeV1alpha1().RuntimeClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/node/v1alpha1/runtimeclass/runtimeclass.go b/client/injection/kube/informers/node/v1alpha1/runtimeclass/runtimeclass.go new file mode 100644 index 0000000000..0b02a917e3 --- /dev/null +++ b/client/injection/kube/informers/node/v1alpha1/runtimeclass/runtimeclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package runtimeclass + +import ( + context "context" + + apinodev1alpha1 "k8s.io/api/node/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/node/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + nodev1alpha1 "k8s.io/client-go/listers/node/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Node().V1alpha1().RuntimeClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.RuntimeClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/node/v1alpha1.RuntimeClassInformer from context.") + } + return untyped.(v1alpha1.RuntimeClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.RuntimeClassInformer = (*wrapper)(nil) +var _ nodev1alpha1.RuntimeClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinodev1alpha1.RuntimeClass{}, 0, nil) +} + +func (w *wrapper) Lister() nodev1alpha1.RuntimeClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinodev1alpha1.RuntimeClass, err error) { + lo, err := w.client.NodeV1alpha1().RuntimeClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinodev1alpha1.RuntimeClass, error) { + return w.client.NodeV1alpha1().RuntimeClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/node/v1beta1/runtimeclass/fake/fake.go b/client/injection/kube/informers/node/v1beta1/runtimeclass/fake/fake.go new file mode 100644 index 0000000000..4b393875c5 --- /dev/null +++ b/client/injection/kube/informers/node/v1beta1/runtimeclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + runtimeclass "knative.dev/pkg/client/injection/kube/informers/node/v1beta1/runtimeclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = runtimeclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Node().V1beta1().RuntimeClasses() + return context.WithValue(ctx, runtimeclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/node/v1beta1/runtimeclass/filtered/fake/fake.go b/client/injection/kube/informers/node/v1beta1/runtimeclass/filtered/fake/fake.go new file mode 100644 index 0000000000..79b2209d96 --- /dev/null +++ b/client/injection/kube/informers/node/v1beta1/runtimeclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/node/v1beta1/runtimeclass/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.Node().V1beta1().RuntimeClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/node/v1beta1/runtimeclass/filtered/runtimeclass.go b/client/injection/kube/informers/node/v1beta1/runtimeclass/filtered/runtimeclass.go new file mode 100644 index 0000000000..51dc059b83 --- /dev/null +++ b/client/injection/kube/informers/node/v1beta1/runtimeclass/filtered/runtimeclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apinodev1beta1 "k8s.io/api/node/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/node/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + nodev1beta1 "k8s.io/client-go/listers/node/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Node().V1beta1().RuntimeClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.RuntimeClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/node/v1beta1.RuntimeClassInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.RuntimeClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.RuntimeClassInformer = (*wrapper)(nil) +var _ nodev1beta1.RuntimeClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinodev1beta1.RuntimeClass{}, 0, nil) +} + +func (w *wrapper) Lister() nodev1beta1.RuntimeClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinodev1beta1.RuntimeClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.NodeV1beta1().RuntimeClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinodev1beta1.RuntimeClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.NodeV1beta1().RuntimeClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/node/v1beta1/runtimeclass/runtimeclass.go b/client/injection/kube/informers/node/v1beta1/runtimeclass/runtimeclass.go new file mode 100644 index 0000000000..be1bf83df3 --- /dev/null +++ b/client/injection/kube/informers/node/v1beta1/runtimeclass/runtimeclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package runtimeclass + +import ( + context "context" + + apinodev1beta1 "k8s.io/api/node/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/node/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + nodev1beta1 "k8s.io/client-go/listers/node/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Node().V1beta1().RuntimeClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.RuntimeClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/node/v1beta1.RuntimeClassInformer from context.") + } + return untyped.(v1beta1.RuntimeClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.RuntimeClassInformer = (*wrapper)(nil) +var _ nodev1beta1.RuntimeClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apinodev1beta1.RuntimeClass{}, 0, nil) +} + +func (w *wrapper) Lister() nodev1beta1.RuntimeClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apinodev1beta1.RuntimeClass, err error) { + lo, err := w.client.NodeV1beta1().RuntimeClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apinodev1beta1.RuntimeClass, error) { + return w.client.NodeV1beta1().RuntimeClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/fake/fake.go b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/fake/fake.go new file mode 100644 index 0000000000..880d441476 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + poddisruptionbudget "knative.dev/pkg/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = poddisruptionbudget.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Policy().V1beta1().PodDisruptionBudgets() + return context.WithValue(ctx, poddisruptionbudget.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/fake/fake.go b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/fake/fake.go new file mode 100644 index 0000000000..5055c1b9ed --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/policy/v1beta1/poddisruptionbudget/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.Policy().V1beta1().PodDisruptionBudgets() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/poddisruptionbudget.go b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/poddisruptionbudget.go new file mode 100644 index 0000000000..bbe9837117 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/poddisruptionbudget.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apipolicyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/policy/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + policyv1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Policy().V1beta1().PodDisruptionBudgets() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.PodDisruptionBudgetInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/policy/v1beta1.PodDisruptionBudgetInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.PodDisruptionBudgetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.PodDisruptionBudgetInformer = (*wrapper)(nil) +var _ policyv1beta1.PodDisruptionBudgetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apipolicyv1beta1.PodDisruptionBudget{}, 0, nil) +} + +func (w *wrapper) Lister() policyv1beta1.PodDisruptionBudgetLister { + return w +} + +func (w *wrapper) PodDisruptionBudgets(namespace string) policyv1beta1.PodDisruptionBudgetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apipolicyv1beta1.PodDisruptionBudget, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.PolicyV1beta1().PodDisruptionBudgets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apipolicyv1beta1.PodDisruptionBudget, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.PolicyV1beta1().PodDisruptionBudgets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/poddisruptionbudget_expansion.go b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/poddisruptionbudget_expansion.go new file mode 100644 index 0000000000..fc2e1502f1 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/filtered/poddisruptionbudget_expansion.go @@ -0,0 +1,26 @@ +/* +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 filtered + +import ( + v1 "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1beta1" +) + +func (w *wrapper) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/poddisruptionbudget.go b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/poddisruptionbudget.go new file mode 100644 index 0000000000..89aff14a76 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/poddisruptionbudget.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package poddisruptionbudget + +import ( + context "context" + + apipolicyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/policy/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + policyv1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Policy().V1beta1().PodDisruptionBudgets() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.PodDisruptionBudgetInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/policy/v1beta1.PodDisruptionBudgetInformer from context.") + } + return untyped.(v1beta1.PodDisruptionBudgetInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.PodDisruptionBudgetInformer = (*wrapper)(nil) +var _ policyv1beta1.PodDisruptionBudgetLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apipolicyv1beta1.PodDisruptionBudget{}, 0, nil) +} + +func (w *wrapper) Lister() policyv1beta1.PodDisruptionBudgetLister { + return w +} + +func (w *wrapper) PodDisruptionBudgets(namespace string) policyv1beta1.PodDisruptionBudgetNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apipolicyv1beta1.PodDisruptionBudget, err error) { + lo, err := w.client.PolicyV1beta1().PodDisruptionBudgets(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apipolicyv1beta1.PodDisruptionBudget, error) { + return w.client.PolicyV1beta1().PodDisruptionBudgets(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/poddisruptionbudget_expansion.go b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/poddisruptionbudget_expansion.go new file mode 100644 index 0000000000..2e7cb8880b --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/poddisruptionbudget/poddisruptionbudget_expansion.go @@ -0,0 +1,26 @@ +/* +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 poddisruptionbudget + +import ( + v1 "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1beta1" +) + +func (w *wrapper) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + panic("NYI") +} diff --git a/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/fake/fake.go b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/fake/fake.go new file mode 100644 index 0000000000..51ffac5513 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + podsecuritypolicy "knative.dev/pkg/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = podsecuritypolicy.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Policy().V1beta1().PodSecurityPolicies() + return context.WithValue(ctx, podsecuritypolicy.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/filtered/fake/fake.go b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/filtered/fake/fake.go new file mode 100644 index 0000000000..8cc80e2267 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/policy/v1beta1/podsecuritypolicy/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.Policy().V1beta1().PodSecurityPolicies() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/filtered/podsecuritypolicy.go b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/filtered/podsecuritypolicy.go new file mode 100644 index 0000000000..3d66584353 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/filtered/podsecuritypolicy.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apipolicyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/policy/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + policyv1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Policy().V1beta1().PodSecurityPolicies() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.PodSecurityPolicyInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/policy/v1beta1.PodSecurityPolicyInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.PodSecurityPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.PodSecurityPolicyInformer = (*wrapper)(nil) +var _ policyv1beta1.PodSecurityPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apipolicyv1beta1.PodSecurityPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() policyv1beta1.PodSecurityPolicyLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apipolicyv1beta1.PodSecurityPolicy, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.PolicyV1beta1().PodSecurityPolicies().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apipolicyv1beta1.PodSecurityPolicy, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.PolicyV1beta1().PodSecurityPolicies().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/podsecuritypolicy.go b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/podsecuritypolicy.go new file mode 100644 index 0000000000..3e56f2a359 --- /dev/null +++ b/client/injection/kube/informers/policy/v1beta1/podsecuritypolicy/podsecuritypolicy.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package podsecuritypolicy + +import ( + context "context" + + apipolicyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/policy/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + policyv1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Policy().V1beta1().PodSecurityPolicies() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.PodSecurityPolicyInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/policy/v1beta1.PodSecurityPolicyInformer from context.") + } + return untyped.(v1beta1.PodSecurityPolicyInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.PodSecurityPolicyInformer = (*wrapper)(nil) +var _ policyv1beta1.PodSecurityPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apipolicyv1beta1.PodSecurityPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() policyv1beta1.PodSecurityPolicyLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apipolicyv1beta1.PodSecurityPolicy, err error) { + lo, err := w.client.PolicyV1beta1().PodSecurityPolicies().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apipolicyv1beta1.PodSecurityPolicy, error) { + return w.client.PolicyV1beta1().PodSecurityPolicies().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go b/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go index 319f01b5be..dc582646fe 100644 --- a/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go +++ b/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go @@ -21,7 +21,14 @@ package clusterrole import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ClusterRoleInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.ClusterRoleInformer { } return untyped.(v1.ClusterRoleInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.ClusterRoleInformer = (*wrapper)(nil) +var _ rbacv1.ClusterRoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.ClusterRole{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.ClusterRoleLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.ClusterRole, err error) { + lo, err := w.client.RbacV1().ClusterRoles().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.ClusterRole, error) { + return w.client.RbacV1().ClusterRoles().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go b/client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go index 52a9902fd4..d57d94043b 100644 --- a/client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go +++ b/client/injection/kube/informers/rbac/v1/clusterrole/filtered/clusterrole.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ClusterRoleInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.ClusterRoleInformer { } return untyped.(v1.ClusterRoleInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.ClusterRoleInformer = (*wrapper)(nil) +var _ rbacv1.ClusterRoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.ClusterRole{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.ClusterRoleLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.ClusterRole, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1().ClusterRoles().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.ClusterRole, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1().ClusterRoles().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go b/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go index de202bd94a..f5488b07c1 100644 --- a/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go +++ b/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go @@ -21,7 +21,14 @@ package clusterrolebinding import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ClusterRoleBindingInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,38 @@ func Get(ctx context.Context) v1.ClusterRoleBindingInformer { } return untyped.(v1.ClusterRoleBindingInformer) } + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.ClusterRoleBindingInformer = (*wrapper)(nil) +var _ rbacv1.ClusterRoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.ClusterRoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.ClusterRoleBindingLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.ClusterRoleBinding, err error) { + lo, err := w.client.RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.ClusterRoleBinding, error) { + return w.client.RbacV1().ClusterRoleBindings().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go b/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go index 2997fab4ef..27a943c4c2 100644 --- a/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go +++ b/client/injection/kube/informers/rbac/v1/clusterrolebinding/filtered/clusterrolebinding.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.ClusterRoleBindingInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,46 @@ func Get(ctx context.Context, selector string) v1.ClusterRoleBindingInformer { } return untyped.(v1.ClusterRoleBindingInformer) } + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.ClusterRoleBindingInformer = (*wrapper)(nil) +var _ rbacv1.ClusterRoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.ClusterRoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.ClusterRoleBindingLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.ClusterRoleBinding, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.ClusterRoleBinding, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1().ClusterRoleBindings().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/role/filtered/role.go b/client/injection/kube/informers/rbac/v1/role/filtered/role.go index 6ec8ceb89b..d4cda0f8c1 100644 --- a/client/injection/kube/informers/rbac/v1/role/filtered/role.go +++ b/client/injection/kube/informers/rbac/v1/role/filtered/role.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.RoleInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.RoleInformer { } return untyped.(v1.RoleInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.RoleInformer = (*wrapper)(nil) +var _ rbacv1.RoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.Role{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.RoleLister { + return w +} + +func (w *wrapper) Roles(namespace string) rbacv1.RoleNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.Role, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1().Roles(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.Role, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1().Roles(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/role/role.go b/client/injection/kube/informers/rbac/v1/role/role.go index 52047104f6..230b78d654 100644 --- a/client/injection/kube/informers/rbac/v1/role/role.go +++ b/client/injection/kube/informers/rbac/v1/role/role.go @@ -21,7 +21,14 @@ package role import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.RoleInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.RoleInformer { } return untyped.(v1.RoleInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.RoleInformer = (*wrapper)(nil) +var _ rbacv1.RoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.Role{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.RoleLister { + return w +} + +func (w *wrapper) Roles(namespace string) rbacv1.RoleNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.Role, err error) { + lo, err := w.client.RbacV1().Roles(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.Role, error) { + return w.client.RbacV1().Roles(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go b/client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go index 2317ed305b..c4b74be238 100644 --- a/client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go +++ b/client/injection/kube/informers/rbac/v1/rolebinding/filtered/rolebinding.go @@ -21,7 +21,14 @@ package filtered import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -54,6 +62,20 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1.RoleBindingInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -63,3 +85,52 @@ func Get(ctx context.Context, selector string) v1.RoleBindingInformer { } return untyped.(v1.RoleBindingInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1.RoleBindingInformer = (*wrapper)(nil) +var _ rbacv1.RoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.RoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.RoleBindingLister { + return w +} + +func (w *wrapper) RoleBindings(namespace string) rbacv1.RoleBindingNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.RoleBinding, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1().RoleBindings(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.RoleBinding, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1().RoleBindings(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1/rolebinding/rolebinding.go b/client/injection/kube/informers/rbac/v1/rolebinding/rolebinding.go index 737360a58f..99e738d75d 100644 --- a/client/injection/kube/informers/rbac/v1/rolebinding/rolebinding.go +++ b/client/injection/kube/informers/rbac/v1/rolebinding/rolebinding.go @@ -21,7 +21,14 @@ package rolebinding import ( context "context" + apirbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -30,6 +37,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -41,6 +49,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.RoleBindingInformer { untyped := ctx.Value(Key{}) @@ -50,3 +63,44 @@ func Get(ctx context.Context) v1.RoleBindingInformer { } return untyped.(v1.RoleBindingInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.RoleBindingInformer = (*wrapper)(nil) +var _ rbacv1.RoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1.RoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1.RoleBindingLister { + return w +} + +func (w *wrapper) RoleBindings(namespace string) rbacv1.RoleBindingNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.RoleBinding, err error) { + lo, err := w.client.RbacV1().RoleBindings(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1.RoleBinding, error) { + return w.client.RbacV1().RoleBindings(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/clusterrole/clusterrole.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/clusterrole.go new file mode 100644 index 0000000000..ec46e860d3 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/clusterrole.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package clusterrole + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1alpha1().ClusterRoles() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.ClusterRoleInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.ClusterRoleInformer from context.") + } + return untyped.(v1alpha1.ClusterRoleInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.ClusterRoleInformer = (*wrapper)(nil) +var _ rbacv1alpha1.ClusterRoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.ClusterRole{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.ClusterRoleLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.ClusterRole, err error) { + lo, err := w.client.RbacV1alpha1().ClusterRoles().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.ClusterRole, error) { + return w.client.RbacV1alpha1().ClusterRoles().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/clusterrole/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/fake/fake.go new file mode 100644 index 0000000000..184445c2a4 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + clusterrole "knative.dev/pkg/client/injection/kube/informers/rbac/v1alpha1/clusterrole" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = clusterrole.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1alpha1().ClusterRoles() + return context.WithValue(ctx, clusterrole.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/clusterrole/filtered/clusterrole.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/filtered/clusterrole.go new file mode 100644 index 0000000000..748e54b252 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/filtered/clusterrole.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1alpha1().ClusterRoles() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.ClusterRoleInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.ClusterRoleInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.ClusterRoleInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.ClusterRoleInformer = (*wrapper)(nil) +var _ rbacv1alpha1.ClusterRoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.ClusterRole{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.ClusterRoleLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.ClusterRole, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1alpha1().ClusterRoles().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.ClusterRole, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1alpha1().ClusterRoles().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/clusterrole/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/filtered/fake/fake.go new file mode 100644 index 0000000000..93e031b85b --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrole/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1alpha1/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().V1alpha1().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/v1alpha1/clusterrolebinding/clusterrolebinding.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/clusterrolebinding.go new file mode 100644 index 0000000000..a2f4540661 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/clusterrolebinding.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package clusterrolebinding + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1alpha1().ClusterRoleBindings() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.ClusterRoleBindingInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.ClusterRoleBindingInformer from context.") + } + return untyped.(v1alpha1.ClusterRoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.ClusterRoleBindingInformer = (*wrapper)(nil) +var _ rbacv1alpha1.ClusterRoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.ClusterRoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.ClusterRoleBindingLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.ClusterRoleBinding, err error) { + lo, err := w.client.RbacV1alpha1().ClusterRoleBindings().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.ClusterRoleBinding, error) { + return w.client.RbacV1alpha1().ClusterRoleBindings().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/fake/fake.go new file mode 100644 index 0000000000..b12bc89692 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + clusterrolebinding "knative.dev/pkg/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = clusterrolebinding.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1alpha1().ClusterRoleBindings() + return context.WithValue(ctx, clusterrolebinding.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/filtered/clusterrolebinding.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/filtered/clusterrolebinding.go new file mode 100644 index 0000000000..f5dbeee175 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/filtered/clusterrolebinding.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1alpha1().ClusterRoleBindings() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.ClusterRoleBindingInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.ClusterRoleBindingInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.ClusterRoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.ClusterRoleBindingInformer = (*wrapper)(nil) +var _ rbacv1alpha1.ClusterRoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.ClusterRoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.ClusterRoleBindingLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.ClusterRoleBinding, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1alpha1().ClusterRoleBindings().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.ClusterRoleBinding, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1alpha1().ClusterRoleBindings().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/filtered/fake/fake.go new file mode 100644 index 0000000000..317afd0381 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/clusterrolebinding/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1alpha1/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().V1alpha1().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/v1alpha1/role/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/role/fake/fake.go new file mode 100644 index 0000000000..d0edd03a43 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/role/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + role "knative.dev/pkg/client/injection/kube/informers/rbac/v1alpha1/role" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = role.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1alpha1().Roles() + return context.WithValue(ctx, role.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/role/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/role/filtered/fake/fake.go new file mode 100644 index 0000000000..8429b74bca --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/role/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1alpha1/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().V1alpha1().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/v1alpha1/role/filtered/role.go b/client/injection/kube/informers/rbac/v1alpha1/role/filtered/role.go new file mode 100644 index 0000000000..a86ebceffa --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/role/filtered/role.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1alpha1().Roles() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.RoleInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.RoleInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.RoleInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1alpha1.RoleInformer = (*wrapper)(nil) +var _ rbacv1alpha1.RoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.Role{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.RoleLister { + return w +} + +func (w *wrapper) Roles(namespace string) rbacv1alpha1.RoleNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.Role, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1alpha1().Roles(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.Role, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1alpha1().Roles(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/role/role.go b/client/injection/kube/informers/rbac/v1alpha1/role/role.go new file mode 100644 index 0000000000..2807895ee0 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/role/role.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package role + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1alpha1().Roles() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.RoleInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.RoleInformer from context.") + } + return untyped.(v1alpha1.RoleInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1alpha1.RoleInformer = (*wrapper)(nil) +var _ rbacv1alpha1.RoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.Role{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.RoleLister { + return w +} + +func (w *wrapper) Roles(namespace string) rbacv1alpha1.RoleNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.Role, err error) { + lo, err := w.client.RbacV1alpha1().Roles(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.Role, error) { + return w.client.RbacV1alpha1().Roles(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/rolebinding/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/fake/fake.go new file mode 100644 index 0000000000..96828e7cf6 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + rolebinding "knative.dev/pkg/client/injection/kube/informers/rbac/v1alpha1/rolebinding" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = rolebinding.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1alpha1().RoleBindings() + return context.WithValue(ctx, rolebinding.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/rolebinding/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/filtered/fake/fake.go new file mode 100644 index 0000000000..716c223b2e --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1alpha1/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().V1alpha1().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/v1alpha1/rolebinding/filtered/rolebinding.go b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/filtered/rolebinding.go new file mode 100644 index 0000000000..dbdf0e66cc --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/filtered/rolebinding.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1alpha1().RoleBindings() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.RoleBindingInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.RoleBindingInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.RoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1alpha1.RoleBindingInformer = (*wrapper)(nil) +var _ rbacv1alpha1.RoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.RoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.RoleBindingLister { + return w +} + +func (w *wrapper) RoleBindings(namespace string) rbacv1alpha1.RoleBindingNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.RoleBinding, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1alpha1().RoleBindings(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.RoleBinding, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1alpha1().RoleBindings(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1alpha1/rolebinding/rolebinding.go b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/rolebinding.go new file mode 100644 index 0000000000..bbdba85fc7 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1alpha1/rolebinding/rolebinding.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package rolebinding + +import ( + context "context" + + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1alpha1().RoleBindings() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.RoleBindingInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1alpha1.RoleBindingInformer from context.") + } + return untyped.(v1alpha1.RoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1alpha1.RoleBindingInformer = (*wrapper)(nil) +var _ rbacv1alpha1.RoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1alpha1.RoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1alpha1.RoleBindingLister { + return w +} + +func (w *wrapper) RoleBindings(namespace string) rbacv1alpha1.RoleBindingNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1alpha1.RoleBinding, err error) { + lo, err := w.client.RbacV1alpha1().RoleBindings(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1alpha1.RoleBinding, error) { + return w.client.RbacV1alpha1().RoleBindings(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/clusterrole/clusterrole.go b/client/injection/kube/informers/rbac/v1beta1/clusterrole/clusterrole.go new file mode 100644 index 0000000000..a04e074628 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrole/clusterrole.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package clusterrole + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1beta1().ClusterRoles() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.ClusterRoleInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.ClusterRoleInformer from context.") + } + return untyped.(v1beta1.ClusterRoleInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.ClusterRoleInformer = (*wrapper)(nil) +var _ rbacv1beta1.ClusterRoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.ClusterRole{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.ClusterRoleLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.ClusterRole, err error) { + lo, err := w.client.RbacV1beta1().ClusterRoles().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.ClusterRole, error) { + return w.client.RbacV1beta1().ClusterRoles().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/clusterrole/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/clusterrole/fake/fake.go new file mode 100644 index 0000000000..7bb8cf6634 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrole/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + clusterrole "knative.dev/pkg/client/injection/kube/informers/rbac/v1beta1/clusterrole" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = clusterrole.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1beta1().ClusterRoles() + return context.WithValue(ctx, clusterrole.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1beta1/clusterrole/filtered/clusterrole.go b/client/injection/kube/informers/rbac/v1beta1/clusterrole/filtered/clusterrole.go new file mode 100644 index 0000000000..c449524424 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrole/filtered/clusterrole.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().ClusterRoles() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.ClusterRoleInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.ClusterRoleInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.ClusterRoleInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.ClusterRoleInformer = (*wrapper)(nil) +var _ rbacv1beta1.ClusterRoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.ClusterRole{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.ClusterRoleLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.ClusterRole, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1beta1().ClusterRoles().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.ClusterRole, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1beta1().ClusterRoles().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/clusterrole/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/clusterrole/filtered/fake/fake.go new file mode 100644 index 0000000000..c2d35532a2 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrole/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1beta1/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().V1beta1().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/v1beta1/clusterrolebinding/clusterrolebinding.go b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/clusterrolebinding.go new file mode 100644 index 0000000000..391511fa35 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/clusterrolebinding.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package clusterrolebinding + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1beta1().ClusterRoleBindings() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.ClusterRoleBindingInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.ClusterRoleBindingInformer from context.") + } + return untyped.(v1beta1.ClusterRoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.ClusterRoleBindingInformer = (*wrapper)(nil) +var _ rbacv1beta1.ClusterRoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.ClusterRoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.ClusterRoleBindingLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.ClusterRoleBinding, err error) { + lo, err := w.client.RbacV1beta1().ClusterRoleBindings().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.ClusterRoleBinding, error) { + return w.client.RbacV1beta1().ClusterRoleBindings().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/fake/fake.go new file mode 100644 index 0000000000..639910c3c7 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + clusterrolebinding "knative.dev/pkg/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = clusterrolebinding.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1beta1().ClusterRoleBindings() + return context.WithValue(ctx, clusterrolebinding.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/filtered/clusterrolebinding.go b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/filtered/clusterrolebinding.go new file mode 100644 index 0000000000..334634e669 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/filtered/clusterrolebinding.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().ClusterRoleBindings() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.ClusterRoleBindingInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.ClusterRoleBindingInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.ClusterRoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.ClusterRoleBindingInformer = (*wrapper)(nil) +var _ rbacv1beta1.ClusterRoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.ClusterRoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.ClusterRoleBindingLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.ClusterRoleBinding, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1beta1().ClusterRoleBindings().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.ClusterRoleBinding, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1beta1().ClusterRoleBindings().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/filtered/fake/fake.go new file mode 100644 index 0000000000..42eb5b60b4 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/clusterrolebinding/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1beta1/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().V1beta1().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/v1beta1/role/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/role/fake/fake.go new file mode 100644 index 0000000000..8fccc50164 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/role/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + role "knative.dev/pkg/client/injection/kube/informers/rbac/v1beta1/role" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = role.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1beta1().Roles() + return context.WithValue(ctx, role.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1beta1/role/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/role/filtered/fake/fake.go new file mode 100644 index 0000000000..be7b06f366 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/role/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1beta1/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().V1beta1().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/v1beta1/role/filtered/role.go b/client/injection/kube/informers/rbac/v1beta1/role/filtered/role.go new file mode 100644 index 0000000000..8d3f91b04c --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/role/filtered/role.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().Roles() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.RoleInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.RoleInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.RoleInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.RoleInformer = (*wrapper)(nil) +var _ rbacv1beta1.RoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.Role{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.RoleLister { + return w +} + +func (w *wrapper) Roles(namespace string) rbacv1beta1.RoleNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.Role, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1beta1().Roles(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.Role, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1beta1().Roles(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/role/role.go b/client/injection/kube/informers/rbac/v1beta1/role/role.go new file mode 100644 index 0000000000..98bc8fc19d --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/role/role.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package role + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1beta1().Roles() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.RoleInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.RoleInformer from context.") + } + return untyped.(v1beta1.RoleInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.RoleInformer = (*wrapper)(nil) +var _ rbacv1beta1.RoleLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.Role{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.RoleLister { + return w +} + +func (w *wrapper) Roles(namespace string) rbacv1beta1.RoleNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.Role, err error) { + lo, err := w.client.RbacV1beta1().Roles(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.Role, error) { + return w.client.RbacV1beta1().Roles(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/rolebinding/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/rolebinding/fake/fake.go new file mode 100644 index 0000000000..36a90f98b7 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/rolebinding/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + rolebinding "knative.dev/pkg/client/injection/kube/informers/rbac/v1beta1/rolebinding" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = rolebinding.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Rbac().V1beta1().RoleBindings() + return context.WithValue(ctx, rolebinding.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/rbac/v1beta1/rolebinding/filtered/fake/fake.go b/client/injection/kube/informers/rbac/v1beta1/rolebinding/filtered/fake/fake.go new file mode 100644 index 0000000000..ff06b84380 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/rolebinding/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/v1beta1/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().V1beta1().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/v1beta1/rolebinding/filtered/rolebinding.go b/client/injection/kube/informers/rbac/v1beta1/rolebinding/filtered/rolebinding.go new file mode 100644 index 0000000000..86ed9f0ac4 --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/rolebinding/filtered/rolebinding.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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().V1beta1().RoleBindings() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.RoleBindingInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.RoleBindingInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.RoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1beta1.RoleBindingInformer = (*wrapper)(nil) +var _ rbacv1beta1.RoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.RoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.RoleBindingLister { + return w +} + +func (w *wrapper) RoleBindings(namespace string) rbacv1beta1.RoleBindingNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.RoleBinding, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.RbacV1beta1().RoleBindings(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.RoleBinding, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.RbacV1beta1().RoleBindings(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/rbac/v1beta1/rolebinding/rolebinding.go b/client/injection/kube/informers/rbac/v1beta1/rolebinding/rolebinding.go new file mode 100644 index 0000000000..7a870b6fcc --- /dev/null +++ b/client/injection/kube/informers/rbac/v1beta1/rolebinding/rolebinding.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package rolebinding + +import ( + context "context" + + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + rbacv1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Rbac().V1beta1().RoleBindings() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.RoleBindingInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/rbac/v1beta1.RoleBindingInformer from context.") + } + return untyped.(v1beta1.RoleBindingInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1beta1.RoleBindingInformer = (*wrapper)(nil) +var _ rbacv1beta1.RoleBindingLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apirbacv1beta1.RoleBinding{}, 0, nil) +} + +func (w *wrapper) Lister() rbacv1beta1.RoleBindingLister { + return w +} + +func (w *wrapper) RoleBindings(namespace string) rbacv1beta1.RoleBindingNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1beta1.RoleBinding, err error) { + lo, err := w.client.RbacV1beta1().RoleBindings(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apirbacv1beta1.RoleBinding, error) { + return w.client.RbacV1beta1().RoleBindings(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/scheduling/v1/priorityclass/fake/fake.go b/client/injection/kube/informers/scheduling/v1/priorityclass/fake/fake.go new file mode 100644 index 0000000000..f81a36b0f5 --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1/priorityclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + priorityclass "knative.dev/pkg/client/injection/kube/informers/scheduling/v1/priorityclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = priorityclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Scheduling().V1().PriorityClasses() + return context.WithValue(ctx, priorityclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/scheduling/v1/priorityclass/filtered/fake/fake.go b/client/injection/kube/informers/scheduling/v1/priorityclass/filtered/fake/fake.go new file mode 100644 index 0000000000..2b19e4561d --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1/priorityclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/scheduling/v1/priorityclass/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.Scheduling().V1().PriorityClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/scheduling/v1/priorityclass/filtered/priorityclass.go b/client/injection/kube/informers/scheduling/v1/priorityclass/filtered/priorityclass.go new file mode 100644 index 0000000000..7154388154 --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1/priorityclass/filtered/priorityclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apischedulingv1 "k8s.io/api/scheduling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/scheduling/v1" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1 "k8s.io/client-go/listers/scheduling/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Scheduling().V1().PriorityClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.PriorityClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/scheduling/v1.PriorityClassInformer with selector %s from context.", selector) + } + return untyped.(v1.PriorityClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.PriorityClassInformer = (*wrapper)(nil) +var _ schedulingv1.PriorityClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apischedulingv1.PriorityClass{}, 0, nil) +} + +func (w *wrapper) Lister() schedulingv1.PriorityClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apischedulingv1.PriorityClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.SchedulingV1().PriorityClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apischedulingv1.PriorityClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.SchedulingV1().PriorityClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/scheduling/v1/priorityclass/priorityclass.go b/client/injection/kube/informers/scheduling/v1/priorityclass/priorityclass.go new file mode 100644 index 0000000000..1b8dbd794f --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1/priorityclass/priorityclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package priorityclass + +import ( + context "context" + + apischedulingv1 "k8s.io/api/scheduling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/scheduling/v1" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1 "k8s.io/client-go/listers/scheduling/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Scheduling().V1().PriorityClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.PriorityClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/scheduling/v1.PriorityClassInformer from context.") + } + return untyped.(v1.PriorityClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.PriorityClassInformer = (*wrapper)(nil) +var _ schedulingv1.PriorityClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apischedulingv1.PriorityClass{}, 0, nil) +} + +func (w *wrapper) Lister() schedulingv1.PriorityClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apischedulingv1.PriorityClass, err error) { + lo, err := w.client.SchedulingV1().PriorityClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apischedulingv1.PriorityClass, error) { + return w.client.SchedulingV1().PriorityClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/fake/fake.go b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/fake/fake.go new file mode 100644 index 0000000000..14f8d4465f --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + priorityclass "knative.dev/pkg/client/injection/kube/informers/scheduling/v1alpha1/priorityclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = priorityclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Scheduling().V1alpha1().PriorityClasses() + return context.WithValue(ctx, priorityclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/filtered/fake/fake.go b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/filtered/fake/fake.go new file mode 100644 index 0000000000..d52c2a1a28 --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/scheduling/v1alpha1/priorityclass/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.Scheduling().V1alpha1().PriorityClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/filtered/priorityclass.go b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/filtered/priorityclass.go new file mode 100644 index 0000000000..fcff4ce63d --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/filtered/priorityclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apischedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/scheduling/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha1 "k8s.io/client-go/listers/scheduling/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Scheduling().V1alpha1().PriorityClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.PriorityClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/scheduling/v1alpha1.PriorityClassInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.PriorityClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.PriorityClassInformer = (*wrapper)(nil) +var _ schedulingv1alpha1.PriorityClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apischedulingv1alpha1.PriorityClass{}, 0, nil) +} + +func (w *wrapper) Lister() schedulingv1alpha1.PriorityClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apischedulingv1alpha1.PriorityClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.SchedulingV1alpha1().PriorityClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apischedulingv1alpha1.PriorityClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.SchedulingV1alpha1().PriorityClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/priorityclass.go b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/priorityclass.go new file mode 100644 index 0000000000..16229ec141 --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1alpha1/priorityclass/priorityclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package priorityclass + +import ( + context "context" + + apischedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/scheduling/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha1 "k8s.io/client-go/listers/scheduling/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Scheduling().V1alpha1().PriorityClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.PriorityClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/scheduling/v1alpha1.PriorityClassInformer from context.") + } + return untyped.(v1alpha1.PriorityClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.PriorityClassInformer = (*wrapper)(nil) +var _ schedulingv1alpha1.PriorityClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apischedulingv1alpha1.PriorityClass{}, 0, nil) +} + +func (w *wrapper) Lister() schedulingv1alpha1.PriorityClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apischedulingv1alpha1.PriorityClass, err error) { + lo, err := w.client.SchedulingV1alpha1().PriorityClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apischedulingv1alpha1.PriorityClass, error) { + return w.client.SchedulingV1alpha1().PriorityClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/scheduling/v1beta1/priorityclass/fake/fake.go b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/fake/fake.go new file mode 100644 index 0000000000..5409e6cd27 --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + priorityclass "knative.dev/pkg/client/injection/kube/informers/scheduling/v1beta1/priorityclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = priorityclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Scheduling().V1beta1().PriorityClasses() + return context.WithValue(ctx, priorityclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/scheduling/v1beta1/priorityclass/filtered/fake/fake.go b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/filtered/fake/fake.go new file mode 100644 index 0000000000..57d0078d60 --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/scheduling/v1beta1/priorityclass/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.Scheduling().V1beta1().PriorityClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/scheduling/v1beta1/priorityclass/filtered/priorityclass.go b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/filtered/priorityclass.go new file mode 100644 index 0000000000..f320f44f2f --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/filtered/priorityclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apischedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Scheduling().V1beta1().PriorityClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.PriorityClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/scheduling/v1beta1.PriorityClassInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.PriorityClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.PriorityClassInformer = (*wrapper)(nil) +var _ schedulingv1beta1.PriorityClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apischedulingv1beta1.PriorityClass{}, 0, nil) +} + +func (w *wrapper) Lister() schedulingv1beta1.PriorityClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apischedulingv1beta1.PriorityClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.SchedulingV1beta1().PriorityClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apischedulingv1beta1.PriorityClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.SchedulingV1beta1().PriorityClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/scheduling/v1beta1/priorityclass/priorityclass.go b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/priorityclass.go new file mode 100644 index 0000000000..a255524c63 --- /dev/null +++ b/client/injection/kube/informers/scheduling/v1beta1/priorityclass/priorityclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package priorityclass + +import ( + context "context" + + apischedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Scheduling().V1beta1().PriorityClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.PriorityClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/scheduling/v1beta1.PriorityClassInformer from context.") + } + return untyped.(v1beta1.PriorityClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.PriorityClassInformer = (*wrapper)(nil) +var _ schedulingv1beta1.PriorityClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apischedulingv1beta1.PriorityClass{}, 0, nil) +} + +func (w *wrapper) Lister() schedulingv1beta1.PriorityClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apischedulingv1beta1.PriorityClass, err error) { + lo, err := w.client.SchedulingV1beta1().PriorityClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apischedulingv1beta1.PriorityClass, error) { + return w.client.SchedulingV1beta1().PriorityClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/csidriver/csidriver.go b/client/injection/kube/informers/storage/v1/csidriver/csidriver.go new file mode 100644 index 0000000000..b1891e1c7a --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csidriver/csidriver.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package csidriver + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1().CSIDrivers() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.CSIDriverInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1.CSIDriverInformer from context.") + } + return untyped.(v1.CSIDriverInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.CSIDriverInformer = (*wrapper)(nil) +var _ storagev1.CSIDriverLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.CSIDriver{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.CSIDriverLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.CSIDriver, err error) { + lo, err := w.client.StorageV1().CSIDrivers().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.CSIDriver, error) { + return w.client.StorageV1().CSIDrivers().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/csidriver/fake/fake.go b/client/injection/kube/informers/storage/v1/csidriver/fake/fake.go new file mode 100644 index 0000000000..e10a6924fb --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csidriver/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + csidriver "knative.dev/pkg/client/injection/kube/informers/storage/v1/csidriver" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = csidriver.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1().CSIDrivers() + return context.WithValue(ctx, csidriver.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1/csidriver/filtered/csidriver.go b/client/injection/kube/informers/storage/v1/csidriver/filtered/csidriver.go new file mode 100644 index 0000000000..776b6deabf --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csidriver/filtered/csidriver.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1().CSIDrivers() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.CSIDriverInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1.CSIDriverInformer with selector %s from context.", selector) + } + return untyped.(v1.CSIDriverInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.CSIDriverInformer = (*wrapper)(nil) +var _ storagev1.CSIDriverLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.CSIDriver{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.CSIDriverLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.CSIDriver, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1().CSIDrivers().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.CSIDriver, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1().CSIDrivers().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/csidriver/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1/csidriver/filtered/fake/fake.go new file mode 100644 index 0000000000..d88e2fd543 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csidriver/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1/csidriver/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.Storage().V1().CSIDrivers() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1/csinode/csinode.go b/client/injection/kube/informers/storage/v1/csinode/csinode.go new file mode 100644 index 0000000000..a7fa2b88a2 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csinode/csinode.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package csinode + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1().CSINodes() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.CSINodeInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1.CSINodeInformer from context.") + } + return untyped.(v1.CSINodeInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.CSINodeInformer = (*wrapper)(nil) +var _ storagev1.CSINodeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.CSINode{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.CSINodeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.CSINode, err error) { + lo, err := w.client.StorageV1().CSINodes().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.CSINode, error) { + return w.client.StorageV1().CSINodes().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/csinode/fake/fake.go b/client/injection/kube/informers/storage/v1/csinode/fake/fake.go new file mode 100644 index 0000000000..2ad37f79bb --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csinode/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + csinode "knative.dev/pkg/client/injection/kube/informers/storage/v1/csinode" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = csinode.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1().CSINodes() + return context.WithValue(ctx, csinode.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1/csinode/filtered/csinode.go b/client/injection/kube/informers/storage/v1/csinode/filtered/csinode.go new file mode 100644 index 0000000000..0542916c5d --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csinode/filtered/csinode.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1().CSINodes() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.CSINodeInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1.CSINodeInformer with selector %s from context.", selector) + } + return untyped.(v1.CSINodeInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.CSINodeInformer = (*wrapper)(nil) +var _ storagev1.CSINodeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.CSINode{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.CSINodeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.CSINode, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1().CSINodes().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.CSINode, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1().CSINodes().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/csinode/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1/csinode/filtered/fake/fake.go new file mode 100644 index 0000000000..7dff903506 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/csinode/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1/csinode/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.Storage().V1().CSINodes() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1/storageclass/fake/fake.go b/client/injection/kube/informers/storage/v1/storageclass/fake/fake.go new file mode 100644 index 0000000000..f061f4b431 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/storageclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + storageclass "knative.dev/pkg/client/injection/kube/informers/storage/v1/storageclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = storageclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1().StorageClasses() + return context.WithValue(ctx, storageclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1/storageclass/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1/storageclass/filtered/fake/fake.go new file mode 100644 index 0000000000..fc28e36236 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/storageclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1/storageclass/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.Storage().V1().StorageClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1/storageclass/filtered/storageclass.go b/client/injection/kube/informers/storage/v1/storageclass/filtered/storageclass.go new file mode 100644 index 0000000000..d91d49b4b6 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/storageclass/filtered/storageclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1().StorageClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.StorageClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1.StorageClassInformer with selector %s from context.", selector) + } + return untyped.(v1.StorageClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.StorageClassInformer = (*wrapper)(nil) +var _ storagev1.StorageClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.StorageClass{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.StorageClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.StorageClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1().StorageClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.StorageClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1().StorageClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/storageclass/storageclass.go b/client/injection/kube/informers/storage/v1/storageclass/storageclass.go new file mode 100644 index 0000000000..e61e143b92 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/storageclass/storageclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package storageclass + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1().StorageClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.StorageClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1.StorageClassInformer from context.") + } + return untyped.(v1.StorageClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.StorageClassInformer = (*wrapper)(nil) +var _ storagev1.StorageClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.StorageClass{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.StorageClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.StorageClass, err error) { + lo, err := w.client.StorageV1().StorageClasses().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.StorageClass, error) { + return w.client.StorageV1().StorageClasses().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/volumeattachment/fake/fake.go b/client/injection/kube/informers/storage/v1/volumeattachment/fake/fake.go new file mode 100644 index 0000000000..20cd08a976 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/volumeattachment/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + volumeattachment "knative.dev/pkg/client/injection/kube/informers/storage/v1/volumeattachment" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = volumeattachment.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1().VolumeAttachments() + return context.WithValue(ctx, volumeattachment.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1/volumeattachment/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1/volumeattachment/filtered/fake/fake.go new file mode 100644 index 0000000000..c3255574c0 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/volumeattachment/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1/volumeattachment/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.Storage().V1().VolumeAttachments() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1/volumeattachment/filtered/volumeattachment.go b/client/injection/kube/informers/storage/v1/volumeattachment/filtered/volumeattachment.go new file mode 100644 index 0000000000..b538489906 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/volumeattachment/filtered/volumeattachment.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1().VolumeAttachments() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1.VolumeAttachmentInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1.VolumeAttachmentInformer with selector %s from context.", selector) + } + return untyped.(v1.VolumeAttachmentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1.VolumeAttachmentInformer = (*wrapper)(nil) +var _ storagev1.VolumeAttachmentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.VolumeAttachment{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.VolumeAttachmentLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.VolumeAttachment, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1().VolumeAttachments().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.VolumeAttachment, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1().VolumeAttachments().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1/volumeattachment/volumeattachment.go b/client/injection/kube/informers/storage/v1/volumeattachment/volumeattachment.go new file mode 100644 index 0000000000..5c1848c746 --- /dev/null +++ b/client/injection/kube/informers/storage/v1/volumeattachment/volumeattachment.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package volumeattachment + +import ( + context "context" + + apistoragev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/client-go/informers/storage/v1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1().VolumeAttachments() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1.VolumeAttachmentInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1.VolumeAttachmentInformer from context.") + } + return untyped.(v1.VolumeAttachmentInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1.VolumeAttachmentInformer = (*wrapper)(nil) +var _ storagev1.VolumeAttachmentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1.VolumeAttachment{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1.VolumeAttachmentLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1.VolumeAttachment, err error) { + lo, err := w.client.StorageV1().VolumeAttachments().List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1.VolumeAttachment, error) { + return w.client.StorageV1().VolumeAttachments().Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/csistoragecapacity.go b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/csistoragecapacity.go new file mode 100644 index 0000000000..be065b5f33 --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/csistoragecapacity.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package csistoragecapacity + +import ( + context "context" + + apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/storage/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1alpha1().CSIStorageCapacities() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.CSIStorageCapacityInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1alpha1.CSIStorageCapacityInformer from context.") + } + return untyped.(v1alpha1.CSIStorageCapacityInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1alpha1.CSIStorageCapacityInformer = (*wrapper)(nil) +var _ storagev1alpha1.CSIStorageCapacityLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1alpha1.CSIStorageCapacity{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1alpha1.CSIStorageCapacityLister { + return w +} + +func (w *wrapper) CSIStorageCapacities(namespace string) storagev1alpha1.CSIStorageCapacityNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1alpha1.CSIStorageCapacity, err error) { + lo, err := w.client.StorageV1alpha1().CSIStorageCapacities(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1alpha1.CSIStorageCapacity, error) { + return w.client.StorageV1alpha1().CSIStorageCapacities(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/fake/fake.go b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/fake/fake.go new file mode 100644 index 0000000000..6e6b084e53 --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + csistoragecapacity "knative.dev/pkg/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = csistoragecapacity.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1alpha1().CSIStorageCapacities() + return context.WithValue(ctx, csistoragecapacity.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/filtered/csistoragecapacity.go b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/filtered/csistoragecapacity.go new file mode 100644 index 0000000000..2cfe0219c9 --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/filtered/csistoragecapacity.go @@ -0,0 +1,136 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/storage/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1alpha1().CSIStorageCapacities() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.CSIStorageCapacityInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1alpha1.CSIStorageCapacityInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.CSIStorageCapacityInformer) +} + +type wrapper struct { + client kubernetes.Interface + + namespace string + + selector string +} + +var _ v1alpha1.CSIStorageCapacityInformer = (*wrapper)(nil) +var _ storagev1alpha1.CSIStorageCapacityLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1alpha1.CSIStorageCapacity{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1alpha1.CSIStorageCapacityLister { + return w +} + +func (w *wrapper) CSIStorageCapacities(namespace string) storagev1alpha1.CSIStorageCapacityNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1alpha1.CSIStorageCapacity, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1alpha1().CSIStorageCapacities(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1alpha1.CSIStorageCapacity, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1alpha1().CSIStorageCapacities(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/filtered/fake/fake.go new file mode 100644 index 0000000000..881df41bfa --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/csistoragecapacity/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1alpha1/csistoragecapacity/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.Storage().V1alpha1().CSIStorageCapacities() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1alpha1/volumeattachment/fake/fake.go b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/fake/fake.go new file mode 100644 index 0000000000..3e2a859f53 --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + volumeattachment "knative.dev/pkg/client/injection/kube/informers/storage/v1alpha1/volumeattachment" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = volumeattachment.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1alpha1().VolumeAttachments() + return context.WithValue(ctx, volumeattachment.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1alpha1/volumeattachment/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/filtered/fake/fake.go new file mode 100644 index 0000000000..1d181cd775 --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1alpha1/volumeattachment/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.Storage().V1alpha1().VolumeAttachments() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1alpha1/volumeattachment/filtered/volumeattachment.go b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/filtered/volumeattachment.go new file mode 100644 index 0000000000..efb3bb2ee2 --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/filtered/volumeattachment.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/storage/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1alpha1().VolumeAttachments() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.VolumeAttachmentInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1alpha1.VolumeAttachmentInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.VolumeAttachmentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1alpha1.VolumeAttachmentInformer = (*wrapper)(nil) +var _ storagev1alpha1.VolumeAttachmentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1alpha1.VolumeAttachment{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1alpha1.VolumeAttachmentLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1alpha1.VolumeAttachment, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1alpha1().VolumeAttachments().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1alpha1.VolumeAttachment, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1alpha1().VolumeAttachments().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1alpha1/volumeattachment/volumeattachment.go b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/volumeattachment.go new file mode 100644 index 0000000000..7b70fbb03f --- /dev/null +++ b/client/injection/kube/informers/storage/v1alpha1/volumeattachment/volumeattachment.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package volumeattachment + +import ( + context "context" + + apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/client-go/informers/storage/v1alpha1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1alpha1().VolumeAttachments() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.VolumeAttachmentInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1alpha1.VolumeAttachmentInformer from context.") + } + return untyped.(v1alpha1.VolumeAttachmentInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1alpha1.VolumeAttachmentInformer = (*wrapper)(nil) +var _ storagev1alpha1.VolumeAttachmentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1alpha1.VolumeAttachment{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1alpha1.VolumeAttachmentLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1alpha1.VolumeAttachment, err error) { + lo, err := w.client.StorageV1alpha1().VolumeAttachments().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1alpha1.VolumeAttachment, error) { + return w.client.StorageV1alpha1().VolumeAttachments().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/csidriver/csidriver.go b/client/injection/kube/informers/storage/v1beta1/csidriver/csidriver.go new file mode 100644 index 0000000000..4573433795 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csidriver/csidriver.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package csidriver + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1beta1().CSIDrivers() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.CSIDriverInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.CSIDriverInformer from context.") + } + return untyped.(v1beta1.CSIDriverInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.CSIDriverInformer = (*wrapper)(nil) +var _ storagev1beta1.CSIDriverLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.CSIDriver{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.CSIDriverLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.CSIDriver, err error) { + lo, err := w.client.StorageV1beta1().CSIDrivers().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.CSIDriver, error) { + return w.client.StorageV1beta1().CSIDrivers().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/csidriver/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/csidriver/fake/fake.go new file mode 100644 index 0000000000..57cf198c0a --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csidriver/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + csidriver "knative.dev/pkg/client/injection/kube/informers/storage/v1beta1/csidriver" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = csidriver.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1beta1().CSIDrivers() + return context.WithValue(ctx, csidriver.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1beta1/csidriver/filtered/csidriver.go b/client/injection/kube/informers/storage/v1beta1/csidriver/filtered/csidriver.go new file mode 100644 index 0000000000..348cdf4c28 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csidriver/filtered/csidriver.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1beta1().CSIDrivers() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.CSIDriverInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.CSIDriverInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.CSIDriverInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.CSIDriverInformer = (*wrapper)(nil) +var _ storagev1beta1.CSIDriverLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.CSIDriver{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.CSIDriverLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.CSIDriver, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1beta1().CSIDrivers().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.CSIDriver, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1beta1().CSIDrivers().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/csidriver/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/csidriver/filtered/fake/fake.go new file mode 100644 index 0000000000..c540d52c95 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csidriver/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1beta1/csidriver/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.Storage().V1beta1().CSIDrivers() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1beta1/csinode/csinode.go b/client/injection/kube/informers/storage/v1beta1/csinode/csinode.go new file mode 100644 index 0000000000..cdc45088fb --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csinode/csinode.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package csinode + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1beta1().CSINodes() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.CSINodeInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.CSINodeInformer from context.") + } + return untyped.(v1beta1.CSINodeInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.CSINodeInformer = (*wrapper)(nil) +var _ storagev1beta1.CSINodeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.CSINode{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.CSINodeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.CSINode, err error) { + lo, err := w.client.StorageV1beta1().CSINodes().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.CSINode, error) { + return w.client.StorageV1beta1().CSINodes().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/csinode/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/csinode/fake/fake.go new file mode 100644 index 0000000000..6f12e18114 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csinode/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + csinode "knative.dev/pkg/client/injection/kube/informers/storage/v1beta1/csinode" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = csinode.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1beta1().CSINodes() + return context.WithValue(ctx, csinode.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1beta1/csinode/filtered/csinode.go b/client/injection/kube/informers/storage/v1beta1/csinode/filtered/csinode.go new file mode 100644 index 0000000000..796dd316da --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csinode/filtered/csinode.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1beta1().CSINodes() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.CSINodeInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.CSINodeInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.CSINodeInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.CSINodeInformer = (*wrapper)(nil) +var _ storagev1beta1.CSINodeLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.CSINode{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.CSINodeLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.CSINode, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1beta1().CSINodes().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.CSINode, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1beta1().CSINodes().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/csinode/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/csinode/filtered/fake/fake.go new file mode 100644 index 0000000000..b55cc03ac6 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/csinode/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1beta1/csinode/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.Storage().V1beta1().CSINodes() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1beta1/storageclass/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/storageclass/fake/fake.go new file mode 100644 index 0000000000..99b08c475d --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/storageclass/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + storageclass "knative.dev/pkg/client/injection/kube/informers/storage/v1beta1/storageclass" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = storageclass.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1beta1().StorageClasses() + return context.WithValue(ctx, storageclass.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1beta1/storageclass/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/storageclass/filtered/fake/fake.go new file mode 100644 index 0000000000..98499c9f3a --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/storageclass/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1beta1/storageclass/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.Storage().V1beta1().StorageClasses() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1beta1/storageclass/filtered/storageclass.go b/client/injection/kube/informers/storage/v1beta1/storageclass/filtered/storageclass.go new file mode 100644 index 0000000000..86da16a8f6 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/storageclass/filtered/storageclass.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1beta1().StorageClasses() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.StorageClassInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.StorageClassInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.StorageClassInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.StorageClassInformer = (*wrapper)(nil) +var _ storagev1beta1.StorageClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.StorageClass{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.StorageClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.StorageClass, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1beta1().StorageClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.StorageClass, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1beta1().StorageClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/storageclass/storageclass.go b/client/injection/kube/informers/storage/v1beta1/storageclass/storageclass.go new file mode 100644 index 0000000000..86da7531c8 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/storageclass/storageclass.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package storageclass + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1beta1().StorageClasses() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.StorageClassInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.StorageClassInformer from context.") + } + return untyped.(v1beta1.StorageClassInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.StorageClassInformer = (*wrapper)(nil) +var _ storagev1beta1.StorageClassLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.StorageClass{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.StorageClassLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.StorageClass, err error) { + lo, err := w.client.StorageV1beta1().StorageClasses().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.StorageClass, error) { + return w.client.StorageV1beta1().StorageClasses().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/volumeattachment/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/volumeattachment/fake/fake.go new file mode 100644 index 0000000000..4501088d7b --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/volumeattachment/fake/fake.go @@ -0,0 +1,40 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "knative.dev/pkg/client/injection/kube/informers/factory/fake" + volumeattachment "knative.dev/pkg/client/injection/kube/informers/storage/v1beta1/volumeattachment" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = volumeattachment.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Storage().V1beta1().VolumeAttachments() + return context.WithValue(ctx, volumeattachment.Key{}, inf), inf.Informer() +} diff --git a/client/injection/kube/informers/storage/v1beta1/volumeattachment/filtered/fake/fake.go b/client/injection/kube/informers/storage/v1beta1/volumeattachment/filtered/fake/fake.go new file mode 100644 index 0000000000..74cf210c6e --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/volumeattachment/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +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. +*/ + +// 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/storage/v1beta1/volumeattachment/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.Storage().V1beta1().VolumeAttachments() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/client/injection/kube/informers/storage/v1beta1/volumeattachment/filtered/volumeattachment.go b/client/injection/kube/informers/storage/v1beta1/volumeattachment/filtered/volumeattachment.go new file mode 100644 index 0000000000..24e368ce57 --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/volumeattachment/filtered/volumeattachment.go @@ -0,0 +1,130 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + 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) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// 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.Storage().V1beta1().VolumeAttachments() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + 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 { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1beta1.VolumeAttachmentInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.VolumeAttachmentInformer with selector %s from context.", selector) + } + return untyped.(v1beta1.VolumeAttachmentInformer) +} + +type wrapper struct { + client kubernetes.Interface + + selector string +} + +var _ v1beta1.VolumeAttachmentInformer = (*wrapper)(nil) +var _ storagev1beta1.VolumeAttachmentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.VolumeAttachment{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.VolumeAttachmentLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.VolumeAttachment, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.StorageV1beta1().VolumeAttachments().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.VolumeAttachment, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.StorageV1beta1().VolumeAttachments().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/informers/storage/v1beta1/volumeattachment/volumeattachment.go b/client/injection/kube/informers/storage/v1beta1/volumeattachment/volumeattachment.go new file mode 100644 index 0000000000..4b4ecf84df --- /dev/null +++ b/client/injection/kube/informers/storage/v1beta1/volumeattachment/volumeattachment.go @@ -0,0 +1,100 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package volumeattachment + +import ( + context "context" + + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" + kubernetes "k8s.io/client-go/kubernetes" + storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" + factory "knative.dev/pkg/client/injection/kube/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Storage().V1beta1().VolumeAttachments() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1beta1.VolumeAttachmentInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/informers/storage/v1beta1.VolumeAttachmentInformer from context.") + } + return untyped.(v1beta1.VolumeAttachmentInformer) +} + +type wrapper struct { + client kubernetes.Interface +} + +var _ v1beta1.VolumeAttachmentInformer = (*wrapper)(nil) +var _ storagev1beta1.VolumeAttachmentLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apistoragev1beta1.VolumeAttachment{}, 0, nil) +} + +func (w *wrapper) Lister() storagev1beta1.VolumeAttachmentLister { + return w +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apistoragev1beta1.VolumeAttachment, err error) { + lo, err := w.client.StorageV1beta1().VolumeAttachments().List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apistoragev1beta1.VolumeAttachment, error) { + return w.client.StorageV1beta1().VolumeAttachments().Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/client/injection/kube/reconciler/apps/v1beta1/deployment/controller.go b/client/injection/kube/reconciler/apps/v1beta1/deployment/controller.go new file mode 100644 index 0000000000..cf4be642fb --- /dev/null +++ b/client/injection/kube/reconciler/apps/v1beta1/deployment/controller.go @@ -0,0 +1,160 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + fmt "fmt" + reflect "reflect" + strings "strings" + + zap "go.uber.org/zap" + corev1 "k8s.io/api/core/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/client-go/kubernetes/scheme" + v1 "k8s.io/client-go/kubernetes/typed/core/v1" + record "k8s.io/client-go/tools/record" + client "knative.dev/pkg/client/injection/kube/client" + deployment "knative.dev/pkg/client/injection/kube/informers/apps/v1beta1/deployment" + controller "knative.dev/pkg/controller" + logging "knative.dev/pkg/logging" + logkey "knative.dev/pkg/logging/logkey" + reconciler "knative.dev/pkg/reconciler" +) + +const ( + defaultControllerAgentName = "deployment-controller" + defaultFinalizerName = "deployments.apps" +) + +// NewImpl returns a controller.Impl that handles queuing and feeding work from +// the queue through an implementation of controller.Reconciler, delegating to +// the provided Interface and optional Finalizer methods. OptionsFn is used to return +// controller.Options to be used by the internal reconciler. +func NewImpl(ctx context.Context, r Interface, optionsFns ...controller.OptionsFn) *controller.Impl { + logger := logging.FromContext(ctx) + + // Check the options function input. It should be 0 or 1. + if len(optionsFns) > 1 { + logger.Fatal("Up to one options function is supported, found: ", len(optionsFns)) + } + + deploymentInformer := deployment.Get(ctx) + + lister := deploymentInformer.Lister() + + var promoteFilterFunc func(obj interface{}) bool + + rec := &reconcilerImpl{ + LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ + PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { + all, err := lister.List(labels.Everything()) + if err != nil { + return err + } + for _, elt := range all { + if promoteFilterFunc != nil { + if ok := promoteFilterFunc(elt); !ok { + continue + } + } + enq(bkt, types.NamespacedName{ + Namespace: elt.GetNamespace(), + Name: elt.GetName(), + }) + } + return nil + }, + }, + Client: client.Get(ctx), + Lister: lister, + reconciler: r, + finalizerName: defaultFinalizerName, + } + + ctrType := reflect.TypeOf(r).Elem() + ctrTypeName := fmt.Sprintf("%s.%s", ctrType.PkgPath(), ctrType.Name()) + ctrTypeName = strings.ReplaceAll(ctrTypeName, "/", ".") + + logger = logger.With( + zap.String(logkey.ControllerType, ctrTypeName), + zap.String(logkey.Kind, "apps.Deployment"), + ) + + impl := controller.NewImpl(rec, logger, ctrTypeName) + agentName := defaultControllerAgentName + + // Pass impl to the options. Save any optional results. + for _, fn := range optionsFns { + opts := fn(impl) + if opts.ConfigStore != nil { + rec.configStore = opts.ConfigStore + } + if opts.FinalizerName != "" { + rec.finalizerName = opts.FinalizerName + } + if opts.AgentName != "" { + agentName = opts.AgentName + } + if opts.SkipStatusUpdates { + rec.skipStatusUpdates = true + } + if opts.DemoteFunc != nil { + rec.DemoteFunc = opts.DemoteFunc + } + if opts.PromoteFilterFunc != nil { + promoteFilterFunc = opts.PromoteFilterFunc + } + } + + rec.Recorder = createRecorder(ctx, agentName) + + return impl +} + +func createRecorder(ctx context.Context, agentName string) record.EventRecorder { + logger := logging.FromContext(ctx) + + recorder := controller.GetEventRecorder(ctx) + if recorder == nil { + // Create event broadcaster + logger.Debug("Creating event broadcaster") + eventBroadcaster := record.NewBroadcaster() + watches := []watch.Interface{ + eventBroadcaster.StartLogging(logger.Named("event-broadcaster").Infof), + eventBroadcaster.StartRecordingToSink( + &v1.EventSinkImpl{Interface: client.Get(ctx).CoreV1().Events("")}), + } + recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: agentName}) + go func() { + <-ctx.Done() + for _, w := range watches { + w.Stop() + } + }() + } + + return recorder +} + +func init() { + scheme.AddToScheme(scheme.Scheme) +} diff --git a/client/injection/kube/reconciler/apps/v1beta1/deployment/reconciler.go b/client/injection/kube/reconciler/apps/v1beta1/deployment/reconciler.go new file mode 100644 index 0000000000..84625cb18d --- /dev/null +++ b/client/injection/kube/reconciler/apps/v1beta1/deployment/reconciler.go @@ -0,0 +1,453 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + json "encoding/json" + fmt "fmt" + + zap "go.uber.org/zap" + v1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/api/core/v1" + equality "k8s.io/apimachinery/pkg/api/equality" + errors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + sets "k8s.io/apimachinery/pkg/util/sets" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" + record "k8s.io/client-go/tools/record" + controller "knative.dev/pkg/controller" + kmp "knative.dev/pkg/kmp" + logging "knative.dev/pkg/logging" + reconciler "knative.dev/pkg/reconciler" +) + +// Interface defines the strongly typed interfaces to be implemented by a +// controller reconciling v1beta1.Deployment. +type Interface interface { + // ReconcileKind implements custom logic to reconcile v1beta1.Deployment. Any changes + // to the objects .Status or .Finalizers will be propagated to the stored + // object. It is recommended that implementors do not call any update calls + // for the Kind inside of ReconcileKind, it is the responsibility of the calling + // controller to propagate those properties. The resource passed to ReconcileKind + // will always have an empty deletion timestamp. + ReconcileKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +// Finalizer defines the strongly typed interfaces to be implemented by a +// controller finalizing v1beta1.Deployment. +type Finalizer interface { + // FinalizeKind implements custom logic to finalize v1beta1.Deployment. Any changes + // to the objects .Status or .Finalizers will be ignored. Returning a nil or + // Normal type reconciler.Event will allow the finalizer to be deleted on + // the resource. The resource passed to FinalizeKind will always have a set + // deletion timestamp. + FinalizeKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +// ReadOnlyInterface defines the strongly typed interfaces to be implemented by a +// controller reconciling v1beta1.Deployment if they want to process resources for which +// they are not the leader. +type ReadOnlyInterface interface { + // ObserveKind implements logic to observe v1beta1.Deployment. + // This method should not write to the API. + ObserveKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a +// controller finalizing v1beta1.Deployment if they want to process tombstoned resources +// even when they are not the leader. Due to the nature of how finalizers are handled +// there are no guarantees that this will be called. +type ReadOnlyFinalizer interface { + // ObserveFinalizeKind implements custom logic to observe the final state of v1beta1.Deployment. + // This method should not write to the API. + ObserveFinalizeKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +type doReconcile func(ctx context.Context, o *v1beta1.Deployment) reconciler.Event + +// reconcilerImpl implements controller.Reconciler for v1beta1.Deployment resources. +type reconcilerImpl struct { + // LeaderAwareFuncs is inlined to help us implement reconciler.LeaderAware. + reconciler.LeaderAwareFuncs + + // Client is used to write back status updates. + Client kubernetes.Interface + + // Listers index properties about resources. + Lister appsv1beta1.DeploymentLister + + // Recorder is an event recorder for recording Event resources to the + // Kubernetes API. + Recorder record.EventRecorder + + // configStore allows for decorating a context with config maps. + // +optional + configStore reconciler.ConfigStore + + // reconciler is the implementation of the business logic of the resource. + reconciler Interface + + // finalizerName is the name of the finalizer to reconcile. + finalizerName string + + // skipStatusUpdates configures whether or not this reconciler automatically updates + // the status of the reconciled resource. + skipStatusUpdates bool +} + +// Check that our Reconciler implements controller.Reconciler. +var _ controller.Reconciler = (*reconcilerImpl)(nil) + +// Check that our generated Reconciler is always LeaderAware. +var _ reconciler.LeaderAware = (*reconcilerImpl)(nil) + +func NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client kubernetes.Interface, lister appsv1beta1.DeploymentLister, recorder record.EventRecorder, r Interface, options ...controller.Options) controller.Reconciler { + // Check the options function input. It should be 0 or 1. + if len(options) > 1 { + logger.Fatal("Up to one options struct is supported, found: ", len(options)) + } + + // Fail fast when users inadvertently implement the other LeaderAware interface. + // For the typed reconcilers, Promote shouldn't take any arguments. + if _, ok := r.(reconciler.LeaderAware); ok { + logger.Fatalf("%T implements the incorrect LeaderAware interface. Promote() should not take an argument as genreconciler handles the enqueuing automatically.", r) + } + // TODO: Consider validating when folks implement ReadOnlyFinalizer, but not Finalizer. + + rec := &reconcilerImpl{ + LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ + PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { + all, err := lister.List(labels.Everything()) + if err != nil { + return err + } + for _, elt := range all { + // TODO: Consider letting users specify a filter in options. + enq(bkt, types.NamespacedName{ + Namespace: elt.GetNamespace(), + Name: elt.GetName(), + }) + } + return nil + }, + }, + Client: client, + Lister: lister, + Recorder: recorder, + reconciler: r, + finalizerName: defaultFinalizerName, + } + + for _, opts := range options { + if opts.ConfigStore != nil { + rec.configStore = opts.ConfigStore + } + if opts.FinalizerName != "" { + rec.finalizerName = opts.FinalizerName + } + if opts.SkipStatusUpdates { + rec.skipStatusUpdates = true + } + if opts.DemoteFunc != nil { + rec.DemoteFunc = opts.DemoteFunc + } + } + + return rec +} + +// Reconcile implements controller.Reconciler +func (r *reconcilerImpl) Reconcile(ctx context.Context, key string) error { + logger := logging.FromContext(ctx) + + // Initialize the reconciler state. This will convert the namespace/name + // string into a distinct namespace and name, determine if this instance of + // the reconciler is the leader, and any additional interfaces implemented + // by the reconciler. Returns an error is the resource key is invalid. + s, err := newState(key, r) + if err != nil { + logger.Error("Invalid resource key: ", key) + return nil + } + + // If we are not the leader, and we don't implement either ReadOnly + // observer interfaces, then take a fast-path out. + if s.isNotLeaderNorObserver() { + return controller.NewSkipKey(key) + } + + // If configStore is set, attach the frozen configuration to the context. + if r.configStore != nil { + ctx = r.configStore.ToContext(ctx) + } + + // Add the recorder to context. + ctx = controller.WithEventRecorder(ctx, r.Recorder) + + // Get the resource with this namespace/name. + + getter := r.Lister.Deployments(s.namespace) + + original, err := getter.Get(s.name) + + if errors.IsNotFound(err) { + // The resource may no longer exist, in which case we stop processing and call + // the ObserveDeletion handler if appropriate. + logger.Debugf("Resource %q no longer exists", key) + if del, ok := r.reconciler.(reconciler.OnDeletionInterface); ok { + return del.ObserveDeletion(ctx, types.NamespacedName{ + Namespace: s.namespace, + Name: s.name, + }) + } + return nil + } else if err != nil { + return err + } + + // Don't modify the informers copy. + resource := original.DeepCopy() + + var reconcileEvent reconciler.Event + + name, do := s.reconcileMethodFor(resource) + // Append the target method to the logger. + logger = logger.With(zap.String("targetMethod", name)) + switch name { + case reconciler.DoReconcileKind: + // Set and update the finalizer on resource if r.reconciler + // implements Finalizer. + if resource, err = r.setFinalizerIfFinalizer(ctx, resource); err != nil { + return fmt.Errorf("failed to set finalizers: %w", err) + } + + // Reconcile this copy of the resource and then write back any status + // updates regardless of whether the reconciliation errored out. + reconcileEvent = do(ctx, resource) + + case reconciler.DoFinalizeKind: + // For finalizing reconcilers, if this resource being marked for deletion + // and reconciled cleanly (nil or normal event), remove the finalizer. + reconcileEvent = do(ctx, resource) + + if resource, err = r.clearFinalizer(ctx, resource, reconcileEvent); err != nil { + return fmt.Errorf("failed to clear finalizers: %w", err) + } + + case reconciler.DoObserveKind, reconciler.DoObserveFinalizeKind: + // Observe any changes to this resource, since we are not the leader. + reconcileEvent = do(ctx, resource) + + } + + // Synchronize the status. + switch { + case r.skipStatusUpdates: + // This reconciler implementation is configured to skip resource updates. + // This may mean this reconciler does not observe spec, but reconciles external changes. + case equality.Semantic.DeepEqual(original.Status, resource.Status): + // If we didn't change anything then don't call updateStatus. + // This is important because the copy we loaded from the injectionInformer's + // cache may be stale and we don't want to overwrite a prior update + // to status with this stale state. + case !s.isLeader: + // High-availability reconcilers may have many replicas watching the resource, but only + // the elected leader is expected to write modifications. + logger.Warn("Saw status changes when we aren't the leader!") + default: + if err = r.updateStatus(ctx, original, resource); err != nil { + logger.Warnw("Failed to update resource status", zap.Error(err)) + r.Recorder.Eventf(resource, v1.EventTypeWarning, "UpdateFailed", + "Failed to update status for %q: %v", resource.Name, err) + return err + } + } + + // Report the reconciler event, if any. + if reconcileEvent != nil { + var event *reconciler.ReconcilerEvent + if reconciler.EventAs(reconcileEvent, &event) { + logger.Infow("Returned an event", zap.Any("event", reconcileEvent)) + r.Recorder.Event(resource, event.EventType, event.Reason, event.Error()) + + // the event was wrapped inside an error, consider the reconciliation as failed + if _, isEvent := reconcileEvent.(*reconciler.ReconcilerEvent); !isEvent { + return reconcileEvent + } + return nil + } + + if controller.IsSkipKey(reconcileEvent) { + // This is a wrapped error, don't emit an event. + } else if ok, _ := controller.IsRequeueKey(reconcileEvent); ok { + // This is a wrapped error, don't emit an event. + } else { + logger.Errorw("Returned an error", zap.Error(reconcileEvent)) + r.Recorder.Event(resource, v1.EventTypeWarning, "InternalError", reconcileEvent.Error()) + } + return reconcileEvent + } + + return nil +} + +func (r *reconcilerImpl) updateStatus(ctx context.Context, existing *v1beta1.Deployment, desired *v1beta1.Deployment) error { + existing = existing.DeepCopy() + return reconciler.RetryUpdateConflicts(func(attempts int) (err error) { + // The first iteration tries to use the injectionInformer's state, subsequent attempts fetch the latest state via API. + if attempts > 0 { + + getter := r.Client.AppsV1beta1().Deployments(desired.Namespace) + + existing, err = getter.Get(ctx, desired.Name, metav1.GetOptions{}) + if err != nil { + return err + } + } + + // If there's nothing to update, just return. + if equality.Semantic.DeepEqual(existing.Status, desired.Status) { + return nil + } + + if diff, err := kmp.SafeDiff(existing.Status, desired.Status); err == nil && diff != "" { + logging.FromContext(ctx).Debug("Updating status with: ", diff) + } + + existing.Status = desired.Status + + updater := r.Client.AppsV1beta1().Deployments(existing.Namespace) + + _, err = updater.UpdateStatus(ctx, existing, metav1.UpdateOptions{}) + return err + }) +} + +// updateFinalizersFiltered will update the Finalizers of the resource. +// TODO: this method could be generic and sync all finalizers. For now it only +// updates defaultFinalizerName or its override. +func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1beta1.Deployment) (*v1beta1.Deployment, error) { + + getter := r.Lister.Deployments(resource.Namespace) + + actual, err := getter.Get(resource.Name) + if err != nil { + return resource, err + } + + // Don't modify the informers copy. + existing := actual.DeepCopy() + + var finalizers []string + + // If there's nothing to update, just return. + existingFinalizers := sets.NewString(existing.Finalizers...) + desiredFinalizers := sets.NewString(resource.Finalizers...) + + if desiredFinalizers.Has(r.finalizerName) { + if existingFinalizers.Has(r.finalizerName) { + // Nothing to do. + return resource, nil + } + // Add the finalizer. + finalizers = append(existing.Finalizers, r.finalizerName) + } else { + if !existingFinalizers.Has(r.finalizerName) { + // Nothing to do. + return resource, nil + } + // Remove the finalizer. + existingFinalizers.Delete(r.finalizerName) + finalizers = existingFinalizers.List() + } + + mergePatch := map[string]interface{}{ + "metadata": map[string]interface{}{ + "finalizers": finalizers, + "resourceVersion": existing.ResourceVersion, + }, + } + + patch, err := json.Marshal(mergePatch) + if err != nil { + return resource, err + } + + patcher := r.Client.AppsV1beta1().Deployments(resource.Namespace) + + resourceName := resource.Name + updated, err := patcher.Patch(ctx, resourceName, types.MergePatchType, patch, metav1.PatchOptions{}) + if err != nil { + r.Recorder.Eventf(existing, v1.EventTypeWarning, "FinalizerUpdateFailed", + "Failed to update finalizers for %q: %v", resourceName, err) + } else { + r.Recorder.Eventf(updated, v1.EventTypeNormal, "FinalizerUpdate", + "Updated %q finalizers", resource.GetName()) + } + return updated, err +} + +func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource *v1beta1.Deployment) (*v1beta1.Deployment, error) { + if _, ok := r.reconciler.(Finalizer); !ok { + return resource, nil + } + + finalizers := sets.NewString(resource.Finalizers...) + + // If this resource is not being deleted, mark the finalizer. + if resource.GetDeletionTimestamp().IsZero() { + finalizers.Insert(r.finalizerName) + } + + resource.Finalizers = finalizers.List() + + // Synchronize the finalizers filtered by r.finalizerName. + return r.updateFinalizersFiltered(ctx, resource) +} + +func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1beta1.Deployment, reconcileEvent reconciler.Event) (*v1beta1.Deployment, error) { + if _, ok := r.reconciler.(Finalizer); !ok { + return resource, nil + } + if resource.GetDeletionTimestamp().IsZero() { + return resource, nil + } + + finalizers := sets.NewString(resource.Finalizers...) + + if reconcileEvent != nil { + var event *reconciler.ReconcilerEvent + if reconciler.EventAs(reconcileEvent, &event) { + if event.EventType == v1.EventTypeNormal { + finalizers.Delete(r.finalizerName) + } + } + } else { + finalizers.Delete(r.finalizerName) + } + + resource.Finalizers = finalizers.List() + + // Synchronize the finalizers filtered by r.finalizerName. + return r.updateFinalizersFiltered(ctx, resource) +} diff --git a/client/injection/kube/reconciler/apps/v1beta1/deployment/state.go b/client/injection/kube/reconciler/apps/v1beta1/deployment/state.go new file mode 100644 index 0000000000..addc5a2f17 --- /dev/null +++ b/client/injection/kube/reconciler/apps/v1beta1/deployment/state.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + fmt "fmt" + + v1beta1 "k8s.io/api/apps/v1beta1" + types "k8s.io/apimachinery/pkg/types" + cache "k8s.io/client-go/tools/cache" + reconciler "knative.dev/pkg/reconciler" +) + +// state is used to track the state of a reconciler in a single run. +type state struct { + // key is the original reconciliation key from the queue. + key string + // namespace is the namespace split from the reconciliation key. + namespace string + // name is the name split from the reconciliation key. + name string + // reconciler is the reconciler. + reconciler Interface + // roi is the read only interface cast of the reconciler. + roi ReadOnlyInterface + // isROI (Read Only Interface) the reconciler only observes reconciliation. + isROI bool + // rof is the read only finalizer cast of the reconciler. + rof ReadOnlyFinalizer + // isROF (Read Only Finalizer) the reconciler only observes finalize. + isROF bool + // isLeader the instance of the reconciler is the elected leader. + isLeader bool +} + +func newState(key string, r *reconcilerImpl) (*state, error) { + // Convert the namespace/name string into a distinct namespace and name. + namespace, name, err := cache.SplitMetaNamespaceKey(key) + if err != nil { + return nil, fmt.Errorf("invalid resource key: %s", key) + } + + roi, isROI := r.reconciler.(ReadOnlyInterface) + rof, isROF := r.reconciler.(ReadOnlyFinalizer) + + isLeader := r.IsLeaderFor(types.NamespacedName{ + Namespace: namespace, + Name: name, + }) + + return &state{ + key: key, + namespace: namespace, + name: name, + reconciler: r.reconciler, + roi: roi, + isROI: isROI, + rof: rof, + isROF: isROF, + isLeader: isLeader, + }, nil +} + +// isNotLeaderNorObserver checks to see if this reconciler with the current +// state is enabled to do any work or not. +// isNotLeaderNorObserver returns true when there is no work possible for the +// reconciler. +func (s *state) isNotLeaderNorObserver() bool { + if !s.isLeader && !s.isROI && !s.isROF { + // If we are not the leader, and we don't implement either ReadOnly + // interface, then take a fast-path out. + return true + } + return false +} + +func (s *state) reconcileMethodFor(o *v1beta1.Deployment) (string, doReconcile) { + if o.GetDeletionTimestamp().IsZero() { + if s.isLeader { + return reconciler.DoReconcileKind, s.reconciler.ReconcileKind + } else if s.isROI { + return reconciler.DoObserveKind, s.roi.ObserveKind + } + } else if fin, ok := s.reconciler.(Finalizer); s.isLeader && ok { + return reconciler.DoFinalizeKind, fin.FinalizeKind + } else if !s.isLeader && s.isROF { + return reconciler.DoObserveFinalizeKind, s.rof.ObserveFinalizeKind + } + return "unknown", nil +} diff --git a/client/injection/kube/reconciler/apps/v1beta2/deployment/controller.go b/client/injection/kube/reconciler/apps/v1beta2/deployment/controller.go new file mode 100644 index 0000000000..45a92eebfb --- /dev/null +++ b/client/injection/kube/reconciler/apps/v1beta2/deployment/controller.go @@ -0,0 +1,160 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + fmt "fmt" + reflect "reflect" + strings "strings" + + zap "go.uber.org/zap" + corev1 "k8s.io/api/core/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/client-go/kubernetes/scheme" + v1 "k8s.io/client-go/kubernetes/typed/core/v1" + record "k8s.io/client-go/tools/record" + client "knative.dev/pkg/client/injection/kube/client" + deployment "knative.dev/pkg/client/injection/kube/informers/apps/v1beta2/deployment" + controller "knative.dev/pkg/controller" + logging "knative.dev/pkg/logging" + logkey "knative.dev/pkg/logging/logkey" + reconciler "knative.dev/pkg/reconciler" +) + +const ( + defaultControllerAgentName = "deployment-controller" + defaultFinalizerName = "deployments.apps" +) + +// NewImpl returns a controller.Impl that handles queuing and feeding work from +// the queue through an implementation of controller.Reconciler, delegating to +// the provided Interface and optional Finalizer methods. OptionsFn is used to return +// controller.Options to be used by the internal reconciler. +func NewImpl(ctx context.Context, r Interface, optionsFns ...controller.OptionsFn) *controller.Impl { + logger := logging.FromContext(ctx) + + // Check the options function input. It should be 0 or 1. + if len(optionsFns) > 1 { + logger.Fatal("Up to one options function is supported, found: ", len(optionsFns)) + } + + deploymentInformer := deployment.Get(ctx) + + lister := deploymentInformer.Lister() + + var promoteFilterFunc func(obj interface{}) bool + + rec := &reconcilerImpl{ + LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ + PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { + all, err := lister.List(labels.Everything()) + if err != nil { + return err + } + for _, elt := range all { + if promoteFilterFunc != nil { + if ok := promoteFilterFunc(elt); !ok { + continue + } + } + enq(bkt, types.NamespacedName{ + Namespace: elt.GetNamespace(), + Name: elt.GetName(), + }) + } + return nil + }, + }, + Client: client.Get(ctx), + Lister: lister, + reconciler: r, + finalizerName: defaultFinalizerName, + } + + ctrType := reflect.TypeOf(r).Elem() + ctrTypeName := fmt.Sprintf("%s.%s", ctrType.PkgPath(), ctrType.Name()) + ctrTypeName = strings.ReplaceAll(ctrTypeName, "/", ".") + + logger = logger.With( + zap.String(logkey.ControllerType, ctrTypeName), + zap.String(logkey.Kind, "apps.Deployment"), + ) + + impl := controller.NewImpl(rec, logger, ctrTypeName) + agentName := defaultControllerAgentName + + // Pass impl to the options. Save any optional results. + for _, fn := range optionsFns { + opts := fn(impl) + if opts.ConfigStore != nil { + rec.configStore = opts.ConfigStore + } + if opts.FinalizerName != "" { + rec.finalizerName = opts.FinalizerName + } + if opts.AgentName != "" { + agentName = opts.AgentName + } + if opts.SkipStatusUpdates { + rec.skipStatusUpdates = true + } + if opts.DemoteFunc != nil { + rec.DemoteFunc = opts.DemoteFunc + } + if opts.PromoteFilterFunc != nil { + promoteFilterFunc = opts.PromoteFilterFunc + } + } + + rec.Recorder = createRecorder(ctx, agentName) + + return impl +} + +func createRecorder(ctx context.Context, agentName string) record.EventRecorder { + logger := logging.FromContext(ctx) + + recorder := controller.GetEventRecorder(ctx) + if recorder == nil { + // Create event broadcaster + logger.Debug("Creating event broadcaster") + eventBroadcaster := record.NewBroadcaster() + watches := []watch.Interface{ + eventBroadcaster.StartLogging(logger.Named("event-broadcaster").Infof), + eventBroadcaster.StartRecordingToSink( + &v1.EventSinkImpl{Interface: client.Get(ctx).CoreV1().Events("")}), + } + recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: agentName}) + go func() { + <-ctx.Done() + for _, w := range watches { + w.Stop() + } + }() + } + + return recorder +} + +func init() { + scheme.AddToScheme(scheme.Scheme) +} diff --git a/client/injection/kube/reconciler/apps/v1beta2/deployment/reconciler.go b/client/injection/kube/reconciler/apps/v1beta2/deployment/reconciler.go new file mode 100644 index 0000000000..02ca5b92a0 --- /dev/null +++ b/client/injection/kube/reconciler/apps/v1beta2/deployment/reconciler.go @@ -0,0 +1,453 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + json "encoding/json" + fmt "fmt" + + zap "go.uber.org/zap" + v1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/api/core/v1" + equality "k8s.io/apimachinery/pkg/api/equality" + errors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + sets "k8s.io/apimachinery/pkg/util/sets" + kubernetes "k8s.io/client-go/kubernetes" + appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" + record "k8s.io/client-go/tools/record" + controller "knative.dev/pkg/controller" + kmp "knative.dev/pkg/kmp" + logging "knative.dev/pkg/logging" + reconciler "knative.dev/pkg/reconciler" +) + +// Interface defines the strongly typed interfaces to be implemented by a +// controller reconciling v1beta2.Deployment. +type Interface interface { + // ReconcileKind implements custom logic to reconcile v1beta2.Deployment. Any changes + // to the objects .Status or .Finalizers will be propagated to the stored + // object. It is recommended that implementors do not call any update calls + // for the Kind inside of ReconcileKind, it is the responsibility of the calling + // controller to propagate those properties. The resource passed to ReconcileKind + // will always have an empty deletion timestamp. + ReconcileKind(ctx context.Context, o *v1beta2.Deployment) reconciler.Event +} + +// Finalizer defines the strongly typed interfaces to be implemented by a +// controller finalizing v1beta2.Deployment. +type Finalizer interface { + // FinalizeKind implements custom logic to finalize v1beta2.Deployment. Any changes + // to the objects .Status or .Finalizers will be ignored. Returning a nil or + // Normal type reconciler.Event will allow the finalizer to be deleted on + // the resource. The resource passed to FinalizeKind will always have a set + // deletion timestamp. + FinalizeKind(ctx context.Context, o *v1beta2.Deployment) reconciler.Event +} + +// ReadOnlyInterface defines the strongly typed interfaces to be implemented by a +// controller reconciling v1beta2.Deployment if they want to process resources for which +// they are not the leader. +type ReadOnlyInterface interface { + // ObserveKind implements logic to observe v1beta2.Deployment. + // This method should not write to the API. + ObserveKind(ctx context.Context, o *v1beta2.Deployment) reconciler.Event +} + +// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a +// controller finalizing v1beta2.Deployment if they want to process tombstoned resources +// even when they are not the leader. Due to the nature of how finalizers are handled +// there are no guarantees that this will be called. +type ReadOnlyFinalizer interface { + // ObserveFinalizeKind implements custom logic to observe the final state of v1beta2.Deployment. + // This method should not write to the API. + ObserveFinalizeKind(ctx context.Context, o *v1beta2.Deployment) reconciler.Event +} + +type doReconcile func(ctx context.Context, o *v1beta2.Deployment) reconciler.Event + +// reconcilerImpl implements controller.Reconciler for v1beta2.Deployment resources. +type reconcilerImpl struct { + // LeaderAwareFuncs is inlined to help us implement reconciler.LeaderAware. + reconciler.LeaderAwareFuncs + + // Client is used to write back status updates. + Client kubernetes.Interface + + // Listers index properties about resources. + Lister appsv1beta2.DeploymentLister + + // Recorder is an event recorder for recording Event resources to the + // Kubernetes API. + Recorder record.EventRecorder + + // configStore allows for decorating a context with config maps. + // +optional + configStore reconciler.ConfigStore + + // reconciler is the implementation of the business logic of the resource. + reconciler Interface + + // finalizerName is the name of the finalizer to reconcile. + finalizerName string + + // skipStatusUpdates configures whether or not this reconciler automatically updates + // the status of the reconciled resource. + skipStatusUpdates bool +} + +// Check that our Reconciler implements controller.Reconciler. +var _ controller.Reconciler = (*reconcilerImpl)(nil) + +// Check that our generated Reconciler is always LeaderAware. +var _ reconciler.LeaderAware = (*reconcilerImpl)(nil) + +func NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client kubernetes.Interface, lister appsv1beta2.DeploymentLister, recorder record.EventRecorder, r Interface, options ...controller.Options) controller.Reconciler { + // Check the options function input. It should be 0 or 1. + if len(options) > 1 { + logger.Fatal("Up to one options struct is supported, found: ", len(options)) + } + + // Fail fast when users inadvertently implement the other LeaderAware interface. + // For the typed reconcilers, Promote shouldn't take any arguments. + if _, ok := r.(reconciler.LeaderAware); ok { + logger.Fatalf("%T implements the incorrect LeaderAware interface. Promote() should not take an argument as genreconciler handles the enqueuing automatically.", r) + } + // TODO: Consider validating when folks implement ReadOnlyFinalizer, but not Finalizer. + + rec := &reconcilerImpl{ + LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ + PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { + all, err := lister.List(labels.Everything()) + if err != nil { + return err + } + for _, elt := range all { + // TODO: Consider letting users specify a filter in options. + enq(bkt, types.NamespacedName{ + Namespace: elt.GetNamespace(), + Name: elt.GetName(), + }) + } + return nil + }, + }, + Client: client, + Lister: lister, + Recorder: recorder, + reconciler: r, + finalizerName: defaultFinalizerName, + } + + for _, opts := range options { + if opts.ConfigStore != nil { + rec.configStore = opts.ConfigStore + } + if opts.FinalizerName != "" { + rec.finalizerName = opts.FinalizerName + } + if opts.SkipStatusUpdates { + rec.skipStatusUpdates = true + } + if opts.DemoteFunc != nil { + rec.DemoteFunc = opts.DemoteFunc + } + } + + return rec +} + +// Reconcile implements controller.Reconciler +func (r *reconcilerImpl) Reconcile(ctx context.Context, key string) error { + logger := logging.FromContext(ctx) + + // Initialize the reconciler state. This will convert the namespace/name + // string into a distinct namespace and name, determine if this instance of + // the reconciler is the leader, and any additional interfaces implemented + // by the reconciler. Returns an error is the resource key is invalid. + s, err := newState(key, r) + if err != nil { + logger.Error("Invalid resource key: ", key) + return nil + } + + // If we are not the leader, and we don't implement either ReadOnly + // observer interfaces, then take a fast-path out. + if s.isNotLeaderNorObserver() { + return controller.NewSkipKey(key) + } + + // If configStore is set, attach the frozen configuration to the context. + if r.configStore != nil { + ctx = r.configStore.ToContext(ctx) + } + + // Add the recorder to context. + ctx = controller.WithEventRecorder(ctx, r.Recorder) + + // Get the resource with this namespace/name. + + getter := r.Lister.Deployments(s.namespace) + + original, err := getter.Get(s.name) + + if errors.IsNotFound(err) { + // The resource may no longer exist, in which case we stop processing and call + // the ObserveDeletion handler if appropriate. + logger.Debugf("Resource %q no longer exists", key) + if del, ok := r.reconciler.(reconciler.OnDeletionInterface); ok { + return del.ObserveDeletion(ctx, types.NamespacedName{ + Namespace: s.namespace, + Name: s.name, + }) + } + return nil + } else if err != nil { + return err + } + + // Don't modify the informers copy. + resource := original.DeepCopy() + + var reconcileEvent reconciler.Event + + name, do := s.reconcileMethodFor(resource) + // Append the target method to the logger. + logger = logger.With(zap.String("targetMethod", name)) + switch name { + case reconciler.DoReconcileKind: + // Set and update the finalizer on resource if r.reconciler + // implements Finalizer. + if resource, err = r.setFinalizerIfFinalizer(ctx, resource); err != nil { + return fmt.Errorf("failed to set finalizers: %w", err) + } + + // Reconcile this copy of the resource and then write back any status + // updates regardless of whether the reconciliation errored out. + reconcileEvent = do(ctx, resource) + + case reconciler.DoFinalizeKind: + // For finalizing reconcilers, if this resource being marked for deletion + // and reconciled cleanly (nil or normal event), remove the finalizer. + reconcileEvent = do(ctx, resource) + + if resource, err = r.clearFinalizer(ctx, resource, reconcileEvent); err != nil { + return fmt.Errorf("failed to clear finalizers: %w", err) + } + + case reconciler.DoObserveKind, reconciler.DoObserveFinalizeKind: + // Observe any changes to this resource, since we are not the leader. + reconcileEvent = do(ctx, resource) + + } + + // Synchronize the status. + switch { + case r.skipStatusUpdates: + // This reconciler implementation is configured to skip resource updates. + // This may mean this reconciler does not observe spec, but reconciles external changes. + case equality.Semantic.DeepEqual(original.Status, resource.Status): + // If we didn't change anything then don't call updateStatus. + // This is important because the copy we loaded from the injectionInformer's + // cache may be stale and we don't want to overwrite a prior update + // to status with this stale state. + case !s.isLeader: + // High-availability reconcilers may have many replicas watching the resource, but only + // the elected leader is expected to write modifications. + logger.Warn("Saw status changes when we aren't the leader!") + default: + if err = r.updateStatus(ctx, original, resource); err != nil { + logger.Warnw("Failed to update resource status", zap.Error(err)) + r.Recorder.Eventf(resource, v1.EventTypeWarning, "UpdateFailed", + "Failed to update status for %q: %v", resource.Name, err) + return err + } + } + + // Report the reconciler event, if any. + if reconcileEvent != nil { + var event *reconciler.ReconcilerEvent + if reconciler.EventAs(reconcileEvent, &event) { + logger.Infow("Returned an event", zap.Any("event", reconcileEvent)) + r.Recorder.Event(resource, event.EventType, event.Reason, event.Error()) + + // the event was wrapped inside an error, consider the reconciliation as failed + if _, isEvent := reconcileEvent.(*reconciler.ReconcilerEvent); !isEvent { + return reconcileEvent + } + return nil + } + + if controller.IsSkipKey(reconcileEvent) { + // This is a wrapped error, don't emit an event. + } else if ok, _ := controller.IsRequeueKey(reconcileEvent); ok { + // This is a wrapped error, don't emit an event. + } else { + logger.Errorw("Returned an error", zap.Error(reconcileEvent)) + r.Recorder.Event(resource, v1.EventTypeWarning, "InternalError", reconcileEvent.Error()) + } + return reconcileEvent + } + + return nil +} + +func (r *reconcilerImpl) updateStatus(ctx context.Context, existing *v1beta2.Deployment, desired *v1beta2.Deployment) error { + existing = existing.DeepCopy() + return reconciler.RetryUpdateConflicts(func(attempts int) (err error) { + // The first iteration tries to use the injectionInformer's state, subsequent attempts fetch the latest state via API. + if attempts > 0 { + + getter := r.Client.AppsV1beta2().Deployments(desired.Namespace) + + existing, err = getter.Get(ctx, desired.Name, metav1.GetOptions{}) + if err != nil { + return err + } + } + + // If there's nothing to update, just return. + if equality.Semantic.DeepEqual(existing.Status, desired.Status) { + return nil + } + + if diff, err := kmp.SafeDiff(existing.Status, desired.Status); err == nil && diff != "" { + logging.FromContext(ctx).Debug("Updating status with: ", diff) + } + + existing.Status = desired.Status + + updater := r.Client.AppsV1beta2().Deployments(existing.Namespace) + + _, err = updater.UpdateStatus(ctx, existing, metav1.UpdateOptions{}) + return err + }) +} + +// updateFinalizersFiltered will update the Finalizers of the resource. +// TODO: this method could be generic and sync all finalizers. For now it only +// updates defaultFinalizerName or its override. +func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1beta2.Deployment) (*v1beta2.Deployment, error) { + + getter := r.Lister.Deployments(resource.Namespace) + + actual, err := getter.Get(resource.Name) + if err != nil { + return resource, err + } + + // Don't modify the informers copy. + existing := actual.DeepCopy() + + var finalizers []string + + // If there's nothing to update, just return. + existingFinalizers := sets.NewString(existing.Finalizers...) + desiredFinalizers := sets.NewString(resource.Finalizers...) + + if desiredFinalizers.Has(r.finalizerName) { + if existingFinalizers.Has(r.finalizerName) { + // Nothing to do. + return resource, nil + } + // Add the finalizer. + finalizers = append(existing.Finalizers, r.finalizerName) + } else { + if !existingFinalizers.Has(r.finalizerName) { + // Nothing to do. + return resource, nil + } + // Remove the finalizer. + existingFinalizers.Delete(r.finalizerName) + finalizers = existingFinalizers.List() + } + + mergePatch := map[string]interface{}{ + "metadata": map[string]interface{}{ + "finalizers": finalizers, + "resourceVersion": existing.ResourceVersion, + }, + } + + patch, err := json.Marshal(mergePatch) + if err != nil { + return resource, err + } + + patcher := r.Client.AppsV1beta2().Deployments(resource.Namespace) + + resourceName := resource.Name + updated, err := patcher.Patch(ctx, resourceName, types.MergePatchType, patch, metav1.PatchOptions{}) + if err != nil { + r.Recorder.Eventf(existing, v1.EventTypeWarning, "FinalizerUpdateFailed", + "Failed to update finalizers for %q: %v", resourceName, err) + } else { + r.Recorder.Eventf(updated, v1.EventTypeNormal, "FinalizerUpdate", + "Updated %q finalizers", resource.GetName()) + } + return updated, err +} + +func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource *v1beta2.Deployment) (*v1beta2.Deployment, error) { + if _, ok := r.reconciler.(Finalizer); !ok { + return resource, nil + } + + finalizers := sets.NewString(resource.Finalizers...) + + // If this resource is not being deleted, mark the finalizer. + if resource.GetDeletionTimestamp().IsZero() { + finalizers.Insert(r.finalizerName) + } + + resource.Finalizers = finalizers.List() + + // Synchronize the finalizers filtered by r.finalizerName. + return r.updateFinalizersFiltered(ctx, resource) +} + +func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1beta2.Deployment, reconcileEvent reconciler.Event) (*v1beta2.Deployment, error) { + if _, ok := r.reconciler.(Finalizer); !ok { + return resource, nil + } + if resource.GetDeletionTimestamp().IsZero() { + return resource, nil + } + + finalizers := sets.NewString(resource.Finalizers...) + + if reconcileEvent != nil { + var event *reconciler.ReconcilerEvent + if reconciler.EventAs(reconcileEvent, &event) { + if event.EventType == v1.EventTypeNormal { + finalizers.Delete(r.finalizerName) + } + } + } else { + finalizers.Delete(r.finalizerName) + } + + resource.Finalizers = finalizers.List() + + // Synchronize the finalizers filtered by r.finalizerName. + return r.updateFinalizersFiltered(ctx, resource) +} diff --git a/client/injection/kube/reconciler/apps/v1beta2/deployment/state.go b/client/injection/kube/reconciler/apps/v1beta2/deployment/state.go new file mode 100644 index 0000000000..d3e701d730 --- /dev/null +++ b/client/injection/kube/reconciler/apps/v1beta2/deployment/state.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + fmt "fmt" + + v1beta2 "k8s.io/api/apps/v1beta2" + types "k8s.io/apimachinery/pkg/types" + cache "k8s.io/client-go/tools/cache" + reconciler "knative.dev/pkg/reconciler" +) + +// state is used to track the state of a reconciler in a single run. +type state struct { + // key is the original reconciliation key from the queue. + key string + // namespace is the namespace split from the reconciliation key. + namespace string + // name is the name split from the reconciliation key. + name string + // reconciler is the reconciler. + reconciler Interface + // roi is the read only interface cast of the reconciler. + roi ReadOnlyInterface + // isROI (Read Only Interface) the reconciler only observes reconciliation. + isROI bool + // rof is the read only finalizer cast of the reconciler. + rof ReadOnlyFinalizer + // isROF (Read Only Finalizer) the reconciler only observes finalize. + isROF bool + // isLeader the instance of the reconciler is the elected leader. + isLeader bool +} + +func newState(key string, r *reconcilerImpl) (*state, error) { + // Convert the namespace/name string into a distinct namespace and name. + namespace, name, err := cache.SplitMetaNamespaceKey(key) + if err != nil { + return nil, fmt.Errorf("invalid resource key: %s", key) + } + + roi, isROI := r.reconciler.(ReadOnlyInterface) + rof, isROF := r.reconciler.(ReadOnlyFinalizer) + + isLeader := r.IsLeaderFor(types.NamespacedName{ + Namespace: namespace, + Name: name, + }) + + return &state{ + key: key, + namespace: namespace, + name: name, + reconciler: r.reconciler, + roi: roi, + isROI: isROI, + rof: rof, + isROF: isROF, + isLeader: isLeader, + }, nil +} + +// isNotLeaderNorObserver checks to see if this reconciler with the current +// state is enabled to do any work or not. +// isNotLeaderNorObserver returns true when there is no work possible for the +// reconciler. +func (s *state) isNotLeaderNorObserver() bool { + if !s.isLeader && !s.isROI && !s.isROF { + // If we are not the leader, and we don't implement either ReadOnly + // interface, then take a fast-path out. + return true + } + return false +} + +func (s *state) reconcileMethodFor(o *v1beta2.Deployment) (string, doReconcile) { + if o.GetDeletionTimestamp().IsZero() { + if s.isLeader { + return reconciler.DoReconcileKind, s.reconciler.ReconcileKind + } else if s.isROI { + return reconciler.DoObserveKind, s.roi.ObserveKind + } + } else if fin, ok := s.reconciler.(Finalizer); s.isLeader && ok { + return reconciler.DoFinalizeKind, fin.FinalizeKind + } else if !s.isLeader && s.isROF { + return reconciler.DoObserveFinalizeKind, s.rof.ObserveFinalizeKind + } + return "unknown", nil +} diff --git a/client/injection/kube/reconciler/extensions/v1beta1/deployment/controller.go b/client/injection/kube/reconciler/extensions/v1beta1/deployment/controller.go new file mode 100644 index 0000000000..c8228d16b6 --- /dev/null +++ b/client/injection/kube/reconciler/extensions/v1beta1/deployment/controller.go @@ -0,0 +1,160 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + fmt "fmt" + reflect "reflect" + strings "strings" + + zap "go.uber.org/zap" + corev1 "k8s.io/api/core/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/client-go/kubernetes/scheme" + v1 "k8s.io/client-go/kubernetes/typed/core/v1" + record "k8s.io/client-go/tools/record" + client "knative.dev/pkg/client/injection/kube/client" + deployment "knative.dev/pkg/client/injection/kube/informers/extensions/v1beta1/deployment" + controller "knative.dev/pkg/controller" + logging "knative.dev/pkg/logging" + logkey "knative.dev/pkg/logging/logkey" + reconciler "knative.dev/pkg/reconciler" +) + +const ( + defaultControllerAgentName = "deployment-controller" + defaultFinalizerName = "deployments.extensions" +) + +// NewImpl returns a controller.Impl that handles queuing and feeding work from +// the queue through an implementation of controller.Reconciler, delegating to +// the provided Interface and optional Finalizer methods. OptionsFn is used to return +// controller.Options to be used by the internal reconciler. +func NewImpl(ctx context.Context, r Interface, optionsFns ...controller.OptionsFn) *controller.Impl { + logger := logging.FromContext(ctx) + + // Check the options function input. It should be 0 or 1. + if len(optionsFns) > 1 { + logger.Fatal("Up to one options function is supported, found: ", len(optionsFns)) + } + + deploymentInformer := deployment.Get(ctx) + + lister := deploymentInformer.Lister() + + var promoteFilterFunc func(obj interface{}) bool + + rec := &reconcilerImpl{ + LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ + PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { + all, err := lister.List(labels.Everything()) + if err != nil { + return err + } + for _, elt := range all { + if promoteFilterFunc != nil { + if ok := promoteFilterFunc(elt); !ok { + continue + } + } + enq(bkt, types.NamespacedName{ + Namespace: elt.GetNamespace(), + Name: elt.GetName(), + }) + } + return nil + }, + }, + Client: client.Get(ctx), + Lister: lister, + reconciler: r, + finalizerName: defaultFinalizerName, + } + + ctrType := reflect.TypeOf(r).Elem() + ctrTypeName := fmt.Sprintf("%s.%s", ctrType.PkgPath(), ctrType.Name()) + ctrTypeName = strings.ReplaceAll(ctrTypeName, "/", ".") + + logger = logger.With( + zap.String(logkey.ControllerType, ctrTypeName), + zap.String(logkey.Kind, "extensions.Deployment"), + ) + + impl := controller.NewImpl(rec, logger, ctrTypeName) + agentName := defaultControllerAgentName + + // Pass impl to the options. Save any optional results. + for _, fn := range optionsFns { + opts := fn(impl) + if opts.ConfigStore != nil { + rec.configStore = opts.ConfigStore + } + if opts.FinalizerName != "" { + rec.finalizerName = opts.FinalizerName + } + if opts.AgentName != "" { + agentName = opts.AgentName + } + if opts.SkipStatusUpdates { + rec.skipStatusUpdates = true + } + if opts.DemoteFunc != nil { + rec.DemoteFunc = opts.DemoteFunc + } + if opts.PromoteFilterFunc != nil { + promoteFilterFunc = opts.PromoteFilterFunc + } + } + + rec.Recorder = createRecorder(ctx, agentName) + + return impl +} + +func createRecorder(ctx context.Context, agentName string) record.EventRecorder { + logger := logging.FromContext(ctx) + + recorder := controller.GetEventRecorder(ctx) + if recorder == nil { + // Create event broadcaster + logger.Debug("Creating event broadcaster") + eventBroadcaster := record.NewBroadcaster() + watches := []watch.Interface{ + eventBroadcaster.StartLogging(logger.Named("event-broadcaster").Infof), + eventBroadcaster.StartRecordingToSink( + &v1.EventSinkImpl{Interface: client.Get(ctx).CoreV1().Events("")}), + } + recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: agentName}) + go func() { + <-ctx.Done() + for _, w := range watches { + w.Stop() + } + }() + } + + return recorder +} + +func init() { + scheme.AddToScheme(scheme.Scheme) +} diff --git a/client/injection/kube/reconciler/extensions/v1beta1/deployment/reconciler.go b/client/injection/kube/reconciler/extensions/v1beta1/deployment/reconciler.go new file mode 100644 index 0000000000..5433c3b59d --- /dev/null +++ b/client/injection/kube/reconciler/extensions/v1beta1/deployment/reconciler.go @@ -0,0 +1,453 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + context "context" + json "encoding/json" + fmt "fmt" + + zap "go.uber.org/zap" + v1 "k8s.io/api/core/v1" + v1beta1 "k8s.io/api/extensions/v1beta1" + equality "k8s.io/apimachinery/pkg/api/equality" + errors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + sets "k8s.io/apimachinery/pkg/util/sets" + kubernetes "k8s.io/client-go/kubernetes" + extensionsv1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + record "k8s.io/client-go/tools/record" + controller "knative.dev/pkg/controller" + kmp "knative.dev/pkg/kmp" + logging "knative.dev/pkg/logging" + reconciler "knative.dev/pkg/reconciler" +) + +// Interface defines the strongly typed interfaces to be implemented by a +// controller reconciling v1beta1.Deployment. +type Interface interface { + // ReconcileKind implements custom logic to reconcile v1beta1.Deployment. Any changes + // to the objects .Status or .Finalizers will be propagated to the stored + // object. It is recommended that implementors do not call any update calls + // for the Kind inside of ReconcileKind, it is the responsibility of the calling + // controller to propagate those properties. The resource passed to ReconcileKind + // will always have an empty deletion timestamp. + ReconcileKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +// Finalizer defines the strongly typed interfaces to be implemented by a +// controller finalizing v1beta1.Deployment. +type Finalizer interface { + // FinalizeKind implements custom logic to finalize v1beta1.Deployment. Any changes + // to the objects .Status or .Finalizers will be ignored. Returning a nil or + // Normal type reconciler.Event will allow the finalizer to be deleted on + // the resource. The resource passed to FinalizeKind will always have a set + // deletion timestamp. + FinalizeKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +// ReadOnlyInterface defines the strongly typed interfaces to be implemented by a +// controller reconciling v1beta1.Deployment if they want to process resources for which +// they are not the leader. +type ReadOnlyInterface interface { + // ObserveKind implements logic to observe v1beta1.Deployment. + // This method should not write to the API. + ObserveKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a +// controller finalizing v1beta1.Deployment if they want to process tombstoned resources +// even when they are not the leader. Due to the nature of how finalizers are handled +// there are no guarantees that this will be called. +type ReadOnlyFinalizer interface { + // ObserveFinalizeKind implements custom logic to observe the final state of v1beta1.Deployment. + // This method should not write to the API. + ObserveFinalizeKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event +} + +type doReconcile func(ctx context.Context, o *v1beta1.Deployment) reconciler.Event + +// reconcilerImpl implements controller.Reconciler for v1beta1.Deployment resources. +type reconcilerImpl struct { + // LeaderAwareFuncs is inlined to help us implement reconciler.LeaderAware. + reconciler.LeaderAwareFuncs + + // Client is used to write back status updates. + Client kubernetes.Interface + + // Listers index properties about resources. + Lister extensionsv1beta1.DeploymentLister + + // Recorder is an event recorder for recording Event resources to the + // Kubernetes API. + Recorder record.EventRecorder + + // configStore allows for decorating a context with config maps. + // +optional + configStore reconciler.ConfigStore + + // reconciler is the implementation of the business logic of the resource. + reconciler Interface + + // finalizerName is the name of the finalizer to reconcile. + finalizerName string + + // skipStatusUpdates configures whether or not this reconciler automatically updates + // the status of the reconciled resource. + skipStatusUpdates bool +} + +// Check that our Reconciler implements controller.Reconciler. +var _ controller.Reconciler = (*reconcilerImpl)(nil) + +// Check that our generated Reconciler is always LeaderAware. +var _ reconciler.LeaderAware = (*reconcilerImpl)(nil) + +func NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client kubernetes.Interface, lister extensionsv1beta1.DeploymentLister, recorder record.EventRecorder, r Interface, options ...controller.Options) controller.Reconciler { + // Check the options function input. It should be 0 or 1. + if len(options) > 1 { + logger.Fatal("Up to one options struct is supported, found: ", len(options)) + } + + // Fail fast when users inadvertently implement the other LeaderAware interface. + // For the typed reconcilers, Promote shouldn't take any arguments. + if _, ok := r.(reconciler.LeaderAware); ok { + logger.Fatalf("%T implements the incorrect LeaderAware interface. Promote() should not take an argument as genreconciler handles the enqueuing automatically.", r) + } + // TODO: Consider validating when folks implement ReadOnlyFinalizer, but not Finalizer. + + rec := &reconcilerImpl{ + LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ + PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { + all, err := lister.List(labels.Everything()) + if err != nil { + return err + } + for _, elt := range all { + // TODO: Consider letting users specify a filter in options. + enq(bkt, types.NamespacedName{ + Namespace: elt.GetNamespace(), + Name: elt.GetName(), + }) + } + return nil + }, + }, + Client: client, + Lister: lister, + Recorder: recorder, + reconciler: r, + finalizerName: defaultFinalizerName, + } + + for _, opts := range options { + if opts.ConfigStore != nil { + rec.configStore = opts.ConfigStore + } + if opts.FinalizerName != "" { + rec.finalizerName = opts.FinalizerName + } + if opts.SkipStatusUpdates { + rec.skipStatusUpdates = true + } + if opts.DemoteFunc != nil { + rec.DemoteFunc = opts.DemoteFunc + } + } + + return rec +} + +// Reconcile implements controller.Reconciler +func (r *reconcilerImpl) Reconcile(ctx context.Context, key string) error { + logger := logging.FromContext(ctx) + + // Initialize the reconciler state. This will convert the namespace/name + // string into a distinct namespace and name, determine if this instance of + // the reconciler is the leader, and any additional interfaces implemented + // by the reconciler. Returns an error is the resource key is invalid. + s, err := newState(key, r) + if err != nil { + logger.Error("Invalid resource key: ", key) + return nil + } + + // If we are not the leader, and we don't implement either ReadOnly + // observer interfaces, then take a fast-path out. + if s.isNotLeaderNorObserver() { + return controller.NewSkipKey(key) + } + + // If configStore is set, attach the frozen configuration to the context. + if r.configStore != nil { + ctx = r.configStore.ToContext(ctx) + } + + // Add the recorder to context. + ctx = controller.WithEventRecorder(ctx, r.Recorder) + + // Get the resource with this namespace/name. + + getter := r.Lister.Deployments(s.namespace) + + original, err := getter.Get(s.name) + + if errors.IsNotFound(err) { + // The resource may no longer exist, in which case we stop processing and call + // the ObserveDeletion handler if appropriate. + logger.Debugf("Resource %q no longer exists", key) + if del, ok := r.reconciler.(reconciler.OnDeletionInterface); ok { + return del.ObserveDeletion(ctx, types.NamespacedName{ + Namespace: s.namespace, + Name: s.name, + }) + } + return nil + } else if err != nil { + return err + } + + // Don't modify the informers copy. + resource := original.DeepCopy() + + var reconcileEvent reconciler.Event + + name, do := s.reconcileMethodFor(resource) + // Append the target method to the logger. + logger = logger.With(zap.String("targetMethod", name)) + switch name { + case reconciler.DoReconcileKind: + // Set and update the finalizer on resource if r.reconciler + // implements Finalizer. + if resource, err = r.setFinalizerIfFinalizer(ctx, resource); err != nil { + return fmt.Errorf("failed to set finalizers: %w", err) + } + + // Reconcile this copy of the resource and then write back any status + // updates regardless of whether the reconciliation errored out. + reconcileEvent = do(ctx, resource) + + case reconciler.DoFinalizeKind: + // For finalizing reconcilers, if this resource being marked for deletion + // and reconciled cleanly (nil or normal event), remove the finalizer. + reconcileEvent = do(ctx, resource) + + if resource, err = r.clearFinalizer(ctx, resource, reconcileEvent); err != nil { + return fmt.Errorf("failed to clear finalizers: %w", err) + } + + case reconciler.DoObserveKind, reconciler.DoObserveFinalizeKind: + // Observe any changes to this resource, since we are not the leader. + reconcileEvent = do(ctx, resource) + + } + + // Synchronize the status. + switch { + case r.skipStatusUpdates: + // This reconciler implementation is configured to skip resource updates. + // This may mean this reconciler does not observe spec, but reconciles external changes. + case equality.Semantic.DeepEqual(original.Status, resource.Status): + // If we didn't change anything then don't call updateStatus. + // This is important because the copy we loaded from the injectionInformer's + // cache may be stale and we don't want to overwrite a prior update + // to status with this stale state. + case !s.isLeader: + // High-availability reconcilers may have many replicas watching the resource, but only + // the elected leader is expected to write modifications. + logger.Warn("Saw status changes when we aren't the leader!") + default: + if err = r.updateStatus(ctx, original, resource); err != nil { + logger.Warnw("Failed to update resource status", zap.Error(err)) + r.Recorder.Eventf(resource, v1.EventTypeWarning, "UpdateFailed", + "Failed to update status for %q: %v", resource.Name, err) + return err + } + } + + // Report the reconciler event, if any. + if reconcileEvent != nil { + var event *reconciler.ReconcilerEvent + if reconciler.EventAs(reconcileEvent, &event) { + logger.Infow("Returned an event", zap.Any("event", reconcileEvent)) + r.Recorder.Event(resource, event.EventType, event.Reason, event.Error()) + + // the event was wrapped inside an error, consider the reconciliation as failed + if _, isEvent := reconcileEvent.(*reconciler.ReconcilerEvent); !isEvent { + return reconcileEvent + } + return nil + } + + if controller.IsSkipKey(reconcileEvent) { + // This is a wrapped error, don't emit an event. + } else if ok, _ := controller.IsRequeueKey(reconcileEvent); ok { + // This is a wrapped error, don't emit an event. + } else { + logger.Errorw("Returned an error", zap.Error(reconcileEvent)) + r.Recorder.Event(resource, v1.EventTypeWarning, "InternalError", reconcileEvent.Error()) + } + return reconcileEvent + } + + return nil +} + +func (r *reconcilerImpl) updateStatus(ctx context.Context, existing *v1beta1.Deployment, desired *v1beta1.Deployment) error { + existing = existing.DeepCopy() + return reconciler.RetryUpdateConflicts(func(attempts int) (err error) { + // The first iteration tries to use the injectionInformer's state, subsequent attempts fetch the latest state via API. + if attempts > 0 { + + getter := r.Client.ExtensionsV1beta1().Deployments(desired.Namespace) + + existing, err = getter.Get(ctx, desired.Name, metav1.GetOptions{}) + if err != nil { + return err + } + } + + // If there's nothing to update, just return. + if equality.Semantic.DeepEqual(existing.Status, desired.Status) { + return nil + } + + if diff, err := kmp.SafeDiff(existing.Status, desired.Status); err == nil && diff != "" { + logging.FromContext(ctx).Debug("Updating status with: ", diff) + } + + existing.Status = desired.Status + + updater := r.Client.ExtensionsV1beta1().Deployments(existing.Namespace) + + _, err = updater.UpdateStatus(ctx, existing, metav1.UpdateOptions{}) + return err + }) +} + +// updateFinalizersFiltered will update the Finalizers of the resource. +// TODO: this method could be generic and sync all finalizers. For now it only +// updates defaultFinalizerName or its override. +func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1beta1.Deployment) (*v1beta1.Deployment, error) { + + getter := r.Lister.Deployments(resource.Namespace) + + actual, err := getter.Get(resource.Name) + if err != nil { + return resource, err + } + + // Don't modify the informers copy. + existing := actual.DeepCopy() + + var finalizers []string + + // If there's nothing to update, just return. + existingFinalizers := sets.NewString(existing.Finalizers...) + desiredFinalizers := sets.NewString(resource.Finalizers...) + + if desiredFinalizers.Has(r.finalizerName) { + if existingFinalizers.Has(r.finalizerName) { + // Nothing to do. + return resource, nil + } + // Add the finalizer. + finalizers = append(existing.Finalizers, r.finalizerName) + } else { + if !existingFinalizers.Has(r.finalizerName) { + // Nothing to do. + return resource, nil + } + // Remove the finalizer. + existingFinalizers.Delete(r.finalizerName) + finalizers = existingFinalizers.List() + } + + mergePatch := map[string]interface{}{ + "metadata": map[string]interface{}{ + "finalizers": finalizers, + "resourceVersion": existing.ResourceVersion, + }, + } + + patch, err := json.Marshal(mergePatch) + if err != nil { + return resource, err + } + + patcher := r.Client.ExtensionsV1beta1().Deployments(resource.Namespace) + + resourceName := resource.Name + updated, err := patcher.Patch(ctx, resourceName, types.MergePatchType, patch, metav1.PatchOptions{}) + if err != nil { + r.Recorder.Eventf(existing, v1.EventTypeWarning, "FinalizerUpdateFailed", + "Failed to update finalizers for %q: %v", resourceName, err) + } else { + r.Recorder.Eventf(updated, v1.EventTypeNormal, "FinalizerUpdate", + "Updated %q finalizers", resource.GetName()) + } + return updated, err +} + +func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource *v1beta1.Deployment) (*v1beta1.Deployment, error) { + if _, ok := r.reconciler.(Finalizer); !ok { + return resource, nil + } + + finalizers := sets.NewString(resource.Finalizers...) + + // If this resource is not being deleted, mark the finalizer. + if resource.GetDeletionTimestamp().IsZero() { + finalizers.Insert(r.finalizerName) + } + + resource.Finalizers = finalizers.List() + + // Synchronize the finalizers filtered by r.finalizerName. + return r.updateFinalizersFiltered(ctx, resource) +} + +func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1beta1.Deployment, reconcileEvent reconciler.Event) (*v1beta1.Deployment, error) { + if _, ok := r.reconciler.(Finalizer); !ok { + return resource, nil + } + if resource.GetDeletionTimestamp().IsZero() { + return resource, nil + } + + finalizers := sets.NewString(resource.Finalizers...) + + if reconcileEvent != nil { + var event *reconciler.ReconcilerEvent + if reconciler.EventAs(reconcileEvent, &event) { + if event.EventType == v1.EventTypeNormal { + finalizers.Delete(r.finalizerName) + } + } + } else { + finalizers.Delete(r.finalizerName) + } + + resource.Finalizers = finalizers.List() + + // Synchronize the finalizers filtered by r.finalizerName. + return r.updateFinalizersFiltered(ctx, resource) +} diff --git a/client/injection/kube/reconciler/extensions/v1beta1/deployment/state.go b/client/injection/kube/reconciler/extensions/v1beta1/deployment/state.go new file mode 100644 index 0000000000..47c279b6a1 --- /dev/null +++ b/client/injection/kube/reconciler/extensions/v1beta1/deployment/state.go @@ -0,0 +1,106 @@ +/* +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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package deployment + +import ( + fmt "fmt" + + v1beta1 "k8s.io/api/extensions/v1beta1" + types "k8s.io/apimachinery/pkg/types" + cache "k8s.io/client-go/tools/cache" + reconciler "knative.dev/pkg/reconciler" +) + +// state is used to track the state of a reconciler in a single run. +type state struct { + // key is the original reconciliation key from the queue. + key string + // namespace is the namespace split from the reconciliation key. + namespace string + // name is the name split from the reconciliation key. + name string + // reconciler is the reconciler. + reconciler Interface + // roi is the read only interface cast of the reconciler. + roi ReadOnlyInterface + // isROI (Read Only Interface) the reconciler only observes reconciliation. + isROI bool + // rof is the read only finalizer cast of the reconciler. + rof ReadOnlyFinalizer + // isROF (Read Only Finalizer) the reconciler only observes finalize. + isROF bool + // isLeader the instance of the reconciler is the elected leader. + isLeader bool +} + +func newState(key string, r *reconcilerImpl) (*state, error) { + // Convert the namespace/name string into a distinct namespace and name. + namespace, name, err := cache.SplitMetaNamespaceKey(key) + if err != nil { + return nil, fmt.Errorf("invalid resource key: %s", key) + } + + roi, isROI := r.reconciler.(ReadOnlyInterface) + rof, isROF := r.reconciler.(ReadOnlyFinalizer) + + isLeader := r.IsLeaderFor(types.NamespacedName{ + Namespace: namespace, + Name: name, + }) + + return &state{ + key: key, + namespace: namespace, + name: name, + reconciler: r.reconciler, + roi: roi, + isROI: isROI, + rof: rof, + isROF: isROF, + isLeader: isLeader, + }, nil +} + +// isNotLeaderNorObserver checks to see if this reconciler with the current +// state is enabled to do any work or not. +// isNotLeaderNorObserver returns true when there is no work possible for the +// reconciler. +func (s *state) isNotLeaderNorObserver() bool { + if !s.isLeader && !s.isROI && !s.isROF { + // If we are not the leader, and we don't implement either ReadOnly + // interface, then take a fast-path out. + return true + } + return false +} + +func (s *state) reconcileMethodFor(o *v1beta1.Deployment) (string, doReconcile) { + if o.GetDeletionTimestamp().IsZero() { + if s.isLeader { + return reconciler.DoReconcileKind, s.reconciler.ReconcileKind + } else if s.isROI { + return reconciler.DoObserveKind, s.roi.ObserveKind + } + } else if fin, ok := s.reconciler.(Finalizer); s.isLeader && ok { + return reconciler.DoFinalizeKind, fin.FinalizeKind + } else if !s.isLeader && s.isROF { + return reconciler.DoObserveFinalizeKind, s.rof.ObserveFinalizeKind + } + return "unknown", nil +} diff --git a/codegen/cmd/injection-gen/generators/client.go b/codegen/cmd/injection-gen/generators/client.go index d7cb717ed5..8346454be6 100644 --- a/codegen/cmd/injection-gen/generators/client.go +++ b/codegen/cmd/injection-gen/generators/client.go @@ -17,8 +17,15 @@ limitations under the License. package generators import ( + "fmt" "io" + "path/filepath" + "sort" + "strings" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/code-generator/cmd/client-gen/generators/util" + clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/gengo/generator" "k8s.io/gengo/namer" "k8s.io/gengo/types" @@ -29,6 +36,11 @@ import ( // type. type clientGenerator struct { generator.DefaultGen + + groupVersions map[string]clientgentypes.GroupVersions + groupGoNames map[string]string + groupVersionTypes map[string]map[clientgentypes.Version][]*types.Type + outputPackage string imports namer.ImportTracker clientSetPackage string @@ -46,14 +58,37 @@ func (g *clientGenerator) Filter(c *generator.Context, t *types.Type) bool { return false } +var 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", + }), +} + func (g *clientGenerator) Namers(c *generator.Context) namer.NameSystems { return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + "publicPlural": publicPluralNamer, } } func (g *clientGenerator) Imports(c *generator.Context) (imports []string) { imports = append(imports, g.imports.ImportLines()...) + for gpn, group := range g.groupVersions { + for _, version := range group.Versions { + typedClientPath := filepath.Join(g.clientSetPackage, "typed", strings.ToLower(group.PackageName), strings.ToLower(version.NonEmpty())) + imports = append(imports, fmt.Sprintf("%s \"%s\"", strings.ToLower("typed"+g.groupGoNames[gpn]+version.NonEmpty()), typedClientPath)) + } + } + imports = sets.NewString(imports...).List() return } @@ -63,9 +98,10 @@ func (g *clientGenerator) GenerateType(c *generator.Context, t *types.Type, w io klog.V(5).Info("processing type ", t) m := map[string]interface{}{ - "clientSetNewForConfigOrDie": c.Universe.Function(types.Name{Package: g.clientSetPackage, Name: "NewForConfigOrDie"}), - "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), - "injectionRegisterClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterClient"}), + "clientSetNewForConfigOrDie": c.Universe.Function(types.Name{Package: g.clientSetPackage, Name: "NewForConfigOrDie"}), + "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), + "injectionRegisterClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterClient"}), + "injectionRegisterDynamicClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Dynamic.RegisterDynamicClient"}), "injectionRegisterClientFetcher": c.Universe.Function(types.Name{ Package: "knative.dev/pkg/injection", Name: "Default.RegisterClientFetcher", @@ -79,28 +115,231 @@ func (g *clientGenerator) GenerateType(c *generator.Context, t *types.Type, w io Package: "context", Name: "Context", }), + "dynamicInterface": c.Universe.Type(types.Name{ + Package: "k8s.io/client-go/dynamic", + Name: "Interface", + }), + "dynamicclientGet": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/injection/clients/dynamicclient", + Name: "Get", + }), + "discoveryInterface": c.Universe.Type(types.Name{ + Package: "k8s.io/client-go/discovery", + Name: "DiscoveryInterface", + }), + "runtimeObject": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/runtime", + Name: "Object", + }), + "jsonMarshal": c.Universe.Function(types.Name{ + Package: "encoding/json", + Name: "Marshal", + }), + "jsonUnmarshal": c.Universe.Function(types.Name{ + Package: "encoding/json", + Name: "Unmarshal", + }), + "fmtErrorf": c.Universe.Function(types.Name{ + Package: "fmt", + Name: "Errorf", + }), } sw.Do(injectionClient, m) + gpns := make(sets.String, len(g.groupGoNames)) + for gpn := range g.groupGoNames { + gpns.Insert(gpn) + } + + for _, gpn := range gpns.List() { + ggn := g.groupGoNames[gpn] + gv := g.groupVersions[gpn] + verTypes := g.groupVersionTypes[gpn] + for _, version := range gv.Versions { + vts := verTypes[version.Version] + if len(vts) == 0 { + // Skip things with zero types. + continue + } + sw.Do(clientsetInterfaceImplTemplate, map[string]interface{}{ + "dynamicInterface": c.Universe.Type(types.Name{ + Package: "k8s.io/client-go/dynamic", + Name: "Interface", + }), + "restInterface": c.Universe.Type(types.Name{ + Package: "k8s.io/client-go/rest", + Name: "Interface", + }), + "GroupGoName": ggn, + "Version": namer.IC(version.String()), + "PackageAlias": strings.ToLower("typed" + g.groupGoNames[gpn] + version.NonEmpty()), + }) + sort.Slice(vts, func(i, j int) bool { + lhs, rhs := vts[i], vts[j] + return lhs.String() < rhs.String() + }) + for _, t := range vts { + tags, err := util.ParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) + if err != nil { + return err + } + + // Don't use the literal group "core", these should be left blank. + group := gv.Group + if group == "core" { + group = "" + } + + sw.Do(typeImplTemplate, map[string]interface{}{ + "dynamicNamespaceableResourceInterface": c.Universe.Type(types.Name{ + Package: "k8s.io/client-go/dynamic", + Name: "NamespaceableResourceInterface", + }), + "schemaGroupVersionResource": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/runtime/schema", + Name: "GroupVersionResource", + }), + "contextContext": c.Universe.Type(types.Name{ + Package: "context", + Name: "Context", + }), + "GroupGoName": ggn, + "Version": namer.IC(version.String()), + "PackageAlias": strings.ToLower("typed" + g.groupGoNames[gpn] + version.NonEmpty()), + "Type": t, + "Namespaced": !tags.NonNamespaced, + "Group": group, + "VersionLower": version, + "Resource": strings.ToLower(publicPluralNamer.Name(t)), + }) + opts := map[string]interface{}{ + "contextContext": c.Universe.Type(types.Name{ + Package: "context", + Name: "Context", + }), + "unstructuredUnstructured": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", + Name: "Unstructured", + }), + "metav1CreateOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "CreateOptions", + }), + "metav1UpdateOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "UpdateOptions", + }), + "metav1GetOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "GetOptions", + }), + "metav1ListOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "ListOptions", + }), + "metav1DeleteOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "DeleteOptions", + }), + "metav1PatchOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "PatchOptions", + }), + "typesPatchType": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/types", + Name: "PatchType", + }), + "watchInterface": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/watch", + Name: "Interface", + }), + "errorsNew": c.Universe.Function(types.Name{ + Package: "errors", + Name: "New", + }), + "GroupGoName": ggn, + "Version": namer.IC(version.String()), + "Type": t, + "InputType": t, + "ResultType": t, + "Namespaced": !tags.NonNamespaced, + "Subresource": "", + "schemaGroupVersionKind": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/runtime/schema", + Name: "GroupVersionKind", + }), + "Group": group, + "VersionLower": version, + "Kind": t.Name.Name, + } + for _, v := range verbs.List() { + tmpl := verbMap[v] + if tags.NoVerbs || !tags.HasVerb(v) { + continue + } + sw.Do(tmpl, opts) + } + for _, e := range tags.Extensions { + for _, v := range extensionVerbs.List() { + tmpl := extensionVerbMap[v] + if !e.HasVerb(v) { + continue + } + inputType := *t + resultType := *t + if len(e.InputTypeOverride) > 0 { + if name, pkg := e.Input(); len(pkg) > 0 { + // _, inputGVString = util.ParsePathGroupVersion(pkg) + newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) + inputType = *newType + } else { + inputType.Name.Name = e.InputTypeOverride + } + } + if len(e.ResultTypeOverride) > 0 { + if name, pkg := e.Result(); len(pkg) > 0 { + newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) + resultType = *newType + } else { + resultType.Name.Name = e.ResultTypeOverride + } + } + opts["InputType"] = &inputType + opts["ResultType"] = &resultType + if e.IsSubresource() { + opts["Subresource"] = e.SubResourcePath + } + sw.Do(strings.Replace(tmpl, " "+strings.Title(e.VerbType), " "+e.VerbName, -1), opts) + } + } + } + } + } + return sw.Error() } var injectionClient = ` func init() { - {{.injectionRegisterClient|raw}}(withClient) + {{.injectionRegisterClient|raw}}(withClientFromConfig) {{.injectionRegisterClientFetcher|raw}}(func(ctx context.Context) interface{} { return Get(ctx) }) + {{.injectionRegisterDynamicClient|raw}}(withClientFromDynamic) } // Key is used as the key for associating information with a context.Context. type Key struct{} -func withClient(ctx {{.contextContext|raw}}, cfg *{{.restConfig|raw}}) context.Context { +func withClientFromConfig(ctx {{.contextContext|raw}}, cfg *{{.restConfig|raw}}) context.Context { return context.WithValue(ctx, Key{}, {{.clientSetNewForConfigOrDie|raw}}(cfg)) } +func withClientFromDynamic(ctx {{.contextContext|raw}}) context.Context { + return context.WithValue(ctx, Key{}, &wrapClient{dyn: {{.dynamicclientGet|raw}}(ctx)}) +} + // Get extracts the {{.clientSetInterface|raw}} client from the context. func Get(ctx {{.contextContext|raw}}) {{.clientSetInterface|raw}} { untyped := ctx.Value(Key{}) @@ -115,4 +354,258 @@ func Get(ctx {{.contextContext|raw}}) {{.clientSetInterface|raw}} { } return untyped.({{.clientSetInterface|raw}}) } + +type wrapClient struct { + dyn {{.dynamicInterface|raw}} +} + +var _ {{.clientSetInterface|raw}} = (*wrapClient)(nil) + +func (w *wrapClient) Discovery() {{.discoveryInterface|raw}} { + panic("Discovery called on dynamic client!") +} + + +func convert(from interface{}, to {{ .runtimeObject|raw }}) error { + bs, err := {{ .jsonMarshal|raw }}(from) + if err != nil { + return {{ .fmtErrorf|raw }}("Marshal() = %w", err) + } + if err := {{ .jsonUnmarshal|raw }}(bs, to); err != nil { + return {{ .fmtErrorf|raw }}("Unmarshal() = %w", err) + } + return nil +} + ` + +var clientsetInterfaceImplTemplate = ` +// {{.GroupGoName}}{{.Version}} retrieves the {{.GroupGoName}}{{.Version}}Client +func (w *wrapClient) {{.GroupGoName}}{{.Version}}() {{.PackageAlias}}.{{.GroupGoName}}{{.Version}}Interface { + return &wrap{{.GroupGoName}}{{.Version}}{ + dyn: w.dyn, + } +} + +type wrap{{.GroupGoName}}{{.Version}} struct { + dyn {{.dynamicInterface|raw}} +} + +func (w *wrap{{.GroupGoName}}{{.Version}}) RESTClient() {{.restInterface|raw}} { + panic("RESTClient called on dynamic client!") +} + +` + +var typeImplTemplate = ` +func (w *wrap{{ .GroupGoName }}{{ .Version }}) {{ .Type|publicPlural }}({{if .Namespaced}}namespace string{{end}}) {{ .PackageAlias }}.{{ .Type.Name.Name }}Interface { + return &wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl{ + dyn: w.dyn.Resource({{ .schemaGroupVersionResource|raw }}{ + Group: "{{ .Group }}", + Version: "{{ .VersionLower }}", + Resource: "{{ .Resource }}", + }), +{{if .Namespaced}} + namespace: namespace, +{{end}} + } +} + +type wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl struct { + dyn {{.dynamicNamespaceableResourceInterface|raw}} +{{if .Namespaced}} + namespace string +{{end}}} + +var _ {{ .PackageAlias }}.{{ .Type.Name.Name }}Interface = (*wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl)(nil) + +` + +var verbs = sets.NewString( /* Populated from verbMap during init */ ) +var verbMap = map[string]string{ + "create": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Create(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1CreateOptions|raw }}) (*{{ .ResultType|raw }}, error) { + in.SetGroupVersionKind({{ .schemaGroupVersionKind|raw }}{ + Group: "{{ .Group }}", + Version: "{{ .VersionLower }}", + Kind: "{{ .Kind }}", + }) + uo := &{{ .unstructuredUnstructured|raw }}{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn{{if .Namespaced}}{{if .Namespaced}}.Namespace(w.namespace){{end}}{{end}}.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} +`, + + "update": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Update(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { + in.SetGroupVersionKind({{ .schemaGroupVersionKind|raw }}{ + Group: "{{ .Group }}", + Version: "{{ .VersionLower }}", + Kind: "{{ .Kind }}", + }) + uo := &{{ .unstructuredUnstructured|raw }}{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} +`, + + "updateStatus": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) UpdateStatus(ctx {{ .contextContext|raw }}, in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { + in.SetGroupVersionKind({{ .schemaGroupVersionKind|raw }}{ + Group: "{{ .Group }}", + Version: "{{ .VersionLower }}", + Kind: "{{ .Kind }}", + }) + uo := &{{ .unstructuredUnstructured|raw }}{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} +`, + + "delete": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Delete(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1DeleteOptions|raw }}) error { + return w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Delete(ctx, name, opts) +} +`, + + "deleteCollection": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) DeleteCollection(ctx {{ .contextContext|raw }}, opts {{ .metav1DeleteOptions|raw }}, listOpts {{ .metav1ListOptions|raw }}) error { + return w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.DeleteCollection(ctx, opts, listOpts) +} +`, + + "get": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Get(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1GetOptions|raw }}) (*{{ .ResultType|raw }}, error) { + uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} +`, + + "list": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) List(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) (*{{ .ResultType|raw }}List, error) { + uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.List(ctx, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}List{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} +`, + + "watch": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Watch(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) ({{ .watchInterface|raw }}, error) { + return nil, {{ .errorsNew|raw }}("NYI: Watch") +} +`, + "patch": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Patch(ctx {{ .contextContext|raw }}, name string, pt {{ .typesPatchType|raw }}, data []byte, opts {{ .metav1PatchOptions|raw }}, subresources ...string) (result *{{ .ResultType|raw }}, err error) { + uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} +`, +} + +var extensionVerbs = sets.NewString( /* Populated from extensionVerbMap during init */ ) +var extensionVerbMap = map[string]string{ + "create": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Create(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1CreateOptions|raw }}) (*{{ .ResultType|raw }}, error) { + panic("NYI") +} +`, + "update": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Update(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { + panic("NYI") +} +`, + "updateStatus": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) UpdateStatus(ctx {{ .contextContext|raw }}, in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { + panic("NYI") +} +`, + "delete": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Delete(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1DeleteOptions|raw }}) error { + panic("NYI") +} +`, + "deleteCollection": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) DeleteCollection(ctx {{ .contextContext|raw }}, opts {{ .metav1DeleteOptions|raw }}, listOpts {{ .metav1ListOptions|raw }}) error { + panic("NYI") +} +`, + "get": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Get(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1GetOptions|raw }}) (*{{ .ResultType|raw }}, error) { + panic("NYI") +} +`, + "list": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) List(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) (*{{ .ResultType|raw }}List, error) { + panic("NYI") +} +`, + "watch": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Watch(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) ({{ .watchInterface|raw }}, error) { + panic("NYI") +} +`, + "patch": ` +func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Patch(ctx {{ .contextContext|raw }}, name string, pt {{ .typesPatchType|raw }}, data []byte, opts {{ .metav1PatchOptions|raw }}, subresources ...string) (result *{{ .ResultType|raw }}, err error) { + panic("NYI") +} +`, +} + +func init() { + for v := range verbMap { + verbs.Insert(v) + } + for ev := range extensionVerbMap { + extensionVerbs.Insert(ev) + } +} diff --git a/codegen/cmd/injection-gen/generators/filtered_informer.go b/codegen/cmd/injection-gen/generators/filtered_informer.go index c82a2e59f1..3100052a86 100644 --- a/codegen/cmd/injection-gen/generators/filtered_informer.go +++ b/codegen/cmd/injection-gen/generators/filtered_informer.go @@ -19,6 +19,7 @@ package generators import ( "io" + "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/gengo/generator" "k8s.io/gengo/namer" @@ -37,6 +38,9 @@ type filteredInjectionGenerator struct { imports namer.ImportTracker typedInformerPackage string groupInformerFactoryPackage string + injectionClientSetPackage string + clientSetPackage string + listerPkg string } var _ generator.Generator = (*filteredInjectionGenerator)(nil) @@ -78,11 +82,23 @@ func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types klog.V(5).Info("processing type ", t) + tags, err := util.ParseClientGenTags(append(g.typeToGenerate.SecondClosestCommentLines, g.typeToGenerate.CommentLines...)) + if err != nil { + return err + } + m := map[string]interface{}{ + "clientGet": c.Universe.Type(types.Name{Package: g.injectionClientSetPackage, Name: "Get"}), + "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), + "resourceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "Lister", Package: g.listerPkg}), + "resourceNamespaceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "NamespaceLister", Package: g.listerPkg}), + "groupGoName": namer.IC(g.groupGoName), + "versionGoName": namer.IC(g.groupVersion.Version.String()), "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"}), + "injectionRegisterDynamicInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Dynamic.RegisterDynamicInformer"}), "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"}), @@ -95,6 +111,43 @@ func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types Package: "context", Name: "Context", }), + "contextWithValue": c.Universe.Function(types.Name{ + Package: "context", + Name: "WithValue", + }), + "schemaGVR": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/runtime/schema", + Name: "GroupVersionResource", + }), + "labelsSelector": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/labels", + Name: "Selector", + }), + "labelsParseToRequirements": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/labels", + Name: "ParseToRequirements", + }), + "contextTODO": c.Universe.Function(types.Name{ + Package: "context", + Name: "TODO", + }), + "metav1GetOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "GetOptions", + }), + "metav1ListOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "ListOptions", + }), + "cacheSharedIndexInformer": c.Universe.Type(types.Name{ + Package: "k8s.io/client-go/tools/cache", + Name: "SharedIndexInformer", + }), + "cacheNewSharedIndexInformer": c.Universe.Function(types.Name{ + Package: "k8s.io/client-go/tools/cache", + Name: "NewSharedIndexInformer", + }), + "Namespaced": !tags.NonNamespaced, } sw.Do(filteredInjectionInformer, m) @@ -105,6 +158,7 @@ func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types var filteredInjectionInformer = ` func init() { {{.injectionRegisterFilteredInformers|raw}}(withInformer) + {{.injectionRegisterDynamicInformer|raw}}(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -123,12 +177,26 @@ func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, []{{.co for _, selector := range labelSelectors { f := {{.factoryGet|raw}}(ctx, selector) inf := f.{{.group}}().{{.version}}().{{.type|publicPlural}}() - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + ctx = {{ .contextWithValue|raw }}(ctx, Key{Selector: selector}, inf) infs = append(infs, inf.Informer()) } return ctx, infs } +func withDynamicInformer(ctx {{.contextContext|raw}}) {{.contextContext|raw}} { + 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 { + inf := &wrapper{client: {{ .clientGet|raw }}(ctx), selector: selector} + ctx = {{ .contextWithValue|raw }}(ctx, Key{Selector: selector}, inf) + } + return ctx +} + // Get extracts the typed informer from the context. func Get(ctx {{.contextContext|raw}}, selector string) {{.informersTypedInformer|raw}} { untyped := ctx.Value(Key{Selector: selector}) @@ -138,4 +206,55 @@ func Get(ctx {{.contextContext|raw}}, selector string) {{.informersTypedInformer } return untyped.({{.informersTypedInformer|raw}}) } + +type wrapper struct { + client {{.clientSetInterface|raw}} +{{ if .Namespaced }} + namespace string +{{ end }} + selector string +} + +var _ {{.informersTypedInformer|raw}} = (*wrapper)(nil) +var _ {{.resourceLister|raw}} = (*wrapper)(nil) + +func (w *wrapper) Informer() {{ .cacheSharedIndexInformer|raw }} { + return {{ .cacheNewSharedIndexInformer|raw }}(nil, &{{ .type|raw }}{}, 0, nil) +} + +func (w *wrapper) Lister() {{ .resourceLister|raw }} { + return w +} + +{{if .Namespaced}} +func (w *wrapper) {{ .type|publicPlural }}(namespace string) {{ .resourceNamespaceLister|raw }} { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} +{{end}} + +func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw }}, err error) { + reqs, err := {{ .labelsParseToRequirements|raw }}(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).List({{ .contextTODO|raw }}(), {{ .metav1ListOptions|raw }}{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*{{ .type|raw }}, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).Get({{ .contextTODO|raw }}(), name, {{ .metav1GetOptions|raw }}{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} ` diff --git a/codegen/cmd/injection-gen/generators/informer.go b/codegen/cmd/injection-gen/generators/informer.go index e696873fd5..bbbffb4ccf 100644 --- a/codegen/cmd/injection-gen/generators/informer.go +++ b/codegen/cmd/injection-gen/generators/informer.go @@ -19,6 +19,7 @@ package generators import ( "io" + "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/gengo/generator" "k8s.io/gengo/namer" @@ -37,6 +38,9 @@ type injectionGenerator struct { imports namer.ImportTracker typedInformerPackage string groupInformerFactoryPackage string + injectionClientSetPackage string + clientSetPackage string + listerPkg string } var _ generator.Generator = (*injectionGenerator)(nil) @@ -78,14 +82,26 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w klog.V(5).Info("processing type ", t) + tags, err := util.ParseClientGenTags(append(g.typeToGenerate.SecondClosestCommentLines, g.typeToGenerate.CommentLines...)) + if err != nil { + return err + } + m := map[string]interface{}{ - "group": namer.IC(g.groupGoName), - "type": t, - "version": namer.IC(g.groupVersion.Version.String()), - "injectionRegisterInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterInformer"}), - "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"}), - "factoryGet": c.Universe.Type(types.Name{Package: g.groupInformerFactoryPackage, Name: "Get"}), + "clientGet": c.Universe.Type(types.Name{Package: g.injectionClientSetPackage, Name: "Get"}), + "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), + "resourceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "Lister", Package: g.listerPkg}), + "resourceNamespaceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "NamespaceLister", Package: g.listerPkg}), + "groupGoName": namer.IC(g.groupGoName), + "versionGoName": namer.IC(g.groupVersion.Version.String()), + "group": g.groupVersion.Group.String(), + "version": g.groupVersion.Version.String(), + "type": t, + "injectionRegisterInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterInformer"}), + "injectionRegisterDynamicInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Dynamic.RegisterDynamicInformer"}), + "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"}), + "factoryGet": c.Universe.Type(types.Name{Package: g.groupInformerFactoryPackage, Name: "Get"}), "loggingFromContext": c.Universe.Function(types.Name{ Package: "knative.dev/pkg/logging", Name: "FromContext", @@ -94,6 +110,39 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w Package: "context", Name: "Context", }), + "contextWithValue": c.Universe.Function(types.Name{ + Package: "context", + Name: "WithValue", + }), + "schemaGVR": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/runtime/schema", + Name: "GroupVersionResource", + }), + "labelsSelector": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/labels", + Name: "Selector", + }), + "contextTODO": c.Universe.Function(types.Name{ + Package: "context", + Name: "TODO", + }), + "metav1GetOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "GetOptions", + }), + "metav1ListOptions": c.Universe.Type(types.Name{ + Package: "k8s.io/apimachinery/pkg/apis/meta/v1", + Name: "ListOptions", + }), + "cacheSharedIndexInformer": c.Universe.Type(types.Name{ + Package: "k8s.io/client-go/tools/cache", + Name: "SharedIndexInformer", + }), + "cacheNewSharedIndexInformer": c.Universe.Function(types.Name{ + Package: "k8s.io/client-go/tools/cache", + Name: "NewSharedIndexInformer", + }), + "Namespaced": !tags.NonNamespaced, } sw.Do(injectionInformer, m) @@ -104,6 +153,7 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w var injectionInformer = ` func init() { {{.injectionRegisterInformer|raw}}(withInformer) + {{.injectionRegisterDynamicInformer|raw}}(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -111,8 +161,13 @@ type Key struct{} func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, {{.controllerInformer|raw}}) { f := {{.factoryGet|raw}}(ctx) - inf := f.{{.group}}().{{.version}}().{{.type|publicPlural}}() - return context.WithValue(ctx, Key{}, inf), inf.Informer() + inf := f.{{.groupGoName}}().{{.versionGoName}}().{{.type|publicPlural}}() + return {{ .contextWithValue|raw }}(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx {{.contextContext|raw}}) {{.contextContext|raw}} { + inf := &wrapper{client: {{ .clientGet|raw }}(ctx)} + return {{ .contextWithValue|raw }}(ctx, Key{}, inf) } // Get extracts the typed informer from the context. @@ -124,4 +179,49 @@ func Get(ctx {{.contextContext|raw}}) {{.informersTypedInformer|raw}} { } return untyped.({{.informersTypedInformer|raw}}) } + +type wrapper struct { + client {{.clientSetInterface|raw}} +{{ if .Namespaced }} + namespace string +{{ end }} +} + +var _ {{.informersTypedInformer|raw}} = (*wrapper)(nil) +var _ {{.resourceLister|raw}} = (*wrapper)(nil) + +func (w *wrapper) Informer() {{ .cacheSharedIndexInformer|raw }} { + return {{ .cacheNewSharedIndexInformer|raw }}(nil, &{{ .type|raw }}{}, 0, nil) +} + +func (w *wrapper) Lister() {{ .resourceLister|raw }} { + return w +} + +{{if .Namespaced}} +func (w *wrapper) {{ .type|publicPlural }}(namespace string) {{ .resourceNamespaceLister|raw }} { + return &wrapper{client: w.client, namespace: namespace} +} +{{end}} + +func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw }}, err error) { + lo, err := w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).List({{ .contextTODO|raw }}(), {{ .metav1ListOptions|raw }}{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*{{ .type|raw }}, error) { + return w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).Get({{ .contextTODO|raw }}(), name, {{ .metav1GetOptions|raw }}{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} + ` diff --git a/codegen/cmd/injection-gen/generators/packages.go b/codegen/cmd/injection-gen/generators/packages.go index c873774f51..1900802fad 100644 --- a/codegen/cmd/injection-gen/generators/packages.go +++ b/codegen/cmd/injection-gen/generators/packages.go @@ -50,6 +50,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat groupVersions := make(map[string]clientgentypes.GroupVersions) groupGoNames := make(map[string]string) + groupVersionTypes := make(map[string]map[clientgentypes.Version][]*types.Type) for _, inputDir := range arguments.InputDirs { p := context.Universe.Package(vendorless(inputDir)) @@ -81,6 +82,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat var typesWithInformers []*types.Type var duckTypes []*types.Type var reconcilerTypes []*types.Type + var clientTypes []*types.Type for _, t := range p.Types { tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) if tags.NeedsInformerInjection() { @@ -92,6 +94,9 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat if tags.NeedsReconciler(t, customArgs) { reconcilerTypes = append(reconcilerTypes, t) } + if tags.GenerateClient { + clientTypes = append(clientTypes, t) + } } groupVersionsEntry, ok := targetGroupVersions[groupPackageName] @@ -103,6 +108,12 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } groupVersionsEntry.Versions = append(groupVersionsEntry.Versions, clientgentypes.PackageVersion{Version: gv.Version, Package: gvPackage}) targetGroupVersions[groupPackageName] = groupVersionsEntry + verTypes, ok := groupVersionTypes[groupPackageName] + if !ok { + verTypes = make(map[clientgentypes.Version][]*types.Type) + } + verTypes[gv.Version] = clientTypes + groupVersionTypes[groupPackageName] = verTypes if len(typesWithInformers) != 0 { orderer := namer.Orderer{Namer: namer.NewPrivateNamer(0)} @@ -130,7 +141,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } // Generate the client and fake. - packageList = append(packageList, versionClientsPackages(versionPackagePath, boilerplate, customArgs)...) + packageList = append(packageList, versionClientsPackages(versionPackagePath, boilerplate, customArgs, groupVersions, groupGoNames, groupVersionTypes)...) // Generate the informer factory and fake. packageList = append(packageList, versionFactoryPackages(versionPackagePath, boilerplate, customArgs)...) @@ -233,7 +244,7 @@ func typedInformerPackage(groupPkgName string, gv clientgentypes.GroupVersion, e return filepath.Join(externalVersionsInformersPackage, groupPkgName, gv.Version.String()) } -func versionClientsPackages(basePackage string, boilerplate []byte, customArgs *informergenargs.CustomArgs) []generator.Package { +func versionClientsPackages(basePackage string, boilerplate []byte, customArgs *informergenargs.CustomArgs, groupVersions map[string]clientgentypes.GroupVersions, groupGoNames map[string]string, groupVersionTypes map[string]map[clientgentypes.Version][]*types.Type) []generator.Package { packagePath := filepath.Join(basePackage, "client") return []generator.Package{ @@ -248,6 +259,11 @@ func versionClientsPackages(basePackage string, boilerplate []byte, customArgs * DefaultGen: generator.DefaultGen{ OptionalName: "client", }, + + groupVersions: groupVersions, + groupGoNames: groupGoNames, + groupVersionTypes: groupVersionTypes, + outputPackage: packagePath, imports: generator.NewImportTracker(), clientSetPackage: customArgs.VersionedClientSetPackage, @@ -392,6 +408,7 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg filteredFactoryPackagePath := filepath.Join(basePackage, "informers", "factory", "filtered") packagePath := filepath.Join(basePackage, "informers", groupPkgName, strings.ToLower(gv.Version.NonEmpty())) + listerPackagePath := filepath.Join(customArgs.ListersPackage, groupPkgName, strings.ToLower(gv.Version.NonEmpty())) vers := make([]generator.Package, 0, 2*len(typesToGenerate)) @@ -419,6 +436,9 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg imports: generator.NewImportTracker(), typedInformerPackage: typedInformerPackage, groupInformerFactoryPackage: factoryPackagePath, + clientSetPackage: customArgs.VersionedClientSetPackage, + injectionClientSetPackage: filepath.Join(basePackage, "client"), + listerPkg: listerPackagePath, }) return generators }, @@ -472,6 +492,9 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg imports: generator.NewImportTracker(), typedInformerPackage: typedInformerPackage, groupInformerFactoryPackage: filteredFactoryPackagePath, + clientSetPackage: customArgs.VersionedClientSetPackage, + injectionClientSetPackage: filepath.Join(basePackage, "client"), + listerPkg: listerPackagePath, }) return generators }, diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index a8051e6de4..3b374fa52a 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -38,13 +38,18 @@ ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ "duck:v1alpha1,v1beta1,v1" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt +# Based on: https://github.com/kubernetes/kubernetes/blob/8ddabd0da5cc54761f3216c08e99fa1a9f7ee2c5/hack/lib/init.sh#L116 +# The '-path' is a hack to workaround the lack of portable `-depth 2`. +K8S_TYPES=$(find ./vendor/k8s.io/api -type d -path '*/*/*/*/*/*' | cut -d'/' -f 5-6 | sort | sed 's@/@:@g' | + grep -v "admission:" | grep -v "imagepolicy:" | grep -v "abac:" | grep -v "componentconfig:") + OUTPUT_PKG="knative.dev/pkg/client/injection/kube" \ VERSIONED_CLIENTSET_PKG="k8s.io/client-go/kubernetes" \ EXTERNAL_INFORMER_PKG="k8s.io/client-go/informers" \ ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ k8s.io/client-go \ k8s.io/api \ - "admissionregistration:v1beta1,v1 apps:v1 autoscaling:v1,v2beta1 batch:v1,v1beta1 core:v1 rbac:v1 coordination:v1" \ + "${K8S_TYPES}" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt \ --force-genreconciler-kinds "Namespace,Deployment,Secret" diff --git a/injection/clients.go b/injection/clients.go index b71ef1d943..92e9912185 100644 --- a/injection/clients.go +++ b/injection/clients.go @@ -62,3 +62,22 @@ func (i *impl) FetchAllClients(ctx context.Context) []interface{} { } return clients } + +// DynamicClientInjector holds the type of a callback that attaches a particular +// client type to a context. +type DynamicClientInjector func(context.Context) context.Context + +func (i *impl) RegisterDynamicClient(ci DynamicClientInjector) { + i.m.Lock() + defer i.m.Unlock() + + i.dynamicClients = append(i.dynamicClients, ci) +} + +func (i *impl) GetDynamicClients() []DynamicClientInjector { + i.m.RLock() + defer i.m.RUnlock() + + // Copy the slice before returning. + return append(i.dynamicClients[:0:0], i.dynamicClients...) +} diff --git a/injection/clients/namespacedkube/informers/core/v1/secret/secret.go b/injection/clients/namespacedkube/informers/core/v1/secret/secret.go index 90d70627f4..e5193c8655 100644 --- a/injection/clients/namespacedkube/informers/core/v1/secret/secret.go +++ b/injection/clients/namespacedkube/informers/core/v1/secret/secret.go @@ -19,7 +19,14 @@ package secret import ( context "context" + apicorev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" + kubernetes "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + client "knative.dev/pkg/client/injection/kube/client" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" factory "knative.dev/pkg/injection/clients/namespacedkube/informers/factory" @@ -28,6 +35,7 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -39,6 +47,11 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.SecretInformer { untyped := ctx.Value(Key{}) @@ -48,3 +61,44 @@ func Get(ctx context.Context) v1.SecretInformer { } return untyped.(v1.SecretInformer) } + +type wrapper struct { + client kubernetes.Interface + + namespace string +} + +var _ v1.SecretInformer = (*wrapper)(nil) +var _ corev1.SecretLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apicorev1.Secret{}, 0, nil) +} + +func (w *wrapper) Lister() corev1.SecretLister { + return w +} + +func (w *wrapper) Secrets(namespace string) corev1.SecretNamespaceLister { + return &wrapper{client: w.client, namespace: namespace} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Secret, err error) { + lo, err := w.client.CoreV1().Secrets(w.namespace).List(context.TODO(), metav1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apicorev1.Secret, error) { + return w.client.CoreV1().Secrets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/injection/informers.go b/injection/informers.go index 9356f8d7f9..ce5d481e88 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) +// DynamicInformerInjector holds the type of a callback that attaches a particular +// informer type (backed by a Dynamic) to a context. +type DynamicInformerInjector func(context.Context) context.Context + // 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) @@ -39,6 +43,13 @@ func (i *impl) RegisterInformer(ii InformerInjector) { i.informers = append(i.informers, ii) } +func (i *impl) RegisterDynamicInformer(ii DynamicInformerInjector) { + i.m.Lock() + defer i.m.Unlock() + + i.dynamicInformers = append(i.dynamicInformers, ii) +} + func (i *impl) RegisterFilteredInformers(fii FilteredInformersInjector) { i.m.Lock() defer i.m.Unlock() @@ -54,6 +65,14 @@ func (i *impl) GetInformers() []InformerInjector { return append(i.informers[:0:0], i.informers...) } +func (i *impl) GetDynamicInformers() []DynamicInformerInjector { + i.m.RLock() + defer i.m.RUnlock() + + // Copy the slice before returning. + return append(i.dynamicInformers[:0:0], i.dynamicInformers...) +} + func (i *impl) GetFilteredInformers() []FilteredInformersInjector { i.m.RLock() defer i.m.RUnlock() @@ -62,6 +81,22 @@ func (i *impl) GetFilteredInformers() []FilteredInformersInjector { return append(i.filteredInformers[:0:0], i.filteredInformers...) } +func (i *impl) SetupDynamic(ctx context.Context) context.Context { + // Based on the reconcilers we have linked, build up a set of clients and inject + // them onto the context. + for _, ci := range i.GetDynamicClients() { + ctx = ci(ctx) + } + + // Based on the reconcilers we have linked, build up a set of informers + // and inject them onto the context. + for _, ii := range i.GetDynamicInformers() { + ctx = ii(ctx) + } + + return ctx +} + 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. diff --git a/injection/interface.go b/injection/interface.go index 112a6415f2..4337282984 100644 --- a/injection/interface.go +++ b/injection/interface.go @@ -78,6 +78,29 @@ type Interface interface { SetupInformers(context.Context, *rest.Config) (context.Context, []controller.Informer) } +// DynamicInterface is the interface for interacting with dynamicclient-based injection +// implementations, such as Dynamic below. +type DynamicInterface interface { + // RegisterDynamicClient registers a new injector callback for associating + // a new dynamicclient-based client with a context. + RegisterDynamicClient(DynamicClientInjector) + + // GetDynamicClients fetches all of the registered dynamicclient-based client injectors. + GetDynamicClients() []DynamicClientInjector + + // RegisterDynamicInformer registers a new injector callback for associating + // a new dynamicclient-based informer with a context. + RegisterDynamicInformer(DynamicInformerInjector) + + // GetDynamicInformers fetches all of the registered dynamicclient-based informer injectors. + GetDynamicInformers() []DynamicInformerInjector + + // SetupDynamic runs all of the injectors against a context, starting with + // the clients and the given stream. A context infused with the various elements + // is returned. + SetupDynamic(context.Context) context.Context +} + type ControllerConstructor func(context.Context, configmap.Watcher) *controller.Impl var ( @@ -89,6 +112,10 @@ var ( // are being run for real. Default Interface = &impl{} + // Dynamic is the injection interface to use when bootstrapping a version + // of things based on the prototype dynamicclient-based reconciler framework. + Dynamic DynamicInterface = &impl{} + // Fake is the injection interface with which informers should register // to make themselves available to the controller process when it is being // unit tested. @@ -99,9 +126,11 @@ type impl struct { m sync.RWMutex clients []ClientInjector + dynamicClients []DynamicClientInjector clientFetchers []ClientFetcher factories []InformerFactoryInjector informers []InformerInjector + dynamicInformers []DynamicInformerInjector filteredInformers []FilteredInformersInjector ducks []DuckFactoryInjector }