diff --git a/cli/cmd/crd2apiresourceschema/cmd/crd2apiresourceschema.go b/cli/cmd/crd2apiresourceschema/cmd/crd2apiresourceschema.go new file mode 100644 index 000000000..37d494f07 --- /dev/null +++ b/cli/cmd/crd2apiresourceschema/cmd/crd2apiresourceschema.go @@ -0,0 +1,51 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cmd + +import ( + goflags "flag" + "fmt" + "os" + + "github.com/spf13/cobra" + + "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/component-base/version" + "k8s.io/klog/v2" + + crd2apiresourceschemacmd "github.com/kube-bind/kube-bind/cli/pkg/crd2apiresourceschema/cmd" +) + +func CRD2APIResourceSchemaCmd() *cobra.Command { + rootCmd, err := crd2apiresourceschemacmd.New(genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}) + if err != nil { + fmt.Fprintf(os.Stderr, "error: %v", err) + os.Exit(1) + } + // setup klog + fs := goflags.NewFlagSet("klog", goflags.PanicOnError) + klog.InitFlags(fs) + rootCmd.PersistentFlags().AddGoFlagSet(fs) + + if v := version.Get().String(); len(v) == 0 { + rootCmd.Version = "" + } else { + rootCmd.Version = v + } + + return rootCmd +} diff --git a/cli/cmd/crd2apiresourceschema/main.go b/cli/cmd/crd2apiresourceschema/main.go new file mode 100644 index 000000000..f4c7207e3 --- /dev/null +++ b/cli/cmd/crd2apiresourceschema/main.go @@ -0,0 +1,37 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 main + +import ( + "fmt" + "os" + + "github.com/spf13/pflag" + + cmd "github.com/kube-bind/kube-bind/cli/cmd/crd2apiresourceschema/cmd" +) + +func main() { + flags := pflag.NewFlagSet("crd2apiresourceschema", pflag.ExitOnError) + pflag.CommandLine = flags + + command := cmd.CRD2APIResourceSchemaCmd() + if err := command.Execute(); err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } +} diff --git a/cli/pkg/crd2apiresourceschema/cmd/cmd.go b/cli/pkg/crd2apiresourceschema/cmd/cmd.go new file mode 100644 index 000000000..b7dccc582 --- /dev/null +++ b/cli/pkg/crd2apiresourceschema/cmd/cmd.go @@ -0,0 +1,75 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cmd + +import ( + "github.com/spf13/cobra" + + "k8s.io/cli-runtime/pkg/genericclioptions" + _ "k8s.io/client-go/plugin/pkg/client/auth/exec" + _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" + logsv1 "k8s.io/component-base/logs/api/v1" + + "github.com/kube-bind/kube-bind/cli/pkg/crd2apiresourceschema/plugin" +) + +var ( + CRD2APIResourceSchemaUses = ` +# Generate APIResourceSchemas from provided CRDs in the cluster and save them to YAML files in the specified output directory +crd2apiresourceschema --output-dir /output/dir + +# Generate APIResourceSchemas from provided CRDs in the cluster and save them to YAML files, specifying a different kubeconfig and output directory +crd2apiresourceschema --kubeconfig /path/to/your/kubeconfig --output-dir /path/to/output/dir + +# Generate and create APIResourceSchema objects for all CRDs in the cluster +crd2apiresourceschema --generate-in-cluster + +# Generate and create APIResourceSchema objects for all CRDs in the cluster, specifying a different kubeconfig +crd2apiresourceschema --kubeconfig /path/to/your/kubeconfig --generate-in-cluster +` +) + +func New(streams genericclioptions.IOStreams) (*cobra.Command, error) { + opts := plugin.NewCRD2APIResourceSchemaOptions(streams) + cmd := &cobra.Command{ + Use: "crd2apiresourceschema", + Short: "Create APIResourceSchema from provided CRDs in the cluster.", + Example: CRD2APIResourceSchemaUses, + SilenceUsage: true, + RunE: func(cmd *cobra.Command, args []string) error { + if err := logsv1.ValidateAndApply(opts.Logs, nil); err != nil { + return err + } + + if len(args) > 1 { + return cmd.Help() + } + if err := opts.Complete(args); err != nil { + return err + } + + if err := opts.Validate(); err != nil { + return err + } + + return opts.Run(cmd.Context()) + }, + } + opts.AddCmdFlags(cmd) + + return cmd, nil +} diff --git a/cli/pkg/crd2apiresourceschema/plugin/crd2apiresourceschema.go b/cli/pkg/crd2apiresourceschema/plugin/crd2apiresourceschema.go new file mode 100644 index 000000000..16252af56 --- /dev/null +++ b/cli/pkg/crd2apiresourceschema/plugin/crd2apiresourceschema.go @@ -0,0 +1,265 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 plugin + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "time" + + "github.com/spf13/cobra" + + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/client-go/dynamic" + "k8s.io/component-base/logs" + logsv1 "k8s.io/component-base/logs/api/v1" + "k8s.io/component-base/version" + + "github.com/kube-bind/kube-bind/cli/pkg/kubectl/base" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" +) + +type CRD2APIResourceSchemaOptions struct { + Options *base.Options + Logs *logs.Options + Print *genericclioptions.PrintFlags + + // GenerateInCluster indicates whether to generate the APIResourceSchema in-cluster. + GenerateInCluster bool + // OutputDir is the directory where the APIResourceSchemas will be written. + OutputDir string +} + +func NewCRD2APIResourceSchemaOptions(streams genericclioptions.IOStreams) *CRD2APIResourceSchemaOptions { + return &CRD2APIResourceSchemaOptions{ + Options: base.NewOptions(streams), + Logs: logs.NewOptions(), + Print: genericclioptions.NewPrintFlags("crd2apiresourceschema"), + } +} + +func (b *CRD2APIResourceSchemaOptions) AddCmdFlags(cmd *cobra.Command) { + b.Options.BindFlags(cmd) + logsv1.AddFlags(b.Logs, cmd.Flags()) + b.Print.AddFlags(cmd) + + cmd.Flags().BoolVar(&b.GenerateInCluster, "generate-in-cluster", b.GenerateInCluster, "Generate the APIResourceSchema in-cluster.") + cmd.Flags().StringVar(&b.OutputDir, "output-dir", b.OutputDir, "Directory where APIResourceSchemas will be written.") +} + +func (b *CRD2APIResourceSchemaOptions) Complete(args []string) error { + return b.Options.Complete() +} + +func (b *CRD2APIResourceSchemaOptions) Validate() error { + if b.GenerateInCluster && b.OutputDir != "" { + return errors.New("output-dir and generate-in-cluster cannot be used together") + } + + return b.Options.Validate() +} + +// Run starts the process of converting CRDs to APIResourceSchema objects. +func (b *CRD2APIResourceSchemaOptions) Run(ctx context.Context) error { + config, err := b.Options.ClientConfig.ClientConfig() + if err != nil { + return err + } + client, err := dynamic.NewForConfig(config) + if err != nil { + return fmt.Errorf("failed to create dynamic client: %w", err) + } + + if b.OutputDir == "" { + b.OutputDir = "." + } + + crdGVR := apiextensionsv1.SchemeGroupVersion.WithResource("customresourcedefinitions") + crdList, err := client.Resource(crdGVR).List(ctx, metav1.ListOptions{}) + if err != nil { + return fmt.Errorf("failed to list CRDs: %w", err) + } + + for _, crd := range crdList.Items { + crdObj := &apiextensionsv1.CustomResourceDefinition{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(crd.UnstructuredContent(), crdObj); err != nil { + return fmt.Errorf("failed to convert CRD: %w", err) + } + + if crdObj.Spec.Group == "kube-bind.io" { + fmt.Fprintf(b.Options.ErrOut, "Skipping CRD %s: belongs to group kube-bind.io\n", crdObj.Name) + continue + } + + prefix := fmt.Sprintf("v%s-%s", time.Now().Format("060102"), string(version.Get().GitCommit)) + apiResourceSchema, err := convertCRDToAPIResourceSchema(crdObj, prefix) + if err != nil { + fmt.Fprintf(b.Options.ErrOut, "Failed to convert CRD %s to APIResourceSchema: %v\n", crdObj.Name, err) + continue + } + + if apiResourceSchema == nil { + fmt.Fprintf(b.Options.ErrOut, "Skipping CRD %s: no schema found\n", crdObj.Name) + continue + } + + if b.GenerateInCluster { + if err := generateAPIResourceSchemaInCluster(ctx, client, apiResourceSchema, b.Options.ErrOut, b.Options.Out); err != nil { + continue + } + } + if err := writeObjectToYAML(b.OutputDir, apiResourceSchema, b.Options.Out); err != nil { + return err + } + } + + return nil +} + +func generateAPIResourceSchemaInCluster(ctx context.Context, client dynamic.Interface, apiResourceSchema *kubebindv1alpha2.APIResourceSchema, errOut, out io.Writer) error { + apiResourceSchemaGVR := kubebindv1alpha2.SchemeGroupVersion.WithResource("apiresourceschemas") + unstructuredObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(apiResourceSchema) + if err != nil { + return fmt.Errorf("failed to convert APIResourceSchema to unstructured: %w", err) + } + unstructuredResource := &unstructured.Unstructured{Object: unstructuredObj} + + _, err = client.Resource(apiResourceSchemaGVR).Create(ctx, unstructuredResource, metav1.CreateOptions{}) + if err != nil { + fmt.Fprintf(errOut, "Failed to create APIResourceSchema for CRD %s: %v\n", apiResourceSchema.Name, err) + return err + } + + fmt.Fprintf(out, "Successfully created APIResourceSchema for CRD %s\n", apiResourceSchema.Name) + return nil +} + +func convertCRDToAPIResourceSchema(crd *apiextensionsv1.CustomResourceDefinition, prefix string) (*kubebindv1alpha2.APIResourceSchema, error) { + name := prefix + "." + crd.Name + informerScope := kubebindv1alpha2.NamespacedScope + apiResourceSchema := &kubebindv1alpha2.APIResourceSchema{ + TypeMeta: metav1.TypeMeta{ + APIVersion: kubebindv1alpha2.SchemeGroupVersion.String(), + Kind: "APIResourceSchema", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: kubebindv1alpha2.APIResourceSchemaSpec{ + InformerScope: informerScope, + APIResourceSchemaCRDSpec: kubebindv1alpha2.APIResourceSchemaCRDSpec{ + Group: crd.Spec.Group, + Names: crd.Spec.Names, + Scope: crd.Spec.Scope, + }, + }, + } + + if len(crd.Spec.Versions) > 1 && crd.Spec.Conversion == nil { + return nil, fmt.Errorf("multiple versions specified for CRD %q but no conversion strategy", crd.Name) + } + + if crd.Spec.Conversion != nil { + crConversion := &kubebindv1alpha2.CustomResourceConversion{ + Strategy: kubebindv1alpha2.ConversionStrategyType(crd.Spec.Conversion.Strategy), + } + + if crd.Spec.Conversion.Strategy == "Webhook" { + crConversion.Webhook = &kubebindv1alpha2.WebhookConversion{ + ConversionReviewVersions: crd.Spec.Conversion.Webhook.ConversionReviewVersions, + } + + if crd.Spec.Conversion.Webhook.ClientConfig != nil { + crConversion.Webhook.ClientConfig = &kubebindv1alpha2.WebhookClientConfig{ + URL: crd.Spec.Conversion.Webhook.ClientConfig.URL, + CABundle: crd.Spec.Conversion.Webhook.ClientConfig.CABundle, + } + } + } + + apiResourceSchema.Spec.Conversion = crConversion + } + + for i := range crd.Spec.Versions { + crdVersion := crd.Spec.Versions[i] + + apiResourceVersion := kubebindv1alpha2.APIResourceVersion{ + Name: crdVersion.Name, + Served: crdVersion.Served, + Storage: crdVersion.Storage, + Deprecated: crdVersion.Deprecated, + DeprecationWarning: crdVersion.DeprecationWarning, + AdditionalPrinterColumns: crdVersion.AdditionalPrinterColumns, + } + + if crdVersion.Schema != nil && crdVersion.Schema.OpenAPIV3Schema != nil { + rawSchema, err := json.Marshal(crdVersion.Schema.OpenAPIV3Schema) + if err != nil { + return nil, fmt.Errorf("error converting schema for version %q: %w", crdVersion.Name, err) + } + apiResourceVersion.Schema = runtime.RawExtension{Raw: rawSchema} + } + + if crdVersion.Subresources != nil { + apiResourceVersion.Subresources = *crdVersion.Subresources + } + + apiResourceSchema.Spec.Versions = append(apiResourceSchema.Spec.Versions, apiResourceVersion) + } + + return apiResourceSchema, nil +} + +func writeObjectToYAML(outputDir string, apiResourceSchema *kubebindv1alpha2.APIResourceSchema, logger io.Writer) error { + if err := os.MkdirAll(outputDir, 0755); err != nil { + return fmt.Errorf("failed to create output directory %s: %w", outputDir, err) + } + + scheme := runtime.NewScheme() + if err := kubebindv1alpha2.AddToScheme(scheme); err != nil { + return fmt.Errorf("failed to register kubebindv1alpha2 API group: %w", err) + } + + codecs := serializer.NewCodecFactory(scheme) + info, ok := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), runtime.ContentTypeYAML) + if !ok { + return fmt.Errorf("unsupported media type %q", runtime.ContentTypeYAML) + } + encoder := codecs.EncoderForVersion(info.Serializer, kubebindv1alpha2.SchemeGroupVersion) + + out, err := runtime.Encode(encoder, apiResourceSchema) + if err != nil { + return fmt.Errorf("failed to encode APIResourceSchema %s: %w", apiResourceSchema.Name, err) + } + outputPath := filepath.Join(outputDir, fmt.Sprintf("%s.yaml", apiResourceSchema.Name)) + if err := os.WriteFile(outputPath, out, 0644); err != nil { + return fmt.Errorf("failed to write APIResourceSchema to file %s: %w", outputPath, err) + } + + fmt.Fprintf(logger, "Wrote APIResourceSchema %s to %s\n", apiResourceSchema.Name, outputPath) + return nil +} diff --git a/deploy/crd/kube-bind.io_apiconversions.yaml b/deploy/crd/kube-bind.io_apiconversions.yaml new file mode 100644 index 000000000..5101a551d --- /dev/null +++ b/deploy/crd/kube-bind.io_apiconversions.yaml @@ -0,0 +1,124 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.5 + name: apiconversions.kube-bind.io +spec: + group: kube-bind.io + names: + categories: + - kcp + kind: APIConversion + listKind: APIConversionList + plural: apiconversions + singular: apiconversion + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 + schema: + openAPIV3Schema: + description: |- + APIConversion contains rules to convert between different API versions in an APIResourceSchema. The name must match + the name of the APIResourceSchema for the conversions to take effect. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Spec holds the desired state. + properties: + conversions: + description: conversions specify rules to convert between different + API versions in an APIResourceSchema. + items: + description: |- + APIVersionConversion contains rules to convert between two specific API versions in an + APIResourceSchema. Additionally, to avoid data loss when round-tripping from a version that + contains a new field to one that doesn't and back again, you can specify a list of fields to + preserve (these are stored in annotations). + properties: + from: + description: from is the source version. + minLength: 1 + pattern: ^v[1-9][0-9]*([a-z]+[1-9][0-9]*)?$ + type: string + preserve: + description: |- + preserve contains a list of JSONPath expressions to fields to preserve in the originating version + of the object, relative to its root, such as '.spec.name.first'. + items: + type: string + type: array + rules: + description: rules contains field-specific conversion expressions. + items: + description: APIConversionRule specifies how to convert a + single field. + properties: + destination: + description: |- + destination is a JSONPath expression to the field in the target version of the object, relative to + its root, such as '.spec.name.first'. + minLength: 1 + type: string + field: + description: |- + field is a JSONPath expression to the field in the originating version of the object, relative to its root, such + as '.spec.name.first'. + minLength: 1 + type: string + transformation: + description: |- + transformation is an optional CEL expression used to execute user-specified rules to transform the + originating field -- identified by 'self' -- to the destination field. + type: string + required: + - destination + - field + type: object + type: array + x-kubernetes-list-map-keys: + - destination + x-kubernetes-list-type: map + to: + description: to is the target version. + minLength: 1 + pattern: ^v[1-9][0-9]*([a-z]+[1-9][0-9]*)?$ + type: string + required: + - from + - rules + - to + type: object + type: array + x-kubernetes-list-map-keys: + - from + - to + x-kubernetes-list-type: map + required: + - conversions + type: object + type: object + served: true + storage: true + subresources: {} diff --git a/deploy/crd/kube-bind.io_apiresourceschemas.yaml b/deploy/crd/kube-bind.io_apiresourceschemas.yaml new file mode 100644 index 000000000..6d9eb6887 --- /dev/null +++ b/deploy/crd/kube-bind.io_apiresourceschemas.yaml @@ -0,0 +1,350 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.5 + name: apiresourceschemas.kube-bind.io +spec: + group: kube-bind.io + names: + categories: + - kube-bindings + kind: APIResourceSchema + listKind: APIResourceSchemaList + plural: apiresourceschemas + singular: apiresourceschema + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 + schema: + openAPIV3Schema: + description: APIResourceSchema + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + conversion: + description: conversion defines conversion settings for the defined + custom resource. + properties: + strategy: + description: |- + strategy specifies how custom resources are converted between versions. Allowed values are: + - `"None"`: The converter only change the apiVersion and would not touch any other field in the custom resource. + - `"Webhook"`: API Server will call to an external webhook to do the conversion. Additional information + is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhook to be set. + enum: + - None + - Webhook + type: string + webhook: + description: webhook describes how to call the conversion webhook. + Required when `strategy` is set to `"Webhook"`. + properties: + clientConfig: + description: clientConfig is the instructions for how to call + the webhook if strategy is `Webhook`. + properties: + caBundle: + description: |- + caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + If unspecified, system trust roots on the apiserver are used. + format: byte + type: string + url: + description: |- + url gives the location of the webhook, in standard URL form + (`scheme://host:port/path`). + + Please note that using `localhost` or `127.0.0.1` as a `host` is + risky unless you take great care to run this webhook on all hosts + which run an apiserver which might need to make calls to this + webhook. Such installs are likely to be non-portable, i.e., not easy + to turn up in a new cluster. + + The scheme must be "https"; the URL must begin with "https://". + + A path is optional, and if present may be any string permissible in + a URL. You may use the path to pass an arbitrary string to the + webhook, for example, a cluster identifier. + + Attempting to use a user or basic auth e.g. "user:password@" is not + allowed. Fragments ("#...") and query parameters ("?...") are not + allowed, either. + format: uri + type: string + type: object + conversionReviewVersions: + description: |- + conversionReviewVersions is an ordered list of preferred `ConversionReview` + versions the Webhook expects. The API server will use the first version in + the list which it supports. If none of the versions specified in this list + are supported by API server, conversion will fail for the custom resource. + If a persisted Webhook configuration specifies allowed versions and does not + include any versions known to the API Server, calls to the webhook will fail. + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + type: object + x-kubernetes-validations: + - message: Webhook must be specified if strategy=Webhook + rule: (self.strategy == 'None' && !has(self.webhook)) || (self.strategy + == 'Webhook' && has(self.webhook)) + group: + description: "group is the API group of the defined custom resource. + Empty string means the\ncore API group. \tThe resources are served + under `/apis//...` or `/api` for the core group." + type: string + informerScope: + allOf: + - enum: + - Cluster + - Namespaced + - enum: + - Cluster + - Namespaced + description: |- + InformerScope indicates whether the informer for defined custom resource is cluster- or namespace-scoped. + Allowed values are `Cluster` and `Namespaced`. + type: string + names: + description: names specify the resource and kind names for the custom + resource. + properties: + categories: + description: |- + categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). + This is published in API discovery documents, and used by clients to support invocations like + `kubectl get all`. + items: + type: string + type: array + x-kubernetes-list-type: atomic + kind: + description: |- + kind is the serialized kind of the resource. It is normally CamelCase and singular. + Custom resource instances will use this value as the `kind` attribute in API calls. + type: string + listKind: + description: listKind is the serialized kind of the list for this + resource. Defaults to "`kind`List". + type: string + plural: + description: |- + plural is the plural name of the resource to serve. + The custom resources are served under `/apis///.../`. + Must match the name of the CustomResourceDefinition (in the form `.`). + Must be all lowercase. + type: string + shortNames: + description: |- + shortNames are short names for the resource, exposed in API discovery documents, + and used by clients to support invocations like `kubectl get `. + It must be all lowercase. + items: + type: string + type: array + x-kubernetes-list-type: atomic + singular: + description: singular is the singular name of the resource. It + must be all lowercase. Defaults to lowercased `kind`. + type: string + required: + - kind + - plural + type: object + scope: + description: |- + scope indicates whether the defined custom resource is cluster- or namespace-scoped. + Allowed values are `Cluster` and `Namespaced`. + enum: + - Cluster + - Namespaced + type: string + versions: + description: |- + versions is the API version of the defined custom resource. + + Note: the OpenAPI v3 schemas must be equal for all versions until CEL + version migration is supported. + items: + description: APIResourceVersion describes one API version of a resource. + properties: + additionalPrinterColumns: + description: |- + additionalPrinterColumns specifies additional columns returned in Table output. + See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. + If no columns are specified, a single column displaying the age of the custom resource is used. + items: + description: CustomResourceColumnDefinition specifies a column + for server side printing. + properties: + description: + description: description is a human readable description + of this column. + type: string + format: + description: |- + format is an optional OpenAPI type definition for this column. The 'name' format is applied + to the primary identifier column to assist in clients identifying column is the resource name. + See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + type: string + jsonPath: + description: |- + jsonPath is a simple JSON path (i.e. with array notation) which is evaluated against + each custom resource to produce the value for this column. + type: string + name: + description: name is a human readable name for the column. + type: string + priority: + description: |- + priority is an integer defining the relative importance of this column compared to others. Lower + numbers are considered higher priority. Columns that may be omitted in limited space scenarios + should be given a priority greater than 0. + format: int32 + type: integer + type: + description: |- + type is an OpenAPI type definition for this column. + See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + type: string + required: + - jsonPath + - name + - type + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + deprecated: + description: |- + deprecated indicates this version of the custom resource API is deprecated. + When set to true, API requests to this version receive a warning header in the server response. + Defaults to false. + type: boolean + deprecationWarning: + description: |- + deprecationWarning overrides the default warning returned to API clients. + May only be set when `deprecated` is true. + The default warning indicates this version is deprecated and recommends use + of the newest served version of equal or greater stability, if one exists. + type: string + name: + description: |- + name is the version name, e.g. “v1”, “v2beta1”, etc. + The custom resources are served under this version at `/apis///...` if `served` is true. + minLength: 1 + pattern: ^v[1-9][0-9]*([a-z]+[1-9][0-9]*)?$ + type: string + schema: + description: |- + schema describes the structural schema used for validation, pruning, and defaulting + of this version of the custom resource. + type: object + x-kubernetes-map-type: atomic + x-kubernetes-preserve-unknown-fields: true + served: + default: true + description: served is a flag enabling/disabling this version + from being served via REST APIs + type: boolean + storage: + description: |- + storage indicates this version should be used when persisting custom resources to storage. + There must be exactly one version with storage=true. + type: boolean + subresources: + description: subresources specify what subresources this version + of the defined custom resource have. + properties: + scale: + description: scale indicates the custom resource should + serve a `/scale` subresource that returns an `autoscaling/v1` + Scale object. + properties: + labelSelectorPath: + description: |- + labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. + Only JSON paths without the array notation are allowed. + Must be a JSON Path under `.status` or `.spec`. + Must be set to work with HorizontalPodAutoscaler. + The field pointed by this JSON path must be a string field (not a complex selector struct) + which contains a serialized label selector in string form. + More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource + If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` + subresource will default to the empty string. + type: string + specReplicasPath: + description: |- + specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. + Only JSON paths without the array notation are allowed. + Must be a JSON Path under `.spec`. + If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET. + type: string + statusReplicasPath: + description: |- + statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. + Only JSON paths without the array notation are allowed. + Must be a JSON Path under `.status`. + If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource + will default to 0. + type: string + required: + - specReplicasPath + - statusReplicasPath + type: object + status: + description: |- + status indicates the custom resource should serve a `/status` subresource. + When enabled: + 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. + 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object. + type: object + type: object + required: + - name + - schema + - served + - storage + type: object + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + required: + - group + - informerScope + - names + - scope + - versions + type: object + type: object + served: true + storage: true + subresources: {} diff --git a/sdk/apis/kubebind/v1alpha2/apiresourceschema_types.go b/sdk/apis/kubebind/v1alpha2/apiresourceschema_types.go new file mode 100644 index 000000000..812741219 --- /dev/null +++ b/sdk/apis/kubebind/v1alpha2/apiresourceschema_types.go @@ -0,0 +1,246 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 v1alpha2 + +import ( + "encoding/json" + + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// InformerScope is the scope of the Api. +// +// +kubebuilder:validation:Enum=Cluster;Namespaced +type InformerScope string + +const ( + ClusterScope InformerScope = "Cluster" + NamespacedScope InformerScope = "Namespaced" +) + +// APIResourceSchema +// +crd +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Namespaced,categories=kube-bindings +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type APIResourceSchema struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec APIResourceSchemaSpec `json:"spec"` +} + +type APIResourceSchemaSpec struct { + // InformerScope indicates whether the informer for defined custom resource is cluster- or namespace-scoped. + // Allowed values are `Cluster` and `Namespaced`. + // + // +required + // +kubebuilder:validation:Enum=Cluster;Namespaced + InformerScope InformerScope `json:"informerScope"` + + APIResourceSchemaCRDSpec `json:",inline"` +} + +type APIResourceSchemaCRDSpec struct { + // group is the API group of the defined custom resource. Empty string means the + // core API group. The resources are served under `/apis//...` or `/api` for the core group. + // + // +required + Group string `json:"group"` + + // names specify the resource and kind names for the custom resource. + // + // +required + Names apiextensionsv1.CustomResourceDefinitionNames `json:"names"` + // scope indicates whether the defined custom resource is cluster- or namespace-scoped. + // Allowed values are `Cluster` and `Namespaced`. + // + // +required + // +kubebuilder:validation:Enum=Cluster;Namespaced + Scope apiextensionsv1.ResourceScope `json:"scope"` + + // versions is the API version of the defined custom resource. + // + // Note: the OpenAPI v3 schemas must be equal for all versions until CEL + // version migration is supported. + // + // +required + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MinItems=1 + Versions []APIResourceVersion `json:"versions"` + + // conversion defines conversion settings for the defined custom resource. + // +optional + Conversion *CustomResourceConversion `json:"conversion,omitempty"` +} + +// APIResourceVersion describes one API version of a resource. +type APIResourceVersion struct { + // name is the version name, e.g. “v1”, “v2beta1”, etc. + // The custom resources are served under this version at `/apis///...` if `served` is true. + // + // +required + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:Pattern=^v[1-9][0-9]*([a-z]+[1-9][0-9]*)?$ + Name string `json:"name"` + // served is a flag enabling/disabling this version from being served via REST APIs + // + // +required + // +kubebuilder:default=true + Served bool `json:"served"` + // storage indicates this version should be used when persisting custom resources to storage. + // There must be exactly one version with storage=true. + // + // +required + Storage bool `json:"storage"` + + //nolint:gocritic + // deprecated indicates this version of the custom resource API is deprecated. + // When set to true, API requests to this version receive a warning header in the server response. + // Defaults to false. + // + // +optional + Deprecated bool `json:"deprecated,omitempty"` + // deprecationWarning overrides the default warning returned to API clients. + // May only be set when `deprecated` is true. + // The default warning indicates this version is deprecated and recommends use + // of the newest served version of equal or greater stability, if one exists. + // + // +optional + DeprecationWarning *string `json:"deprecationWarning,omitempty"` + // schema describes the structural schema used for validation, pruning, and defaulting + // of this version of the custom resource. + // + // +required + // +kubebuilder:pruning:PreserveUnknownFields + // +structType=atomic + Schema runtime.RawExtension `json:"schema"` + // subresources specify what subresources this version of the defined custom resource have. + // + // +optional + Subresources apiextensionsv1.CustomResourceSubresources `json:"subresources,omitempty"` + // additionalPrinterColumns specifies additional columns returned in Table output. + // See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. + // If no columns are specified, a single column displaying the age of the custom resource is used. + // + // +optional + // +listType=map + // +listMapKey=name + AdditionalPrinterColumns []apiextensionsv1.CustomResourceColumnDefinition `json:"additionalPrinterColumns,omitempty"` +} + +// CustomResourceConversion describes how to convert different versions of a CR. +// +kubebuilder:validation:XValidation:message="Webhook must be specified if strategy=Webhook",rule="(self.strategy == 'None' && !has(self.webhook)) || (self.strategy == 'Webhook' && has(self.webhook))" +type CustomResourceConversion struct { + // strategy specifies how custom resources are converted between versions. Allowed values are: + // - `"None"`: The converter only change the apiVersion and would not touch any other field in the custom resource. + // - `"Webhook"`: API Server will call to an external webhook to do the conversion. Additional information + // is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhook to be set. + // +kubebuilder:validation:Enum=None;Webhook + Strategy ConversionStrategyType `json:"strategy"` + + // webhook describes how to call the conversion webhook. Required when `strategy` is set to `"Webhook"`. + // +optional + Webhook *WebhookConversion `json:"webhook,omitempty"` +} + +// ConversionStrategyType describes different conversion types. +type ConversionStrategyType string + +// WebhookConversion describes how to call a conversion webhook +type WebhookConversion struct { + // clientConfig is the instructions for how to call the webhook if strategy is `Webhook`. + // +optional + ClientConfig *WebhookClientConfig `json:"clientConfig,omitempty"` + + // conversionReviewVersions is an ordered list of preferred `ConversionReview` + // versions the Webhook expects. The API server will use the first version in + // the list which it supports. If none of the versions specified in this list + // are supported by API server, conversion will fail for the custom resource. + // If a persisted Webhook configuration specifies allowed versions and does not + // include any versions known to the API Server, calls to the webhook will fail. + // +listType=atomic + ConversionReviewVersions []string `json:"conversionReviewVersions"` +} + +// WebhookClientConfig contains the information to make a TLS connection with the webhook. +type WebhookClientConfig struct { + // url gives the location of the webhook, in standard URL form + // (`scheme://host:port/path`). + // + // Please note that using `localhost` or `127.0.0.1` as a `host` is + // risky unless you take great care to run this webhook on all hosts + // which run an apiserver which might need to make calls to this + // webhook. Such installs are likely to be non-portable, i.e., not easy + // to turn up in a new cluster. + // + // The scheme must be "https"; the URL must begin with "https://". + // + // A path is optional, and if present may be any string permissible in + // a URL. You may use the path to pass an arbitrary string to the + // webhook, for example, a cluster identifier. + // + // Attempting to use a user or basic auth e.g. "user:password@" is not + // allowed. Fragments ("#...") and query parameters ("?...") are not + // allowed, either. + // + // +kubebuilder:validation:Format=uri + URL *string `json:"url,omitempty"` + + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // If unspecified, system trust roots on the apiserver are used. + // +optional + CABundle []byte `json:"caBundle,omitempty"` +} + +// APIResourceSchemaList is a list of APIResourceSchemas. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type APIResourceSchemaList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []APIResourceSchema `json:"items"` +} + +func (v *APIResourceVersion) GetSchema() (*apiextensionsv1.JSONSchemaProps, error) { + if v.Schema.Raw == nil { + return nil, nil + } + var schema apiextensionsv1.JSONSchemaProps + if err := json.Unmarshal(v.Schema.Raw, &schema); err != nil { + return nil, err + } + return &schema, nil +} + +func (v *APIResourceVersion) SetSchema(schema *apiextensionsv1.JSONSchemaProps) error { + if schema == nil { + v.Schema.Raw = nil + return nil + } + raw, err := json.Marshal(schema) + if err != nil { + return err + } + v.Schema.Raw = raw + return nil +} diff --git a/sdk/apis/kubebind/v1alpha2/doc.go b/sdk/apis/kubebind/v1alpha2/doc.go new file mode 100644 index 000000000..35aca2a27 --- /dev/null +++ b/sdk/apis/kubebind/v1alpha2/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 v1alpha2 defines the v1alpha2 version of the Kube Bind API +// +// +groupName=kube-bind.io +// +groupGoName=KubeBind +// +k8s:deepcopy-gen=package,register +// +kubebuilder:validation:Optional +package v1alpha2 diff --git a/sdk/apis/kubebind/v1alpha2/register.go b/sdk/apis/kubebind/v1alpha2/register.go new file mode 100644 index 000000000..72700a89e --- /dev/null +++ b/sdk/apis/kubebind/v1alpha2/register.go @@ -0,0 +1,54 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +const ( + // GroupName is the group name used in this package + GroupName = "kube-bind.io" + + // GroupVersion is the group version used in this package + GroupVersion = "v1alpha2" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &APIResourceSchema{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/sdk/apis/kubebind/v1alpha2/zz_generated.deepcopy.go b/sdk/apis/kubebind/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 000000000..0fa206039 --- /dev/null +++ b/sdk/apis/kubebind/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,234 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceSchema) DeepCopyInto(out *APIResourceSchema) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceSchema. +func (in *APIResourceSchema) DeepCopy() *APIResourceSchema { + if in == nil { + return nil + } + out := new(APIResourceSchema) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIResourceSchema) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceSchemaCRDSpec) DeepCopyInto(out *APIResourceSchemaCRDSpec) { + *out = *in + in.Names.DeepCopyInto(&out.Names) + if in.Versions != nil { + in, out := &in.Versions, &out.Versions + *out = make([]APIResourceVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conversion != nil { + in, out := &in.Conversion, &out.Conversion + *out = new(CustomResourceConversion) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceSchemaCRDSpec. +func (in *APIResourceSchemaCRDSpec) DeepCopy() *APIResourceSchemaCRDSpec { + if in == nil { + return nil + } + out := new(APIResourceSchemaCRDSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceSchemaList) DeepCopyInto(out *APIResourceSchemaList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]APIResourceSchema, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceSchemaList. +func (in *APIResourceSchemaList) DeepCopy() *APIResourceSchemaList { + if in == nil { + return nil + } + out := new(APIResourceSchemaList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIResourceSchemaList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceSchemaSpec) DeepCopyInto(out *APIResourceSchemaSpec) { + *out = *in + in.APIResourceSchemaCRDSpec.DeepCopyInto(&out.APIResourceSchemaCRDSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceSchemaSpec. +func (in *APIResourceSchemaSpec) DeepCopy() *APIResourceSchemaSpec { + if in == nil { + return nil + } + out := new(APIResourceSchemaSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceVersion) DeepCopyInto(out *APIResourceVersion) { + *out = *in + if in.DeprecationWarning != nil { + in, out := &in.DeprecationWarning, &out.DeprecationWarning + *out = new(string) + **out = **in + } + in.Schema.DeepCopyInto(&out.Schema) + in.Subresources.DeepCopyInto(&out.Subresources) + if in.AdditionalPrinterColumns != nil { + in, out := &in.AdditionalPrinterColumns, &out.AdditionalPrinterColumns + *out = make([]v1.CustomResourceColumnDefinition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceVersion. +func (in *APIResourceVersion) DeepCopy() *APIResourceVersion { + if in == nil { + return nil + } + out := new(APIResourceVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomResourceConversion) DeepCopyInto(out *CustomResourceConversion) { + *out = *in + if in.Webhook != nil { + in, out := &in.Webhook, &out.Webhook + *out = new(WebhookConversion) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceConversion. +func (in *CustomResourceConversion) DeepCopy() *CustomResourceConversion { + if in == nil { + return nil + } + out := new(CustomResourceConversion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookClientConfig) DeepCopyInto(out *WebhookClientConfig) { + *out = *in + if in.URL != nil { + in, out := &in.URL, &out.URL + *out = new(string) + **out = **in + } + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookClientConfig. +func (in *WebhookClientConfig) DeepCopy() *WebhookClientConfig { + if in == nil { + return nil + } + out := new(WebhookClientConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookConversion) DeepCopyInto(out *WebhookConversion) { + *out = *in + if in.ClientConfig != nil { + in, out := &in.ClientConfig, &out.ClientConfig + *out = new(WebhookClientConfig) + (*in).DeepCopyInto(*out) + } + if in.ConversionReviewVersions != nil { + in, out := &in.ConversionReviewVersions, &out.ConversionReviewVersions + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConversion. +func (in *WebhookConversion) DeepCopy() *WebhookConversion { + if in == nil { + return nil + } + out := new(WebhookConversion) + in.DeepCopyInto(out) + return out +} diff --git a/sdk/client/clientset/versioned/clientset.go b/sdk/client/clientset/versioned/clientset.go index 7ddfa947e..cceba1e28 100644 --- a/sdk/client/clientset/versioned/clientset.go +++ b/sdk/client/clientset/versioned/clientset.go @@ -27,17 +27,20 @@ import ( flowcontrol "k8s.io/client-go/util/flowcontrol" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/typed/kubebind/v1alpha1" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/typed/kubebind/v1alpha2" ) type Interface interface { Discovery() discovery.DiscoveryInterface KubeBindV1alpha1() kubebindv1alpha1.KubeBindV1alpha1Interface + KubeBindV1alpha2() kubebindv1alpha2.KubeBindV1alpha2Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient kubeBindV1alpha1 *kubebindv1alpha1.KubeBindV1alpha1Client + kubeBindV1alpha2 *kubebindv1alpha2.KubeBindV1alpha2Client } // KubeBindV1alpha1 retrieves the KubeBindV1alpha1Client @@ -45,6 +48,11 @@ func (c *Clientset) KubeBindV1alpha1() kubebindv1alpha1.KubeBindV1alpha1Interfac return c.kubeBindV1alpha1 } +// KubeBindV1alpha2 retrieves the KubeBindV1alpha2Client +func (c *Clientset) KubeBindV1alpha2() kubebindv1alpha2.KubeBindV1alpha2Interface { + return c.kubeBindV1alpha2 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -93,6 +101,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.kubeBindV1alpha2, err = kubebindv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -115,6 +127,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.kubeBindV1alpha1 = kubebindv1alpha1.New(c) + cs.kubeBindV1alpha2 = kubebindv1alpha2.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/sdk/client/clientset/versioned/fake/clientset_generated.go b/sdk/client/clientset/versioned/fake/clientset_generated.go index 4bd9384d5..8d15d2197 100644 --- a/sdk/client/clientset/versioned/fake/clientset_generated.go +++ b/sdk/client/clientset/versioned/fake/clientset_generated.go @@ -28,6 +28,8 @@ import ( clientset "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/typed/kubebind/v1alpha1" fakekubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/typed/kubebind/v1alpha1/fake" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/typed/kubebind/v1alpha2" + fakekubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -88,3 +90,8 @@ var ( func (c *Clientset) KubeBindV1alpha1() kubebindv1alpha1.KubeBindV1alpha1Interface { return &fakekubebindv1alpha1.FakeKubeBindV1alpha1{Fake: &c.Fake} } + +// KubeBindV1alpha2 retrieves the KubeBindV1alpha2Client +func (c *Clientset) KubeBindV1alpha2() kubebindv1alpha2.KubeBindV1alpha2Interface { + return &fakekubebindv1alpha2.FakeKubeBindV1alpha2{Fake: &c.Fake} +} diff --git a/sdk/client/clientset/versioned/fake/register.go b/sdk/client/clientset/versioned/fake/register.go index 0eb19ef74..f361cafbd 100644 --- a/sdk/client/clientset/versioned/fake/register.go +++ b/sdk/client/clientset/versioned/fake/register.go @@ -26,6 +26,7 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha1" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" ) var scheme = runtime.NewScheme() @@ -33,6 +34,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ kubebindv1alpha1.AddToScheme, + kubebindv1alpha2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/sdk/client/clientset/versioned/scheme/register.go b/sdk/client/clientset/versioned/scheme/register.go index 7f424d295..20fd57527 100644 --- a/sdk/client/clientset/versioned/scheme/register.go +++ b/sdk/client/clientset/versioned/scheme/register.go @@ -26,6 +26,7 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha1" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" ) var Scheme = runtime.NewScheme() @@ -33,6 +34,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ kubebindv1alpha1.AddToScheme, + kubebindv1alpha2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/apiresourceschema.go b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/apiresourceschema.go new file mode 100644 index 000000000..501a6a2d4 --- /dev/null +++ b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/apiresourceschema.go @@ -0,0 +1,68 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" + + v1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" + scheme "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/scheme" +) + +// APIResourceSchemasGetter has a method to return a APIResourceSchemaInterface. +// A group's client should implement this interface. +type APIResourceSchemasGetter interface { + APIResourceSchemas(namespace string) APIResourceSchemaInterface +} + +// APIResourceSchemaInterface has methods to work with APIResourceSchema resources. +type APIResourceSchemaInterface interface { + Create(ctx context.Context, aPIResourceSchema *v1alpha2.APIResourceSchema, opts v1.CreateOptions) (*v1alpha2.APIResourceSchema, error) + Update(ctx context.Context, aPIResourceSchema *v1alpha2.APIResourceSchema, opts v1.UpdateOptions) (*v1alpha2.APIResourceSchema, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha2.APIResourceSchema, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.APIResourceSchemaList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.APIResourceSchema, err error) + APIResourceSchemaExpansion +} + +// aPIResourceSchemas implements APIResourceSchemaInterface +type aPIResourceSchemas struct { + *gentype.ClientWithList[*v1alpha2.APIResourceSchema, *v1alpha2.APIResourceSchemaList] +} + +// newAPIResourceSchemas returns a APIResourceSchemas +func newAPIResourceSchemas(c *KubeBindV1alpha2Client, namespace string) *aPIResourceSchemas { + return &aPIResourceSchemas{ + gentype.NewClientWithList[*v1alpha2.APIResourceSchema, *v1alpha2.APIResourceSchemaList]( + "apiresourceschemas", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.APIResourceSchema { return &v1alpha2.APIResourceSchema{} }, + func() *v1alpha2.APIResourceSchemaList { return &v1alpha2.APIResourceSchemaList{} }), + } +} diff --git a/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/doc.go b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/doc.go new file mode 100644 index 000000000..5c1216263 --- /dev/null +++ b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha2 diff --git a/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/doc.go b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/doc.go new file mode 100644 index 000000000..a0ee34800 --- /dev/null +++ b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/fake_apiresourceschema.go b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/fake_apiresourceschema.go new file mode 100644 index 000000000..6ba06ccb8 --- /dev/null +++ b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/fake_apiresourceschema.go @@ -0,0 +1,135 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + + v1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" +) + +// FakeAPIResourceSchemas implements APIResourceSchemaInterface +type FakeAPIResourceSchemas struct { + Fake *FakeKubeBindV1alpha2 + ns string +} + +var apiresourceschemasResource = v1alpha2.SchemeGroupVersion.WithResource("apiresourceschemas") + +var apiresourceschemasKind = v1alpha2.SchemeGroupVersion.WithKind("APIResourceSchema") + +// Get takes name of the aPIResourceSchema, and returns the corresponding aPIResourceSchema object, and an error if there is any. +func (c *FakeAPIResourceSchemas) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.APIResourceSchema, err error) { + emptyResult := &v1alpha2.APIResourceSchema{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(apiresourceschemasResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.APIResourceSchema), err +} + +// List takes label and field selectors, and returns the list of APIResourceSchemas that match those selectors. +func (c *FakeAPIResourceSchemas) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.APIResourceSchemaList, err error) { + emptyResult := &v1alpha2.APIResourceSchemaList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(apiresourceschemasResource, apiresourceschemasKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.APIResourceSchemaList{ListMeta: obj.(*v1alpha2.APIResourceSchemaList).ListMeta} + for _, item := range obj.(*v1alpha2.APIResourceSchemaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested aPIResourceSchemas. +func (c *FakeAPIResourceSchemas) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(apiresourceschemasResource, c.ns, opts)) + +} + +// Create takes the representation of a aPIResourceSchema and creates it. Returns the server's representation of the aPIResourceSchema, and an error, if there is any. +func (c *FakeAPIResourceSchemas) Create(ctx context.Context, aPIResourceSchema *v1alpha2.APIResourceSchema, opts v1.CreateOptions) (result *v1alpha2.APIResourceSchema, err error) { + emptyResult := &v1alpha2.APIResourceSchema{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(apiresourceschemasResource, c.ns, aPIResourceSchema, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.APIResourceSchema), err +} + +// Update takes the representation of a aPIResourceSchema and updates it. Returns the server's representation of the aPIResourceSchema, and an error, if there is any. +func (c *FakeAPIResourceSchemas) Update(ctx context.Context, aPIResourceSchema *v1alpha2.APIResourceSchema, opts v1.UpdateOptions) (result *v1alpha2.APIResourceSchema, err error) { + emptyResult := &v1alpha2.APIResourceSchema{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(apiresourceschemasResource, c.ns, aPIResourceSchema, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.APIResourceSchema), err +} + +// Delete takes name of the aPIResourceSchema and deletes it. Returns an error if one occurs. +func (c *FakeAPIResourceSchemas) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(apiresourceschemasResource, c.ns, name, opts), &v1alpha2.APIResourceSchema{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAPIResourceSchemas) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(apiresourceschemasResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha2.APIResourceSchemaList{}) + return err +} + +// Patch applies the patch and returns the patched aPIResourceSchema. +func (c *FakeAPIResourceSchemas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.APIResourceSchema, err error) { + emptyResult := &v1alpha2.APIResourceSchema{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(apiresourceschemasResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.APIResourceSchema), err +} diff --git a/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/fake_kubebind_client.go b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/fake_kubebind_client.go new file mode 100644 index 000000000..429226072 --- /dev/null +++ b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/fake/fake_kubebind_client.go @@ -0,0 +1,41 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + + v1alpha2 "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/typed/kubebind/v1alpha2" +) + +type FakeKubeBindV1alpha2 struct { + *testing.Fake +} + +func (c *FakeKubeBindV1alpha2) APIResourceSchemas(namespace string) v1alpha2.APIResourceSchemaInterface { + return &FakeAPIResourceSchemas{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeKubeBindV1alpha2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/generated_expansion.go b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/generated_expansion.go new file mode 100644 index 000000000..4e3067937 --- /dev/null +++ b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +type APIResourceSchemaExpansion interface{} diff --git a/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/kubebind_client.go b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/kubebind_client.go new file mode 100644 index 000000000..1f77db9cc --- /dev/null +++ b/sdk/client/clientset/versioned/typed/kubebind/v1alpha2/kubebind_client.go @@ -0,0 +1,108 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + + v1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" + "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned/scheme" +) + +type KubeBindV1alpha2Interface interface { + RESTClient() rest.Interface + APIResourceSchemasGetter +} + +// KubeBindV1alpha2Client is used to interact with features provided by the kube-bind.io group. +type KubeBindV1alpha2Client struct { + restClient rest.Interface +} + +func (c *KubeBindV1alpha2Client) APIResourceSchemas(namespace string) APIResourceSchemaInterface { + return newAPIResourceSchemas(c, namespace) +} + +// NewForConfig creates a new KubeBindV1alpha2Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*KubeBindV1alpha2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new KubeBindV1alpha2Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KubeBindV1alpha2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &KubeBindV1alpha2Client{client}, nil +} + +// NewForConfigOrDie creates a new KubeBindV1alpha2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *KubeBindV1alpha2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new KubeBindV1alpha2Client for the given RESTClient. +func New(c rest.Interface) *KubeBindV1alpha2Client { + return &KubeBindV1alpha2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *KubeBindV1alpha2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/sdk/client/informers/externalversions/generic.go b/sdk/client/informers/externalversions/generic.go index 6c2da7da1..f61e26520 100644 --- a/sdk/client/informers/externalversions/generic.go +++ b/sdk/client/informers/externalversions/generic.go @@ -25,6 +25,7 @@ import ( cache "k8s.io/client-go/tools/cache" v1alpha1 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha1" + v1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" ) // GenericInformer is type of SharedIndexInformer which will locate and delegate to other @@ -65,6 +66,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("clusterbindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.KubeBind().V1alpha1().ClusterBindings().Informer()}, nil + // Group=kube-bind.io, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithResource("apiresourceschemas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.KubeBind().V1alpha2().APIResourceSchemas().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/sdk/client/informers/externalversions/kubebind/interface.go b/sdk/client/informers/externalversions/kubebind/interface.go index eb6257351..2a3f534d3 100644 --- a/sdk/client/informers/externalversions/kubebind/interface.go +++ b/sdk/client/informers/externalversions/kubebind/interface.go @@ -21,12 +21,15 @@ package kubebind import ( internalinterfaces "github.com/kube-bind/kube-bind/sdk/client/informers/externalversions/internalinterfaces" v1alpha1 "github.com/kube-bind/kube-bind/sdk/client/informers/externalversions/kubebind/v1alpha1" + v1alpha2 "github.com/kube-bind/kube-bind/sdk/client/informers/externalversions/kubebind/v1alpha2" ) // Interface provides access to each of this group's versions. type Interface interface { // V1alpha1 provides access to shared informers for resources in V1alpha1. V1alpha1() v1alpha1.Interface + // V1alpha2 provides access to shared informers for resources in V1alpha2. + V1alpha2() v1alpha2.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha1() v1alpha1.Interface { return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1alpha2 returns a new v1alpha2.Interface. +func (g *group) V1alpha2() v1alpha2.Interface { + return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/sdk/client/informers/externalversions/kubebind/v1alpha2/apiresourceschema.go b/sdk/client/informers/externalversions/kubebind/v1alpha2/apiresourceschema.go new file mode 100644 index 000000000..dd8e23ef0 --- /dev/null +++ b/sdk/client/informers/externalversions/kubebind/v1alpha2/apiresourceschema.go @@ -0,0 +1,91 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" + versioned "github.com/kube-bind/kube-bind/sdk/client/clientset/versioned" + internalinterfaces "github.com/kube-bind/kube-bind/sdk/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/kube-bind/kube-bind/sdk/client/listers/kubebind/v1alpha2" +) + +// APIResourceSchemaInformer provides access to a shared informer and lister for +// APIResourceSchemas. +type APIResourceSchemaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.APIResourceSchemaLister +} + +type aPIResourceSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewAPIResourceSchemaInformer constructs a new informer for APIResourceSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAPIResourceSchemaInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredAPIResourceSchemaInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredAPIResourceSchemaInformer constructs a new informer for APIResourceSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAPIResourceSchemaInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeBindV1alpha2().APIResourceSchemas(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeBindV1alpha2().APIResourceSchemas(namespace).Watch(context.TODO(), options) + }, + }, + &kubebindv1alpha2.APIResourceSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f *aPIResourceSchemaInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredAPIResourceSchemaInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *aPIResourceSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kubebindv1alpha2.APIResourceSchema{}, f.defaultInformer) +} + +func (f *aPIResourceSchemaInformer) Lister() v1alpha2.APIResourceSchemaLister { + return v1alpha2.NewAPIResourceSchemaLister(f.Informer().GetIndexer()) +} diff --git a/sdk/client/informers/externalversions/kubebind/v1alpha2/interface.go b/sdk/client/informers/externalversions/kubebind/v1alpha2/interface.go new file mode 100644 index 000000000..caee10c7f --- /dev/null +++ b/sdk/client/informers/externalversions/kubebind/v1alpha2/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + internalinterfaces "github.com/kube-bind/kube-bind/sdk/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // APIResourceSchemas returns a APIResourceSchemaInformer. + APIResourceSchemas() APIResourceSchemaInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// APIResourceSchemas returns a APIResourceSchemaInformer. +func (v *version) APIResourceSchemas() APIResourceSchemaInformer { + return &aPIResourceSchemaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/sdk/client/listers/kubebind/v1alpha2/apiresourceschema.go b/sdk/client/listers/kubebind/v1alpha2/apiresourceschema.go new file mode 100644 index 000000000..f3cdcdac1 --- /dev/null +++ b/sdk/client/listers/kubebind/v1alpha2/apiresourceschema.go @@ -0,0 +1,71 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" + + v1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" +) + +// APIResourceSchemaLister helps list APIResourceSchemas. +// All objects returned here must be treated as read-only. +type APIResourceSchemaLister interface { + // List lists all APIResourceSchemas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.APIResourceSchema, err error) + // APIResourceSchemas returns an object that can list and get APIResourceSchemas. + APIResourceSchemas(namespace string) APIResourceSchemaNamespaceLister + APIResourceSchemaListerExpansion +} + +// aPIResourceSchemaLister implements the APIResourceSchemaLister interface. +type aPIResourceSchemaLister struct { + listers.ResourceIndexer[*v1alpha2.APIResourceSchema] +} + +// NewAPIResourceSchemaLister returns a new APIResourceSchemaLister. +func NewAPIResourceSchemaLister(indexer cache.Indexer) APIResourceSchemaLister { + return &aPIResourceSchemaLister{listers.New[*v1alpha2.APIResourceSchema](indexer, v1alpha2.Resource("apiresourceschema"))} +} + +// APIResourceSchemas returns an object that can list and get APIResourceSchemas. +func (s *aPIResourceSchemaLister) APIResourceSchemas(namespace string) APIResourceSchemaNamespaceLister { + return aPIResourceSchemaNamespaceLister{listers.NewNamespaced[*v1alpha2.APIResourceSchema](s.ResourceIndexer, namespace)} +} + +// APIResourceSchemaNamespaceLister helps list and get APIResourceSchemas. +// All objects returned here must be treated as read-only. +type APIResourceSchemaNamespaceLister interface { + // List lists all APIResourceSchemas in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.APIResourceSchema, err error) + // Get retrieves the APIResourceSchema from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha2.APIResourceSchema, error) + APIResourceSchemaNamespaceListerExpansion +} + +// aPIResourceSchemaNamespaceLister implements the APIResourceSchemaNamespaceLister +// interface. +type aPIResourceSchemaNamespaceLister struct { + listers.ResourceIndexer[*v1alpha2.APIResourceSchema] +} diff --git a/sdk/client/listers/kubebind/v1alpha2/expansion_generated.go b/sdk/client/listers/kubebind/v1alpha2/expansion_generated.go new file mode 100644 index 000000000..f2287acf0 --- /dev/null +++ b/sdk/client/listers/kubebind/v1alpha2/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +// APIResourceSchemaListerExpansion allows custom methods to be added to +// APIResourceSchemaLister. +type APIResourceSchemaListerExpansion interface{} + +// APIResourceSchemaNamespaceListerExpansion allows custom methods to be added to +// APIResourceSchemaNamespaceLister. +type APIResourceSchemaNamespaceListerExpansion interface{} diff --git a/sdk/kcp/clientset/versioned/cluster/clientset.go b/sdk/kcp/clientset/versioned/cluster/clientset.go index 2b3e8aec6..b647bc8e2 100644 --- a/sdk/kcp/clientset/versioned/cluster/clientset.go +++ b/sdk/kcp/clientset/versioned/cluster/clientset.go @@ -34,12 +34,14 @@ import ( client "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha1" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2" ) type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface Discovery() discovery.DiscoveryInterface KubeBindV1alpha1() kubebindv1alpha1.KubeBindV1alpha1ClusterInterface + KubeBindV1alpha2() kubebindv1alpha2.KubeBindV1alpha2ClusterInterface } // ClusterClientset contains the clients for groups. @@ -47,6 +49,7 @@ type ClusterClientset struct { *discovery.DiscoveryClient clientCache kcpclient.Cache[*client.Clientset] kubebindV1alpha1 *kubebindv1alpha1.KubeBindV1alpha1ClusterClient + kubebindV1alpha2 *kubebindv1alpha2.KubeBindV1alpha2ClusterClient } // Discovery retrieves the DiscoveryClient @@ -62,6 +65,11 @@ func (c *ClusterClientset) KubeBindV1alpha1() kubebindv1alpha1.KubeBindV1alpha1C return c.kubebindV1alpha1 } +// KubeBindV1alpha2 retrieves the KubeBindV1alpha2ClusterClient. +func (c *ClusterClientset) KubeBindV1alpha2() kubebindv1alpha2.KubeBindV1alpha2ClusterInterface { + return c.kubebindV1alpha2 +} + // Cluster scopes this clientset to one cluster. func (c *ClusterClientset) Cluster(clusterPath logicalcluster.Path) client.Interface { if clusterPath == logicalcluster.Wildcard { @@ -118,6 +126,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*ClusterCli if err != nil { return nil, err } + cs.kubebindV1alpha2, err = kubebindv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { diff --git a/sdk/kcp/clientset/versioned/cluster/fake/clientset.go b/sdk/kcp/clientset/versioned/cluster/fake/clientset.go index 515b705e6..171ca39a2 100644 --- a/sdk/kcp/clientset/versioned/cluster/fake/clientset.go +++ b/sdk/kcp/clientset/versioned/cluster/fake/clientset.go @@ -33,8 +33,11 @@ import ( kcpclient "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster" kcpkubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha1" fakekubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha1/fake" + kcpkubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2" + fakekubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/fake" clientscheme "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/scheme" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/typed/kubebind/v1alpha1" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/typed/kubebind/v1alpha2" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -76,6 +79,11 @@ func (c *ClusterClientset) KubeBindV1alpha1() kcpkubebindv1alpha1.KubeBindV1alph return &fakekubebindv1alpha1.KubeBindV1alpha1ClusterClient{Fake: c.Fake} } +// KubeBindV1alpha2 retrieves the KubeBindV1alpha2ClusterClient. +func (c *ClusterClientset) KubeBindV1alpha2() kcpkubebindv1alpha2.KubeBindV1alpha2ClusterInterface { + return &fakekubebindv1alpha2.KubeBindV1alpha2ClusterClient{Fake: c.Fake} +} + // Cluster scopes this clientset to one cluster. func (c *ClusterClientset) Cluster(clusterPath logicalcluster.Path) client.Interface { if clusterPath == logicalcluster.Wildcard { @@ -112,3 +120,8 @@ func (c *Clientset) Tracker() kcptesting.ScopedObjectTracker { func (c *Clientset) KubeBindV1alpha1() kubebindv1alpha1.KubeBindV1alpha1Interface { return &fakekubebindv1alpha1.KubeBindV1alpha1Client{Fake: c.Fake, ClusterPath: c.clusterPath} } + +// KubeBindV1alpha2 retrieves the KubeBindV1alpha2Client. +func (c *Clientset) KubeBindV1alpha2() kubebindv1alpha2.KubeBindV1alpha2Interface { + return &fakekubebindv1alpha2.KubeBindV1alpha2Client{Fake: c.Fake, ClusterPath: c.clusterPath} +} diff --git a/sdk/kcp/clientset/versioned/cluster/scheme/register.go b/sdk/kcp/clientset/versioned/cluster/scheme/register.go index 245fefb54..2b46e2bb8 100644 --- a/sdk/kcp/clientset/versioned/cluster/scheme/register.go +++ b/sdk/kcp/clientset/versioned/cluster/scheme/register.go @@ -29,6 +29,7 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha1" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" ) var Scheme = runtime.NewScheme() @@ -36,6 +37,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ kubebindv1alpha1.AddToScheme, + kubebindv1alpha2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/apiresourceschema.go b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/apiresourceschema.go new file mode 100644 index 000000000..3672294f8 --- /dev/null +++ b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/apiresourceschema.go @@ -0,0 +1,86 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" + + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" + kubebindv1alpha2client "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/typed/kubebind/v1alpha2" +) + +// APIResourceSchemasClusterGetter has a method to return a APIResourceSchemaClusterInterface. +// A group's cluster client should implement this interface. +type APIResourceSchemasClusterGetter interface { + APIResourceSchemas() APIResourceSchemaClusterInterface +} + +// APIResourceSchemaClusterInterface can operate on APIResourceSchemas across all clusters, +// or scope down to one cluster and return a APIResourceSchemasNamespacer. +type APIResourceSchemaClusterInterface interface { + Cluster(logicalcluster.Path) APIResourceSchemasNamespacer + List(ctx context.Context, opts metav1.ListOptions) (*kubebindv1alpha2.APIResourceSchemaList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) +} + +type aPIResourceSchemasClusterInterface struct { + clientCache kcpclient.Cache[*kubebindv1alpha2client.KubeBindV1alpha2Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *aPIResourceSchemasClusterInterface) Cluster(clusterPath logicalcluster.Path) APIResourceSchemasNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &aPIResourceSchemasNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} +} + +// List returns the entire collection of all APIResourceSchemas across all clusters. +func (c *aPIResourceSchemasClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*kubebindv1alpha2.APIResourceSchemaList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).APIResourceSchemas(metav1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all APIResourceSchemas across all clusters. +func (c *aPIResourceSchemasClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).APIResourceSchemas(metav1.NamespaceAll).Watch(ctx, opts) +} + +// APIResourceSchemasNamespacer can scope to objects within a namespace, returning a kubebindv1alpha2client.APIResourceSchemaInterface. +type APIResourceSchemasNamespacer interface { + Namespace(string) kubebindv1alpha2client.APIResourceSchemaInterface +} + +type aPIResourceSchemasNamespacer struct { + clientCache kcpclient.Cache[*kubebindv1alpha2client.KubeBindV1alpha2Client] + clusterPath logicalcluster.Path +} + +func (n *aPIResourceSchemasNamespacer) Namespace(namespace string) kubebindv1alpha2client.APIResourceSchemaInterface { + return n.clientCache.ClusterOrDie(n.clusterPath).APIResourceSchemas(namespace) +} diff --git a/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/fake/apiresourceschema.go b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/fake/apiresourceschema.go new file mode 100644 index 000000000..7bc22b869 --- /dev/null +++ b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/fake/apiresourceschema.go @@ -0,0 +1,213 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package fake + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/kcp-dev/logicalcluster/v3" + + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/testing" + + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" + applyconfigurationskubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/applyconfiguration/kubebind/v1alpha2" + kcpkubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2" + kubebindv1alpha2client "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/typed/kubebind/v1alpha2" +) + +var aPIResourceSchemasResource = schema.GroupVersionResource{Group: "kube-bind.io", Version: "v1alpha2", Resource: "apiresourceschemas"} +var aPIResourceSchemasKind = schema.GroupVersionKind{Group: "kube-bind.io", Version: "v1alpha2", Kind: "APIResourceSchema"} + +type aPIResourceSchemasClusterClient struct { + *kcptesting.Fake +} + +// Cluster scopes the client down to a particular cluster. +func (c *aPIResourceSchemasClusterClient) Cluster(clusterPath logicalcluster.Path) kcpkubebindv1alpha2.APIResourceSchemasNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &aPIResourceSchemasNamespacer{Fake: c.Fake, ClusterPath: clusterPath} +} + +// List takes label and field selectors, and returns the list of APIResourceSchemas that match those selectors across all clusters. +func (c *aPIResourceSchemasClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*kubebindv1alpha2.APIResourceSchemaList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewListAction(aPIResourceSchemasResource, aPIResourceSchemasKind, logicalcluster.Wildcard, metav1.NamespaceAll, opts), &kubebindv1alpha2.APIResourceSchemaList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &kubebindv1alpha2.APIResourceSchemaList{ListMeta: obj.(*kubebindv1alpha2.APIResourceSchemaList).ListMeta} + for _, item := range obj.(*kubebindv1alpha2.APIResourceSchemaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested APIResourceSchemas across all clusters. +func (c *aPIResourceSchemasClusterClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(kcptesting.NewWatchAction(aPIResourceSchemasResource, logicalcluster.Wildcard, metav1.NamespaceAll, opts)) +} + +type aPIResourceSchemasNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *aPIResourceSchemasNamespacer) Namespace(namespace string) kubebindv1alpha2client.APIResourceSchemaInterface { + return &aPIResourceSchemasClient{Fake: n.Fake, ClusterPath: n.ClusterPath, Namespace: namespace} +} + +type aPIResourceSchemasClient struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path + Namespace string +} + +func (c *aPIResourceSchemasClient) Create(ctx context.Context, aPIResourceSchema *kubebindv1alpha2.APIResourceSchema, opts metav1.CreateOptions) (*kubebindv1alpha2.APIResourceSchema, error) { + obj, err := c.Fake.Invokes(kcptesting.NewCreateAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, aPIResourceSchema), &kubebindv1alpha2.APIResourceSchema{}) + if obj == nil { + return nil, err + } + return obj.(*kubebindv1alpha2.APIResourceSchema), err +} + +func (c *aPIResourceSchemasClient) Update(ctx context.Context, aPIResourceSchema *kubebindv1alpha2.APIResourceSchema, opts metav1.UpdateOptions) (*kubebindv1alpha2.APIResourceSchema, error) { + obj, err := c.Fake.Invokes(kcptesting.NewUpdateAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, aPIResourceSchema), &kubebindv1alpha2.APIResourceSchema{}) + if obj == nil { + return nil, err + } + return obj.(*kubebindv1alpha2.APIResourceSchema), err +} + +func (c *aPIResourceSchemasClient) UpdateStatus(ctx context.Context, aPIResourceSchema *kubebindv1alpha2.APIResourceSchema, opts metav1.UpdateOptions) (*kubebindv1alpha2.APIResourceSchema, error) { + obj, err := c.Fake.Invokes(kcptesting.NewUpdateSubresourceAction(aPIResourceSchemasResource, c.ClusterPath, "status", c.Namespace, aPIResourceSchema), &kubebindv1alpha2.APIResourceSchema{}) + if obj == nil { + return nil, err + } + return obj.(*kubebindv1alpha2.APIResourceSchema), err +} + +func (c *aPIResourceSchemasClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake.Invokes(kcptesting.NewDeleteActionWithOptions(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, name, opts), &kubebindv1alpha2.APIResourceSchema{}) + return err +} + +func (c *aPIResourceSchemasClient) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := kcptesting.NewDeleteCollectionAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, listOpts) + + _, err := c.Fake.Invokes(action, &kubebindv1alpha2.APIResourceSchemaList{}) + return err +} + +func (c *aPIResourceSchemasClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*kubebindv1alpha2.APIResourceSchema, error) { + obj, err := c.Fake.Invokes(kcptesting.NewGetAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, name), &kubebindv1alpha2.APIResourceSchema{}) + if obj == nil { + return nil, err + } + return obj.(*kubebindv1alpha2.APIResourceSchema), err +} + +// List takes label and field selectors, and returns the list of APIResourceSchemas that match those selectors. +func (c *aPIResourceSchemasClient) List(ctx context.Context, opts metav1.ListOptions) (*kubebindv1alpha2.APIResourceSchemaList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewListAction(aPIResourceSchemasResource, aPIResourceSchemasKind, c.ClusterPath, c.Namespace, opts), &kubebindv1alpha2.APIResourceSchemaList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &kubebindv1alpha2.APIResourceSchemaList{ListMeta: obj.(*kubebindv1alpha2.APIResourceSchemaList).ListMeta} + for _, item := range obj.(*kubebindv1alpha2.APIResourceSchemaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +func (c *aPIResourceSchemasClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(kcptesting.NewWatchAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, opts)) +} + +func (c *aPIResourceSchemasClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*kubebindv1alpha2.APIResourceSchema, error) { + obj, err := c.Fake.Invokes(kcptesting.NewPatchSubresourceAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, name, pt, data, subresources...), &kubebindv1alpha2.APIResourceSchema{}) + if obj == nil { + return nil, err + } + return obj.(*kubebindv1alpha2.APIResourceSchema), err +} + +func (c *aPIResourceSchemasClient) Apply(ctx context.Context, applyConfiguration *applyconfigurationskubebindv1alpha2.APIResourceSchemaApplyConfiguration, opts metav1.ApplyOptions) (*kubebindv1alpha2.APIResourceSchema, error) { + if applyConfiguration == nil { + return nil, fmt.Errorf("applyConfiguration provided to Apply must not be nil") + } + data, err := json.Marshal(applyConfiguration) + if err != nil { + return nil, err + } + name := applyConfiguration.Name + if name == nil { + return nil, fmt.Errorf("applyConfiguration.Name must be provided to Apply") + } + obj, err := c.Fake.Invokes(kcptesting.NewPatchSubresourceAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, *name, types.ApplyPatchType, data), &kubebindv1alpha2.APIResourceSchema{}) + if obj == nil { + return nil, err + } + return obj.(*kubebindv1alpha2.APIResourceSchema), err +} + +func (c *aPIResourceSchemasClient) ApplyStatus(ctx context.Context, applyConfiguration *applyconfigurationskubebindv1alpha2.APIResourceSchemaApplyConfiguration, opts metav1.ApplyOptions) (*kubebindv1alpha2.APIResourceSchema, error) { + if applyConfiguration == nil { + return nil, fmt.Errorf("applyConfiguration provided to Apply must not be nil") + } + data, err := json.Marshal(applyConfiguration) + if err != nil { + return nil, err + } + name := applyConfiguration.Name + if name == nil { + return nil, fmt.Errorf("applyConfiguration.Name must be provided to Apply") + } + obj, err := c.Fake.Invokes(kcptesting.NewPatchSubresourceAction(aPIResourceSchemasResource, c.ClusterPath, c.Namespace, *name, types.ApplyPatchType, data, "status"), &kubebindv1alpha2.APIResourceSchema{}) + if obj == nil { + return nil, err + } + return obj.(*kubebindv1alpha2.APIResourceSchema), err +} diff --git a/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/fake/kubebind_client.go b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/fake/kubebind_client.go new file mode 100644 index 000000000..3131126b7 --- /dev/null +++ b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/fake/kubebind_client.go @@ -0,0 +1,65 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package fake + +import ( + "github.com/kcp-dev/logicalcluster/v3" + + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "k8s.io/client-go/rest" + + kcpkubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/typed/kubebind/v1alpha2" +) + +var _ kcpkubebindv1alpha2.KubeBindV1alpha2ClusterInterface = (*KubeBindV1alpha2ClusterClient)(nil) + +type KubeBindV1alpha2ClusterClient struct { + *kcptesting.Fake +} + +func (c *KubeBindV1alpha2ClusterClient) Cluster(clusterPath logicalcluster.Path) kubebindv1alpha2.KubeBindV1alpha2Interface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + return &KubeBindV1alpha2Client{Fake: c.Fake, ClusterPath: clusterPath} +} + +func (c *KubeBindV1alpha2ClusterClient) APIResourceSchemas() kcpkubebindv1alpha2.APIResourceSchemaClusterInterface { + return &aPIResourceSchemasClusterClient{Fake: c.Fake} +} + +var _ kubebindv1alpha2.KubeBindV1alpha2Interface = (*KubeBindV1alpha2Client)(nil) + +type KubeBindV1alpha2Client struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (c *KubeBindV1alpha2Client) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} + +func (c *KubeBindV1alpha2Client) APIResourceSchemas(namespace string) kubebindv1alpha2.APIResourceSchemaInterface { + return &aPIResourceSchemasClient{Fake: c.Fake, ClusterPath: c.ClusterPath, Namespace: namespace} +} diff --git a/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/kubebind_client.go b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/kubebind_client.go new file mode 100644 index 000000000..82300fa55 --- /dev/null +++ b/sdk/kcp/clientset/versioned/cluster/typed/kubebind/v1alpha2/kubebind_client.go @@ -0,0 +1,90 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha2 + +import ( + "net/http" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" + + "k8s.io/client-go/rest" + + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/typed/kubebind/v1alpha2" +) + +type KubeBindV1alpha2ClusterInterface interface { + KubeBindV1alpha2ClusterScoper + APIResourceSchemasClusterGetter +} + +type KubeBindV1alpha2ClusterScoper interface { + Cluster(logicalcluster.Path) kubebindv1alpha2.KubeBindV1alpha2Interface +} + +type KubeBindV1alpha2ClusterClient struct { + clientCache kcpclient.Cache[*kubebindv1alpha2.KubeBindV1alpha2Client] +} + +func (c *KubeBindV1alpha2ClusterClient) Cluster(clusterPath logicalcluster.Path) kubebindv1alpha2.KubeBindV1alpha2Interface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + return c.clientCache.ClusterOrDie(clusterPath) +} + +func (c *KubeBindV1alpha2ClusterClient) APIResourceSchemas() APIResourceSchemaClusterInterface { + return &aPIResourceSchemasClusterInterface{clientCache: c.clientCache} +} + +// NewForConfig creates a new KubeBindV1alpha2ClusterClient for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*KubeBindV1alpha2ClusterClient, error) { + client, err := rest.HTTPClientFor(c) + if err != nil { + return nil, err + } + return NewForConfigAndClient(c, client) +} + +// NewForConfigAndClient creates a new KubeBindV1alpha2ClusterClient for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KubeBindV1alpha2ClusterClient, error) { + cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*kubebindv1alpha2.KubeBindV1alpha2Client]{ + NewForConfigAndClient: kubebindv1alpha2.NewForConfigAndClient, + }) + if _, err := cache.Cluster(logicalcluster.Name("root").Path()); err != nil { + return nil, err + } + return &KubeBindV1alpha2ClusterClient{clientCache: cache}, nil +} + +// NewForConfigOrDie creates a new KubeBindV1alpha2ClusterClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *KubeBindV1alpha2ClusterClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} diff --git a/sdk/kcp/informers/externalversions/generic.go b/sdk/kcp/informers/externalversions/generic.go index 80ffdd5c6..2c960fdce 100644 --- a/sdk/kcp/informers/externalversions/generic.go +++ b/sdk/kcp/informers/externalversions/generic.go @@ -31,6 +31,7 @@ import ( "k8s.io/client-go/tools/cache" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha1" + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" ) type GenericClusterInformer interface { @@ -97,6 +98,9 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericClusterInformer{resource: resource.GroupResource(), informer: f.KubeBind().V1alpha1().APIServiceNamespaces().Informer()}, nil case kubebindv1alpha1.SchemeGroupVersion.WithResource("clusterbindings"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.KubeBind().V1alpha1().ClusterBindings().Informer()}, nil + // Group=kube-bind.io, Version=V1alpha2 + case kubebindv1alpha2.SchemeGroupVersion.WithResource("apiresourceschemas"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.KubeBind().V1alpha2().APIResourceSchemas().Informer()}, nil } return nil, fmt.Errorf("no informer found for %v", resource) @@ -122,6 +126,10 @@ func (f *sharedScopedInformerFactory) ForResource(resource schema.GroupVersionRe case kubebindv1alpha1.SchemeGroupVersion.WithResource("clusterbindings"): informer := f.KubeBind().V1alpha1().ClusterBindings().Informer() return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil + // Group=kube-bind.io, Version=V1alpha2 + case kubebindv1alpha2.SchemeGroupVersion.WithResource("apiresourceschemas"): + informer := f.KubeBind().V1alpha2().APIResourceSchemas().Informer() + return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/sdk/kcp/informers/externalversions/kubebind/interface.go b/sdk/kcp/informers/externalversions/kubebind/interface.go index 7f42e6ea7..ce45aed66 100644 --- a/sdk/kcp/informers/externalversions/kubebind/interface.go +++ b/sdk/kcp/informers/externalversions/kubebind/interface.go @@ -24,11 +24,14 @@ package kubebind import ( "github.com/kube-bind/kube-bind/sdk/kcp/informers/externalversions/internalinterfaces" "github.com/kube-bind/kube-bind/sdk/kcp/informers/externalversions/kubebind/v1alpha1" + "github.com/kube-bind/kube-bind/sdk/kcp/informers/externalversions/kubebind/v1alpha2" ) type ClusterInterface interface { // V1alpha1 provides access to the shared informers in V1alpha1. V1alpha1() v1alpha1.ClusterInterface + // V1alpha2 provides access to the shared informers in V1alpha2. + V1alpha2() v1alpha2.ClusterInterface } type group struct { @@ -46,9 +49,16 @@ func (g *group) V1alpha1() v1alpha1.ClusterInterface { return v1alpha1.New(g.factory, g.tweakListOptions) } +// V1alpha2 returns a new v1alpha2.ClusterInterface. +func (g *group) V1alpha2() v1alpha2.ClusterInterface { + return v1alpha2.New(g.factory, g.tweakListOptions) +} + type Interface interface { // V1alpha1 provides access to the shared informers in V1alpha1. V1alpha1() v1alpha1.Interface + // V1alpha2 provides access to the shared informers in V1alpha2. + V1alpha2() v1alpha2.Interface } type scopedGroup struct { @@ -66,3 +76,8 @@ func NewScoped(f internalinterfaces.SharedScopedInformerFactory, namespace strin func (g *scopedGroup) V1alpha1() v1alpha1.Interface { return v1alpha1.NewScoped(g.factory, g.namespace, g.tweakListOptions) } + +// V1alpha2 returns a new v1alpha2.ClusterInterface. +func (g *scopedGroup) V1alpha2() v1alpha2.Interface { + return v1alpha2.NewScoped(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/sdk/kcp/informers/externalversions/kubebind/v1alpha2/apiresourceschema.go b/sdk/kcp/informers/externalversions/kubebind/v1alpha2/apiresourceschema.go new file mode 100644 index 000000000..a01baaf3b --- /dev/null +++ b/sdk/kcp/informers/externalversions/kubebind/v1alpha2/apiresourceschema.go @@ -0,0 +1,182 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + "time" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + "github.com/kcp-dev/logicalcluster/v3" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" + + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" + scopedclientset "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned" + clientset "github.com/kube-bind/kube-bind/sdk/kcp/clientset/versioned/cluster" + "github.com/kube-bind/kube-bind/sdk/kcp/informers/externalversions/internalinterfaces" + kubebindv1alpha2listers "github.com/kube-bind/kube-bind/sdk/kcp/listers/kubebind/v1alpha2" +) + +// APIResourceSchemaClusterInformer provides access to a shared informer and lister for +// APIResourceSchemas. +type APIResourceSchemaClusterInformer interface { + Cluster(logicalcluster.Name) APIResourceSchemaInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kubebindv1alpha2listers.APIResourceSchemaClusterLister +} + +type aPIResourceSchemaClusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewAPIResourceSchemaClusterInformer constructs a new informer for APIResourceSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAPIResourceSchemaClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredAPIResourceSchemaClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredAPIResourceSchemaClusterInformer constructs a new informer for APIResourceSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAPIResourceSchemaClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeBindV1alpha2().APIResourceSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeBindV1alpha2().APIResourceSchemas().Watch(context.TODO(), options) + }, + }, + &kubebindv1alpha2.APIResourceSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f *aPIResourceSchemaClusterInformer) defaultInformer(client clientset.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredAPIResourceSchemaClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f *aPIResourceSchemaClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return f.factory.InformerFor(&kubebindv1alpha2.APIResourceSchema{}, f.defaultInformer) +} + +func (f *aPIResourceSchemaClusterInformer) Lister() kubebindv1alpha2listers.APIResourceSchemaClusterLister { + return kubebindv1alpha2listers.NewAPIResourceSchemaClusterLister(f.Informer().GetIndexer()) +} + +// APIResourceSchemaInformer provides access to a shared informer and lister for +// APIResourceSchemas. +type APIResourceSchemaInformer interface { + Informer() cache.SharedIndexInformer + Lister() kubebindv1alpha2listers.APIResourceSchemaLister +} + +func (f *aPIResourceSchemaClusterInformer) Cluster(clusterName logicalcluster.Name) APIResourceSchemaInformer { + return &aPIResourceSchemaInformer{ + informer: f.Informer().Cluster(clusterName), + lister: f.Lister().Cluster(clusterName), + } +} + +type aPIResourceSchemaInformer struct { + informer cache.SharedIndexInformer + lister kubebindv1alpha2listers.APIResourceSchemaLister +} + +func (f *aPIResourceSchemaInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +func (f *aPIResourceSchemaInformer) Lister() kubebindv1alpha2listers.APIResourceSchemaLister { + return f.lister +} + +type aPIResourceSchemaScopedInformer struct { + factory internalinterfaces.SharedScopedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +func (f *aPIResourceSchemaScopedInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kubebindv1alpha2.APIResourceSchema{}, f.defaultInformer) +} + +func (f *aPIResourceSchemaScopedInformer) Lister() kubebindv1alpha2listers.APIResourceSchemaLister { + return kubebindv1alpha2listers.NewAPIResourceSchemaLister(f.Informer().GetIndexer()) +} + +// NewAPIResourceSchemaInformer constructs a new informer for APIResourceSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAPIResourceSchemaInformer(client scopedclientset.Interface, resyncPeriod time.Duration, namespace string, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredAPIResourceSchemaInformer(client, resyncPeriod, namespace, indexers, nil) +} + +// NewFilteredAPIResourceSchemaInformer constructs a new informer for APIResourceSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAPIResourceSchemaInformer(client scopedclientset.Interface, resyncPeriod time.Duration, namespace string, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeBindV1alpha2().APIResourceSchemas(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeBindV1alpha2().APIResourceSchemas(namespace).Watch(context.TODO(), options) + }, + }, + &kubebindv1alpha2.APIResourceSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f *aPIResourceSchemaScopedInformer) defaultInformer(client scopedclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredAPIResourceSchemaInformer(client, resyncPeriod, f.namespace, cache.Indexers{ + cache.NamespaceIndex: cache.MetaNamespaceIndexFunc, + }, f.tweakListOptions) +} diff --git a/sdk/kcp/informers/externalversions/kubebind/v1alpha2/interface.go b/sdk/kcp/informers/externalversions/kubebind/v1alpha2/interface.go new file mode 100644 index 000000000..b48ba3bb2 --- /dev/null +++ b/sdk/kcp/informers/externalversions/kubebind/v1alpha2/interface.go @@ -0,0 +1,67 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha2 + +import ( + "github.com/kube-bind/kube-bind/sdk/kcp/informers/externalversions/internalinterfaces" +) + +type ClusterInterface interface { + // APIResourceSchemas returns a APIResourceSchemaClusterInformer + APIResourceSchemas() APIResourceSchemaClusterInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new ClusterInterface. +func New(f internalinterfaces.SharedInformerFactory, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterInterface { + return &version{factory: f, tweakListOptions: tweakListOptions} +} + +// APIResourceSchemas returns a APIResourceSchemaClusterInformer +func (v *version) APIResourceSchemas() APIResourceSchemaClusterInformer { + return &aPIResourceSchemaClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +type Interface interface { + // APIResourceSchemas returns a APIResourceSchemaInformer + APIResourceSchemas() APIResourceSchemaInformer +} + +type scopedVersion struct { + factory internalinterfaces.SharedScopedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// New returns a new ClusterInterface. +func NewScoped(f internalinterfaces.SharedScopedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &scopedVersion{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// APIResourceSchemas returns a APIResourceSchemaInformer +func (v *scopedVersion) APIResourceSchemas() APIResourceSchemaInformer { + return &aPIResourceSchemaScopedInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/sdk/kcp/listers/kubebind/v1alpha2/apiconversion_expansion.go b/sdk/kcp/listers/kubebind/v1alpha2/apiconversion_expansion.go new file mode 100644 index 000000000..9ab53f362 --- /dev/null +++ b/sdk/kcp/listers/kubebind/v1alpha2/apiconversion_expansion.go @@ -0,0 +1,28 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha2 + +// APIConversionClusterListerExpansion allows custom methods to be added to APIConversionClusterLister. +type APIConversionClusterListerExpansion interface{} + +// APIConversionListerExpansion allows custom methods to be added to APIConversionLister. +type APIConversionListerExpansion interface{} diff --git a/sdk/kcp/listers/kubebind/v1alpha2/apiresourceschema.go b/sdk/kcp/listers/kubebind/v1alpha2/apiresourceschema.go new file mode 100644 index 000000000..5498fd446 --- /dev/null +++ b/sdk/kcp/listers/kubebind/v1alpha2/apiresourceschema.go @@ -0,0 +1,196 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha2 + +import ( + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + "github.com/kcp-dev/logicalcluster/v3" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + + kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" +) + +// APIResourceSchemaClusterLister can list APIResourceSchemas across all workspaces, or scope down to a APIResourceSchemaLister for one workspace. +// All objects returned here must be treated as read-only. +type APIResourceSchemaClusterLister interface { + // List lists all APIResourceSchemas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) + // Cluster returns a lister that can list and get APIResourceSchemas in one workspace. + Cluster(clusterName logicalcluster.Name) APIResourceSchemaLister + APIResourceSchemaClusterListerExpansion +} + +type aPIResourceSchemaClusterLister struct { + indexer cache.Indexer +} + +// NewAPIResourceSchemaClusterLister returns a new APIResourceSchemaClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewAPIResourceSchemaClusterLister(indexer cache.Indexer) *aPIResourceSchemaClusterLister { + return &aPIResourceSchemaClusterLister{indexer: indexer} +} + +// List lists all APIResourceSchemas in the indexer across all workspaces. +func (s *aPIResourceSchemaClusterLister) List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*kubebindv1alpha2.APIResourceSchema)) + }) + return ret, err +} + +// Cluster scopes the lister to one workspace, allowing users to list and get APIResourceSchemas. +func (s *aPIResourceSchemaClusterLister) Cluster(clusterName logicalcluster.Name) APIResourceSchemaLister { + return &aPIResourceSchemaLister{indexer: s.indexer, clusterName: clusterName} +} + +// APIResourceSchemaLister can list APIResourceSchemas across all namespaces, or scope down to a APIResourceSchemaNamespaceLister for one namespace. +// All objects returned here must be treated as read-only. +type APIResourceSchemaLister interface { + // List lists all APIResourceSchemas in the workspace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) + // APIResourceSchemas returns a lister that can list and get APIResourceSchemas in one workspace and namespace. + APIResourceSchemas(namespace string) APIResourceSchemaNamespaceLister + APIResourceSchemaListerExpansion +} + +// aPIResourceSchemaLister can list all APIResourceSchemas inside a workspace or scope down to a APIResourceSchemaLister for one namespace. +type aPIResourceSchemaLister struct { + indexer cache.Indexer + clusterName logicalcluster.Name +} + +// List lists all APIResourceSchemas in the indexer for a workspace. +func (s *aPIResourceSchemaLister) List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) { + err = kcpcache.ListAllByCluster(s.indexer, s.clusterName, selector, func(i interface{}) { + ret = append(ret, i.(*kubebindv1alpha2.APIResourceSchema)) + }) + return ret, err +} + +// APIResourceSchemas returns an object that can list and get APIResourceSchemas in one namespace. +func (s *aPIResourceSchemaLister) APIResourceSchemas(namespace string) APIResourceSchemaNamespaceLister { + return &aPIResourceSchemaNamespaceLister{indexer: s.indexer, clusterName: s.clusterName, namespace: namespace} +} + +// aPIResourceSchemaNamespaceLister helps list and get APIResourceSchemas. +// All objects returned here must be treated as read-only. +type APIResourceSchemaNamespaceLister interface { + // List lists all APIResourceSchemas in the workspace and namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) + // Get retrieves the APIResourceSchema from the indexer for a given workspace, namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*kubebindv1alpha2.APIResourceSchema, error) + APIResourceSchemaNamespaceListerExpansion +} + +// aPIResourceSchemaNamespaceLister helps list and get APIResourceSchemas. +// All objects returned here must be treated as read-only. +type aPIResourceSchemaNamespaceLister struct { + indexer cache.Indexer + clusterName logicalcluster.Name + namespace string +} + +// List lists all APIResourceSchemas in the indexer for a given workspace and namespace. +func (s *aPIResourceSchemaNamespaceLister) List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) { + err = kcpcache.ListAllByClusterAndNamespace(s.indexer, s.clusterName, s.namespace, selector, func(i interface{}) { + ret = append(ret, i.(*kubebindv1alpha2.APIResourceSchema)) + }) + return ret, err +} + +// Get retrieves the APIResourceSchema from the indexer for a given workspace, namespace and name. +func (s *aPIResourceSchemaNamespaceLister) Get(name string) (*kubebindv1alpha2.APIResourceSchema, error) { + key := kcpcache.ToClusterAwareKey(s.clusterName.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(kubebindv1alpha2.Resource("apiresourceschemas"), name) + } + return obj.(*kubebindv1alpha2.APIResourceSchema), nil +} + +// NewAPIResourceSchemaLister returns a new APIResourceSchemaLister. +// We assume that the indexer: +// - is fed by a workspace-scoped LIST+WATCH +// - uses cache.MetaNamespaceKeyFunc as the key function +// - has the cache.NamespaceIndex as an index +func NewAPIResourceSchemaLister(indexer cache.Indexer) *aPIResourceSchemaScopedLister { + return &aPIResourceSchemaScopedLister{indexer: indexer} +} + +// aPIResourceSchemaScopedLister can list all APIResourceSchemas inside a workspace or scope down to a APIResourceSchemaLister for one namespace. +type aPIResourceSchemaScopedLister struct { + indexer cache.Indexer +} + +// List lists all APIResourceSchemas in the indexer for a workspace. +func (s *aPIResourceSchemaScopedLister) List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(i interface{}) { + ret = append(ret, i.(*kubebindv1alpha2.APIResourceSchema)) + }) + return ret, err +} + +// APIResourceSchemas returns an object that can list and get APIResourceSchemas in one namespace. +func (s *aPIResourceSchemaScopedLister) APIResourceSchemas(namespace string) APIResourceSchemaNamespaceLister { + return &aPIResourceSchemaScopedNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// aPIResourceSchemaScopedNamespaceLister helps list and get APIResourceSchemas. +type aPIResourceSchemaScopedNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all APIResourceSchemas in the indexer for a given workspace and namespace. +func (s *aPIResourceSchemaScopedNamespaceLister) List(selector labels.Selector) (ret []*kubebindv1alpha2.APIResourceSchema, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(i interface{}) { + ret = append(ret, i.(*kubebindv1alpha2.APIResourceSchema)) + }) + return ret, err +} + +// Get retrieves the APIResourceSchema from the indexer for a given workspace, namespace and name. +func (s *aPIResourceSchemaScopedNamespaceLister) Get(name string) (*kubebindv1alpha2.APIResourceSchema, error) { + key := s.namespace + "/" + name + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(kubebindv1alpha2.Resource("apiresourceschemas"), name) + } + return obj.(*kubebindv1alpha2.APIResourceSchema), nil +} diff --git a/sdk/kcp/listers/kubebind/v1alpha2/apiresourceschema_expansion.go b/sdk/kcp/listers/kubebind/v1alpha2/apiresourceschema_expansion.go new file mode 100644 index 000000000..f656c23de --- /dev/null +++ b/sdk/kcp/listers/kubebind/v1alpha2/apiresourceschema_expansion.go @@ -0,0 +1,31 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1alpha2 + +// APIResourceSchemaClusterListerExpansion allows custom methods to be added to APIResourceSchemaClusterLister. +type APIResourceSchemaClusterListerExpansion interface{} + +// APIResourceSchemaListerExpansion allows custom methods to be added to APIResourceSchemaLister. +type APIResourceSchemaListerExpansion interface{} + +// APIResourceSchemaNamespaceListerExpansion allows custom methods to be added to APIResourceSchemaNamespaceLister. +type APIResourceSchemaNamespaceListerExpansion interface{}