diff --git a/cmd/cluster-controller/main.go b/cmd/cluster-controller/main.go deleted file mode 100644 index 73ca6e95bf5..00000000000 --- a/cmd/cluster-controller/main.go +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 ( - "errors" - "fmt" - "os" - "time" - - "github.com/spf13/pflag" - - kcpapiextensionsclientset "k8s.io/apiextensions-apiserver/pkg/client/kcp/clientset/versioned" - kcpapiextensionsinformers "k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/externalversions" - genericapiserver "k8s.io/apiserver/pkg/server" - "k8s.io/client-go/tools/clientcmd" - - "github.com/kcp-dev/kcp/pkg/reconciler/apis/apiresource" - apiresourceoptions "github.com/kcp-dev/kcp/pkg/reconciler/apis/apiresource/options" - kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster" - kcpinformers "github.com/kcp-dev/kcp/sdk/client/informers/externalversions" -) - -const resyncPeriod = 10 * time.Hour - -func NewOptions() *options { - o := options{ - ApiResourceOptions: apiresourceoptions.NewOptions(), - } - return &o -} - -type options struct { - // in the all-in-one startup, client credentials already exist; in this - // standalone startup, we need to load credentials ourselves - kubeconfigPath string - - ApiResourceOptions *apiresourceoptions.Options -} - -func (o *options) AddFlags(fs *pflag.FlagSet) { - o.ApiResourceOptions.AddFlags(fs) - - fs.StringVar(&o.kubeconfigPath, "kubeconfig", "", "Path to kubeconfig") -} - -func (o *options) Validate() error { - if o.kubeconfigPath == "" { - return errors.New("--kubeconfig is required") - } - return o.ApiResourceOptions.Validate() -} - -func main() { - // Setup signal handler for a cleaner shutdown - ctx := genericapiserver.SetupSignalContext() - - fs := pflag.NewFlagSet("cluster-controller", pflag.ContinueOnError) - o := NewOptions() - o.AddFlags(fs) - if err := fs.Parse(os.Args[1:]); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } - if err := o.Validate(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } - - configLoader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig( - &clientcmd.ClientConfigLoadingRules{ExplicitPath: o.kubeconfigPath}, - &clientcmd.ConfigOverrides{}) - - config, err := configLoader.ClientConfig() - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } - - crdClusterClient, err := kcpapiextensionsclientset.NewForConfig(config) - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } - kcpClusterClient, err := kcpclientset.NewForConfig(config) - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } - - kcpSharedInformerFactory := kcpinformers.NewSharedInformerFactoryWithOptions(kcpClusterClient, resyncPeriod) - crdSharedInformerFactory := kcpapiextensionsinformers.NewSharedInformerFactoryWithOptions(crdClusterClient, resyncPeriod) - - apiResource, err := apiresource.NewController( - crdClusterClient, - kcpClusterClient, - kcpSharedInformerFactory.Apiresource().V1alpha1().NegotiatedAPIResources(), - kcpSharedInformerFactory.Apiresource().V1alpha1().APIResourceImports(), - crdSharedInformerFactory.Apiextensions().V1().CustomResourceDefinitions(), - ) - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } - - kcpSharedInformerFactory.Start(ctx.Done()) - crdSharedInformerFactory.Start(ctx.Done()) - - kcpSharedInformerFactory.WaitForCacheSync(ctx.Done()) - crdSharedInformerFactory.WaitForCacheSync(ctx.Done()) - - go apiResource.Start(ctx, o.ApiResourceOptions.NumThreads) - - <-ctx.Done() -} diff --git a/config/crds/apiresource.kcp.io_apiresourceimports.yaml b/config/crds/apiresource.kcp.io_apiresourceimports.yaml deleted file mode 100644 index 1ca31a2492c..00000000000 --- a/config/crds/apiresource.kcp.io_apiresourceimports.yaml +++ /dev/null @@ -1,225 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.10.0 - creationTimestamp: null - name: apiresourceimports.apiresource.kcp.io -spec: - group: apiresource.kcp.io - names: - categories: - - kcp - kind: APIResourceImport - listKind: APIResourceImportList - plural: apiresourceimports - singular: apiresourceimport - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .spec.location - name: Location - priority: 1 - type: string - - jsonPath: .spec.schemaUpdateStrategy - name: Schema update strategy - priority: 2 - type: string - - jsonPath: .metadata.annotations.apiresource\.kcp\.dev/apiVersion - name: API Version - priority: 3 - type: string - - jsonPath: .spec.plural - name: API Resource - priority: 4 - type: string - - jsonPath: .status.conditions[?(@.type=="Compatible")].status - name: Compatible - priority: 5 - type: string - - jsonPath: .status.conditions[?(@.type=="Available")].status - name: Available - priority: 6 - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - description: APIResourceImport describes an API resource imported from external - clusters (either physical or logical) for a given GVR. - 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: APIResourceImportSpec holds the desired state of the APIResourceImport - (from the client). - 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 - columnDefinitions: - items: - properties: - description: - description: description is a human readable description of - this column. - type: string - format: - description: format is an optional OpenAPI type modifier for - this column. A format modifies the type and imposes additional - rules, like date or time formatting for a string. The 'name' - format is applied to the primary identifier column which has - type 'string' 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 more. - type: string - jsonPath: - 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 higher priority. - format: int32 - type: integer - type: - description: type is an OpenAPI type definition for this column, - such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types - for more. - type: string - required: - - description - - format - - jsonPath - - name - - priority - - type - type: object - type: array - groupVersion: - properties: - group: - type: string - version: - type: string - required: - - version - type: object - 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 - location: - description: Locaton the API resource is imported from This field - is required - type: string - openAPIV3Schema: - type: object - x-kubernetes-map-type: atomic - x-kubernetes-preserve-unknown-fields: true - 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 - schemaUpdateStrategy: - description: SchemaUpdateStrategy defines the schema update strategy - for this API Resource import. Default value is UpdateUnpublished - type: string - scope: - description: ResourceScope is an enum defining the different scopes - available to a custom resource - 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 - singular: - description: singular is the singular name of the resource. It must - be all lowercase. Defaults to lowercased `kind`. - type: string - subResources: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - required: - - groupVersion - - kind - - location - - openAPIV3Schema - - plural - - scope - type: object - status: - description: APIResourceImportStatus communicates the observed state of - the APIResourceImport (from the controller). - properties: - conditions: - items: - description: APIResourceImportCondition contains details for the - current condition of this negotiated api resource. - properties: - lastTransitionTime: - description: Last time the condition transitioned from one status - to another. - format: date-time - type: string - message: - description: Human-readable message indicating details about - last transition. - type: string - reason: - description: Unique, one-word, CamelCase reason for the condition's - last transition. - type: string - status: - description: Status is the status of the condition. Can be True, - False, Unknown. - type: string - type: - description: Type is the type of the condition. Types include - Compatible. - type: string - required: - - status - - type - type: object - type: array - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/config/crds/apiresource.kcp.io_negotiatedapiresources.yaml b/config/crds/apiresource.kcp.io_negotiatedapiresources.yaml deleted file mode 100644 index 92552b6c827..00000000000 --- a/config/crds/apiresource.kcp.io_negotiatedapiresources.yaml +++ /dev/null @@ -1,216 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.10.0 - creationTimestamp: null - name: negotiatedapiresources.apiresource.kcp.io -spec: - group: apiresource.kcp.io - names: - categories: - - kcp - kind: NegotiatedAPIResource - listKind: NegotiatedAPIResourceList - plural: negotiatedapiresources - singular: negotiatedapiresource - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .spec.publish - name: Publish - priority: 1 - type: boolean - - jsonPath: .metadata.annotations.apiresource\.kcp\.dev/apiVersion - name: API Version - priority: 3 - type: string - - jsonPath: .spec.plural - name: API Resource - priority: 4 - type: string - - jsonPath: .status.conditions[?(@.type=="Published")].status - name: Published - priority: 5 - type: string - - jsonPath: .status.conditions[?(@.type=="Enforced")].status - name: Enforced - priority: 6 - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - description: NegotiatedAPIResource describes the result of either the normalization - of any number of imports of an API resource from external clusters (either - physical or logical), or the manual application of a CRD version for the - corresponding GVR. - 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: NegotiatedAPIResourceSpec holds the desired state of the - NegotiatedAPIResource (from the client). - 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 - columnDefinitions: - items: - properties: - description: - description: description is a human readable description of - this column. - type: string - format: - description: format is an optional OpenAPI type modifier for - this column. A format modifies the type and imposes additional - rules, like date or time formatting for a string. The 'name' - format is applied to the primary identifier column which has - type 'string' 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 more. - type: string - jsonPath: - 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 higher priority. - format: int32 - type: integer - type: - description: type is an OpenAPI type definition for this column, - such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types - for more. - type: string - required: - - description - - format - - jsonPath - - name - - priority - - type - type: object - type: array - groupVersion: - properties: - group: - type: string - version: - type: string - required: - - version - type: object - 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 - openAPIV3Schema: - type: object - x-kubernetes-map-type: atomic - x-kubernetes-preserve-unknown-fields: true - 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 - publish: - type: boolean - scope: - description: ResourceScope is an enum defining the different scopes - available to a custom resource - 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 - singular: - description: singular is the singular name of the resource. It must - be all lowercase. Defaults to lowercased `kind`. - type: string - subResources: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - required: - - groupVersion - - kind - - openAPIV3Schema - - plural - - scope - type: object - status: - description: NegotiatedAPIResourceStatus communicates the observed state - of the NegotiatedAPIResource (from the controller). - properties: - conditions: - items: - description: NegotiatedAPIResourceCondition contains details for - the current condition of this negotiated api resource. - properties: - lastTransitionTime: - description: Last time the condition transitioned from one status - to another. - format: date-time - type: string - message: - description: Human-readable message indicating details about - last transition. - type: string - reason: - description: Unique, one-word, CamelCase reason for the condition's - last transition. - type: string - status: - description: Status is the status of the condition. Can be True, - False, Unknown. - type: string - type: - description: Type is the type of the condition. Types include - Submitted, Published, Refused and Enforced. - type: string - required: - - status - - type - type: object - type: array - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/config/root-phase0/apiexport-apiresource.kcp.io.yaml b/config/root-phase0/apiexport-apiresource.kcp.io.yaml deleted file mode 100644 index 1212a6f9d06..00000000000 --- a/config/root-phase0/apiexport-apiresource.kcp.io.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: apis.kcp.io/v1alpha1 -kind: APIExport -metadata: - creationTimestamp: null - name: apiresource.kcp.io -spec: - latestResourceSchemas: - - v220628-546034da.apiresourceimports.apiresource.kcp.io - - v230424-27803b083.negotiatedapiresources.apiresource.kcp.io - maximalPermissionPolicy: - local: {} -status: {} diff --git a/config/root-phase0/apiresourceschema-apiresourceimports.apiresource.kcp.io.yaml b/config/root-phase0/apiresourceschema-apiresourceimports.apiresource.kcp.io.yaml deleted file mode 100644 index 7d87284a02c..00000000000 --- a/config/root-phase0/apiresourceschema-apiresourceimports.apiresource.kcp.io.yaml +++ /dev/null @@ -1,220 +0,0 @@ -apiVersion: apis.kcp.io/v1alpha1 -kind: APIResourceSchema -metadata: - creationTimestamp: null - name: v220628-546034da.apiresourceimports.apiresource.kcp.io -spec: - group: apiresource.kcp.io - names: - categories: - - kcp - kind: APIResourceImport - listKind: APIResourceImportList - plural: apiresourceimports - singular: apiresourceimport - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .spec.location - name: Location - priority: 1 - type: string - - jsonPath: .spec.schemaUpdateStrategy - name: Schema update strategy - priority: 2 - type: string - - jsonPath: .metadata.annotations.apiresource\.kcp\.dev/apiVersion - name: API Version - priority: 3 - type: string - - jsonPath: .spec.plural - name: API Resource - priority: 4 - type: string - - jsonPath: .status.conditions[?(@.type=="Compatible")].status - name: Compatible - priority: 5 - type: string - - jsonPath: .status.conditions[?(@.type=="Available")].status - name: Available - priority: 6 - type: string - name: v1alpha1 - schema: - description: APIResourceImport describes an API resource imported from external - clusters (either physical or logical) for a given GVR. - 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: APIResourceImportSpec holds the desired state of the APIResourceImport - (from the client). - 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 - columnDefinitions: - items: - properties: - description: - description: description is a human readable description of this - column. - type: string - format: - description: format is an optional OpenAPI type modifier for this - column. A format modifies the type and imposes additional rules, - like date or time formatting for a string. The 'name' format - is applied to the primary identifier column which has type 'string' - 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 more. - type: string - jsonPath: - 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 higher priority. - format: int32 - type: integer - type: - description: type is an OpenAPI type definition for this column, - such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types - for more. - type: string - required: - - description - - format - - jsonPath - - name - - priority - - type - type: object - type: array - groupVersion: - properties: - group: - type: string - version: - type: string - required: - - version - type: object - 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 - location: - description: Locaton the API resource is imported from This field is - required - type: string - openAPIV3Schema: - type: object - x-kubernetes-map-type: atomic - x-kubernetes-preserve-unknown-fields: true - 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 - schemaUpdateStrategy: - description: SchemaUpdateStrategy defines the schema update strategy - for this API Resource import. Default value is UpdateUnpublished - type: string - scope: - description: ResourceScope is an enum defining the different scopes - available to a custom resource - 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 - singular: - description: singular is the singular name of the resource. It must - be all lowercase. Defaults to lowercased `kind`. - type: string - subResources: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - required: - - groupVersion - - kind - - location - - openAPIV3Schema - - plural - - scope - type: object - status: - description: APIResourceImportStatus communicates the observed state of - the APIResourceImport (from the controller). - properties: - conditions: - items: - description: APIResourceImportCondition contains details for the current - condition of this negotiated api resource. - properties: - lastTransitionTime: - description: Last time the condition transitioned from one status - to another. - format: date-time - type: string - message: - description: Human-readable message indicating details about last - transition. - type: string - reason: - description: Unique, one-word, CamelCase reason for the condition's - last transition. - type: string - status: - description: Status is the status of the condition. Can be True, - False, Unknown. - type: string - type: - description: Type is the type of the condition. Types include - Compatible. - type: string - required: - - status - - type - type: object - type: array - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/config/root-phase0/apiresourceschema-negotiatedapiresources.apiresource.kcp.io.yaml b/config/root-phase0/apiresourceschema-negotiatedapiresources.apiresource.kcp.io.yaml deleted file mode 100644 index f93d4467f30..00000000000 --- a/config/root-phase0/apiresourceschema-negotiatedapiresources.apiresource.kcp.io.yaml +++ /dev/null @@ -1,211 +0,0 @@ -apiVersion: apis.kcp.io/v1alpha1 -kind: APIResourceSchema -metadata: - creationTimestamp: null - name: v230424-27803b083.negotiatedapiresources.apiresource.kcp.io -spec: - group: apiresource.kcp.io - names: - categories: - - kcp - kind: NegotiatedAPIResource - listKind: NegotiatedAPIResourceList - plural: negotiatedapiresources - singular: negotiatedapiresource - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .spec.publish - name: Publish - priority: 1 - type: boolean - - jsonPath: .metadata.annotations.apiresource\.kcp\.dev/apiVersion - name: API Version - priority: 3 - type: string - - jsonPath: .spec.plural - name: API Resource - priority: 4 - type: string - - jsonPath: .status.conditions[?(@.type=="Published")].status - name: Published - priority: 5 - type: string - - jsonPath: .status.conditions[?(@.type=="Enforced")].status - name: Enforced - priority: 6 - type: string - name: v1alpha1 - schema: - description: NegotiatedAPIResource describes the result of either the normalization - of any number of imports of an API resource from external clusters (either - physical or logical), or the manual application of a CRD version for the corresponding - GVR. - 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: NegotiatedAPIResourceSpec holds the desired state of the NegotiatedAPIResource - (from the client). - 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 - columnDefinitions: - items: - properties: - description: - description: description is a human readable description of this - column. - type: string - format: - description: format is an optional OpenAPI type modifier for this - column. A format modifies the type and imposes additional rules, - like date or time formatting for a string. The 'name' format - is applied to the primary identifier column which has type 'string' - 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 more. - type: string - jsonPath: - 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 higher priority. - format: int32 - type: integer - type: - description: type is an OpenAPI type definition for this column, - such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types - for more. - type: string - required: - - description - - format - - jsonPath - - name - - priority - - type - type: object - type: array - groupVersion: - properties: - group: - type: string - version: - type: string - required: - - version - type: object - 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 - openAPIV3Schema: - type: object - x-kubernetes-map-type: atomic - x-kubernetes-preserve-unknown-fields: true - 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 - publish: - type: boolean - scope: - description: ResourceScope is an enum defining the different scopes - available to a custom resource - 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 - singular: - description: singular is the singular name of the resource. It must - be all lowercase. Defaults to lowercased `kind`. - type: string - subResources: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - required: - - groupVersion - - kind - - openAPIV3Schema - - plural - - scope - type: object - status: - description: NegotiatedAPIResourceStatus communicates the observed state - of the NegotiatedAPIResource (from the controller). - properties: - conditions: - items: - description: NegotiatedAPIResourceCondition contains details for the - current condition of this negotiated api resource. - properties: - lastTransitionTime: - description: Last time the condition transitioned from one status - to another. - format: date-time - type: string - message: - description: Human-readable message indicating details about last - transition. - type: string - reason: - description: Unique, one-word, CamelCase reason for the condition's - last transition. - type: string - status: - description: Status is the status of the condition. Can be True, - False, Unknown. - type: string - type: - description: Type is the type of the condition. Types include - Submitted, Published, Refused and Enforced. - type: string - required: - - status - - type - type: object - type: array - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/config/root-phase0/bootstrap.go b/config/root-phase0/bootstrap.go index f66f54367c7..4e77d439cfc 100644 --- a/config/root-phase0/bootstrap.go +++ b/config/root-phase0/bootstrap.go @@ -41,7 +41,7 @@ var fs embed.FS // This is blocking, i.e. it only returns (with error) when the context is closed or with nil when // the bootstrapping is successfully completed. func Bootstrap(ctx context.Context, kcpClient kcpclient.Interface, rootDiscoveryClient discovery.DiscoveryInterface, rootDynamicClient dynamic.Interface, batteriesIncluded sets.Set[string]) error { - if err := confighelpers.BindRootAPIs(ctx, kcpClient, "shards.core.kcp.io", "tenancy.kcp.io", "apiresource.kcp.io", "topology.kcp.io"); err != nil { + if err := confighelpers.BindRootAPIs(ctx, kcpClient, "shards.core.kcp.io", "tenancy.kcp.io", "topology.kcp.io"); err != nil { return err } err := confighelpers.Bootstrap(ctx, rootDiscoveryClient, rootDynamicClient, batteriesIncluded, fs) diff --git a/config/root/clusterrole-apiresource-apiexport-bind.yaml b/config/root/clusterrole-apiresource-apiexport-bind.yaml deleted file mode 100644 index 12fa863d258..00000000000 --- a/config/root/clusterrole-apiresource-apiexport-bind.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: system:kcp:apiexport:apiresource:bind -rules: -- apiGroups: ["apis.kcp.io"] - resources: - - "apiexports" - resourceNames: - - "apiresource.kcp.io" - verbs: ["bind"] diff --git a/config/root/clusterrole-apiresource-maximal-permission-policy.yaml b/config/root/clusterrole-apiresource-maximal-permission-policy.yaml deleted file mode 100644 index 21a4fd88b57..00000000000 --- a/config/root/clusterrole-apiresource-maximal-permission-policy.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: system:kcp:apiexport:apiresource:maximal-permission-policy -rules: -- apiGroups: ["apiresource.kcp.io"] - verbs: ["*"] - resources: - - apiresourceimports - - negotiatedapiresources -- apiGroups: ["apiresource.kcp.io"] - verbs: ["get","list","watch"] - resources: - - apiresourceimports/status - - negotiatedapiresources/status diff --git a/config/root/clusterrolebinding-apiresource-apiexport-bind.yaml b/config/root/clusterrolebinding-apiresource-apiexport-bind.yaml deleted file mode 100644 index 1d811b84b2b..00000000000 --- a/config/root/clusterrolebinding-apiresource-apiexport-bind.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: system:kcp:authenticated:apiexport:apiresource:bind -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:kcp:apiexport:apiresource:bind -subjects: -- apiGroup: rbac.authorization.k8s.io - kind: Group - name: system:authenticated diff --git a/config/root/clusterrolebinding-apiresource-maximal-permission-policy.yaml b/config/root/clusterrolebinding-apiresource-maximal-permission-policy.yaml deleted file mode 100644 index 9d2fdf731d7..00000000000 --- a/config/root/clusterrolebinding-apiresource-maximal-permission-policy.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: system:kcp:authenticated:apiexport:apiresource:maximal-permission-policy -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:kcp:apiexport:apiresource:maximal-permission-policy -subjects: -- apiGroup: rbac.authorization.k8s.io - kind: Group - name: apis.kcp.io:binding:system:authenticated diff --git a/config/root/workspacetype-universal.yaml b/config/root/workspacetype-universal.yaml index 4cd9287f874..462a6e7289f 100644 --- a/config/root/workspacetype-universal.yaml +++ b/config/root/workspacetype-universal.yaml @@ -7,8 +7,6 @@ spec: defaultAPIBindings: - path: root export: tenancy.kcp.io - - path: root - export: apiresource.kcp.io - path: root export: topology.kcp.io defaultChildren: diff --git a/config/shard/bootstrap.go b/config/shard/bootstrap.go index 926c1ba1b97..e39fbbdf3e6 100644 --- a/config/shard/bootstrap.go +++ b/config/shard/bootstrap.go @@ -40,7 +40,7 @@ var SystemShardCluster = logicalcluster.Name("system:shard") // As of today creating API bindings for the root APIs and the default ns is enough. func Bootstrap(ctx context.Context, discoveryClient discovery.DiscoveryInterface, dynamicClient dynamic.Interface, batteriesIncluded sets.Set[string], kcpClient kcpclient.Interface) error { // note: shards are not really needed. But to avoid breaking the kcp shared informer factory, we also add them. - if err := confighelpers.BindRootAPIs(ctx, kcpClient, "shards.core.kcp.io", "tenancy.kcp.io", "apiresource.kcp.io", "topology.kcp.io"); err != nil { + if err := confighelpers.BindRootAPIs(ctx, kcpClient, "shards.core.kcp.io", "tenancy.kcp.io", "topology.kcp.io"); err != nil { return err } return confighelpers.Bootstrap(ctx, discoveryClient, dynamicClient, batteriesIncluded, fs) diff --git a/docs/generators/crd-ref/config.yaml b/docs/generators/crd-ref/config.yaml index c2560d52e2d..4d5a3aa00e7 100644 --- a/docs/generators/crd-ref/config.yaml +++ b/docs/generators/crd-ref/config.yaml @@ -24,16 +24,6 @@ source_repositories: cr_paths: - docs/cr metadata: - apiresourceimports.apiresource.kcp.io: - owner: - - https://github.com/kcp-dev/kcp - topics: - - apiresource - negotiatedapiresources.apiresource.kcp.io: - owner: - - https://github.com/kcp-dev/kcp - topics: - - apiresource apibindings.apis.kcp.io: owner: - https://github.com/kcp-dev/kcp diff --git a/hack/update-codegen-clients.sh b/hack/update-codegen-clients.sh index 9e21e21da25..cb154ba5545 100755 --- a/hack/update-codegen-clients.sh +++ b/hack/update-codegen-clients.sh @@ -33,7 +33,6 @@ go install "${CODEGEN_PKG}"/cmd/client-gen "$GOPATH"/bin/applyconfiguration-gen \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1 \ - --input-dirs github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1 \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1 \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1 \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/topology/v1alpha1 \ @@ -46,7 +45,6 @@ go install "${CODEGEN_PKG}"/cmd/client-gen "$GOPATH"/bin/client-gen \ --input github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1 \ - --input github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1 \ --input github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1 \ --input github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1 \ --input github.com/kcp-dev/kcp/sdk/apis/topology/v1alpha1 \ @@ -60,7 +58,7 @@ go install "${CODEGEN_PKG}"/cmd/client-gen bash "${CODEGEN_PKG}"/generate-groups.sh "deepcopy" \ github.com/kcp-dev/kcp/sdk/client github.com/kcp-dev/kcp/sdk/apis \ - "core:v1alpha1 apiresource:v1alpha1 tenancy:v1alpha1 apis:v1alpha1 topology:v1alpha1" \ + "core:v1alpha1 tenancy:v1alpha1 apis:v1alpha1 topology:v1alpha1" \ --go-header-file "${SCRIPT_ROOT}"/hack/boilerplate/boilerplate.generatego.txt \ --output-base "${SCRIPT_ROOT}" \ --trim-path-prefix github.com/kcp-dev/kcp @@ -119,7 +117,6 @@ go install "${CODEGEN_PKG}"/cmd/openapi-gen "$GOPATH"/bin/openapi-gen \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1 \ - --input-dirs github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1 \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1 \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1 \ --input-dirs github.com/kcp-dev/kcp/sdk/apis/topology/v1alpha1 \ diff --git a/pkg/openapi/zz_generated.openapi.go b/pkg/openapi/zz_generated.openapi.go index 4bb47e32fda..3ebf7050be1 100644 --- a/pkg/openapi/zz_generated.openapi.go +++ b/pkg/openapi/zz_generated.openapi.go @@ -31,20 +31,6 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImport": schema_sdk_apis_apiresource_v1alpha1_APIResourceImport(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportCondition": schema_sdk_apis_apiresource_v1alpha1_APIResourceImportCondition(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportList": schema_sdk_apis_apiresource_v1alpha1_APIResourceImportList(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportSpec": schema_sdk_apis_apiresource_v1alpha1_APIResourceImportSpec(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportStatus": schema_sdk_apis_apiresource_v1alpha1_APIResourceImportStatus(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.ColumnDefinition": schema_sdk_apis_apiresource_v1alpha1_ColumnDefinition(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.CommonAPIResourceSpec": schema_sdk_apis_apiresource_v1alpha1_CommonAPIResourceSpec(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.GroupVersion": schema_sdk_apis_apiresource_v1alpha1_GroupVersion(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResource": schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResource(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceCondition": schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceCondition(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceList": schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceList(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceSpec": schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceSpec(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceStatus": schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceStatus(ref), - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.SubResource": schema_sdk_apis_apiresource_v1alpha1_SubResource(ref), "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1.APIBinding": schema_sdk_apis_apis_v1alpha1_APIBinding(ref), "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1.APIBindingList": schema_sdk_apis_apis_v1alpha1_APIBindingList(ref), "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1.APIBindingSpec": schema_sdk_apis_apis_v1alpha1_APIBindingSpec(ref), @@ -165,900 +151,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA } } -func schema_sdk_apis_apiresource_v1alpha1_APIResourceImport(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIResourceImport describes an API resource imported from external clusters (either physical or logical) for a given GVR.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportSpec", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_APIResourceImportCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIResourceImportCondition contains details for the current condition of this negotiated api resource.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Description: "Type is the type of the condition. Types include Compatible.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "Status is the status of the condition. Can be True, False, Unknown.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "lastTransitionTime": { - SchemaProps: spec.SchemaProps{ - Description: "Last time the condition transitioned from one status to another.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "reason": { - SchemaProps: spec.SchemaProps{ - Description: "Unique, one-word, CamelCase reason for the condition's last transition.", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "Human-readable message indicating details about last transition.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"type", "status"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_APIResourceImportList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIResourceImportList is a list of APIResourceImport resources", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImport"), - }, - }, - }, - }, - }, - }, - Required: []string{"metadata", "items"}, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImport", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_APIResourceImportSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIResourceImportSpec holds the desired state of the APIResourceImport (from the client).", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "groupVersion": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.GroupVersion"), - }, - }, - "scope": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "plural": { - SchemaProps: spec.SchemaProps{ - 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.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "singular": { - SchemaProps: spec.SchemaProps{ - Description: "singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`.", - Type: []string{"string"}, - Format: "", - }, - }, - "shortNames": { - SchemaProps: spec.SchemaProps{ - 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.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - 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.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "listKind": { - SchemaProps: spec.SchemaProps{ - Description: "listKind is the serialized kind of the list for this resource. Defaults to \"`kind`List\".", - Type: []string{"string"}, - Format: "", - }, - }, - "categories": { - SchemaProps: spec.SchemaProps{ - 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`.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "openAPIV3Schema": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-map-type": "atomic", - }, - }, - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - "subResources": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "name", - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.SubResource"), - }, - }, - }, - }, - }, - "columnDefinitions": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "name", - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.ColumnDefinition"), - }, - }, - }, - }, - }, - "schemaUpdateStrategy": { - SchemaProps: spec.SchemaProps{ - Description: "SchemaUpdateStrategy defines the schema update strategy for this API Resource import. Default value is UpdateUnpublished", - Type: []string{"string"}, - Format: "", - }, - }, - "location": { - SchemaProps: spec.SchemaProps{ - Description: "Locaton the API resource is imported from This field is required", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"groupVersion", "scope", "plural", "kind", "openAPIV3Schema", "location"}, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.ColumnDefinition", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.GroupVersion", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.SubResource", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_APIResourceImportStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIResourceImportStatus communicates the observed state of the APIResourceImport (from the controller).", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportCondition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.APIResourceImportCondition"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_ColumnDefinition(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "name is a human readable name for the column.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "type": { - SchemaProps: spec.SchemaProps{ - Description: "type is an OpenAPI type definition for this column, such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "format": { - SchemaProps: spec.SchemaProps{ - Description: "format is an optional OpenAPI type modifier for this column. A format modifies the type and imposes additional rules, like date or time formatting for a string. The 'name' format is applied to the primary identifier column which has type 'string' 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 more.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "description": { - SchemaProps: spec.SchemaProps{ - Description: "description is a human readable description of this column.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "priority": { - SchemaProps: spec.SchemaProps{ - 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 higher priority.", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - "jsonPath": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name", "type", "format", "description", "priority", "jsonPath"}, - }, - }, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_CommonAPIResourceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "CommonAPIResourceSpec holds the common content of both NegotiatedAPIResourceSpec and APIResourceImportSpec.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "groupVersion": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.GroupVersion"), - }, - }, - "scope": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "plural": { - SchemaProps: spec.SchemaProps{ - 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.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "singular": { - SchemaProps: spec.SchemaProps{ - Description: "singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`.", - Type: []string{"string"}, - Format: "", - }, - }, - "shortNames": { - SchemaProps: spec.SchemaProps{ - 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.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - 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.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "listKind": { - SchemaProps: spec.SchemaProps{ - Description: "listKind is the serialized kind of the list for this resource. Defaults to \"`kind`List\".", - Type: []string{"string"}, - Format: "", - }, - }, - "categories": { - SchemaProps: spec.SchemaProps{ - 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`.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "openAPIV3Schema": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-map-type": "atomic", - }, - }, - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - "subResources": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "name", - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.SubResource"), - }, - }, - }, - }, - }, - "columnDefinitions": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "name", - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.ColumnDefinition"), - }, - }, - }, - }, - }, - }, - Required: []string{"groupVersion", "scope", "plural", "kind", "openAPIV3Schema"}, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.ColumnDefinition", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.GroupVersion", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.SubResource", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_GroupVersion(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"version"}, - }, - }, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResource(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NegotiatedAPIResource describes the result of either the normalization of any number of imports of an API resource from external clusters (either physical or logical), or the manual application of a CRD version for the corresponding GVR.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceSpec", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NegotiatedAPIResourceCondition contains details for the current condition of this negotiated api resource.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Description: "Type is the type of the condition. Types include Submitted, Published, Refused and Enforced.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "Status is the status of the condition. Can be True, False, Unknown.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "lastTransitionTime": { - SchemaProps: spec.SchemaProps{ - Description: "Last time the condition transitioned from one status to another.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "reason": { - SchemaProps: spec.SchemaProps{ - Description: "Unique, one-word, CamelCase reason for the condition's last transition.", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "Human-readable message indicating details about last transition.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"type", "status"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NegotiatedAPIResourceList is a list of NegotiatedAPIResource resources", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResource"), - }, - }, - }, - }, - }, - }, - Required: []string{"metadata", "items"}, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResource", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NegotiatedAPIResourceSpec holds the desired state of the NegotiatedAPIResource (from the client).", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "groupVersion": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.GroupVersion"), - }, - }, - "scope": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "plural": { - SchemaProps: spec.SchemaProps{ - 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.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "singular": { - SchemaProps: spec.SchemaProps{ - Description: "singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`.", - Type: []string{"string"}, - Format: "", - }, - }, - "shortNames": { - SchemaProps: spec.SchemaProps{ - 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.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - 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.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "listKind": { - SchemaProps: spec.SchemaProps{ - Description: "listKind is the serialized kind of the list for this resource. Defaults to \"`kind`List\".", - Type: []string{"string"}, - Format: "", - }, - }, - "categories": { - SchemaProps: spec.SchemaProps{ - 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`.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "openAPIV3Schema": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-map-type": "atomic", - }, - }, - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - "subResources": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "name", - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.SubResource"), - }, - }, - }, - }, - }, - "columnDefinitions": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "name", - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.ColumnDefinition"), - }, - }, - }, - }, - }, - "publish": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - Required: []string{"groupVersion", "scope", "plural", "kind", "openAPIV3Schema"}, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.ColumnDefinition", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.GroupVersion", "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.SubResource", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_NegotiatedAPIResourceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NegotiatedAPIResourceStatus communicates the observed state of the NegotiatedAPIResource (from the controller).", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceCondition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1.NegotiatedAPIResourceCondition"}, - } -} - -func schema_sdk_apis_apiresource_v1alpha1_SubResource(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - func schema_sdk_apis_apis_v1alpha1_APIBinding(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/pkg/reconciler/apis/apiresource/controller.go b/pkg/reconciler/apis/apiresource/controller.go deleted file mode 100644 index b12aad90b24..00000000000 --- a/pkg/reconciler/apis/apiresource/controller.go +++ /dev/null @@ -1,339 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 apiresource - -import ( - "context" - "fmt" - "time" - - kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" - "github.com/kcp-dev/logicalcluster/v3" - - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - kcpapiextensionsclientset "k8s.io/apiextensions-apiserver/pkg/client/kcp/clientset/versioned" - kcpapiextensionsv1informers "k8s.io/apiextensions-apiserver/pkg/client/kcp/informers/externalversions/apiextensions/v1" - kcpapiextensionsv1listers "k8s.io/apiextensions-apiserver/pkg/client/kcp/listers/apiextensions/v1" - "k8s.io/apimachinery/pkg/api/equality" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/util/workqueue" - "k8s.io/klog/v2" - - "github.com/kcp-dev/kcp/pkg/logging" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster" - apiresourceinformer "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/apiresource/v1alpha1" - apiresourcev1alpha1listers "github.com/kcp-dev/kcp/sdk/client/listers/apiresource/v1alpha1" -) - -const clusterNameAndGVRIndexName = "clusterNameAndGVR" -const ControllerName = "kcp-apiresource" - -func GetClusterNameAndGVRIndexKey(clusterName logicalcluster.Name, gvr metav1.GroupVersionResource) string { - return clusterName.String() + "$" + gvr.String() -} - -func NewController( - crdClusterClient kcpapiextensionsclientset.ClusterInterface, - kcpClusterClient kcpclientset.ClusterInterface, - negotiatedAPIResourceInformer apiresourceinformer.NegotiatedAPIResourceClusterInformer, - apiResourceImportInformer apiresourceinformer.APIResourceImportClusterInformer, - crdInformer kcpapiextensionsv1informers.CustomResourceDefinitionClusterInformer, -) (*Controller, error) { - queue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "kcp-apiresource") - - c := &Controller{ - queue: queue, - crdClusterClient: crdClusterClient, - kcpClusterClient: kcpClusterClient, - negotiatedApiResourceIndexer: negotiatedAPIResourceInformer.Informer().GetIndexer(), - negotiatedApiResourceLister: negotiatedAPIResourceInformer.Lister(), - apiResourceImportIndexer: apiResourceImportInformer.Informer().GetIndexer(), - apiResourceImportLister: apiResourceImportInformer.Lister(), - crdIndexer: crdInformer.Informer().GetIndexer(), - crdLister: crdInformer.Lister(), - } - - _, _ = negotiatedAPIResourceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: func(obj interface{}) { c.enqueue(addHandlerAction, nil, obj) }, - UpdateFunc: func(oldObj, obj interface{}) { c.enqueue(updateHandlerAction, oldObj, obj) }, - DeleteFunc: func(obj interface{}) { c.enqueue(deleteHandlerAction, nil, obj) }, - }) - if err := c.negotiatedApiResourceIndexer.AddIndexers(map[string]cache.IndexFunc{ - clusterNameAndGVRIndexName: func(obj interface{}) ([]string, error) { - if negotiatedApiResource, ok := obj.(*apiresourcev1alpha1.NegotiatedAPIResource); ok { - return []string{GetClusterNameAndGVRIndexKey(logicalcluster.From(negotiatedApiResource), negotiatedApiResource.GVR())}, nil - } - return []string{}, nil - }, - }); err != nil { - return nil, fmt.Errorf("failed to add indexer for NegotiatedAPIResource: %w", err) - } - - _, _ = apiResourceImportInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: func(obj interface{}) { c.enqueue(addHandlerAction, nil, obj) }, - UpdateFunc: func(oldObj, obj interface{}) { c.enqueue(updateHandlerAction, oldObj, obj) }, - DeleteFunc: func(obj interface{}) { c.enqueue(deleteHandlerAction, nil, obj) }, - }) - if err := c.apiResourceImportIndexer.AddIndexers(map[string]cache.IndexFunc{ - clusterNameAndGVRIndexName: func(obj interface{}) ([]string, error) { - if apiResourceImport, ok := obj.(*apiresourcev1alpha1.APIResourceImport); ok { - return []string{GetClusterNameAndGVRIndexKey(logicalcluster.From(apiResourceImport), apiResourceImport.GVR())}, nil - } - return []string{}, nil - }, - }); err != nil { - return nil, fmt.Errorf("failed to add indexer for APIResourceImport: %w", err) - } - - _, _ = crdInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: func(obj interface{}) { c.enqueue(addHandlerAction, nil, obj) }, - UpdateFunc: func(oldObj, obj interface{}) { c.enqueue(updateHandlerAction, oldObj, obj) }, - DeleteFunc: func(obj interface{}) { c.enqueue(deleteHandlerAction, nil, obj) }, - }) - if err := c.crdIndexer.AddIndexers(map[string]cache.IndexFunc{ - clusterNameAndGVRIndexName: func(obj interface{}) ([]string, error) { - if crd, ok := obj.(*apiextensionsv1.CustomResourceDefinition); ok { - return []string{GetClusterNameAndGVRIndexKey(logicalcluster.From(crd), metav1.GroupVersionResource{ - Group: crd.Spec.Group, - Resource: crd.Spec.Names.Plural, - })}, nil - } - return []string{}, nil - }, - }); err != nil { - return nil, fmt.Errorf("failed to add indexer for CustomResourceDefinition: %w", err) - } - - return c, nil -} - -type Controller struct { - queue workqueue.RateLimitingInterface - - crdClusterClient kcpapiextensionsclientset.ClusterInterface - kcpClusterClient kcpclientset.ClusterInterface - negotiatedApiResourceIndexer cache.Indexer - negotiatedApiResourceLister apiresourcev1alpha1listers.NegotiatedAPIResourceClusterLister - - apiResourceImportIndexer cache.Indexer - apiResourceImportLister apiresourcev1alpha1listers.APIResourceImportClusterLister - - crdIndexer cache.Indexer - crdLister kcpapiextensionsv1listers.CustomResourceDefinitionClusterLister -} - -type queueElementType string - -const ( - customResourceDefinitionType queueElementType = "CustomResourceDefinition" - negotiatedAPIResourceType queueElementType = "NegotiatedAPIResource" - apiResourceImportType queueElementType = "APIResourceImport" -) - -type queueElementAction string - -const ( - specChangedAction queueElementAction = "SpecChanged" - statusOnlyChangedAction queueElementAction = "StatusOnlyChanged" - annotationOrLabelsOnlyChanged queueElementAction = "AnnotationOrLabelsOnlyChanged" - deletedAction queueElementAction = "Deleted" - createdAction queueElementAction = "Created" -) - -type resourceHandlerAction string - -const ( - addHandlerAction resourceHandlerAction = "Add" - updateHandlerAction resourceHandlerAction = "Update" - deleteHandlerAction resourceHandlerAction = "Delete" -) - -type queueElement struct { - theAction queueElementAction - theType queueElementType - theKey string - gvr metav1.GroupVersionResource - clusterName logicalcluster.Name - deletedObject interface{} -} - -func toQueueElementType(oldObj, obj interface{}) (theType queueElementType, gvr metav1.GroupVersionResource, oldMeta, newMeta metav1.Object, oldStatus, newStatus interface{}) { - switch typedObj := obj.(type) { - case *apiextensionsv1.CustomResourceDefinition: - theType = customResourceDefinitionType - newMeta = typedObj - newStatus = typedObj.Status - if oldObj != nil { - typedOldObj := oldObj.(*apiextensionsv1.CustomResourceDefinition) - oldStatus = typedOldObj.Status - oldMeta = typedOldObj - } - gvr = metav1.GroupVersionResource{ - Group: typedObj.Spec.Group, - Resource: typedObj.Spec.Names.Plural, - } - case *apiresourcev1alpha1.APIResourceImport: - theType = apiResourceImportType - newMeta = typedObj - newStatus = typedObj.Status - if oldObj != nil { - typedOldObj := oldObj.(*apiresourcev1alpha1.APIResourceImport) - oldStatus = typedOldObj.Status - oldMeta = typedOldObj - } - gvr = metav1.GroupVersionResource{ - Group: typedObj.Spec.GroupVersion.Group, - Version: typedObj.Spec.GroupVersion.Version, - Resource: typedObj.Spec.Plural, - } - case *apiresourcev1alpha1.NegotiatedAPIResource: - theType = negotiatedAPIResourceType - newMeta = typedObj - newStatus = typedObj.Status - if oldObj != nil { - typedOldObj := oldObj.(*apiresourcev1alpha1.NegotiatedAPIResource) - oldStatus = typedOldObj.Status - oldMeta = typedOldObj - } - gvr = metav1.GroupVersionResource{ - Group: typedObj.Spec.GroupVersion.Group, - Version: typedObj.Spec.GroupVersion.Version, - Resource: typedObj.Spec.Plural, - } - case cache.DeletedFinalStateUnknown: - tombstone := typedObj - theType, gvr, oldMeta, newMeta, oldStatus, newStatus = toQueueElementType(nil, tombstone.Obj) - if theType == "" { - klog.Background().WithValues("unexpectedObject", obj).Error(nil, "tombstone contained object that is not expected") - } - } - return -} - -func (c *Controller) enqueue(action resourceHandlerAction, oldObj, obj interface{}) { - key, err := kcpcache.MetaClusterNamespaceKeyFunc(obj) - if err != nil { - runtime.HandleError(err) - return - } - if obj == nil { - return - } - - theType, gvr, oldMeta, newMeta, oldStatus, newStatus := toQueueElementType(oldObj, obj) - var theAction queueElementAction - var deletedObject interface{} - - switch action { - case "Add": - theAction = createdAction - case "Update": - if oldMeta == nil { - theAction = createdAction - break - } - - if oldMeta.GetResourceVersion() == newMeta.GetResourceVersion() { - return - } - - if oldMeta.GetGeneration() != newMeta.GetGeneration() { - theAction = specChangedAction - break - } - - if !equality.Semantic.DeepEqual(oldStatus, newStatus) { - theAction = statusOnlyChangedAction - break - } - - if !equality.Semantic.DeepEqual(oldMeta.GetAnnotations(), newMeta.GetAnnotations()) || - equality.Semantic.DeepEqual(oldMeta.GetLabels(), newMeta.GetLabels()) { - theAction = annotationOrLabelsOnlyChanged - break - } - // Nothing significant changed. Ignore the event. - return - case "Delete": - theAction = deletedAction - deletedObject = obj - } - - c.queue.Add(queueElement{ - theAction: theAction, - theType: theType, - theKey: key, - gvr: gvr, - clusterName: logicalcluster.From(newMeta), - deletedObject: deletedObject, - }) -} - -func (c *Controller) Start(ctx context.Context, numThreads int) { - defer runtime.HandleCrash() - defer c.queue.ShutDown() - - logger := logging.WithReconciler(klog.FromContext(ctx), ControllerName) - ctx = klog.NewContext(ctx, logger) - logger.Info("Starting controller") - defer logger.Info("Shutting down controller") - - for i := 0; i < numThreads; i++ { - go wait.Until(func() { c.startWorker(ctx) }, time.Second, ctx.Done()) - } - - <-ctx.Done() -} - -func (c *Controller) startWorker(ctx context.Context) { - for c.processNextWorkItem(ctx) { - } -} - -func (c *Controller) processNextWorkItem(ctx context.Context) bool { - // Wait until there is a new item in the working queue - k, quit := c.queue.Get() - if quit { - return false - } - key := k.(queueElement) - - logger := logging.WithQueueKey(klog.FromContext(ctx), key.theKey).WithValues( - "action", key.theAction, - "type", key.theType, - "gvr", key.gvr, - "clusterName", key.clusterName, - ) - ctx = klog.NewContext(ctx, logger) - logger.V(1).Info("processing key") - - // No matter what, tell the queue we're done with this key, to unblock - // other workers. - defer c.queue.Done(key) - - if err := c.process(ctx, key); err != nil { - runtime.HandleError(fmt.Errorf("%q controller failed to sync %v, err: %w", ControllerName, key, err)) - c.queue.AddRateLimited(key) - return true - } - c.queue.Forget(key) - return true -} diff --git a/pkg/reconciler/apis/apiresource/negotiation.go b/pkg/reconciler/apis/apiresource/negotiation.go deleted file mode 100644 index 3778579a440..00000000000 --- a/pkg/reconciler/apis/apiresource/negotiation.go +++ /dev/null @@ -1,889 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 apiresource - -import ( - "context" - "errors" - "reflect" - - kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" - "github.com/kcp-dev/logicalcluster/v3" - - crdhelpers "k8s.io/apiextensions-apiserver/pkg/apihelpers" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - k8serrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/apimachinery/pkg/version" - "k8s.io/apiserver/pkg/endpoints/request" - "k8s.io/klog/v2" - - "github.com/kcp-dev/kcp/pkg/schemacompat" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" -) - -func (c *Controller) process(ctx context.Context, key queueElement) error { - ctx = request.WithCluster(ctx, request.Cluster{Name: key.clusterName}) - - switch key.theType { - case customResourceDefinitionType: - clusterName, _, name, err := kcpcache.SplitMetaClusterNamespaceKey(key.theKey) - if err != nil { - runtime.HandleError(err) - return nil - } - crd, err := c.crdLister.Cluster(clusterName).Get(name) - if err != nil { - var deletedObjectExists bool - crd, deletedObjectExists = key.deletedObject.(*apiextensionsv1.CustomResourceDefinition) - if !k8serrors.IsNotFound(err) || !deletedObjectExists || crd == nil { - return err - } - } - switch key.theAction { - case createdAction, specChangedAction: - // - if no NegotiatedAPIResource owner - // => Set the Enforced status condition, and then the schema of the Negotiated API Resource of each CRD version - if c.isManuallyCreatedCRD(ctx, crd) { - if err := c.enforceCRDToNegotiatedAPIResource(ctx, logicalcluster.From(crd), key.gvr, crd); err != nil { - return err - } - } - fallthrough - case statusOnlyChangedAction: - // Set the Enforced status on the related Negotiation resources - // - if CRD is owned by a NegotiatedAPIResource - // => Set the status (Published / Refused) on the Negotiated API Resource of each CRD version - - if err := c.updatePublishingStatusOnNegotiatedAPIResources(ctx, logicalcluster.From(crd), key.gvr, crd); err != nil { - return err - } - case deletedAction: - // - if no NegotiatedAPIResource owner - // => Delete the Negotiated API Resource of each CRD version - // (they will be recreated from the related APIResourceImport objects, and if requested a CRD will be created again) - - if c.isManuallyCreatedCRD(ctx, crd) { - return c.deleteNegotiatedAPIResource(ctx, logicalcluster.From(crd), key.gvr, crd) - } else { - return c.updatePublishingStatusOnNegotiatedAPIResources(ctx, logicalcluster.From(crd), key.gvr, crd) - } - } - - case apiResourceImportType: - clusterName, _, name, err := kcpcache.SplitMetaClusterNamespaceKey(key.theKey) - if err != nil { - runtime.HandleError(err) - return nil - } - apiResourceImport, err := c.apiResourceImportLister.Cluster(clusterName).Get(name) - if err != nil { - var deletedObjectExists bool - apiResourceImport, deletedObjectExists = key.deletedObject.(*apiresourcev1alpha1.APIResourceImport) - if !k8serrors.IsNotFound(err) || !deletedObjectExists || apiResourceImport == nil { - return err - } - } - switch key.theAction { - case createdAction, specChangedAction: - // - if strategy allows schema update of the negotiated API resource (and current negotiated API resource is not enforced) - // => Calculate the LCD of this APIResourceImport schema against the schema of the corresponding NegotiatedAPIResource. If not errors occur - // update the NegotiatedAPIResource schema. Update the current APIResourceImport status accordingly (possibly reporting errors). - // - else (NegotiatedAPIResource schema update is not allowed) - // => Just check the compatibility of this APIResourceImport schema against the schema of the corresponding NegotiatedAPIResource. - // Update the current APIResourceImport status accordingly (possibly reporting errors). - return c.ensureAPIResourceCompatibility(ctx, logicalcluster.From(apiResourceImport), key.gvr, apiResourceImport, "") - case statusOnlyChangedAction: - compatible := apiResourceImport.FindCondition(apiresourcev1alpha1.Compatible) - available := apiResourceImport.FindCondition(apiresourcev1alpha1.Available) - - // - if both Compatible and Available conditions are unknown - // => Do the same as if the APIResourceImport was just created or modified. - if compatible == nil && available == nil { - return c.ensureAPIResourceCompatibility(ctx, logicalcluster.From(apiResourceImport), key.gvr, apiResourceImport, "") - } - case deletedAction: - // - If there is no other APIResourceImport for this GVR and the current negotiated API resource is not enforced - // => Delete the corresponding NegotiatedAPIResource - isOrphan, err := c.negotiatedAPIResourceIsOrphan(ctx, logicalcluster.From(apiResourceImport), key.gvr) - if err != nil { - return err - } - if isOrphan { - return c.deleteNegotiatedAPIResource(ctx, logicalcluster.From(apiResourceImport), key.gvr, nil) - } - - // - if strategy allows schema update of the negotiated API resource (and current negotiated API resource is not enforced) - // => Calculate the LCD of all other APIResourceImports for this GVR and update the schema of the corresponding NegotiatedAPIResource. - return c.ensureAPIResourceCompatibility(ctx, logicalcluster.From(apiResourceImport), key.gvr, nil, apiresourcev1alpha1.UpdatePublished) - } - case negotiatedAPIResourceType: - clusterName, _, name, err := kcpcache.SplitMetaClusterNamespaceKey(key.theKey) - if err != nil { - runtime.HandleError(err) - return nil - } - negotiatedApiResource, err := c.negotiatedApiResourceLister.Cluster(clusterName).Get(name) - if err != nil { - var deletedObjectExists bool - negotiatedApiResource, deletedObjectExists = key.deletedObject.(*apiresourcev1alpha1.NegotiatedAPIResource) - if !k8serrors.IsNotFound(err) || !deletedObjectExists || negotiatedApiResource == nil { - return err - } - } - switch key.theAction { - case createdAction, specChangedAction: - // if status.Enforced - // => Check the schema of all APIResourceImports for this GVR against the schema of the NegotiatedAPIResource, and update the - // status of each one with the right Compatible condition. - - if negotiatedApiResource.IsConditionTrue(apiresourcev1alpha1.Enforced) { - if err := c.ensureAPIResourceCompatibility(ctx, logicalcluster.From(negotiatedApiResource), key.gvr, nil, apiresourcev1alpha1.UpdateNever); err != nil { - return err - } - } - - // if spec.Published && !status.Enforced - // => If no CRD for the corresponding GVR exists - // => create it with the right CRD version that corresponds to the NegotiatedAPIResource spec content (schema included) - // and add the current NegotiatedAPIResource as owner of the CRD - // If the CRD for the corresponding GVR exists and has a NegotiatedAPIResource owner - // => update the CRD version of the existing CRD with the NegotiatedAPIResource spec content (schema included), - // and add the current NegotiatedAPIResource as owner of the CRD - - if negotiatedApiResource.Spec.Publish && !negotiatedApiResource.IsConditionTrue(apiresourcev1alpha1.Enforced) { - if err := c.publishNegotiatedResource(ctx, logicalcluster.From(negotiatedApiResource), key.gvr, negotiatedApiResource); err != nil { - return err - } - } - fallthrough - - case statusOnlyChangedAction: - // if status == Published - // => Udate the status of related compatible APIResourceImports, to set the `Available` condition to `true` - return c.updateStatusOnRelatedAPIResourceImports(ctx, logicalcluster.From(negotiatedApiResource), key.gvr, negotiatedApiResource) - - case deletedAction: - // if a CRD with the same GV has a version == to the current NegotiatedAPIResource version *and* has the current object as owner: - // => if this CRD version is the only one, then delete the CRD - // else remove this CRD version from the CRD, as well as the corresponding owner - // In any case change the status on every APIResourceImport with the same GVR, to remove Compatible and Available conditions. - return c.cleanupNegotiatedAPIResource(ctx, logicalcluster.From(negotiatedApiResource), key.gvr, negotiatedApiResource) - } - } - - return nil -} - -var negotiatedAPIResourceKind = reflect.TypeOf(apiresourcev1alpha1.NegotiatedAPIResource{}).Name() - -func NegotiatedAPIResourceAsOwnerReference(obj *apiresourcev1alpha1.NegotiatedAPIResource) metav1.OwnerReference { - return metav1.OwnerReference{ - APIVersion: apiresourcev1alpha1.SchemeGroupVersion.String(), - Kind: negotiatedAPIResourceKind, - Name: obj.Name, - UID: obj.UID, - } -} - -// isManuallyCreatedCRD detects if a CRD was created manually. -// This can be deduced from the fact that it doesn't have any NegotiatedAPIResource owner reference. -func (c *Controller) isManuallyCreatedCRD(ctx context.Context, crd *apiextensionsv1.CustomResourceDefinition) bool { - for _, reference := range crd.OwnerReferences { - if reference.APIVersion == apiresourcev1alpha1.SchemeGroupVersion.String() && - reference.Kind == negotiatedAPIResourceKind { - return false - } - } - return true -} - -// enforceCRDToNegotiatedAPIResource sets the Enforced status condition, -// and then updates the schema of the Negotiated API Resource of each CRD version. -func (c *Controller) enforceCRDToNegotiatedAPIResource(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, crd *apiextensionsv1.CustomResourceDefinition) error { - logger := klog.FromContext(ctx) - for _, version := range crd.Spec.Versions { - objects, err := c.negotiatedApiResourceIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey( - clusterName, - metav1.GroupVersionResource{ - Group: gvr.Group, - Version: version.Name, - Resource: gvr.Resource, - })) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - for _, obj := range objects { - negotiatedAPIResource := obj.(*apiresourcev1alpha1.NegotiatedAPIResource).DeepCopy() - negotiatedAPIResource.SetCondition(apiresourcev1alpha1.NegotiatedAPIResourceCondition{ - Type: apiresourcev1alpha1.Enforced, - Status: metav1.ConditionTrue, - }) - if _, err := c.kcpClusterClient.Cluster(logicalcluster.From(negotiatedAPIResource).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().UpdateStatus(ctx, negotiatedAPIResource, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error updating NegotiatedAPIResource status") - return err - } - // TODO: manage the case when the manually applied CRD has no schema or an invalid schema... - if err := negotiatedAPIResource.Spec.CommonAPIResourceSpec.SetSchema(version.Schema.OpenAPIV3Schema); err != nil { - return err - } - if _, err := c.kcpClusterClient.Cluster(logicalcluster.From(negotiatedAPIResource).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().Update(ctx, negotiatedAPIResource, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error updating NegotiatedAPIResource") - return err - } - } - } - return nil -} - -// setPublishingStatusOnNegotiatedAPIResource sets the status (Published / Refused) on the Negotiated API Resource for a CRD version. -func (c *Controller) setPublishingStatusOnNegotiatedAPIResource(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResource, crd *apiextensionsv1.CustomResourceDefinition) { - if crdhelpers.IsCRDConditionTrue(crd, apiextensionsv1.Established) && - crdhelpers.IsCRDConditionTrue(crd, apiextensionsv1.NamesAccepted) && - !crdhelpers.IsCRDConditionTrue(crd, apiextensionsv1.NonStructuralSchema) && - !crdhelpers.IsCRDConditionTrue(crd, apiextensionsv1.Terminating) { - negotiatedAPIResource.SetCondition(apiresourcev1alpha1.NegotiatedAPIResourceCondition{ - Type: apiresourcev1alpha1.Published, - Status: metav1.ConditionTrue, - }) - } else if crdhelpers.IsCRDConditionFalse(crd, apiextensionsv1.Established) || - crdhelpers.IsCRDConditionFalse(crd, apiextensionsv1.NamesAccepted) || - crdhelpers.IsCRDConditionTrue(crd, apiextensionsv1.NonStructuralSchema) || - crdhelpers.IsCRDConditionTrue(crd, apiextensionsv1.Terminating) { - negotiatedAPIResource.SetCondition(apiresourcev1alpha1.NegotiatedAPIResourceCondition{ - Type: apiresourcev1alpha1.Published, - Status: metav1.ConditionFalse, - }) - } - - enforcedStatus := metav1.ConditionFalse - if c.isManuallyCreatedCRD(ctx, crd) { - enforcedStatus = metav1.ConditionTrue - } - negotiatedAPIResource.SetCondition(apiresourcev1alpha1.NegotiatedAPIResourceCondition{ - Type: apiresourcev1alpha1.Enforced, - Status: enforcedStatus, - }) -} - -// updatePublishingStatusOnNegotiatedAPIResources sets the status (Published / Refused) on the Negotiated API Resource of each CRD version. -func (c *Controller) updatePublishingStatusOnNegotiatedAPIResources(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, crd *apiextensionsv1.CustomResourceDefinition) error { - logger := klog.FromContext(ctx) - for _, version := range crd.Spec.Versions { - objects, err := c.negotiatedApiResourceIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey( - clusterName, - metav1.GroupVersionResource{ - Group: gvr.Group, - Version: version.Name, - Resource: gvr.Resource, - })) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - for _, obj := range objects { - negotiatedAPIResource := obj.(*apiresourcev1alpha1.NegotiatedAPIResource).DeepCopy() - c.setPublishingStatusOnNegotiatedAPIResource(ctx, clusterName, gvr, negotiatedAPIResource, crd) - _, err := c.kcpClusterClient.Cluster(logicalcluster.From(negotiatedAPIResource).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().UpdateStatus(ctx, negotiatedAPIResource, metav1.UpdateOptions{}) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - } - return nil -} - -// deleteNegotiatedAPIResource deletes the Negotiated API Resource of each CRD version -// (they will be recreated from the related APIResourceImport objects if necessary, -// and if requested a CRD will be created again as a consequence). -func (c *Controller) deleteNegotiatedAPIResource(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, crd *apiextensionsv1.CustomResourceDefinition) error { - logger := klog.FromContext(ctx) - var gvrsToDelete []metav1.GroupVersionResource - if gvr.Version != "" { - gvrsToDelete = []metav1.GroupVersionResource{gvr} - } else { - if crd == nil { - logger.Error(errors.New("CRD is nil after deletion"), "no way to find the NegotiatedAPIResources to delete from the CRD versions") - return nil - } - for _, version := range crd.Spec.Versions { - gvrsToDelete = append(gvrsToDelete, metav1.GroupVersionResource{ - Group: gvr.Group, - Version: version.Name, - Resource: gvr.Resource, - }) - } - } - for _, gvrToDelete := range gvrsToDelete { - objs, err := c.negotiatedApiResourceIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvrToDelete)) - if err != nil { - logger.Error(err, "NegotiatedAPIResource for GVR could not be searched in index, and could not be deleted") - } - if len(objs) == 0 { - logger.Info("NegotiatedAPIResource for GVR was not found and could not be deleted") - continue - } - - toDelete := objs[0].(*apiresourcev1alpha1.NegotiatedAPIResource) - err = c.kcpClusterClient.Cluster(logicalcluster.From(toDelete).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().Delete(ctx, toDelete.Name, metav1.DeleteOptions{}) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - return nil -} - -// ensureAPIResourceCompatibility ensures that the given APIResourceImport (or all imports related to the GVR if the import is nil) -// is compatible with the NegotiatedAPIResource. if possible and requested, it updates the NegotiatedAPIResource with the LCD of the -// schemas of the various imported schemas. If no NegotiatedAPIResource already exists, it can create one. -func (c *Controller) ensureAPIResourceCompatibility(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, apiResourceImport *apiresourcev1alpha1.APIResourceImport, overrideStrategy apiresourcev1alpha1.SchemaUpdateStrategyType) error { - logger := klog.FromContext(ctx) - // - if strategy allows schema update of the negotiated API resource (and current negotiated API resource is not enforced) - // => Calculate the LCD of this APIResourceImport schema against the schema of the corresponding NegotiatedAPIResource. If not errors occur - // update the NegotiatedAPIResource schema. Update the current APIResourceImport status accordingly (possibly reporting errors). - // - else (NegotiatedAPIResource schema update is not allowed) - // => Just check the compatibility of this APIResourceImport schema against the schema of the corresponding NegotiatedAPIResource. - // Update the current APIResourceImport status accordingly (possibly reporting errors). - - var negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResource - objs, err := c.negotiatedApiResourceIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr)) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - if len(objs) > 0 { - negotiatedAPIResource = objs[0].(*apiresourcev1alpha1.NegotiatedAPIResource).DeepCopy() - } - - var apiResourcesImports []*apiresourcev1alpha1.APIResourceImport - if apiResourceImport != nil { - apiResourcesImports = append(apiResourcesImports, apiResourceImport) - } else { - objs, err := c.apiResourceImportIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr)) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - for _, obj := range objs { - apiResourcesImports = append(apiResourcesImports, obj.(*apiresourcev1alpha1.APIResourceImport).DeepCopy()) - } - } - - if len(apiResourcesImports) == 0 { - return nil - } - - negotiatedAPIResourceName := gvr.Resource + "." + gvr.Version + "." - if gvr.Group == "" { - negotiatedAPIResourceName += "core" - } else { - negotiatedAPIResourceName += gvr.Group - } - - var newNegotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResource - var updatedNegotiatedSchema bool - if apiResourceImport != nil { - // If a given apiResourceImport is given, then we are in the case of iterative partial comparison / LCD building - // The final negotiated API resource will be based on the existing one. - newNegotiatedAPIResource = negotiatedAPIResource - } - - // If a corresponding manually added CRD exists, - // then the final negotiated API resource will be based the one enforced from the CRD - crdName := gvr.Resource + "." - if gvr.Group == "" { - crdName += "core" - } else { - crdName += gvr.Group - } - crd, err := c.crdLister.Cluster(clusterName).Get(crdName) - if err != nil && !k8serrors.IsNotFound(err) { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - if crd != nil && c.isManuallyCreatedCRD(ctx, crd) { - var crdVersion *apiextensionsv1.CustomResourceDefinitionVersion - for i, version := range crd.Spec.Versions { - if version.Name == gvr.Version { - crdVersion = &crd.Spec.Versions[i] - } - } - - if crdVersion != nil { - groupVersion := apiresourcev1alpha1.GroupVersion{ - Group: gvr.Group, - Version: gvr.Version, - } - newNegotiatedAPIResource = &apiresourcev1alpha1.NegotiatedAPIResource{ - ObjectMeta: metav1.ObjectMeta{ - Name: negotiatedAPIResourceName, - Annotations: map[string]string{ - logicalcluster.AnnotationKey: clusterName.String(), - apiresourcev1alpha1.APIVersionAnnotation: groupVersion.APIVersion(), - }, - }, - Spec: apiresourcev1alpha1.NegotiatedAPIResourceSpec{ - CommonAPIResourceSpec: apiresourcev1alpha1.CommonAPIResourceSpec{ - GroupVersion: groupVersion, - Scope: crd.Spec.Scope, - CustomResourceDefinitionNames: crd.Spec.Names, - SubResources: *(&apiresourcev1alpha1.SubResources{}).ImportFromCRDVersion(crdVersion), - ColumnDefinitions: *(&apiresourcev1alpha1.ColumnDefinitions{}).ImportFromCRDVersion(crdVersion), - }, - Publish: true, - }, - } - if err := newNegotiatedAPIResource.Spec.SetSchema(crdVersion.Schema.OpenAPIV3Schema); err != nil { - return err - } - newNegotiatedAPIResource.SetCondition(apiresourcev1alpha1.NegotiatedAPIResourceCondition{ - Type: apiresourcev1alpha1.Published, - Status: metav1.ConditionTrue, - }) - newNegotiatedAPIResource.SetCondition(apiresourcev1alpha1.NegotiatedAPIResourceCondition{ - Type: apiresourcev1alpha1.Enforced, - Status: metav1.ConditionTrue, - }) - } - } - - apiResourceImportUpdateStatusFuncs := make([]func() error, 0, len(apiResourcesImports)) - - for i := range apiResourcesImports { - apiResourceImport := apiResourcesImports[i].DeepCopy() - - if newNegotiatedAPIResource == nil { - newNegotiatedAPIResource = &apiresourcev1alpha1.NegotiatedAPIResource{ - ObjectMeta: metav1.ObjectMeta{ - Name: negotiatedAPIResourceName, - Annotations: map[string]string{ - logicalcluster.AnnotationKey: clusterName.String(), - apiresourcev1alpha1.APIVersionAnnotation: apiResourceImport.Spec.CommonAPIResourceSpec.GroupVersion.APIVersion(), - }, - }, - Spec: apiresourcev1alpha1.NegotiatedAPIResourceSpec{ - CommonAPIResourceSpec: apiResourceImport.Spec.CommonAPIResourceSpec, - Publish: false, - }, - } - if negotiatedAPIResource != nil { - newNegotiatedAPIResource.ResourceVersion = negotiatedAPIResource.ResourceVersion - newNegotiatedAPIResource.Spec.Publish = negotiatedAPIResource.Spec.Publish - } - updatedNegotiatedSchema = true - apiResourceImport.SetCondition(apiresourcev1alpha1.APIResourceImportCondition{ - Type: apiresourcev1alpha1.Compatible, - Status: metav1.ConditionTrue, - Reason: "", - Message: "", - }) - if value, found := apiResourceImport.Annotations[apiextensionsv1.KubeAPIApprovedAnnotation]; found { - newNegotiatedAPIResource.Annotations[apiextensionsv1.KubeAPIApprovedAnnotation] = value - } - } else { - allowUpdateNegotiatedSchema := !newNegotiatedAPIResource.IsConditionTrue(apiresourcev1alpha1.Enforced) && - apiResourceImport.Spec.SchemaUpdateStrategy.CanUpdate(newNegotiatedAPIResource.IsConditionTrue(apiresourcev1alpha1.Published)) - - // TODO Also check compatibility of non-schema things like group, names, short names, category, resourcescope, subresources, columns etc... - - importSchema, err := apiResourceImport.Spec.GetSchema() - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - negotiatedSchema, err := newNegotiatedAPIResource.Spec.GetSchema() - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - - apiResourceImport = apiResourceImport.DeepCopy() - lcd, err := schemacompat.EnsureStructuralSchemaCompatibility(field.NewPath(newNegotiatedAPIResource.Spec.Kind), negotiatedSchema, importSchema, allowUpdateNegotiatedSchema) - if err != nil { - apiResourceImport.SetCondition(apiresourcev1alpha1.APIResourceImportCondition{ - Type: apiresourcev1alpha1.Compatible, - Status: metav1.ConditionFalse, - Reason: "IncompatibleSchema", - // TODO: improve error message. - Message: err.Error(), - }) - } else { - apiResourceImport.SetCondition(apiresourcev1alpha1.APIResourceImportCondition{ - Type: apiresourcev1alpha1.Compatible, - Status: metav1.ConditionTrue, - Reason: "", - Message: "", - }) - if newNegotiatedAPIResource.IsConditionTrue(apiresourcev1alpha1.Published) { - apiResourceImport.SetCondition(apiresourcev1alpha1.APIResourceImportCondition{ - Type: apiresourcev1alpha1.Available, - Status: metav1.ConditionTrue, - Reason: "", - Message: "", - }) - } - if allowUpdateNegotiatedSchema { - if err := newNegotiatedAPIResource.Spec.SetSchema(lcd); err != nil { - return err - } - updatedNegotiatedSchema = true - } - } - } - apiResourceImportUpdateStatusFuncs = append(apiResourceImportUpdateStatusFuncs, func() error { - lastOne, err := c.apiResourceImportLister.Cluster(logicalcluster.From(apiResourceImport)).Get(apiResourceImport.Name) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - apiResourceImport.SetResourceVersion(lastOne.GetResourceVersion()) - if _, err := c.kcpClusterClient.Cluster(logicalcluster.From(apiResourceImport).Path()).ApiresourceV1alpha1().APIResourceImports().UpdateStatus(ctx, apiResourceImport, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - return nil - }) - } - if negotiatedAPIResource == nil { - existing, err := c.kcpClusterClient.Cluster(logicalcluster.From(newNegotiatedAPIResource).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().Create(ctx, newNegotiatedAPIResource, metav1.CreateOptions{}) - if k8serrors.IsAlreadyExists(err) { - existing, err = c.kcpClusterClient.Cluster(logicalcluster.From(newNegotiatedAPIResource).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().Get(ctx, newNegotiatedAPIResource.Name, metav1.GetOptions{}) - } - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - if len(newNegotiatedAPIResource.Status.Conditions) > 0 { - existing.Status = newNegotiatedAPIResource.Status - _, err = c.kcpClusterClient.Cluster(logicalcluster.From(existing).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().UpdateStatus(ctx, existing, metav1.UpdateOptions{}) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - } else if updatedNegotiatedSchema { - if _, err := c.kcpClusterClient.Cluster(logicalcluster.From(newNegotiatedAPIResource).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().Update(ctx, newNegotiatedAPIResource, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - for _, apiResourceImportUpdateStatusFunc := range apiResourceImportUpdateStatusFuncs { - if err := apiResourceImportUpdateStatusFunc(); err != nil { - return err - } - } - - return nil -} - -// negotiatedAPIResourceIsOrphan detects if there is no other APIResourceImport for this GVR and the current negotiated API resource is not enforced. -func (c *Controller) negotiatedAPIResourceIsOrphan(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource) (bool, error) { - logger := klog.FromContext(ctx) - objs, err := c.apiResourceImportIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr)) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return false, err - } - - if len(objs) > 0 { - return false, nil - } - - objs, err = c.negotiatedApiResourceIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr)) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return false, err - } - if len(objs) != 1 { - return false, nil - } - negotiatedAPIResource := objs[0].(*apiresourcev1alpha1.NegotiatedAPIResource) - return !negotiatedAPIResource.IsConditionTrue(apiresourcev1alpha1.Enforced), nil -} - -// publishNegotiatedResource publishes the NegotiatedAPIResource information as a CRD, unless a manually-added CRD already exists for this GVR. -func (c *Controller) publishNegotiatedResource(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, negotiatedApiResource *apiresourcev1alpha1.NegotiatedAPIResource) error { - logger := klog.FromContext(ctx) - crdName := gvr.Resource - if gvr.Group == "" { - crdName += ".core" - } else { - crdName += "." + gvr.Group - } - - negotiatedSchema, err := negotiatedApiResource.Spec.CommonAPIResourceSpec.GetSchema() - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - - var subResources apiextensionsv1.CustomResourceSubresources - for _, subResource := range negotiatedApiResource.Spec.SubResources { - if subResource.Name == "scale" { - subResources.Scale = &apiextensionsv1.CustomResourceSubresourceScale{ - SpecReplicasPath: ".spec.replicas", - StatusReplicasPath: ".status.replicas", - } - } - if subResource.Name == "status" { - subResources.Status = &apiextensionsv1.CustomResourceSubresourceStatus{} - } - } - - crColumnDefinitions := negotiatedApiResource.Spec.ColumnDefinitions.ToCustomResourceColumnDefinitions() - - crdVersion := apiextensionsv1.CustomResourceDefinitionVersion{ - Name: gvr.Version, - Storage: true, // TODO: How do we know which version will be stored ? the newest one we assume ? - Served: true, // TODO: Should we set served to false when the negotiated API is removed, instead of removing the CRD Version or CRD itself ? - Schema: &apiextensionsv1.CustomResourceValidation{ - OpenAPIV3Schema: negotiatedSchema, - }, - Subresources: &subResources, - AdditionalPrinterColumns: crColumnDefinitions, - } - - crd, err := c.crdLister.Cluster(clusterName).Get(crdName) - if err != nil && !k8serrors.IsNotFound(err) { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - - // If no CRD for the corresponding GR exists - // => create it with the right CRD version that corresponds to the NegotiatedAPIResource spec content (schema included) - // and add the current NegotiatedAPIResource as owner of the CRD - if k8serrors.IsNotFound(err) { - cr := &apiextensionsv1.CustomResourceDefinition{ - ObjectMeta: metav1.ObjectMeta{ - Name: crdName, - OwnerReferences: []metav1.OwnerReference{ - NegotiatedAPIResourceAsOwnerReference(negotiatedApiResource), - }, - // TODO: (shawn-hurley) We need to figure out how to set this - Annotations: map[string]string{ - logicalcluster.AnnotationKey: logicalcluster.From(negotiatedApiResource).String(), - }, - }, - Spec: apiextensionsv1.CustomResourceDefinitionSpec{ - Scope: negotiatedApiResource.Spec.Scope, - Group: negotiatedApiResource.Spec.GroupVersion.Group, - Names: negotiatedApiResource.Spec.CustomResourceDefinitionNames, - Versions: []apiextensionsv1.CustomResourceDefinitionVersion{ - crdVersion, - }, - }, - } - - apiextensionsv1.SetDefaults_CustomResourceDefinition(cr) - - // In Kubernetes, to make it clear to the API consumer that APIs in *.k8s.io or *.kubernetes.io domains - // should be following all quality standards of core Kubernetes, CRDs under these domains - // are expected to go through the API Review process and so must link the API review approval PR - // in an `api-approved.kubernetes.io` annotation. - // Without this annotation, a CRD under the *.k8s.io or *.kubernetes.io domains is rejected by the API server - // - // Of course here we're simply adding already-known resources of existing physical clusters as CRDs in KCP. - // But to please this Kubernetes approval requirement, let's add the required annotation in imported CRDs - // with one of the KCP PRs that hacked Kubernetes CRD support for KCP. - if crdhelpers.IsProtectedCommunityGroup(gvr.Group) { - if cr.ObjectMeta.Annotations == nil { - cr.ObjectMeta.Annotations = map[string]string{} - } - cr.ObjectMeta.Annotations["api-approved.kubernetes.io"] = "https://github.com/kcp-dev/kubernetes/pull/4" - } - - if _, err := c.crdClusterClient.Cluster(clusterName.Path()).ApiextensionsV1().CustomResourceDefinitions().Create(ctx, cr, metav1.CreateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } else if !c.isManuallyCreatedCRD(ctx, crd) { - // If the CRD for the corresponding GVR exists and has a NegotiatedAPIResource owner - // => update the CRD version of the existing CRD with the NegotiatedAPIResource spec content (schema included), - // and add the current NegotiatedAPIResource as owner of the CRD - - crd = crd.DeepCopy() - newCRDVersionIsTheLatest := true - existingCRDVersionIndex := -1 - storageVersionIndex := -1 - for index, existingVersion := range crd.Spec.Versions { - if existingVersion.Name == crdVersion.Name { - existingCRDVersionIndex = index - } - if version.CompareKubeAwareVersionStrings(existingVersion.Name, crdVersion.Name) > 0 { - newCRDVersionIsTheLatest = false - } - if existingVersion.Storage { - storageVersionIndex = index - } - } - - if !newCRDVersionIsTheLatest { - crdVersion.Storage = false - } else if storageVersionIndex > -1 { - crd.Spec.Versions[storageVersionIndex].Storage = false - } - - if existingCRDVersionIndex == -1 { - crd.Spec.Versions = append(crd.Spec.Versions, crdVersion) - } else { - crd.Spec.Versions[existingCRDVersionIndex] = crdVersion - } - - var ownerReferenceAlreadyExists bool - for _, ownerRef := range crd.OwnerReferences { - if ownerRef.Name == negotiatedApiResource.Name && ownerRef.UID == negotiatedApiResource.UID { - ownerReferenceAlreadyExists = true - break - } - } - - if !ownerReferenceAlreadyExists { - crd.OwnerReferences = append(crd.OwnerReferences, - NegotiatedAPIResourceAsOwnerReference(negotiatedApiResource)) - } - - if _, err := c.crdClusterClient.Cluster(clusterName.Path()).ApiextensionsV1().CustomResourceDefinitions().Update(ctx, crd, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - - // Update the NegotiatedAPIResource status to Submitted - - negotiatedApiResource = negotiatedApiResource.DeepCopy() - negotiatedApiResource.SetCondition(apiresourcev1alpha1.NegotiatedAPIResourceCondition{ - Type: apiresourcev1alpha1.Submitted, - Status: metav1.ConditionTrue, - }) - if _, err := c.kcpClusterClient.Cluster(logicalcluster.From(negotiatedApiResource).Path()).ApiresourceV1alpha1().NegotiatedAPIResources().UpdateStatus(ctx, negotiatedApiResource, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - - return nil -} - -// updateStatusOnRelatedAPIResourceImports udates the status of related compatible APIResourceImports, to set the `Available` condition to `true`. -func (c *Controller) updateStatusOnRelatedAPIResourceImports(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, negotiatedApiResource *apiresourcev1alpha1.NegotiatedAPIResource) error { - logger := klog.FromContext(ctx) - publishedCondition := negotiatedApiResource.FindCondition(apiresourcev1alpha1.Published) - if publishedCondition != nil { - objs, err := c.apiResourceImportIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr)) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - for _, obj := range objs { - apiResourceImport := obj.(*apiresourcev1alpha1.APIResourceImport).DeepCopy() - apiResourceImport.SetCondition(apiresourcev1alpha1.APIResourceImportCondition{ - Type: apiresourcev1alpha1.Available, - Status: publishedCondition.Status, - }) - if _, err := c.kcpClusterClient.Cluster(logicalcluster.From(apiResourceImport).Path()).ApiresourceV1alpha1().APIResourceImports().UpdateStatus(ctx, apiResourceImport, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - } - return nil -} - -// cleanupNegotiatedAPIResource does the required cleanup of related resources (CRD,APIResourceImport) after a NegotiatedAPIResource has been deleted. -func (c *Controller) cleanupNegotiatedAPIResource(ctx context.Context, clusterName logicalcluster.Name, gvr metav1.GroupVersionResource, negotiatedApiResource *apiresourcev1alpha1.NegotiatedAPIResource) error { - logger := klog.FromContext(ctx) - // In any case change the status on every APIResourceImport with the same GVR, to remove Compatible and Available conditions. - - objs, err := c.apiResourceImportIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr)) - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - for _, obj := range objs { - apiResourceImport := obj.(*apiresourcev1alpha1.APIResourceImport).DeepCopy() - apiResourceImport.RemoveCondition(apiresourcev1alpha1.Available) - apiResourceImport.RemoveCondition(apiresourcev1alpha1.Compatible) - if _, err := c.kcpClusterClient.Cluster(logicalcluster.From(apiResourceImport).Path()).ApiresourceV1alpha1().APIResourceImports().UpdateStatus(ctx, apiResourceImport, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - - // if a CRD with the same GR has a version == to the current NegotiatedAPIResource version *and* has the current object as owner: - // => if this CRD version is the only one, then delete the CRD - // else remove this CRD version from the CRD, as well as the corresponding owner - - crdName := gvr.Resource - if gvr.Group == "" { - crdName += ".core" - } else { - crdName += "." + gvr.Group - } - - crd, err := c.crdLister.Cluster(clusterName).Get(crdName) - if k8serrors.IsNotFound(err) { - return nil - } - if err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - - var ownerReferenceAlreadyExists bool - cleanedOwnerReferences := make([]metav1.OwnerReference, 0, len(crd.OwnerReferences)) - for _, ownerRef := range crd.OwnerReferences { - if ownerRef.Name == negotiatedApiResource.Name && ownerRef.UID == negotiatedApiResource.UID { - ownerReferenceAlreadyExists = true - continue - } - cleanedOwnerReferences = append(cleanedOwnerReferences, ownerRef) - } - if !ownerReferenceAlreadyExists { - return nil - } - - cleanedVersions := make([]apiextensionsv1.CustomResourceDefinitionVersion, 0, len(crd.Spec.Versions)) - for _, version := range crd.Spec.Versions { - if version.Name == gvr.Version { - continue - } - cleanedVersions = append(cleanedVersions, version) - } - if len(cleanedVersions) == len(crd.Spec.Versions) { - return nil - } - if len(cleanedVersions) == 0 { - if err := c.crdClusterClient.Cluster(clusterName.Path()).ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } else { - crd = crd.DeepCopy() - crd.Spec.Versions = cleanedVersions - crd.OwnerReferences = cleanedOwnerReferences - if _, err := c.crdClusterClient.Cluster(clusterName.Path()).ApiextensionsV1().CustomResourceDefinitions().Update(ctx, crd, metav1.UpdateOptions{}); err != nil { - logger.Error(err, "error", "caller", runtime.GetCaller()) - return err - } - } - - return nil -} diff --git a/pkg/reconciler/apis/apiresource/options/options.go b/pkg/reconciler/apis/apiresource/options/options.go deleted file mode 100644 index 16b753b6987..00000000000 --- a/pkg/reconciler/apis/apiresource/options/options.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2022 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 options - -import ( - "runtime" - - "github.com/spf13/pflag" -) - -// NewOptions are the default options for the apiresource controller. -func NewOptions() *Options { - return &Options{ - // Consumed by server instantiation - NumThreads: runtime.NumCPU(), - } -} - -func (o *Options) AddFlags(fs *pflag.FlagSet) { - if o == nil { - return - } - - fs.IntVar(&o.NumThreads, "apiresource-controller-threads", o.NumThreads, "Number of threads to use for the apiresource controller.") -} - -// Options are the options for the cluster controller. -type Options struct { - NumThreads int -} - -func (o *Options) Validate() error { - if o == nil { - return nil - } - - return nil -} diff --git a/pkg/server/bootstrap/identity.go b/pkg/server/bootstrap/identity.go index 6f1f510c1eb..7a6f276a0a2 100644 --- a/pkg/server/bootstrap/identity.go +++ b/pkg/server/bootstrap/identity.go @@ -47,9 +47,8 @@ import ( var ( // KcpRootGroupExportNames lists the APIExports in the root workspace for standard kcp groups. KcpRootGroupExportNames = map[string]string{ - "tenancy.kcp.io": "tenancy.kcp.io", - "apiresource.kcp.io": "apiresource.kcp.io", - "topology.kcp.io": "topology.kcp.io", + "tenancy.kcp.io": "tenancy.kcp.io", + "topology.kcp.io": "topology.kcp.io", } // KcpRootGroupResourceExportNames lists the APIExports in the root workspace for standard kcp group resources. diff --git a/sdk/apis/apiresource/register.go b/sdk/apis/apiresource/register.go deleted file mode 100644 index d39c596f6f3..00000000000 --- a/sdk/apis/apiresource/register.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 apiresource - -const ( - GroupName = "apiresource.kcp.io" -) diff --git a/sdk/apis/apiresource/v1alpha1/apiresourceimport_helpers.go b/sdk/apis/apiresource/v1alpha1/apiresourceimport_helpers.go deleted file mode 100644 index 5105b2939a3..00000000000 --- a/sdk/apis/apiresource/v1alpha1/apiresourceimport_helpers.go +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v1alpha1 - -import ( - "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// SetCondition sets the status condition. It either overwrites the existing one or creates a new one. -func (apiResourceImport *APIResourceImport) SetCondition(newCondition APIResourceImportCondition) { - newCondition.LastTransitionTime = metav1.NewTime(time.Now()) - - existingCondition := apiResourceImport.FindCondition(newCondition.Type) - if existingCondition == nil { - apiResourceImport.Status.Conditions = append(apiResourceImport.Status.Conditions, newCondition) - return - } - - if existingCondition.Status != newCondition.Status || existingCondition.LastTransitionTime.IsZero() { - existingCondition.LastTransitionTime = newCondition.LastTransitionTime - } - - existingCondition.Status = newCondition.Status - existingCondition.Reason = newCondition.Reason - existingCondition.Message = newCondition.Message -} - -// RemoveCondition removes the status condition. -func (apiResourceImport *APIResourceImport) RemoveCondition(conditionType APIResourceImportConditionType) { - newConditions := []APIResourceImportCondition{} - for _, condition := range apiResourceImport.Status.Conditions { - if condition.Type != conditionType { - newConditions = append(newConditions, condition) - } - } - apiResourceImport.Status.Conditions = newConditions -} - -// FindCondition returns the condition you're looking for or nil. -func (apiResourceImport *APIResourceImport) FindCondition(conditionType APIResourceImportConditionType) *APIResourceImportCondition { - for i := range apiResourceImport.Status.Conditions { - if apiResourceImport.Status.Conditions[i].Type == conditionType { - return &apiResourceImport.Status.Conditions[i] - } - } - - return nil -} - -// IsConditionTrue indicates if the condition is present and strictly true. -func (apiResourceImport *APIResourceImport) IsConditionTrue(conditionType APIResourceImportConditionType) bool { - return apiResourceImport.IsConditionPresentAndEqual(conditionType, metav1.ConditionTrue) -} - -// IsConditionFalse indicates if the condition is present and false. -func (apiResourceImport *APIResourceImport) IsConditionFalse(conditionType APIResourceImportConditionType) bool { - return apiResourceImport.IsConditionPresentAndEqual(conditionType, metav1.ConditionFalse) -} - -// IsConditionPresentAndEqual indicates if the condition is present and equal to the given status. -func (apiResourceImport *APIResourceImport) IsConditionPresentAndEqual(conditionType APIResourceImportConditionType, status metav1.ConditionStatus) bool { - for _, condition := range apiResourceImport.Status.Conditions { - if condition.Type == conditionType { - return condition.Status == status - } - } - return false -} - -// IsAPIResourceImportConditionEquivalent returns true if the lhs and rhs are equivalent except for times. -func IsAPIResourceImportConditionEquivalent(lhs, rhs *APIResourceImportCondition) bool { - if lhs == nil && rhs == nil { - return true - } - if lhs == nil || rhs == nil { - return false - } - - return lhs.Message == rhs.Message && lhs.Reason == rhs.Reason && lhs.Status == rhs.Status && lhs.Type == rhs.Type -} - -// GVR returns the GVR that this APIResourceImport represents. -func (apiResourceImport *APIResourceImport) GVR() metav1.GroupVersionResource { - return metav1.GroupVersionResource{ - Group: apiResourceImport.Spec.GroupVersion.Group, - Version: apiResourceImport.Spec.GroupVersion.Version, - Resource: apiResourceImport.Spec.Plural, - } -} diff --git a/sdk/apis/apiresource/v1alpha1/apiresourceimport_types.go b/sdk/apis/apiresource/v1alpha1/apiresourceimport_types.go deleted file mode 100644 index b9286c2bfc5..00000000000 --- a/sdk/apis/apiresource/v1alpha1/apiresourceimport_types.go +++ /dev/null @@ -1,153 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// APIResourceImport describes an API resource imported from external clusters (either physical or logical) -// for a given GVR. -// -// +crd -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories=kcp -// +kubebuilder:printcolumn:name="Location",type="string",JSONPath=`.spec.location`,priority=1 -// +kubebuilder:printcolumn:name="Schema update strategy",type="string",JSONPath=`.spec.schemaUpdateStrategy`,priority=2 -// +kubebuilder:printcolumn:name="API Version",type="string",JSONPath=`.metadata.annotations.apiresource\.kcp\.dev/apiVersion`,priority=3 -// +kubebuilder:printcolumn:name="API Resource",type="string",JSONPath=`.spec.plural`,priority=4 -// +kubebuilder:printcolumn:name="Compatible",type="string",JSONPath=`.status.conditions[?(@.type=="Compatible")].status`,priority=5 -// +kubebuilder:printcolumn:name="Available",type="string",JSONPath=`.status.conditions[?(@.type=="Available")].status`,priority=6 -type APIResourceImport struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty"` - - // +optional - Spec APIResourceImportSpec `json:"spec,omitempty"` - - // +optional - Status APIResourceImportStatus `json:"status,omitempty"` -} - -// SchemaUpdateStrategy defines the strategy for updating the -// correspondoing negotiated API resource -// based on the schema of this API Resource Import. -type SchemaUpdateStrategyType string - -const ( - // UpdateNever means that the corresponding negotiated API Resource will never be modified - // to take in account the schema of the API resource import. - // No LCD will be used, and the schema comparison will only - // serve to known whether the schema of an API Resource import would be compatible with the - // enforced CRD schema, and flag the API Resource import (and possibly the corresponding cluster location) - // accordingly. - UpdateNever SchemaUpdateStrategyType = "UpdateNever" - - // UpdateUnpublished means that the corresponding negotiated API Resource will be modified - // to take in account the schema of the API resource import, but only for unpublished - // negotiated API resources. - // The modifications to the negotiated API resource will be based (if possible) on a LCD schema between - // the schema of the resource import and the schema of the already-existing negotiated API resource. - // Of course this is not valid if the negotiated API resource has been "enforced" by applying a CRD for - // the same GVR manually. - UpdateUnpublished SchemaUpdateStrategyType = "UpdateUnpublished" - - // UpdateUnpublished means that the corresponding negotiated API Resource will be modified - // to take in account the schema of the API resource import, even if the already-existing - // negotiated API resource has already been published (as a CRD). - // The modifications to the negotiated API resource will be based (if possible) on a LCD schema between - // the schema of the resource import and the schema of the already-existing negotiated API resource. - // Of course this is not valid if the negotiated API resource has been "enforced" by applying a CRD for - // the same GVR manually. - UpdatePublished SchemaUpdateStrategyType = "UpdatePublished" -) - -func (strategy SchemaUpdateStrategyType) CanUpdate(negotiatedAPIResourceIsPublished bool) bool { - switch strategy { - case UpdateNever: - return false - case UpdateUnpublished: - return !negotiatedAPIResourceIsPublished - case UpdatePublished: - return true - } - return false -} - -// APIResourceImportSpec holds the desired state of the APIResourceImport (from the client). -type APIResourceImportSpec struct { - CommonAPIResourceSpec `json:",inline"` - - // SchemaUpdateStrategy defines the schema update strategy for this API Resource import. - // Default value is UpdateUnpublished - // - // +optional - SchemaUpdateStrategy SchemaUpdateStrategyType `json:"schemaUpdateStrategy,omitempty"` - - // Locaton the API resource is imported from - // This field is required - Location string `json:"location"` -} - -// APIResourceImportConditionType is a valid value for APIResourceImportCondition.Type. -type APIResourceImportConditionType string - -const ( - // Compatible means that this API Resource import is compatible with the current - // Negotiated API Resource. - Compatible APIResourceImportConditionType = "Compatible" - // Available means that this API Resource import is compatible with the current - // Negotiated API Resource, which has been published as a CRD. - Available APIResourceImportConditionType = "Available" -) - -// APIResourceImportCondition contains details for the current condition of this negotiated api resource. -type APIResourceImportCondition struct { - // Type is the type of the condition. Types include Compatible. - Type APIResourceImportConditionType `json:"type"` - // Status is the status of the condition. - // Can be True, False, Unknown. - Status metav1.ConditionStatus `json:"status"` - // Last time the condition transitioned from one status to another. - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - // Unique, one-word, CamelCase reason for the condition's last transition. - // +optional - Reason string `json:"reason,omitempty"` - // Human-readable message indicating details about last transition. - // +optional - Message string `json:"message,omitempty"` -} - -// APIResourceImportStatus communicates the observed state of the APIResourceImport (from the controller). -type APIResourceImportStatus struct { - Conditions []APIResourceImportCondition `json:"conditions,omitempty"` -} - -// APIResourceImportList is a list of APIResourceImport resources -// -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type APIResourceImportList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []APIResourceImport `json:"items"` -} diff --git a/sdk/apis/apiresource/v1alpha1/common_types.go b/sdk/apis/apiresource/v1alpha1/common_types.go deleted file mode 100644 index 12fee017e61..00000000000 --- a/sdk/apis/apiresource/v1alpha1/common_types.go +++ /dev/null @@ -1,191 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v1alpha1 - -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" -) - -const APIVersionAnnotation = "apiresource.kcp.io/apiVersion" - -type ColumnDefinition struct { - metav1.TableColumnDefinition `json:",inline"` - - JSONPath *string `json:"jsonPath"` -} - -type ColumnDefinitions []ColumnDefinition - -func (cd *ColumnDefinitions) ImportFromCRDVersion(crdVersion *apiextensionsv1.CustomResourceDefinitionVersion) *ColumnDefinitions { - alreadyExists := func(name string) bool { - for _, colDef := range *cd { - if colDef.Name == name { - return true - } - } - return false - } - - for _, apc := range crdVersion.AdditionalPrinterColumns { - if !alreadyExists(apc.Name) { - jsonPath := apc.JSONPath - *cd = append(*cd, ColumnDefinition{ - TableColumnDefinition: metav1.TableColumnDefinition{ - Name: apc.Name, - Type: apc.Type, - Format: apc.Format, - Description: apc.Description, - Priority: apc.Priority, - }, - JSONPath: &jsonPath, - }) - } - } - return cd -} - -func (cd *ColumnDefinitions) ToCustomResourceColumnDefinitions() []apiextensionsv1.CustomResourceColumnDefinition { - crdcds := make([]apiextensionsv1.CustomResourceColumnDefinition, 0, len(*cd)) - for _, cd := range *cd { - if cd.JSONPath == nil { - continue - } - crdcds = append(crdcds, apiextensionsv1.CustomResourceColumnDefinition{ - Name: cd.Name, - Type: cd.Type, - Format: cd.Format, - Description: cd.Description, - Priority: cd.Priority, - JSONPath: *cd.JSONPath, - }) - } - return crdcds -} - -type SubResource struct { - Name string `json:"name"` -} - -const ( - ScaleSubResourceName string = "scale" - StatusSubResourceName string = "status" -) - -type SubResources []SubResource - -func (sr *SubResources) ImportFromCRDVersion(crdVersion *apiextensionsv1.CustomResourceDefinitionVersion) *SubResources { - alreadyExists := func(name string) bool { - for _, subResource := range *sr { - if subResource.Name == name { - return true - } - } - return false - } - - if crdVersion.Subresources != nil && crdVersion.Subresources.Scale != nil { - if !alreadyExists(ScaleSubResourceName) { - *sr = append(*sr, SubResource{ - Name: ScaleSubResourceName, - }) - } - } - if crdVersion.Subresources != nil && crdVersion.Subresources.Status != nil { - if !alreadyExists(StatusSubResourceName) { - *sr = append(*sr, SubResource{ - Name: StatusSubResourceName, - }) - } - } - return sr -} - -func (sr *SubResources) Contains(name string) bool { - for _, r := range *sr { - if r.Name == name { - return true - } - } - return false -} - -type GroupVersion struct { - // +optional - Group string `json:"group,omitempty"` - Version string `json:"version"` -} - -func (v GroupVersion) APIVersion() string { - return metav1.GroupVersion{ - Group: v.APIGroup(), - Version: v.Version, - }.String() -} - -func (v GroupVersion) APIGroup() string { - group := v.Group - if group == "core" { - group = "" - } - return group -} - -// CommonAPIResourceSpec holds the common content of both NegotiatedAPIResourceSpec -// and APIResourceImportSpec. -type CommonAPIResourceSpec struct { - GroupVersion GroupVersion `json:"groupVersion"` - - Scope apiextensionsv1.ResourceScope `json:"scope"` - - apiextensionsv1.CustomResourceDefinitionNames `json:",inline"` - - // +required - // +kubebuilder:pruning:PreserveUnknownFields - // +structType=atomic - OpenAPIV3Schema runtime.RawExtension `json:"openAPIV3Schema"` - - // +patchMergeKey=name - // +patchStrategy=merge - // +optional - SubResources SubResources `json:"subResources,omitempty" patchStrategy:"merge" patchMergeKey:"name"` - - // +patchMergeKey=name - // +patchStrategy=merge - // +optional - ColumnDefinitions ColumnDefinitions `json:"columnDefinitions,omitempty" patchStrategy:"merge" patchMergeKey:"name"` -} - -func (spec *CommonAPIResourceSpec) GetSchema() (*apiextensionsv1.JSONSchemaProps, error) { - s := &apiextensionsv1.JSONSchemaProps{} - if err := json.Unmarshal(spec.OpenAPIV3Schema.Raw, s); err != nil { - return nil, err - } - return s, nil -} - -func (spec *CommonAPIResourceSpec) SetSchema(s *apiextensionsv1.JSONSchemaProps) error { - bytes, err := json.Marshal(s) - if err != nil { - return err - } - spec.OpenAPIV3Schema.Raw = bytes - return nil -} diff --git a/sdk/apis/apiresource/v1alpha1/doc.go b/sdk/apis/apiresource/v1alpha1/doc.go deleted file mode 100644 index 691d0af79d6..00000000000 --- a/sdk/apis/apiresource/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// +k8s:deepcopy-gen=package,register -// +groupName=apiresource.kcp.io -// +k8s:openapi-gen=true -package v1alpha1 diff --git a/sdk/apis/apiresource/v1alpha1/negotiatedapiresource_helpers.go b/sdk/apis/apiresource/v1alpha1/negotiatedapiresource_helpers.go deleted file mode 100644 index d33d601b4ea..00000000000 --- a/sdk/apis/apiresource/v1alpha1/negotiatedapiresource_helpers.go +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v1alpha1 - -import ( - "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// SetCondition sets the status condition. It either overwrites the existing one or creates a new one. -func (negotiatedApiResource *NegotiatedAPIResource) SetCondition(newCondition NegotiatedAPIResourceCondition) { - newCondition.LastTransitionTime = metav1.NewTime(time.Now()) - - existingCondition := negotiatedApiResource.FindCondition(newCondition.Type) - if existingCondition == nil { - negotiatedApiResource.Status.Conditions = append(negotiatedApiResource.Status.Conditions, newCondition) - return - } - - if existingCondition.Status != newCondition.Status || existingCondition.LastTransitionTime.IsZero() { - existingCondition.LastTransitionTime = newCondition.LastTransitionTime - } - - existingCondition.Status = newCondition.Status - existingCondition.Reason = newCondition.Reason - existingCondition.Message = newCondition.Message -} - -// RemoveCondition removes the status condition. -func (negotiatedApiResource *NegotiatedAPIResource) RemoveCondition(conditionType NegotiatedAPIResourceConditionType) { - newConditions := []NegotiatedAPIResourceCondition{} - for _, condition := range negotiatedApiResource.Status.Conditions { - if condition.Type != conditionType { - newConditions = append(newConditions, condition) - } - } - negotiatedApiResource.Status.Conditions = newConditions -} - -// FindCondition returns the condition you're looking for or nil. -func (negotiatedApiResource *NegotiatedAPIResource) FindCondition(conditionType NegotiatedAPIResourceConditionType) *NegotiatedAPIResourceCondition { - for i := range negotiatedApiResource.Status.Conditions { - if negotiatedApiResource.Status.Conditions[i].Type == conditionType { - return &negotiatedApiResource.Status.Conditions[i] - } - } - - return nil -} - -// IsConditionTrue indicates if the condition is present and strictly true. -func (negotiatedApiResource *NegotiatedAPIResource) IsConditionTrue(conditionType NegotiatedAPIResourceConditionType) bool { - return negotiatedApiResource.IsConditionPresentAndEqual(conditionType, metav1.ConditionTrue) -} - -// IsConditionFalse indicates if the condition is present and false. -func (negotiatedApiResource *NegotiatedAPIResource) IsConditionFalse(conditionType NegotiatedAPIResourceConditionType) bool { - return negotiatedApiResource.IsConditionPresentAndEqual(conditionType, metav1.ConditionFalse) -} - -// IsConditionPresentAndEqual indicates if the condition is present and equal to the given status. -func (negotiatedApiResource *NegotiatedAPIResource) IsConditionPresentAndEqual(conditionType NegotiatedAPIResourceConditionType, status metav1.ConditionStatus) bool { - for _, condition := range negotiatedApiResource.Status.Conditions { - if condition.Type == conditionType { - return condition.Status == status - } - } - return false -} - -// IsNegotiatedAPIResourceConditionEquivalent returns true if the lhs and rhs are equivalent except for times. -func IsNegotiatedAPIResourceConditionEquivalent(lhs, rhs *NegotiatedAPIResourceCondition) bool { - if lhs == nil && rhs == nil { - return true - } - if lhs == nil || rhs == nil { - return false - } - - return lhs.Message == rhs.Message && lhs.Reason == rhs.Reason && lhs.Status == rhs.Status && lhs.Type == rhs.Type -} - -// GVR returns the GVR that this NegotiatedAPIResource represents. -func (negotiatedApiResource *NegotiatedAPIResource) GVR() metav1.GroupVersionResource { - return metav1.GroupVersionResource{ - Group: negotiatedApiResource.Spec.GroupVersion.Group, - Version: negotiatedApiResource.Spec.GroupVersion.Version, - Resource: negotiatedApiResource.Spec.Plural, - } -} diff --git a/sdk/apis/apiresource/v1alpha1/negotiatedapiresource_types.go b/sdk/apis/apiresource/v1alpha1/negotiatedapiresource_types.go deleted file mode 100644 index d95f65ae7e6..00000000000 --- a/sdk/apis/apiresource/v1alpha1/negotiatedapiresource_types.go +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// NegotiatedAPIResource describes the result of either the normalization of -// any number of imports of an API resource from external clusters (either physical or logical), -// or the manual application of a CRD version for the corresponding GVR. -// -// +crd -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories=kcp -// +kubebuilder:printcolumn:name="Publish",type="boolean",JSONPath=`.spec.publish`,priority=1 -// +kubebuilder:printcolumn:name="API Version",type="string",JSONPath=`.metadata.annotations.apiresource\.kcp\.dev/apiVersion`,priority=3 -// +kubebuilder:printcolumn:name="API Resource",type="string",JSONPath=`.spec.plural`,priority=4 -// +kubebuilder:printcolumn:name="Published",type="string",JSONPath=`.status.conditions[?(@.type=="Published")].status`,priority=5 -// +kubebuilder:printcolumn:name="Enforced",type="string",JSONPath=`.status.conditions[?(@.type=="Enforced")].status`,priority=6 -type NegotiatedAPIResource struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty"` - - // +optional - Spec NegotiatedAPIResourceSpec `json:"spec,omitempty"` - - // +optional - Status NegotiatedAPIResourceStatus `json:"status,omitempty"` -} - -// NegotiatedAPIResourceSpec holds the desired state of the NegotiatedAPIResource (from the client). -type NegotiatedAPIResourceSpec struct { - CommonAPIResourceSpec `json:",inline"` - Publish bool `json:"publish,omitempty"` -} - -// NegotiatedAPIResourceConditionType is a valid value for NegotiatedAPIResourceCondition.Type. -type NegotiatedAPIResourceConditionType string - -const ( - // Submitted means that this negotiated API Resource has been submitted - // to the logical cluster as an applied CRD. - Submitted NegotiatedAPIResourceConditionType = "Submitted" - - // Published means that this negotiated API Resource has been published - // to the logical cluster as an installed and accepted CRD - // If the API Resource has been submitted - // to the logical cluster as an applied CRD, but the CRD could not be published - // correctly due to various reasons (non-structural schema, non-accepted names, ...) - // then the Published condition will be false. - Published NegotiatedAPIResourceConditionType = "Published" - - // Enforced means that a CRD version for the same GVR has been manually applied, - // so that the current schema of the negotiated api resource has been forcbly - // replaced by the schema of the manually-applied CRD. - // In such a condition, changes in `APIResourceImport`s would not, by any mean, - // impact the negotiated schema: no LCD will be used, and the schema comparison will only - // serve to known whether the schema of an API Resource import would be compatible with the - // enforced CRD schema, and flag the API Resource import (and possibly the corresponding cluster location) - // accordingly. - Enforced NegotiatedAPIResourceConditionType = "Enforced" -) - -// NegotiatedAPIResourceCondition contains details for the current condition of this negotiated api resource. -type NegotiatedAPIResourceCondition struct { - // Type is the type of the condition. Types include Submitted, Published, Refused and Enforced. - Type NegotiatedAPIResourceConditionType `json:"type"` - // Status is the status of the condition. - // Can be True, False, Unknown. - Status metav1.ConditionStatus `json:"status"` - // Last time the condition transitioned from one status to another. - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - // Unique, one-word, CamelCase reason for the condition's last transition. - // +optional - Reason string `json:"reason,omitempty"` - // Human-readable message indicating details about last transition. - // +optional - Message string `json:"message,omitempty"` -} - -// NegotiatedAPIResourceStatus communicates the observed state of the NegotiatedAPIResource (from the controller). -type NegotiatedAPIResourceStatus struct { - Conditions []NegotiatedAPIResourceCondition `json:"conditions,omitempty"` -} - -// NegotiatedAPIResourceList is a list of NegotiatedAPIResource resources -// -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type NegotiatedAPIResourceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []NegotiatedAPIResource `json:"items"` -} diff --git a/sdk/apis/apiresource/v1alpha1/register.go b/sdk/apis/apiresource/v1alpha1/register.go deleted file mode 100644 index 91f4325c5d4..00000000000 --- a/sdk/apis/apiresource/v1alpha1/register.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 2021 The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - - "github.com/kcp-dev/kcp/sdk/apis/apiresource" -) - -// SchemeGroupVersion is group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: apiresource.GroupName, Version: "v1alpha1"} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind. -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource. -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &APIResourceImport{}, - &APIResourceImportList{}, - &NegotiatedAPIResource{}, - &NegotiatedAPIResourceList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/sdk/apis/apiresource/v1alpha1/zz_generated.deepcopy.go b/sdk/apis/apiresource/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 6233e655dff..00000000000 --- a/sdk/apis/apiresource/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,389 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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 v1alpha1 - -import ( - 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 *APIResourceImport) DeepCopyInto(out *APIResourceImport) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImport. -func (in *APIResourceImport) DeepCopy() *APIResourceImport { - if in == nil { - return nil - } - out := new(APIResourceImport) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *APIResourceImport) 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 *APIResourceImportCondition) DeepCopyInto(out *APIResourceImportCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportCondition. -func (in *APIResourceImportCondition) DeepCopy() *APIResourceImportCondition { - if in == nil { - return nil - } - out := new(APIResourceImportCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIResourceImportList) DeepCopyInto(out *APIResourceImportList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]APIResourceImport, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportList. -func (in *APIResourceImportList) DeepCopy() *APIResourceImportList { - if in == nil { - return nil - } - out := new(APIResourceImportList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *APIResourceImportList) 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 *APIResourceImportSpec) DeepCopyInto(out *APIResourceImportSpec) { - *out = *in - in.CommonAPIResourceSpec.DeepCopyInto(&out.CommonAPIResourceSpec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportSpec. -func (in *APIResourceImportSpec) DeepCopy() *APIResourceImportSpec { - if in == nil { - return nil - } - out := new(APIResourceImportSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIResourceImportStatus) DeepCopyInto(out *APIResourceImportStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]APIResourceImportCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportStatus. -func (in *APIResourceImportStatus) DeepCopy() *APIResourceImportStatus { - if in == nil { - return nil - } - out := new(APIResourceImportStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ColumnDefinition) DeepCopyInto(out *ColumnDefinition) { - *out = *in - out.TableColumnDefinition = in.TableColumnDefinition - if in.JSONPath != nil { - in, out := &in.JSONPath, &out.JSONPath - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnDefinition. -func (in *ColumnDefinition) DeepCopy() *ColumnDefinition { - if in == nil { - return nil - } - out := new(ColumnDefinition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in ColumnDefinitions) DeepCopyInto(out *ColumnDefinitions) { - { - in := &in - *out = make(ColumnDefinitions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnDefinitions. -func (in ColumnDefinitions) DeepCopy() ColumnDefinitions { - if in == nil { - return nil - } - out := new(ColumnDefinitions) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CommonAPIResourceSpec) DeepCopyInto(out *CommonAPIResourceSpec) { - *out = *in - out.GroupVersion = in.GroupVersion - in.CustomResourceDefinitionNames.DeepCopyInto(&out.CustomResourceDefinitionNames) - in.OpenAPIV3Schema.DeepCopyInto(&out.OpenAPIV3Schema) - if in.SubResources != nil { - in, out := &in.SubResources, &out.SubResources - *out = make(SubResources, len(*in)) - copy(*out, *in) - } - if in.ColumnDefinitions != nil { - in, out := &in.ColumnDefinitions, &out.ColumnDefinitions - *out = make(ColumnDefinitions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonAPIResourceSpec. -func (in *CommonAPIResourceSpec) DeepCopy() *CommonAPIResourceSpec { - if in == nil { - return nil - } - out := new(CommonAPIResourceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GroupVersion) DeepCopyInto(out *GroupVersion) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupVersion. -func (in *GroupVersion) DeepCopy() *GroupVersion { - if in == nil { - return nil - } - out := new(GroupVersion) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NegotiatedAPIResource) DeepCopyInto(out *NegotiatedAPIResource) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResource. -func (in *NegotiatedAPIResource) DeepCopy() *NegotiatedAPIResource { - if in == nil { - return nil - } - out := new(NegotiatedAPIResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NegotiatedAPIResource) 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 *NegotiatedAPIResourceCondition) DeepCopyInto(out *NegotiatedAPIResourceCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceCondition. -func (in *NegotiatedAPIResourceCondition) DeepCopy() *NegotiatedAPIResourceCondition { - if in == nil { - return nil - } - out := new(NegotiatedAPIResourceCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NegotiatedAPIResourceList) DeepCopyInto(out *NegotiatedAPIResourceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NegotiatedAPIResource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceList. -func (in *NegotiatedAPIResourceList) DeepCopy() *NegotiatedAPIResourceList { - if in == nil { - return nil - } - out := new(NegotiatedAPIResourceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NegotiatedAPIResourceList) 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 *NegotiatedAPIResourceSpec) DeepCopyInto(out *NegotiatedAPIResourceSpec) { - *out = *in - in.CommonAPIResourceSpec.DeepCopyInto(&out.CommonAPIResourceSpec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceSpec. -func (in *NegotiatedAPIResourceSpec) DeepCopy() *NegotiatedAPIResourceSpec { - if in == nil { - return nil - } - out := new(NegotiatedAPIResourceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NegotiatedAPIResourceStatus) DeepCopyInto(out *NegotiatedAPIResourceStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]NegotiatedAPIResourceCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceStatus. -func (in *NegotiatedAPIResourceStatus) DeepCopy() *NegotiatedAPIResourceStatus { - if in == nil { - return nil - } - out := new(NegotiatedAPIResourceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SubResource) DeepCopyInto(out *SubResource) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResource. -func (in *SubResource) DeepCopy() *SubResource { - if in == nil { - return nil - } - out := new(SubResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in SubResources) DeepCopyInto(out *SubResources) { - { - in := &in - *out = make(SubResources, len(*in)) - copy(*out, *in) - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResources. -func (in SubResources) DeepCopy() SubResources { - if in == nil { - return nil - } - out := new(SubResources) - in.DeepCopyInto(out) - return *out -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimport.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimport.go deleted file mode 100644 index 1f2583f32f6..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimport.go +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - - v1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/meta/v1" -) - -// APIResourceImportApplyConfiguration represents an declarative configuration of the APIResourceImport type for use -// with apply. -type APIResourceImportApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *APIResourceImportSpecApplyConfiguration `json:"spec,omitempty"` - Status *APIResourceImportStatusApplyConfiguration `json:"status,omitempty"` -} - -// APIResourceImport constructs an declarative configuration of the APIResourceImport type for use with -// apply. -func APIResourceImport(name string) *APIResourceImportApplyConfiguration { - b := &APIResourceImportApplyConfiguration{} - b.WithName(name) - b.WithKind("APIResourceImport") - b.WithAPIVersion("apiresource.kcp.io/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithKind(value string) *APIResourceImportApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithAPIVersion(value string) *APIResourceImportApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithName(value string) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithGenerateName(value string) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithNamespace(value string) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithUID(value types.UID) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithResourceVersion(value string) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithGeneration(value int64) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithCreationTimestamp(value metav1.Time) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *APIResourceImportApplyConfiguration) WithLabels(entries map[string]string) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *APIResourceImportApplyConfiguration) WithAnnotations(entries map[string]string) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *APIResourceImportApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *APIResourceImportApplyConfiguration) WithFinalizers(values ...string) *APIResourceImportApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *APIResourceImportApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithSpec(value *APIResourceImportSpecApplyConfiguration) *APIResourceImportApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *APIResourceImportApplyConfiguration) WithStatus(value *APIResourceImportStatusApplyConfiguration) *APIResourceImportApplyConfiguration { - b.Status = value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportcondition.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportcondition.go deleted file mode 100644 index 71004ed85a2..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportcondition.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" -) - -// APIResourceImportConditionApplyConfiguration represents an declarative configuration of the APIResourceImportCondition type for use -// with apply. -type APIResourceImportConditionApplyConfiguration struct { - Type *v1alpha1.APIResourceImportConditionType `json:"type,omitempty"` - Status *v1.ConditionStatus `json:"status,omitempty"` - LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// APIResourceImportConditionApplyConfiguration constructs an declarative configuration of the APIResourceImportCondition type for use with -// apply. -func APIResourceImportCondition() *APIResourceImportConditionApplyConfiguration { - return &APIResourceImportConditionApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *APIResourceImportConditionApplyConfiguration) WithType(value v1alpha1.APIResourceImportConditionType) *APIResourceImportConditionApplyConfiguration { - b.Type = &value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *APIResourceImportConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *APIResourceImportConditionApplyConfiguration { - b.Status = &value - return b -} - -// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LastTransitionTime field is set to the value of the last call. -func (b *APIResourceImportConditionApplyConfiguration) WithLastTransitionTime(value v1.Time) *APIResourceImportConditionApplyConfiguration { - b.LastTransitionTime = &value - return b -} - -// WithReason sets the Reason field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Reason field is set to the value of the last call. -func (b *APIResourceImportConditionApplyConfiguration) WithReason(value string) *APIResourceImportConditionApplyConfiguration { - b.Reason = &value - return b -} - -// WithMessage sets the Message field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Message field is set to the value of the last call. -func (b *APIResourceImportConditionApplyConfiguration) WithMessage(value string) *APIResourceImportConditionApplyConfiguration { - b.Message = &value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportspec.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportspec.go deleted file mode 100644 index f8445769c38..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportspec.go +++ /dev/null @@ -1,148 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" -) - -// APIResourceImportSpecApplyConfiguration represents an declarative configuration of the APIResourceImportSpec type for use -// with apply. -type APIResourceImportSpecApplyConfiguration struct { - CommonAPIResourceSpecApplyConfiguration `json:",inline"` - SchemaUpdateStrategy *apiresourcev1alpha1.SchemaUpdateStrategyType `json:"schemaUpdateStrategy,omitempty"` - Location *string `json:"location,omitempty"` -} - -// APIResourceImportSpecApplyConfiguration constructs an declarative configuration of the APIResourceImportSpec type for use with -// apply. -func APIResourceImportSpec() *APIResourceImportSpecApplyConfiguration { - return &APIResourceImportSpecApplyConfiguration{} -} - -// WithGroupVersion sets the GroupVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GroupVersion field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithGroupVersion(value *GroupVersionApplyConfiguration) *APIResourceImportSpecApplyConfiguration { - b.GroupVersion = value - return b -} - -// WithScope sets the Scope field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Scope field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithScope(value v1.ResourceScope) *APIResourceImportSpecApplyConfiguration { - b.Scope = &value - return b -} - -// WithPlural sets the Plural field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Plural field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithPlural(value string) *APIResourceImportSpecApplyConfiguration { - b.Plural = &value - return b -} - -// WithSingular sets the Singular field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Singular field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithSingular(value string) *APIResourceImportSpecApplyConfiguration { - b.Singular = &value - return b -} - -// WithShortNames adds the given value to the ShortNames field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the ShortNames field. -func (b *APIResourceImportSpecApplyConfiguration) WithShortNames(values ...string) *APIResourceImportSpecApplyConfiguration { - for i := range values { - b.ShortNames = append(b.ShortNames, values[i]) - } - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithKind(value string) *APIResourceImportSpecApplyConfiguration { - b.Kind = &value - return b -} - -// WithListKind sets the ListKind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ListKind field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithListKind(value string) *APIResourceImportSpecApplyConfiguration { - b.ListKind = &value - return b -} - -// WithCategories adds the given value to the Categories field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Categories field. -func (b *APIResourceImportSpecApplyConfiguration) WithCategories(values ...string) *APIResourceImportSpecApplyConfiguration { - for i := range values { - b.Categories = append(b.Categories, values[i]) - } - return b -} - -// WithOpenAPIV3Schema sets the OpenAPIV3Schema field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the OpenAPIV3Schema field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithOpenAPIV3Schema(value runtime.RawExtension) *APIResourceImportSpecApplyConfiguration { - b.OpenAPIV3Schema = &value - return b -} - -// WithSubResources sets the SubResources field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the SubResources field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithSubResources(value apiresourcev1alpha1.SubResources) *APIResourceImportSpecApplyConfiguration { - b.SubResources = &value - return b -} - -// WithColumnDefinitions sets the ColumnDefinitions field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ColumnDefinitions field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithColumnDefinitions(value apiresourcev1alpha1.ColumnDefinitions) *APIResourceImportSpecApplyConfiguration { - b.ColumnDefinitions = &value - return b -} - -// WithSchemaUpdateStrategy sets the SchemaUpdateStrategy field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the SchemaUpdateStrategy field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithSchemaUpdateStrategy(value apiresourcev1alpha1.SchemaUpdateStrategyType) *APIResourceImportSpecApplyConfiguration { - b.SchemaUpdateStrategy = &value - return b -} - -// WithLocation sets the Location field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Location field is set to the value of the last call. -func (b *APIResourceImportSpecApplyConfiguration) WithLocation(value string) *APIResourceImportSpecApplyConfiguration { - b.Location = &value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportstatus.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportstatus.go deleted file mode 100644 index b457b9f50f5..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/apiresourceimportstatus.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// APIResourceImportStatusApplyConfiguration represents an declarative configuration of the APIResourceImportStatus type for use -// with apply. -type APIResourceImportStatusApplyConfiguration struct { - Conditions []APIResourceImportConditionApplyConfiguration `json:"conditions,omitempty"` -} - -// APIResourceImportStatusApplyConfiguration constructs an declarative configuration of the APIResourceImportStatus type for use with -// apply. -func APIResourceImportStatus() *APIResourceImportStatusApplyConfiguration { - return &APIResourceImportStatusApplyConfiguration{} -} - -// WithConditions adds the given value to the Conditions field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Conditions field. -func (b *APIResourceImportStatusApplyConfiguration) WithConditions(values ...*APIResourceImportConditionApplyConfiguration) *APIResourceImportStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithConditions") - } - b.Conditions = append(b.Conditions, *values[i]) - } - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/columndefinition.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/columndefinition.go deleted file mode 100644 index 8b974cc0f03..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/columndefinition.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/meta/v1" -) - -// ColumnDefinitionApplyConfiguration represents an declarative configuration of the ColumnDefinition type for use -// with apply. -type ColumnDefinitionApplyConfiguration struct { - v1.TableColumnDefinitionApplyConfiguration `json:",inline"` - JSONPath *string `json:"jsonPath,omitempty"` -} - -// ColumnDefinitionApplyConfiguration constructs an declarative configuration of the ColumnDefinition type for use with -// apply. -func ColumnDefinition() *ColumnDefinitionApplyConfiguration { - return &ColumnDefinitionApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ColumnDefinitionApplyConfiguration) WithName(value string) *ColumnDefinitionApplyConfiguration { - b.Name = &value - return b -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *ColumnDefinitionApplyConfiguration) WithType(value string) *ColumnDefinitionApplyConfiguration { - b.Type = &value - return b -} - -// WithFormat sets the Format field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Format field is set to the value of the last call. -func (b *ColumnDefinitionApplyConfiguration) WithFormat(value string) *ColumnDefinitionApplyConfiguration { - b.Format = &value - return b -} - -// WithDescription sets the Description field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Description field is set to the value of the last call. -func (b *ColumnDefinitionApplyConfiguration) WithDescription(value string) *ColumnDefinitionApplyConfiguration { - b.Description = &value - return b -} - -// WithPriority sets the Priority field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Priority field is set to the value of the last call. -func (b *ColumnDefinitionApplyConfiguration) WithPriority(value int32) *ColumnDefinitionApplyConfiguration { - b.Priority = &value - return b -} - -// WithJSONPath sets the JSONPath field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the JSONPath field is set to the value of the last call. -func (b *ColumnDefinitionApplyConfiguration) WithJSONPath(value string) *ColumnDefinitionApplyConfiguration { - b.JSONPath = &value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/commonapiresourcespec.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/commonapiresourcespec.go deleted file mode 100644 index ceeccf06895..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/commonapiresourcespec.go +++ /dev/null @@ -1,136 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apiextensionsv1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiextensions/v1" -) - -// CommonAPIResourceSpecApplyConfiguration represents an declarative configuration of the CommonAPIResourceSpec type for use -// with apply. -type CommonAPIResourceSpecApplyConfiguration struct { - GroupVersion *GroupVersionApplyConfiguration `json:"groupVersion,omitempty"` - Scope *v1.ResourceScope `json:"scope,omitempty"` - apiextensionsv1.CustomResourceDefinitionNamesApplyConfiguration `json:",inline"` - OpenAPIV3Schema *runtime.RawExtension `json:"openAPIV3Schema,omitempty"` - SubResources *apiresourcev1alpha1.SubResources `json:"subResources,omitempty"` - ColumnDefinitions *apiresourcev1alpha1.ColumnDefinitions `json:"columnDefinitions,omitempty"` -} - -// CommonAPIResourceSpecApplyConfiguration constructs an declarative configuration of the CommonAPIResourceSpec type for use with -// apply. -func CommonAPIResourceSpec() *CommonAPIResourceSpecApplyConfiguration { - return &CommonAPIResourceSpecApplyConfiguration{} -} - -// WithGroupVersion sets the GroupVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GroupVersion field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithGroupVersion(value *GroupVersionApplyConfiguration) *CommonAPIResourceSpecApplyConfiguration { - b.GroupVersion = value - return b -} - -// WithScope sets the Scope field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Scope field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithScope(value v1.ResourceScope) *CommonAPIResourceSpecApplyConfiguration { - b.Scope = &value - return b -} - -// WithPlural sets the Plural field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Plural field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithPlural(value string) *CommonAPIResourceSpecApplyConfiguration { - b.Plural = &value - return b -} - -// WithSingular sets the Singular field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Singular field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithSingular(value string) *CommonAPIResourceSpecApplyConfiguration { - b.Singular = &value - return b -} - -// WithShortNames adds the given value to the ShortNames field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the ShortNames field. -func (b *CommonAPIResourceSpecApplyConfiguration) WithShortNames(values ...string) *CommonAPIResourceSpecApplyConfiguration { - for i := range values { - b.ShortNames = append(b.ShortNames, values[i]) - } - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithKind(value string) *CommonAPIResourceSpecApplyConfiguration { - b.Kind = &value - return b -} - -// WithListKind sets the ListKind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ListKind field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithListKind(value string) *CommonAPIResourceSpecApplyConfiguration { - b.ListKind = &value - return b -} - -// WithCategories adds the given value to the Categories field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Categories field. -func (b *CommonAPIResourceSpecApplyConfiguration) WithCategories(values ...string) *CommonAPIResourceSpecApplyConfiguration { - for i := range values { - b.Categories = append(b.Categories, values[i]) - } - return b -} - -// WithOpenAPIV3Schema sets the OpenAPIV3Schema field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the OpenAPIV3Schema field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithOpenAPIV3Schema(value runtime.RawExtension) *CommonAPIResourceSpecApplyConfiguration { - b.OpenAPIV3Schema = &value - return b -} - -// WithSubResources sets the SubResources field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the SubResources field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithSubResources(value apiresourcev1alpha1.SubResources) *CommonAPIResourceSpecApplyConfiguration { - b.SubResources = &value - return b -} - -// WithColumnDefinitions sets the ColumnDefinitions field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ColumnDefinitions field is set to the value of the last call. -func (b *CommonAPIResourceSpecApplyConfiguration) WithColumnDefinitions(value apiresourcev1alpha1.ColumnDefinitions) *CommonAPIResourceSpecApplyConfiguration { - b.ColumnDefinitions = &value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/groupversion.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/groupversion.go deleted file mode 100644 index b3e0461252c..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/groupversion.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// GroupVersionApplyConfiguration represents an declarative configuration of the GroupVersion type for use -// with apply. -type GroupVersionApplyConfiguration struct { - Group *string `json:"group,omitempty"` - Version *string `json:"version,omitempty"` -} - -// GroupVersionApplyConfiguration constructs an declarative configuration of the GroupVersion type for use with -// apply. -func GroupVersion() *GroupVersionApplyConfiguration { - return &GroupVersionApplyConfiguration{} -} - -// WithGroup sets the Group field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Group field is set to the value of the last call. -func (b *GroupVersionApplyConfiguration) WithGroup(value string) *GroupVersionApplyConfiguration { - b.Group = &value - return b -} - -// WithVersion sets the Version field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Version field is set to the value of the last call. -func (b *GroupVersionApplyConfiguration) WithVersion(value string) *GroupVersionApplyConfiguration { - b.Version = &value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresource.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresource.go deleted file mode 100644 index ae2212ccc75..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresource.go +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - - v1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/meta/v1" -) - -// NegotiatedAPIResourceApplyConfiguration represents an declarative configuration of the NegotiatedAPIResource type for use -// with apply. -type NegotiatedAPIResourceApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *NegotiatedAPIResourceSpecApplyConfiguration `json:"spec,omitempty"` - Status *NegotiatedAPIResourceStatusApplyConfiguration `json:"status,omitempty"` -} - -// NegotiatedAPIResource constructs an declarative configuration of the NegotiatedAPIResource type for use with -// apply. -func NegotiatedAPIResource(name string) *NegotiatedAPIResourceApplyConfiguration { - b := &NegotiatedAPIResourceApplyConfiguration{} - b.WithName(name) - b.WithKind("NegotiatedAPIResource") - b.WithAPIVersion("apiresource.kcp.io/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithKind(value string) *NegotiatedAPIResourceApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithAPIVersion(value string) *NegotiatedAPIResourceApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithName(value string) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithGenerateName(value string) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithNamespace(value string) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithUID(value types.UID) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithResourceVersion(value string) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithGeneration(value int64) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *NegotiatedAPIResourceApplyConfiguration) WithLabels(entries map[string]string) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *NegotiatedAPIResourceApplyConfiguration) WithAnnotations(entries map[string]string) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *NegotiatedAPIResourceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *NegotiatedAPIResourceApplyConfiguration) WithFinalizers(values ...string) *NegotiatedAPIResourceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *NegotiatedAPIResourceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithSpec(value *NegotiatedAPIResourceSpecApplyConfiguration) *NegotiatedAPIResourceApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *NegotiatedAPIResourceApplyConfiguration) WithStatus(value *NegotiatedAPIResourceStatusApplyConfiguration) *NegotiatedAPIResourceApplyConfiguration { - b.Status = value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcecondition.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcecondition.go deleted file mode 100644 index 5398c3a5321..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcecondition.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" -) - -// NegotiatedAPIResourceConditionApplyConfiguration represents an declarative configuration of the NegotiatedAPIResourceCondition type for use -// with apply. -type NegotiatedAPIResourceConditionApplyConfiguration struct { - Type *v1alpha1.NegotiatedAPIResourceConditionType `json:"type,omitempty"` - Status *v1.ConditionStatus `json:"status,omitempty"` - LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// NegotiatedAPIResourceConditionApplyConfiguration constructs an declarative configuration of the NegotiatedAPIResourceCondition type for use with -// apply. -func NegotiatedAPIResourceCondition() *NegotiatedAPIResourceConditionApplyConfiguration { - return &NegotiatedAPIResourceConditionApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *NegotiatedAPIResourceConditionApplyConfiguration) WithType(value v1alpha1.NegotiatedAPIResourceConditionType) *NegotiatedAPIResourceConditionApplyConfiguration { - b.Type = &value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *NegotiatedAPIResourceConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *NegotiatedAPIResourceConditionApplyConfiguration { - b.Status = &value - return b -} - -// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LastTransitionTime field is set to the value of the last call. -func (b *NegotiatedAPIResourceConditionApplyConfiguration) WithLastTransitionTime(value v1.Time) *NegotiatedAPIResourceConditionApplyConfiguration { - b.LastTransitionTime = &value - return b -} - -// WithReason sets the Reason field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Reason field is set to the value of the last call. -func (b *NegotiatedAPIResourceConditionApplyConfiguration) WithReason(value string) *NegotiatedAPIResourceConditionApplyConfiguration { - b.Reason = &value - return b -} - -// WithMessage sets the Message field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Message field is set to the value of the last call. -func (b *NegotiatedAPIResourceConditionApplyConfiguration) WithMessage(value string) *NegotiatedAPIResourceConditionApplyConfiguration { - b.Message = &value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcespec.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcespec.go deleted file mode 100644 index bc6ab1f53b5..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcespec.go +++ /dev/null @@ -1,139 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" -) - -// NegotiatedAPIResourceSpecApplyConfiguration represents an declarative configuration of the NegotiatedAPIResourceSpec type for use -// with apply. -type NegotiatedAPIResourceSpecApplyConfiguration struct { - CommonAPIResourceSpecApplyConfiguration `json:",inline"` - Publish *bool `json:"publish,omitempty"` -} - -// NegotiatedAPIResourceSpecApplyConfiguration constructs an declarative configuration of the NegotiatedAPIResourceSpec type for use with -// apply. -func NegotiatedAPIResourceSpec() *NegotiatedAPIResourceSpecApplyConfiguration { - return &NegotiatedAPIResourceSpecApplyConfiguration{} -} - -// WithGroupVersion sets the GroupVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GroupVersion field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithGroupVersion(value *GroupVersionApplyConfiguration) *NegotiatedAPIResourceSpecApplyConfiguration { - b.GroupVersion = value - return b -} - -// WithScope sets the Scope field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Scope field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithScope(value v1.ResourceScope) *NegotiatedAPIResourceSpecApplyConfiguration { - b.Scope = &value - return b -} - -// WithPlural sets the Plural field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Plural field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithPlural(value string) *NegotiatedAPIResourceSpecApplyConfiguration { - b.Plural = &value - return b -} - -// WithSingular sets the Singular field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Singular field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithSingular(value string) *NegotiatedAPIResourceSpecApplyConfiguration { - b.Singular = &value - return b -} - -// WithShortNames adds the given value to the ShortNames field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the ShortNames field. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithShortNames(values ...string) *NegotiatedAPIResourceSpecApplyConfiguration { - for i := range values { - b.ShortNames = append(b.ShortNames, values[i]) - } - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithKind(value string) *NegotiatedAPIResourceSpecApplyConfiguration { - b.Kind = &value - return b -} - -// WithListKind sets the ListKind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ListKind field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithListKind(value string) *NegotiatedAPIResourceSpecApplyConfiguration { - b.ListKind = &value - return b -} - -// WithCategories adds the given value to the Categories field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Categories field. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithCategories(values ...string) *NegotiatedAPIResourceSpecApplyConfiguration { - for i := range values { - b.Categories = append(b.Categories, values[i]) - } - return b -} - -// WithOpenAPIV3Schema sets the OpenAPIV3Schema field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the OpenAPIV3Schema field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithOpenAPIV3Schema(value runtime.RawExtension) *NegotiatedAPIResourceSpecApplyConfiguration { - b.OpenAPIV3Schema = &value - return b -} - -// WithSubResources sets the SubResources field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the SubResources field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithSubResources(value apiresourcev1alpha1.SubResources) *NegotiatedAPIResourceSpecApplyConfiguration { - b.SubResources = &value - return b -} - -// WithColumnDefinitions sets the ColumnDefinitions field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ColumnDefinitions field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithColumnDefinitions(value apiresourcev1alpha1.ColumnDefinitions) *NegotiatedAPIResourceSpecApplyConfiguration { - b.ColumnDefinitions = &value - return b -} - -// WithPublish sets the Publish field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Publish field is set to the value of the last call. -func (b *NegotiatedAPIResourceSpecApplyConfiguration) WithPublish(value bool) *NegotiatedAPIResourceSpecApplyConfiguration { - b.Publish = &value - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcestatus.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcestatus.go deleted file mode 100644 index a0faed22b36..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/negotiatedapiresourcestatus.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// NegotiatedAPIResourceStatusApplyConfiguration represents an declarative configuration of the NegotiatedAPIResourceStatus type for use -// with apply. -type NegotiatedAPIResourceStatusApplyConfiguration struct { - Conditions []NegotiatedAPIResourceConditionApplyConfiguration `json:"conditions,omitempty"` -} - -// NegotiatedAPIResourceStatusApplyConfiguration constructs an declarative configuration of the NegotiatedAPIResourceStatus type for use with -// apply. -func NegotiatedAPIResourceStatus() *NegotiatedAPIResourceStatusApplyConfiguration { - return &NegotiatedAPIResourceStatusApplyConfiguration{} -} - -// WithConditions adds the given value to the Conditions field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Conditions field. -func (b *NegotiatedAPIResourceStatusApplyConfiguration) WithConditions(values ...*NegotiatedAPIResourceConditionApplyConfiguration) *NegotiatedAPIResourceStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithConditions") - } - b.Conditions = append(b.Conditions, *values[i]) - } - return b -} diff --git a/sdk/client/applyconfiguration/apiresource/v1alpha1/subresource.go b/sdk/client/applyconfiguration/apiresource/v1alpha1/subresource.go deleted file mode 100644 index ac5b52644fa..00000000000 --- a/sdk/client/applyconfiguration/apiresource/v1alpha1/subresource.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// SubResourceApplyConfiguration represents an declarative configuration of the SubResource type for use -// with apply. -type SubResourceApplyConfiguration struct { - Name *string `json:"name,omitempty"` -} - -// SubResourceApplyConfiguration constructs an declarative configuration of the SubResource type for use with -// apply. -func SubResource() *SubResourceApplyConfiguration { - return &SubResourceApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *SubResourceApplyConfiguration) WithName(value string) *SubResourceApplyConfiguration { - b.Name = &value - return b -} diff --git a/sdk/client/applyconfiguration/utils.go b/sdk/client/applyconfiguration/utils.go index 08f4f9e0568..6dd77ecce59 100644 --- a/sdk/client/applyconfiguration/utils.go +++ b/sdk/client/applyconfiguration/utils.go @@ -23,15 +23,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apisv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" + v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1" conditionsv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/third_party/conditions/apis/conditions/v1alpha1" topologyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/topology/v1alpha1" apiextensionsv1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiextensions/v1" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiresource/v1alpha1" - applyconfigurationapisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apis/v1alpha1" + apisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apis/v1alpha1" applyconfigurationconditionsv1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/conditions/v1alpha1" applyconfigurationcorev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/core/v1alpha1" applyconfigurationmetav1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/meta/v1" @@ -79,89 +77,63 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case v1.SchemeGroupVersion.WithKind("WebhookConversion"): return &apiextensionsv1.WebhookConversionApplyConfiguration{} - // Group=apiresource.kcp.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithKind("APIResourceImport"): - return &apiresourcev1alpha1.APIResourceImportApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("APIResourceImportCondition"): - return &apiresourcev1alpha1.APIResourceImportConditionApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("APIResourceImportSpec"): - return &apiresourcev1alpha1.APIResourceImportSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("APIResourceImportStatus"): - return &apiresourcev1alpha1.APIResourceImportStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("ColumnDefinition"): - return &apiresourcev1alpha1.ColumnDefinitionApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("CommonAPIResourceSpec"): - return &apiresourcev1alpha1.CommonAPIResourceSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("GroupVersion"): - return &apiresourcev1alpha1.GroupVersionApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("NegotiatedAPIResource"): - return &apiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("NegotiatedAPIResourceCondition"): - return &apiresourcev1alpha1.NegotiatedAPIResourceConditionApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("NegotiatedAPIResourceSpec"): - return &apiresourcev1alpha1.NegotiatedAPIResourceSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("NegotiatedAPIResourceStatus"): - return &apiresourcev1alpha1.NegotiatedAPIResourceStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("SubResource"): - return &apiresourcev1alpha1.SubResourceApplyConfiguration{} - // Group=apis.kcp.io, Version=v1alpha1 - case apisv1alpha1.SchemeGroupVersion.WithKind("AcceptablePermissionClaim"): - return &applyconfigurationapisv1alpha1.AcceptablePermissionClaimApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIBinding"): - return &applyconfigurationapisv1alpha1.APIBindingApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIBindingSpec"): - return &applyconfigurationapisv1alpha1.APIBindingSpecApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIBindingStatus"): - return &applyconfigurationapisv1alpha1.APIBindingStatusApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIConversion"): - return &applyconfigurationapisv1alpha1.APIConversionApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIConversionRule"): - return &applyconfigurationapisv1alpha1.APIConversionRuleApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIConversionSpec"): - return &applyconfigurationapisv1alpha1.APIConversionSpecApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIExport"): - return &applyconfigurationapisv1alpha1.APIExportApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIExportEndpoint"): - return &applyconfigurationapisv1alpha1.APIExportEndpointApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIExportEndpointSlice"): - return &applyconfigurationapisv1alpha1.APIExportEndpointSliceApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIExportEndpointSliceSpec"): - return &applyconfigurationapisv1alpha1.APIExportEndpointSliceSpecApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIExportEndpointSliceStatus"): - return &applyconfigurationapisv1alpha1.APIExportEndpointSliceStatusApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIExportSpec"): - return &applyconfigurationapisv1alpha1.APIExportSpecApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIExportStatus"): - return &applyconfigurationapisv1alpha1.APIExportStatusApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIResourceSchema"): - return &applyconfigurationapisv1alpha1.APIResourceSchemaApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIResourceSchemaSpec"): - return &applyconfigurationapisv1alpha1.APIResourceSchemaSpecApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIResourceVersion"): - return &applyconfigurationapisv1alpha1.APIResourceVersionApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("APIVersionConversion"): - return &applyconfigurationapisv1alpha1.APIVersionConversionApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("BindingReference"): - return &applyconfigurationapisv1alpha1.BindingReferenceApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("BoundAPIResource"): - return &applyconfigurationapisv1alpha1.BoundAPIResourceApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("BoundAPIResourceSchema"): - return &applyconfigurationapisv1alpha1.BoundAPIResourceSchemaApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("ExportBindingReference"): - return &applyconfigurationapisv1alpha1.ExportBindingReferenceApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("GroupResource"): - return &applyconfigurationapisv1alpha1.GroupResourceApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("Identity"): - return &applyconfigurationapisv1alpha1.IdentityApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("MaximalPermissionPolicy"): - return &applyconfigurationapisv1alpha1.MaximalPermissionPolicyApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("PermissionClaim"): - return &applyconfigurationapisv1alpha1.PermissionClaimApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("ResourceSelector"): - return &applyconfigurationapisv1alpha1.ResourceSelectorApplyConfiguration{} - case apisv1alpha1.SchemeGroupVersion.WithKind("VirtualWorkspace"): - return &applyconfigurationapisv1alpha1.VirtualWorkspaceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("AcceptablePermissionClaim"): + return &apisv1alpha1.AcceptablePermissionClaimApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIBinding"): + return &apisv1alpha1.APIBindingApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIBindingSpec"): + return &apisv1alpha1.APIBindingSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIBindingStatus"): + return &apisv1alpha1.APIBindingStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIConversion"): + return &apisv1alpha1.APIConversionApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIConversionRule"): + return &apisv1alpha1.APIConversionRuleApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIConversionSpec"): + return &apisv1alpha1.APIConversionSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIExport"): + return &apisv1alpha1.APIExportApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIExportEndpoint"): + return &apisv1alpha1.APIExportEndpointApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIExportEndpointSlice"): + return &apisv1alpha1.APIExportEndpointSliceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIExportEndpointSliceSpec"): + return &apisv1alpha1.APIExportEndpointSliceSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIExportEndpointSliceStatus"): + return &apisv1alpha1.APIExportEndpointSliceStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIExportSpec"): + return &apisv1alpha1.APIExportSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIExportStatus"): + return &apisv1alpha1.APIExportStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIResourceSchema"): + return &apisv1alpha1.APIResourceSchemaApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIResourceSchemaSpec"): + return &apisv1alpha1.APIResourceSchemaSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIResourceVersion"): + return &apisv1alpha1.APIResourceVersionApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("APIVersionConversion"): + return &apisv1alpha1.APIVersionConversionApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("BindingReference"): + return &apisv1alpha1.BindingReferenceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("BoundAPIResource"): + return &apisv1alpha1.BoundAPIResourceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("BoundAPIResourceSchema"): + return &apisv1alpha1.BoundAPIResourceSchemaApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ExportBindingReference"): + return &apisv1alpha1.ExportBindingReferenceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("GroupResource"): + return &apisv1alpha1.GroupResourceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Identity"): + return &apisv1alpha1.IdentityApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("MaximalPermissionPolicy"): + return &apisv1alpha1.MaximalPermissionPolicyApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("PermissionClaim"): + return &apisv1alpha1.PermissionClaimApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ResourceSelector"): + return &apisv1alpha1.ResourceSelectorApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualWorkspace"): + return &apisv1alpha1.VirtualWorkspaceApplyConfiguration{} // Group=conditions, Version=v1alpha1 case conditionsv1alpha1.SchemeGroupVersion.WithKind("Condition"): @@ -194,8 +166,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationmetav1.ObjectMetaApplyConfiguration{} case metav1.SchemeGroupVersion.WithKind("OwnerReference"): return &applyconfigurationmetav1.OwnerReferenceApplyConfiguration{} - case metav1.SchemeGroupVersion.WithKind("TableColumnDefinition"): - return &applyconfigurationmetav1.TableColumnDefinitionApplyConfiguration{} case metav1.SchemeGroupVersion.WithKind("TypeMeta"): return &applyconfigurationmetav1.TypeMetaApplyConfiguration{} diff --git a/sdk/client/clientset/versioned/clientset.go b/sdk/client/clientset/versioned/clientset.go index b0b801c1c44..741803847df 100644 --- a/sdk/client/clientset/versioned/clientset.go +++ b/sdk/client/clientset/versioned/clientset.go @@ -26,7 +26,6 @@ import ( rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/tenancy/v1alpha1" @@ -35,7 +34,6 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - ApiresourceV1alpha1() apiresourcev1alpha1.ApiresourceV1alpha1Interface ApisV1alpha1() apisv1alpha1.ApisV1alpha1Interface CoreV1alpha1() corev1alpha1.CoreV1alpha1Interface TenancyV1alpha1() tenancyv1alpha1.TenancyV1alpha1Interface @@ -45,16 +43,10 @@ type Interface interface { // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - apiresourceV1alpha1 *apiresourcev1alpha1.ApiresourceV1alpha1Client - apisV1alpha1 *apisv1alpha1.ApisV1alpha1Client - coreV1alpha1 *corev1alpha1.CoreV1alpha1Client - tenancyV1alpha1 *tenancyv1alpha1.TenancyV1alpha1Client - topologyV1alpha1 *topologyv1alpha1.TopologyV1alpha1Client -} - -// ApiresourceV1alpha1 retrieves the ApiresourceV1alpha1Client -func (c *Clientset) ApiresourceV1alpha1() apiresourcev1alpha1.ApiresourceV1alpha1Interface { - return c.apiresourceV1alpha1 + apisV1alpha1 *apisv1alpha1.ApisV1alpha1Client + coreV1alpha1 *corev1alpha1.CoreV1alpha1Client + tenancyV1alpha1 *tenancyv1alpha1.TenancyV1alpha1Client + topologyV1alpha1 *topologyv1alpha1.TopologyV1alpha1Client } // ApisV1alpha1 retrieves the ApisV1alpha1Client @@ -121,10 +113,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.apiresourceV1alpha1, err = apiresourcev1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } cs.apisV1alpha1, err = apisv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -162,7 +150,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.apiresourceV1alpha1 = apiresourcev1alpha1.New(c) cs.apisV1alpha1 = apisv1alpha1.New(c) cs.coreV1alpha1 = corev1alpha1.New(c) cs.tenancyV1alpha1 = tenancyv1alpha1.New(c) diff --git a/sdk/client/clientset/versioned/cluster/clientset.go b/sdk/client/clientset/versioned/cluster/clientset.go index 335f1fcac4a..38e474b2806 100644 --- a/sdk/client/clientset/versioned/cluster/clientset.go +++ b/sdk/client/clientset/versioned/cluster/clientset.go @@ -33,7 +33,6 @@ import ( "k8s.io/client-go/util/flowcontrol" client "github.com/kcp-dev/kcp/sdk/client/clientset/versioned" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/tenancy/v1alpha1" @@ -43,7 +42,6 @@ import ( type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface Discovery() discovery.DiscoveryInterface - ApiresourceV1alpha1() apiresourcev1alpha1.ApiresourceV1alpha1ClusterInterface ApisV1alpha1() apisv1alpha1.ApisV1alpha1ClusterInterface CoreV1alpha1() corev1alpha1.CoreV1alpha1ClusterInterface TenancyV1alpha1() tenancyv1alpha1.TenancyV1alpha1ClusterInterface @@ -53,12 +51,11 @@ type ClusterInterface interface { // ClusterClientset contains the clients for groups. type ClusterClientset struct { *discovery.DiscoveryClient - clientCache kcpclient.Cache[*client.Clientset] - apiresourceV1alpha1 *apiresourcev1alpha1.ApiresourceV1alpha1ClusterClient - apisV1alpha1 *apisv1alpha1.ApisV1alpha1ClusterClient - coreV1alpha1 *corev1alpha1.CoreV1alpha1ClusterClient - tenancyV1alpha1 *tenancyv1alpha1.TenancyV1alpha1ClusterClient - topologyV1alpha1 *topologyv1alpha1.TopologyV1alpha1ClusterClient + clientCache kcpclient.Cache[*client.Clientset] + apisV1alpha1 *apisv1alpha1.ApisV1alpha1ClusterClient + coreV1alpha1 *corev1alpha1.CoreV1alpha1ClusterClient + tenancyV1alpha1 *tenancyv1alpha1.TenancyV1alpha1ClusterClient + topologyV1alpha1 *topologyv1alpha1.TopologyV1alpha1ClusterClient } // Discovery retrieves the DiscoveryClient @@ -69,11 +66,6 @@ func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { return c.DiscoveryClient } -// ApiresourceV1alpha1 retrieves the ApiresourceV1alpha1ClusterClient. -func (c *ClusterClientset) ApiresourceV1alpha1() apiresourcev1alpha1.ApiresourceV1alpha1ClusterInterface { - return c.apiresourceV1alpha1 -} - // ApisV1alpha1 retrieves the ApisV1alpha1ClusterClient. func (c *ClusterClientset) ApisV1alpha1() apisv1alpha1.ApisV1alpha1ClusterInterface { return c.apisV1alpha1 @@ -146,10 +138,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*ClusterCli var cs ClusterClientset cs.clientCache = cache var err error - cs.apiresourceV1alpha1, err = apiresourcev1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } cs.apisV1alpha1, err = apisv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err diff --git a/sdk/client/clientset/versioned/cluster/fake/clientset.go b/sdk/client/clientset/versioned/cluster/fake/clientset.go index 9066dd2c766..a58a729f642 100644 --- a/sdk/client/clientset/versioned/cluster/fake/clientset.go +++ b/sdk/client/clientset/versioned/cluster/fake/clientset.go @@ -31,8 +31,6 @@ import ( client "github.com/kcp-dev/kcp/sdk/client/clientset/versioned" kcpclient "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster" - kcpapiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1" - fakeapiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake" kcpapisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/apis/v1alpha1" fakeapisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/apis/v1alpha1/fake" kcpcorev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/core/v1alpha1" @@ -42,7 +40,6 @@ import ( kcptopologyv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/topology/v1alpha1" faketopologyv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/topology/v1alpha1/fake" clientscheme "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/scheme" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/tenancy/v1alpha1" @@ -83,11 +80,6 @@ func (c *ClusterClientset) Tracker() kcptesting.ObjectTracker { return c.tracker } -// ApiresourceV1alpha1 retrieves the ApiresourceV1alpha1ClusterClient. -func (c *ClusterClientset) ApiresourceV1alpha1() kcpapiresourcev1alpha1.ApiresourceV1alpha1ClusterInterface { - return &fakeapiresourcev1alpha1.ApiresourceV1alpha1ClusterClient{Fake: c.Fake} -} - // ApisV1alpha1 retrieves the ApisV1alpha1ClusterClient. func (c *ClusterClientset) ApisV1alpha1() kcpapisv1alpha1.ApisV1alpha1ClusterInterface { return &fakeapisv1alpha1.ApisV1alpha1ClusterClient{Fake: c.Fake} @@ -140,11 +132,6 @@ func (c *Clientset) Tracker() kcptesting.ScopedObjectTracker { return c.tracker } -// ApiresourceV1alpha1 retrieves the ApiresourceV1alpha1Client. -func (c *Clientset) ApiresourceV1alpha1() apiresourcev1alpha1.ApiresourceV1alpha1Interface { - return &fakeapiresourcev1alpha1.ApiresourceV1alpha1Client{Fake: c.Fake, ClusterPath: c.clusterPath} -} - // ApisV1alpha1 retrieves the ApisV1alpha1Client. func (c *Clientset) ApisV1alpha1() apisv1alpha1.ApisV1alpha1Interface { return &fakeapisv1alpha1.ApisV1alpha1Client{Fake: c.Fake, ClusterPath: c.clusterPath} diff --git a/sdk/client/clientset/versioned/cluster/scheme/register.go b/sdk/client/clientset/versioned/cluster/scheme/register.go index df030f3dcf4..5f5aee24575 100644 --- a/sdk/client/clientset/versioned/cluster/scheme/register.go +++ b/sdk/client/clientset/versioned/cluster/scheme/register.go @@ -28,7 +28,6 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1" @@ -39,7 +38,6 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - apiresourcev1alpha1.AddToScheme, apisv1alpha1.AddToScheme, corev1alpha1.AddToScheme, tenancyv1alpha1.AddToScheme, diff --git a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/apiresource_client.go b/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/apiresource_client.go deleted file mode 100644 index b3630791891..00000000000 --- a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/apiresource_client.go +++ /dev/null @@ -1,95 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - "net/http" - - kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" - "github.com/kcp-dev/logicalcluster/v3" - - "k8s.io/client-go/rest" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" -) - -type ApiresourceV1alpha1ClusterInterface interface { - ApiresourceV1alpha1ClusterScoper - APIResourceImportsClusterGetter - NegotiatedAPIResourcesClusterGetter -} - -type ApiresourceV1alpha1ClusterScoper interface { - Cluster(logicalcluster.Path) apiresourcev1alpha1.ApiresourceV1alpha1Interface -} - -type ApiresourceV1alpha1ClusterClient struct { - clientCache kcpclient.Cache[*apiresourcev1alpha1.ApiresourceV1alpha1Client] -} - -func (c *ApiresourceV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) apiresourcev1alpha1.ApiresourceV1alpha1Interface { - if clusterPath == logicalcluster.Wildcard { - panic("A specific cluster must be provided when scoping, not the wildcard.") - } - return c.clientCache.ClusterOrDie(clusterPath) -} - -func (c *ApiresourceV1alpha1ClusterClient) APIResourceImports() APIResourceImportClusterInterface { - return &aPIResourceImportsClusterInterface{clientCache: c.clientCache} -} - -func (c *ApiresourceV1alpha1ClusterClient) NegotiatedAPIResources() NegotiatedAPIResourceClusterInterface { - return &negotiatedAPIResourcesClusterInterface{clientCache: c.clientCache} -} - -// NewForConfig creates a new ApiresourceV1alpha1ClusterClient for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*ApiresourceV1alpha1ClusterClient, error) { - client, err := rest.HTTPClientFor(c) - if err != nil { - return nil, err - } - return NewForConfigAndClient(c, client) -} - -// NewForConfigAndClient creates a new ApiresourceV1alpha1ClusterClient 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) (*ApiresourceV1alpha1ClusterClient, error) { - cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*apiresourcev1alpha1.ApiresourceV1alpha1Client]{ - NewForConfigAndClient: apiresourcev1alpha1.NewForConfigAndClient, - }) - if _, err := cache.Cluster(logicalcluster.Name("root").Path()); err != nil { - return nil, err - } - return &ApiresourceV1alpha1ClusterClient{clientCache: cache}, nil -} - -// NewForConfigOrDie creates a new ApiresourceV1alpha1ClusterClient for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ApiresourceV1alpha1ClusterClient { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} diff --git a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/apiresourceimport.go b/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/apiresourceimport.go deleted file mode 100644 index a59b541c4b1..00000000000 --- a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/apiresourceimport.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - - 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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apiresourcev1alpha1client "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" -) - -// APIResourceImportsClusterGetter has a method to return a APIResourceImportClusterInterface. -// A group's cluster client should implement this interface. -type APIResourceImportsClusterGetter interface { - APIResourceImports() APIResourceImportClusterInterface -} - -// APIResourceImportClusterInterface can operate on APIResourceImports across all clusters, -// or scope down to one cluster and return a apiresourcev1alpha1client.APIResourceImportInterface. -type APIResourceImportClusterInterface interface { - Cluster(logicalcluster.Path) apiresourcev1alpha1client.APIResourceImportInterface - List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.APIResourceImportList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) -} - -type aPIResourceImportsClusterInterface struct { - clientCache kcpclient.Cache[*apiresourcev1alpha1client.ApiresourceV1alpha1Client] -} - -// Cluster scopes the client down to a particular cluster. -func (c *aPIResourceImportsClusterInterface) Cluster(clusterPath logicalcluster.Path) apiresourcev1alpha1client.APIResourceImportInterface { - if clusterPath == logicalcluster.Wildcard { - panic("A specific cluster must be provided when scoping, not the wildcard.") - } - - return c.clientCache.ClusterOrDie(clusterPath).APIResourceImports() -} - -// List returns the entire collection of all APIResourceImports across all clusters. -func (c *aPIResourceImportsClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.APIResourceImportList, error) { - return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).APIResourceImports().List(ctx, opts) -} - -// Watch begins to watch all APIResourceImports across all clusters. -func (c *aPIResourceImportsClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).APIResourceImports().Watch(ctx, opts) -} diff --git a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/apiresource_client.go b/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/apiresource_client.go deleted file mode 100644 index 6955984e365..00000000000 --- a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/apiresource_client.go +++ /dev/null @@ -1,73 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -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" - - kcpapiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" -) - -var _ kcpapiresourcev1alpha1.ApiresourceV1alpha1ClusterInterface = (*ApiresourceV1alpha1ClusterClient)(nil) - -type ApiresourceV1alpha1ClusterClient struct { - *kcptesting.Fake -} - -func (c *ApiresourceV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) apiresourcev1alpha1.ApiresourceV1alpha1Interface { - if clusterPath == logicalcluster.Wildcard { - panic("A specific cluster must be provided when scoping, not the wildcard.") - } - return &ApiresourceV1alpha1Client{Fake: c.Fake, ClusterPath: clusterPath} -} - -func (c *ApiresourceV1alpha1ClusterClient) APIResourceImports() kcpapiresourcev1alpha1.APIResourceImportClusterInterface { - return &aPIResourceImportsClusterClient{Fake: c.Fake} -} - -func (c *ApiresourceV1alpha1ClusterClient) NegotiatedAPIResources() kcpapiresourcev1alpha1.NegotiatedAPIResourceClusterInterface { - return &negotiatedAPIResourcesClusterClient{Fake: c.Fake} -} - -var _ apiresourcev1alpha1.ApiresourceV1alpha1Interface = (*ApiresourceV1alpha1Client)(nil) - -type ApiresourceV1alpha1Client struct { - *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func (c *ApiresourceV1alpha1Client) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} - -func (c *ApiresourceV1alpha1Client) APIResourceImports() apiresourcev1alpha1.APIResourceImportInterface { - return &aPIResourceImportsClient{Fake: c.Fake, ClusterPath: c.ClusterPath} -} - -func (c *ApiresourceV1alpha1Client) NegotiatedAPIResources() apiresourcev1alpha1.NegotiatedAPIResourceInterface { - return &negotiatedAPIResourcesClient{Fake: c.Fake, ClusterPath: c.ClusterPath} -} diff --git a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/apiresourceimport.go b/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/apiresourceimport.go deleted file mode 100644 index 51429da766d..00000000000 --- a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/apiresourceimport.go +++ /dev/null @@ -1,202 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - applyconfigurationsapiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiresource/v1alpha1" - apiresourcev1alpha1client "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" -) - -var aPIResourceImportsResource = schema.GroupVersionResource{Group: "apiresource.kcp.io", Version: "v1alpha1", Resource: "apiresourceimports"} -var aPIResourceImportsKind = schema.GroupVersionKind{Group: "apiresource.kcp.io", Version: "v1alpha1", Kind: "APIResourceImport"} - -type aPIResourceImportsClusterClient struct { - *kcptesting.Fake -} - -// Cluster scopes the client down to a particular cluster. -func (c *aPIResourceImportsClusterClient) Cluster(clusterPath logicalcluster.Path) apiresourcev1alpha1client.APIResourceImportInterface { - if clusterPath == logicalcluster.Wildcard { - panic("A specific cluster must be provided when scoping, not the wildcard.") - } - - return &aPIResourceImportsClient{Fake: c.Fake, ClusterPath: clusterPath} -} - -// List takes label and field selectors, and returns the list of APIResourceImports that match those selectors across all clusters. -func (c *aPIResourceImportsClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.APIResourceImportList, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(aPIResourceImportsResource, aPIResourceImportsKind, logicalcluster.Wildcard, opts), &apiresourcev1alpha1.APIResourceImportList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &apiresourcev1alpha1.APIResourceImportList{ListMeta: obj.(*apiresourcev1alpha1.APIResourceImportList).ListMeta} - for _, item := range obj.(*apiresourcev1alpha1.APIResourceImportList).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 APIResourceImports across all clusters. -func (c *aPIResourceImportsClusterClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake.InvokesWatch(kcptesting.NewRootWatchAction(aPIResourceImportsResource, logicalcluster.Wildcard, opts)) -} - -type aPIResourceImportsClient struct { - *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func (c *aPIResourceImportsClient) Create(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImport, opts metav1.CreateOptions) (*apiresourcev1alpha1.APIResourceImport, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootCreateAction(aPIResourceImportsResource, c.ClusterPath, aPIResourceImport), &apiresourcev1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.APIResourceImport), err -} - -func (c *aPIResourceImportsClient) Update(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImport, opts metav1.UpdateOptions) (*apiresourcev1alpha1.APIResourceImport, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateAction(aPIResourceImportsResource, c.ClusterPath, aPIResourceImport), &apiresourcev1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.APIResourceImport), err -} - -func (c *aPIResourceImportsClient) UpdateStatus(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImport, opts metav1.UpdateOptions) (*apiresourcev1alpha1.APIResourceImport, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateSubresourceAction(aPIResourceImportsResource, c.ClusterPath, "status", aPIResourceImport), &apiresourcev1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.APIResourceImport), err -} - -func (c *aPIResourceImportsClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake.Invokes(kcptesting.NewRootDeleteActionWithOptions(aPIResourceImportsResource, c.ClusterPath, name, opts), &apiresourcev1alpha1.APIResourceImport{}) - return err -} - -func (c *aPIResourceImportsClient) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := kcptesting.NewRootDeleteCollectionAction(aPIResourceImportsResource, c.ClusterPath, listOpts) - - _, err := c.Fake.Invokes(action, &apiresourcev1alpha1.APIResourceImportList{}) - return err -} - -func (c *aPIResourceImportsClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*apiresourcev1alpha1.APIResourceImport, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootGetAction(aPIResourceImportsResource, c.ClusterPath, name), &apiresourcev1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.APIResourceImport), err -} - -// List takes label and field selectors, and returns the list of APIResourceImports that match those selectors. -func (c *aPIResourceImportsClient) List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.APIResourceImportList, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(aPIResourceImportsResource, aPIResourceImportsKind, c.ClusterPath, opts), &apiresourcev1alpha1.APIResourceImportList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &apiresourcev1alpha1.APIResourceImportList{ListMeta: obj.(*apiresourcev1alpha1.APIResourceImportList).ListMeta} - for _, item := range obj.(*apiresourcev1alpha1.APIResourceImportList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -func (c *aPIResourceImportsClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake.InvokesWatch(kcptesting.NewRootWatchAction(aPIResourceImportsResource, c.ClusterPath, opts)) -} - -func (c *aPIResourceImportsClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*apiresourcev1alpha1.APIResourceImport, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(aPIResourceImportsResource, c.ClusterPath, name, pt, data, subresources...), &apiresourcev1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.APIResourceImport), err -} - -func (c *aPIResourceImportsClient) Apply(ctx context.Context, applyConfiguration *applyconfigurationsapiresourcev1alpha1.APIResourceImportApplyConfiguration, opts metav1.ApplyOptions) (*apiresourcev1alpha1.APIResourceImport, 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.NewRootPatchSubresourceAction(aPIResourceImportsResource, c.ClusterPath, *name, types.ApplyPatchType, data), &apiresourcev1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.APIResourceImport), err -} - -func (c *aPIResourceImportsClient) ApplyStatus(ctx context.Context, applyConfiguration *applyconfigurationsapiresourcev1alpha1.APIResourceImportApplyConfiguration, opts metav1.ApplyOptions) (*apiresourcev1alpha1.APIResourceImport, 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.NewRootPatchSubresourceAction(aPIResourceImportsResource, c.ClusterPath, *name, types.ApplyPatchType, data, "status"), &apiresourcev1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.APIResourceImport), err -} diff --git a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/negotiatedapiresource.go b/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/negotiatedapiresource.go deleted file mode 100644 index 36039a9b64f..00000000000 --- a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/fake/negotiatedapiresource.go +++ /dev/null @@ -1,202 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - applyconfigurationsapiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiresource/v1alpha1" - apiresourcev1alpha1client "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" -) - -var negotiatedAPIResourcesResource = schema.GroupVersionResource{Group: "apiresource.kcp.io", Version: "v1alpha1", Resource: "negotiatedapiresources"} -var negotiatedAPIResourcesKind = schema.GroupVersionKind{Group: "apiresource.kcp.io", Version: "v1alpha1", Kind: "NegotiatedAPIResource"} - -type negotiatedAPIResourcesClusterClient struct { - *kcptesting.Fake -} - -// Cluster scopes the client down to a particular cluster. -func (c *negotiatedAPIResourcesClusterClient) Cluster(clusterPath logicalcluster.Path) apiresourcev1alpha1client.NegotiatedAPIResourceInterface { - if clusterPath == logicalcluster.Wildcard { - panic("A specific cluster must be provided when scoping, not the wildcard.") - } - - return &negotiatedAPIResourcesClient{Fake: c.Fake, ClusterPath: clusterPath} -} - -// List takes label and field selectors, and returns the list of NegotiatedAPIResources that match those selectors across all clusters. -func (c *negotiatedAPIResourcesClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.NegotiatedAPIResourceList, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(negotiatedAPIResourcesResource, negotiatedAPIResourcesKind, logicalcluster.Wildcard, opts), &apiresourcev1alpha1.NegotiatedAPIResourceList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &apiresourcev1alpha1.NegotiatedAPIResourceList{ListMeta: obj.(*apiresourcev1alpha1.NegotiatedAPIResourceList).ListMeta} - for _, item := range obj.(*apiresourcev1alpha1.NegotiatedAPIResourceList).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 NegotiatedAPIResources across all clusters. -func (c *negotiatedAPIResourcesClusterClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake.InvokesWatch(kcptesting.NewRootWatchAction(negotiatedAPIResourcesResource, logicalcluster.Wildcard, opts)) -} - -type negotiatedAPIResourcesClient struct { - *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func (c *negotiatedAPIResourcesClient) Create(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResource, opts metav1.CreateOptions) (*apiresourcev1alpha1.NegotiatedAPIResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootCreateAction(negotiatedAPIResourcesResource, c.ClusterPath, negotiatedAPIResource), &apiresourcev1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), err -} - -func (c *negotiatedAPIResourcesClient) Update(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResource, opts metav1.UpdateOptions) (*apiresourcev1alpha1.NegotiatedAPIResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateAction(negotiatedAPIResourcesResource, c.ClusterPath, negotiatedAPIResource), &apiresourcev1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), err -} - -func (c *negotiatedAPIResourcesClient) UpdateStatus(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResource, opts metav1.UpdateOptions) (*apiresourcev1alpha1.NegotiatedAPIResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateSubresourceAction(negotiatedAPIResourcesResource, c.ClusterPath, "status", negotiatedAPIResource), &apiresourcev1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), err -} - -func (c *negotiatedAPIResourcesClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake.Invokes(kcptesting.NewRootDeleteActionWithOptions(negotiatedAPIResourcesResource, c.ClusterPath, name, opts), &apiresourcev1alpha1.NegotiatedAPIResource{}) - return err -} - -func (c *negotiatedAPIResourcesClient) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := kcptesting.NewRootDeleteCollectionAction(negotiatedAPIResourcesResource, c.ClusterPath, listOpts) - - _, err := c.Fake.Invokes(action, &apiresourcev1alpha1.NegotiatedAPIResourceList{}) - return err -} - -func (c *negotiatedAPIResourcesClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*apiresourcev1alpha1.NegotiatedAPIResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootGetAction(negotiatedAPIResourcesResource, c.ClusterPath, name), &apiresourcev1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), err -} - -// List takes label and field selectors, and returns the list of NegotiatedAPIResources that match those selectors. -func (c *negotiatedAPIResourcesClient) List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.NegotiatedAPIResourceList, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(negotiatedAPIResourcesResource, negotiatedAPIResourcesKind, c.ClusterPath, opts), &apiresourcev1alpha1.NegotiatedAPIResourceList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &apiresourcev1alpha1.NegotiatedAPIResourceList{ListMeta: obj.(*apiresourcev1alpha1.NegotiatedAPIResourceList).ListMeta} - for _, item := range obj.(*apiresourcev1alpha1.NegotiatedAPIResourceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -func (c *negotiatedAPIResourcesClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake.InvokesWatch(kcptesting.NewRootWatchAction(negotiatedAPIResourcesResource, c.ClusterPath, opts)) -} - -func (c *negotiatedAPIResourcesClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*apiresourcev1alpha1.NegotiatedAPIResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(negotiatedAPIResourcesResource, c.ClusterPath, name, pt, data, subresources...), &apiresourcev1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), err -} - -func (c *negotiatedAPIResourcesClient) Apply(ctx context.Context, applyConfiguration *applyconfigurationsapiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts metav1.ApplyOptions) (*apiresourcev1alpha1.NegotiatedAPIResource, 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.NewRootPatchSubresourceAction(negotiatedAPIResourcesResource, c.ClusterPath, *name, types.ApplyPatchType, data), &apiresourcev1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), err -} - -func (c *negotiatedAPIResourcesClient) ApplyStatus(ctx context.Context, applyConfiguration *applyconfigurationsapiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts metav1.ApplyOptions) (*apiresourcev1alpha1.NegotiatedAPIResource, 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.NewRootPatchSubresourceAction(negotiatedAPIResourcesResource, c.ClusterPath, *name, types.ApplyPatchType, data, "status"), &apiresourcev1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), err -} diff --git a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/negotiatedapiresource.go b/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/negotiatedapiresource.go deleted file mode 100644 index 4ed31f821e2..00000000000 --- a/sdk/client/clientset/versioned/cluster/typed/apiresource/v1alpha1/negotiatedapiresource.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - - 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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apiresourcev1alpha1client "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" -) - -// NegotiatedAPIResourcesClusterGetter has a method to return a NegotiatedAPIResourceClusterInterface. -// A group's cluster client should implement this interface. -type NegotiatedAPIResourcesClusterGetter interface { - NegotiatedAPIResources() NegotiatedAPIResourceClusterInterface -} - -// NegotiatedAPIResourceClusterInterface can operate on NegotiatedAPIResources across all clusters, -// or scope down to one cluster and return a apiresourcev1alpha1client.NegotiatedAPIResourceInterface. -type NegotiatedAPIResourceClusterInterface interface { - Cluster(logicalcluster.Path) apiresourcev1alpha1client.NegotiatedAPIResourceInterface - List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.NegotiatedAPIResourceList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) -} - -type negotiatedAPIResourcesClusterInterface struct { - clientCache kcpclient.Cache[*apiresourcev1alpha1client.ApiresourceV1alpha1Client] -} - -// Cluster scopes the client down to a particular cluster. -func (c *negotiatedAPIResourcesClusterInterface) Cluster(clusterPath logicalcluster.Path) apiresourcev1alpha1client.NegotiatedAPIResourceInterface { - if clusterPath == logicalcluster.Wildcard { - panic("A specific cluster must be provided when scoping, not the wildcard.") - } - - return c.clientCache.ClusterOrDie(clusterPath).NegotiatedAPIResources() -} - -// List returns the entire collection of all NegotiatedAPIResources across all clusters. -func (c *negotiatedAPIResourcesClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1alpha1.NegotiatedAPIResourceList, error) { - return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).NegotiatedAPIResources().List(ctx, opts) -} - -// Watch begins to watch all NegotiatedAPIResources across all clusters. -func (c *negotiatedAPIResourcesClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).NegotiatedAPIResources().Watch(ctx, opts) -} diff --git a/sdk/client/clientset/versioned/fake/clientset_generated.go b/sdk/client/clientset/versioned/fake/clientset_generated.go index 02a4c29624b..d497f7fa069 100644 --- a/sdk/client/clientset/versioned/fake/clientset_generated.go +++ b/sdk/client/clientset/versioned/fake/clientset_generated.go @@ -26,8 +26,6 @@ import ( "k8s.io/client-go/testing" clientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" - fakeapiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apis/v1alpha1" fakeapisv1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apis/v1alpha1/fake" corev1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/core/v1alpha1" @@ -88,11 +86,6 @@ var ( _ testing.FakeClient = &Clientset{} ) -// ApiresourceV1alpha1 retrieves the ApiresourceV1alpha1Client -func (c *Clientset) ApiresourceV1alpha1() apiresourcev1alpha1.ApiresourceV1alpha1Interface { - return &fakeapiresourcev1alpha1.FakeApiresourceV1alpha1{Fake: &c.Fake} -} - // ApisV1alpha1 retrieves the ApisV1alpha1Client func (c *Clientset) ApisV1alpha1() apisv1alpha1.ApisV1alpha1Interface { return &fakeapisv1alpha1.FakeApisV1alpha1{Fake: &c.Fake} diff --git a/sdk/client/clientset/versioned/fake/register.go b/sdk/client/clientset/versioned/fake/register.go index 5dea70e303f..16aa9822ede 100644 --- a/sdk/client/clientset/versioned/fake/register.go +++ b/sdk/client/clientset/versioned/fake/register.go @@ -25,7 +25,6 @@ import ( serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1" @@ -36,7 +35,6 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - apiresourcev1alpha1.AddToScheme, apisv1alpha1.AddToScheme, corev1alpha1.AddToScheme, tenancyv1alpha1.AddToScheme, diff --git a/sdk/client/clientset/versioned/scheme/register.go b/sdk/client/clientset/versioned/scheme/register.go index dc9670690f2..c41f339c28c 100644 --- a/sdk/client/clientset/versioned/scheme/register.go +++ b/sdk/client/clientset/versioned/scheme/register.go @@ -25,7 +25,6 @@ import ( serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1" @@ -36,7 +35,6 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - apiresourcev1alpha1.AddToScheme, apisv1alpha1.AddToScheme, corev1alpha1.AddToScheme, tenancyv1alpha1.AddToScheme, diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/apiresource_client.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/apiresource_client.go deleted file mode 100644 index 45964977130..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/apiresource_client.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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 v1alpha1 - -import ( - "net/http" - - rest "k8s.io/client-go/rest" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/scheme" -) - -type ApiresourceV1alpha1Interface interface { - RESTClient() rest.Interface - APIResourceImportsGetter - NegotiatedAPIResourcesGetter -} - -// ApiresourceV1alpha1Client is used to interact with features provided by the apiresource.kcp.io group. -type ApiresourceV1alpha1Client struct { - restClient rest.Interface -} - -func (c *ApiresourceV1alpha1Client) APIResourceImports() APIResourceImportInterface { - return newAPIResourceImports(c) -} - -func (c *ApiresourceV1alpha1Client) NegotiatedAPIResources() NegotiatedAPIResourceInterface { - return newNegotiatedAPIResources(c) -} - -// NewForConfig creates a new ApiresourceV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*ApiresourceV1alpha1Client, 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 ApiresourceV1alpha1Client 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) (*ApiresourceV1alpha1Client, 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 &ApiresourceV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new ApiresourceV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ApiresourceV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new ApiresourceV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *ApiresourceV1alpha1Client { - return &ApiresourceV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *ApiresourceV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/apiresourceimport.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/apiresourceimport.go deleted file mode 100644 index e6af482aeb3..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/apiresourceimport.go +++ /dev/null @@ -1,244 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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 v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiresource/v1alpha1" - scheme "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/scheme" -) - -// APIResourceImportsGetter has a method to return a APIResourceImportInterface. -// A group's client should implement this interface. -type APIResourceImportsGetter interface { - APIResourceImports() APIResourceImportInterface -} - -// APIResourceImportInterface has methods to work with APIResourceImport resources. -type APIResourceImportInterface interface { - Create(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.CreateOptions) (*v1alpha1.APIResourceImport, error) - Update(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.UpdateOptions) (*v1alpha1.APIResourceImport, error) - UpdateStatus(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.UpdateOptions) (*v1alpha1.APIResourceImport, 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) (*v1alpha1.APIResourceImport, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.APIResourceImportList, 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 *v1alpha1.APIResourceImport, err error) - Apply(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImportApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.APIResourceImport, err error) - ApplyStatus(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImportApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.APIResourceImport, err error) - APIResourceImportExpansion -} - -// aPIResourceImports implements APIResourceImportInterface -type aPIResourceImports struct { - client rest.Interface -} - -// newAPIResourceImports returns a APIResourceImports -func newAPIResourceImports(c *ApiresourceV1alpha1Client) *aPIResourceImports { - return &aPIResourceImports{ - client: c.RESTClient(), - } -} - -// Get takes name of the aPIResourceImport, and returns the corresponding aPIResourceImport object, and an error if there is any. -func (c *aPIResourceImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.APIResourceImport, err error) { - result = &v1alpha1.APIResourceImport{} - err = c.client.Get(). - Resource("apiresourceimports"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of APIResourceImports that match those selectors. -func (c *aPIResourceImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.APIResourceImportList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.APIResourceImportList{} - err = c.client.Get(). - Resource("apiresourceimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested aPIResourceImports. -func (c *aPIResourceImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("apiresourceimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a aPIResourceImport and creates it. Returns the server's representation of the aPIResourceImport, and an error, if there is any. -func (c *aPIResourceImports) Create(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.CreateOptions) (result *v1alpha1.APIResourceImport, err error) { - result = &v1alpha1.APIResourceImport{} - err = c.client.Post(). - Resource("apiresourceimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aPIResourceImport). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a aPIResourceImport and updates it. Returns the server's representation of the aPIResourceImport, and an error, if there is any. -func (c *aPIResourceImports) Update(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.UpdateOptions) (result *v1alpha1.APIResourceImport, err error) { - result = &v1alpha1.APIResourceImport{} - err = c.client.Put(). - Resource("apiresourceimports"). - Name(aPIResourceImport.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aPIResourceImport). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *aPIResourceImports) UpdateStatus(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.UpdateOptions) (result *v1alpha1.APIResourceImport, err error) { - result = &v1alpha1.APIResourceImport{} - err = c.client.Put(). - Resource("apiresourceimports"). - Name(aPIResourceImport.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aPIResourceImport). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the aPIResourceImport and deletes it. Returns an error if one occurs. -func (c *aPIResourceImports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("apiresourceimports"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *aPIResourceImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("apiresourceimports"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched aPIResourceImport. -func (c *aPIResourceImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.APIResourceImport, err error) { - result = &v1alpha1.APIResourceImport{} - err = c.client.Patch(pt). - Resource("apiresourceimports"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied aPIResourceImport. -func (c *aPIResourceImports) Apply(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImportApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.APIResourceImport, err error) { - if aPIResourceImport == nil { - return nil, fmt.Errorf("aPIResourceImport provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(aPIResourceImport) - if err != nil { - return nil, err - } - name := aPIResourceImport.Name - if name == nil { - return nil, fmt.Errorf("aPIResourceImport.Name must be provided to Apply") - } - result = &v1alpha1.APIResourceImport{} - err = c.client.Patch(types.ApplyPatchType). - Resource("apiresourceimports"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *aPIResourceImports) ApplyStatus(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImportApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.APIResourceImport, err error) { - if aPIResourceImport == nil { - return nil, fmt.Errorf("aPIResourceImport provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(aPIResourceImport) - if err != nil { - return nil, err - } - - name := aPIResourceImport.Name - if name == nil { - return nil, fmt.Errorf("aPIResourceImport.Name must be provided to Apply") - } - - result = &v1alpha1.APIResourceImport{} - err = c.client.Patch(types.ApplyPatchType). - Resource("apiresourceimports"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/doc.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/doc.go deleted file mode 100644 index 364b93c7cfd..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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 v1alpha1 diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/doc.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/doc.go deleted file mode 100644 index e388f29189e..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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/apiresource/v1alpha1/fake/fake_apiresource_client.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_apiresource_client.go deleted file mode 100644 index 39aac0649e3..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_apiresource_client.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apiresource/v1alpha1" -) - -type FakeApiresourceV1alpha1 struct { - *testing.Fake -} - -func (c *FakeApiresourceV1alpha1) APIResourceImports() v1alpha1.APIResourceImportInterface { - return &FakeAPIResourceImports{c} -} - -func (c *FakeApiresourceV1alpha1) NegotiatedAPIResources() v1alpha1.NegotiatedAPIResourceInterface { - return &FakeNegotiatedAPIResources{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeApiresourceV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_apiresourceimport.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_apiresourceimport.go deleted file mode 100644 index ed331e9ce3a..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_apiresourceimport.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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" - json "encoding/json" - "fmt" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiresource/v1alpha1" -) - -// FakeAPIResourceImports implements APIResourceImportInterface -type FakeAPIResourceImports struct { - Fake *FakeApiresourceV1alpha1 -} - -var apiresourceimportsResource = schema.GroupVersionResource{Group: "apiresource.kcp.io", Version: "v1alpha1", Resource: "apiresourceimports"} - -var apiresourceimportsKind = schema.GroupVersionKind{Group: "apiresource.kcp.io", Version: "v1alpha1", Kind: "APIResourceImport"} - -// Get takes name of the aPIResourceImport, and returns the corresponding aPIResourceImport object, and an error if there is any. -func (c *FakeAPIResourceImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.APIResourceImport, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(apiresourceimportsResource, name), &v1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.APIResourceImport), err -} - -// List takes label and field selectors, and returns the list of APIResourceImports that match those selectors. -func (c *FakeAPIResourceImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.APIResourceImportList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(apiresourceimportsResource, apiresourceimportsKind, opts), &v1alpha1.APIResourceImportList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.APIResourceImportList{ListMeta: obj.(*v1alpha1.APIResourceImportList).ListMeta} - for _, item := range obj.(*v1alpha1.APIResourceImportList).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 aPIResourceImports. -func (c *FakeAPIResourceImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(apiresourceimportsResource, opts)) -} - -// Create takes the representation of a aPIResourceImport and creates it. Returns the server's representation of the aPIResourceImport, and an error, if there is any. -func (c *FakeAPIResourceImports) Create(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.CreateOptions) (result *v1alpha1.APIResourceImport, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(apiresourceimportsResource, aPIResourceImport), &v1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.APIResourceImport), err -} - -// Update takes the representation of a aPIResourceImport and updates it. Returns the server's representation of the aPIResourceImport, and an error, if there is any. -func (c *FakeAPIResourceImports) Update(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.UpdateOptions) (result *v1alpha1.APIResourceImport, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(apiresourceimportsResource, aPIResourceImport), &v1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.APIResourceImport), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeAPIResourceImports) UpdateStatus(ctx context.Context, aPIResourceImport *v1alpha1.APIResourceImport, opts v1.UpdateOptions) (*v1alpha1.APIResourceImport, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(apiresourceimportsResource, "status", aPIResourceImport), &v1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.APIResourceImport), err -} - -// Delete takes name of the aPIResourceImport and deletes it. Returns an error if one occurs. -func (c *FakeAPIResourceImports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(apiresourceimportsResource, name, opts), &v1alpha1.APIResourceImport{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeAPIResourceImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(apiresourceimportsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.APIResourceImportList{}) - return err -} - -// Patch applies the patch and returns the patched aPIResourceImport. -func (c *FakeAPIResourceImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.APIResourceImport, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(apiresourceimportsResource, name, pt, data, subresources...), &v1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.APIResourceImport), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied aPIResourceImport. -func (c *FakeAPIResourceImports) Apply(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImportApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.APIResourceImport, err error) { - if aPIResourceImport == nil { - return nil, fmt.Errorf("aPIResourceImport provided to Apply must not be nil") - } - data, err := json.Marshal(aPIResourceImport) - if err != nil { - return nil, err - } - name := aPIResourceImport.Name - if name == nil { - return nil, fmt.Errorf("aPIResourceImport.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(apiresourceimportsResource, *name, types.ApplyPatchType, data), &v1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.APIResourceImport), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeAPIResourceImports) ApplyStatus(ctx context.Context, aPIResourceImport *apiresourcev1alpha1.APIResourceImportApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.APIResourceImport, err error) { - if aPIResourceImport == nil { - return nil, fmt.Errorf("aPIResourceImport provided to Apply must not be nil") - } - data, err := json.Marshal(aPIResourceImport) - if err != nil { - return nil, err - } - name := aPIResourceImport.Name - if name == nil { - return nil, fmt.Errorf("aPIResourceImport.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(apiresourceimportsResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.APIResourceImport{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.APIResourceImport), err -} diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_negotiatedapiresource.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_negotiatedapiresource.go deleted file mode 100644 index 38b711d460d..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/fake/fake_negotiatedapiresource.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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" - json "encoding/json" - "fmt" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiresource/v1alpha1" -) - -// FakeNegotiatedAPIResources implements NegotiatedAPIResourceInterface -type FakeNegotiatedAPIResources struct { - Fake *FakeApiresourceV1alpha1 -} - -var negotiatedapiresourcesResource = schema.GroupVersionResource{Group: "apiresource.kcp.io", Version: "v1alpha1", Resource: "negotiatedapiresources"} - -var negotiatedapiresourcesKind = schema.GroupVersionKind{Group: "apiresource.kcp.io", Version: "v1alpha1", Kind: "NegotiatedAPIResource"} - -// Get takes name of the negotiatedAPIResource, and returns the corresponding negotiatedAPIResource object, and an error if there is any. -func (c *FakeNegotiatedAPIResources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(negotiatedapiresourcesResource, name), &v1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NegotiatedAPIResource), err -} - -// List takes label and field selectors, and returns the list of NegotiatedAPIResources that match those selectors. -func (c *FakeNegotiatedAPIResources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NegotiatedAPIResourceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(negotiatedapiresourcesResource, negotiatedapiresourcesKind, opts), &v1alpha1.NegotiatedAPIResourceList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.NegotiatedAPIResourceList{ListMeta: obj.(*v1alpha1.NegotiatedAPIResourceList).ListMeta} - for _, item := range obj.(*v1alpha1.NegotiatedAPIResourceList).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 negotiatedAPIResources. -func (c *FakeNegotiatedAPIResources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(negotiatedapiresourcesResource, opts)) -} - -// Create takes the representation of a negotiatedAPIResource and creates it. Returns the server's representation of the negotiatedAPIResource, and an error, if there is any. -func (c *FakeNegotiatedAPIResources) Create(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.CreateOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(negotiatedapiresourcesResource, negotiatedAPIResource), &v1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NegotiatedAPIResource), err -} - -// Update takes the representation of a negotiatedAPIResource and updates it. Returns the server's representation of the negotiatedAPIResource, and an error, if there is any. -func (c *FakeNegotiatedAPIResources) Update(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.UpdateOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(negotiatedapiresourcesResource, negotiatedAPIResource), &v1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NegotiatedAPIResource), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeNegotiatedAPIResources) UpdateStatus(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.UpdateOptions) (*v1alpha1.NegotiatedAPIResource, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(negotiatedapiresourcesResource, "status", negotiatedAPIResource), &v1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NegotiatedAPIResource), err -} - -// Delete takes name of the negotiatedAPIResource and deletes it. Returns an error if one occurs. -func (c *FakeNegotiatedAPIResources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(negotiatedapiresourcesResource, name, opts), &v1alpha1.NegotiatedAPIResource{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNegotiatedAPIResources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(negotiatedapiresourcesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.NegotiatedAPIResourceList{}) - return err -} - -// Patch applies the patch and returns the patched negotiatedAPIResource. -func (c *FakeNegotiatedAPIResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NegotiatedAPIResource, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(negotiatedapiresourcesResource, name, pt, data, subresources...), &v1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NegotiatedAPIResource), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied negotiatedAPIResource. -func (c *FakeNegotiatedAPIResources) Apply(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - if negotiatedAPIResource == nil { - return nil, fmt.Errorf("negotiatedAPIResource provided to Apply must not be nil") - } - data, err := json.Marshal(negotiatedAPIResource) - if err != nil { - return nil, err - } - name := negotiatedAPIResource.Name - if name == nil { - return nil, fmt.Errorf("negotiatedAPIResource.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(negotiatedapiresourcesResource, *name, types.ApplyPatchType, data), &v1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NegotiatedAPIResource), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeNegotiatedAPIResources) ApplyStatus(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - if negotiatedAPIResource == nil { - return nil, fmt.Errorf("negotiatedAPIResource provided to Apply must not be nil") - } - data, err := json.Marshal(negotiatedAPIResource) - if err != nil { - return nil, err - } - name := negotiatedAPIResource.Name - if name == nil { - return nil, fmt.Errorf("negotiatedAPIResource.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(negotiatedapiresourcesResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.NegotiatedAPIResource{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NegotiatedAPIResource), err -} diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/generated_expansion.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/generated_expansion.go deleted file mode 100644 index d7da13a9ba0..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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 v1alpha1 - -type APIResourceImportExpansion interface{} - -type NegotiatedAPIResourceExpansion interface{} diff --git a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/negotiatedapiresource.go b/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/negotiatedapiresource.go deleted file mode 100644 index cbb15be7659..00000000000 --- a/sdk/client/clientset/versioned/typed/apiresource/v1alpha1/negotiatedapiresource.go +++ /dev/null @@ -1,244 +0,0 @@ -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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 v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - - v1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/client/applyconfiguration/apiresource/v1alpha1" - scheme "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/scheme" -) - -// NegotiatedAPIResourcesGetter has a method to return a NegotiatedAPIResourceInterface. -// A group's client should implement this interface. -type NegotiatedAPIResourcesGetter interface { - NegotiatedAPIResources() NegotiatedAPIResourceInterface -} - -// NegotiatedAPIResourceInterface has methods to work with NegotiatedAPIResource resources. -type NegotiatedAPIResourceInterface interface { - Create(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.CreateOptions) (*v1alpha1.NegotiatedAPIResource, error) - Update(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.UpdateOptions) (*v1alpha1.NegotiatedAPIResource, error) - UpdateStatus(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.UpdateOptions) (*v1alpha1.NegotiatedAPIResource, 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) (*v1alpha1.NegotiatedAPIResource, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NegotiatedAPIResourceList, 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 *v1alpha1.NegotiatedAPIResource, err error) - Apply(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NegotiatedAPIResource, err error) - ApplyStatus(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NegotiatedAPIResource, err error) - NegotiatedAPIResourceExpansion -} - -// negotiatedAPIResources implements NegotiatedAPIResourceInterface -type negotiatedAPIResources struct { - client rest.Interface -} - -// newNegotiatedAPIResources returns a NegotiatedAPIResources -func newNegotiatedAPIResources(c *ApiresourceV1alpha1Client) *negotiatedAPIResources { - return &negotiatedAPIResources{ - client: c.RESTClient(), - } -} - -// Get takes name of the negotiatedAPIResource, and returns the corresponding negotiatedAPIResource object, and an error if there is any. -func (c *negotiatedAPIResources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - result = &v1alpha1.NegotiatedAPIResource{} - err = c.client.Get(). - Resource("negotiatedapiresources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NegotiatedAPIResources that match those selectors. -func (c *negotiatedAPIResources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NegotiatedAPIResourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NegotiatedAPIResourceList{} - err = c.client.Get(). - Resource("negotiatedapiresources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested negotiatedAPIResources. -func (c *negotiatedAPIResources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("negotiatedapiresources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a negotiatedAPIResource and creates it. Returns the server's representation of the negotiatedAPIResource, and an error, if there is any. -func (c *negotiatedAPIResources) Create(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.CreateOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - result = &v1alpha1.NegotiatedAPIResource{} - err = c.client.Post(). - Resource("negotiatedapiresources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(negotiatedAPIResource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a negotiatedAPIResource and updates it. Returns the server's representation of the negotiatedAPIResource, and an error, if there is any. -func (c *negotiatedAPIResources) Update(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.UpdateOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - result = &v1alpha1.NegotiatedAPIResource{} - err = c.client.Put(). - Resource("negotiatedapiresources"). - Name(negotiatedAPIResource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(negotiatedAPIResource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *negotiatedAPIResources) UpdateStatus(ctx context.Context, negotiatedAPIResource *v1alpha1.NegotiatedAPIResource, opts v1.UpdateOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - result = &v1alpha1.NegotiatedAPIResource{} - err = c.client.Put(). - Resource("negotiatedapiresources"). - Name(negotiatedAPIResource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(negotiatedAPIResource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the negotiatedAPIResource and deletes it. Returns an error if one occurs. -func (c *negotiatedAPIResources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("negotiatedapiresources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *negotiatedAPIResources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("negotiatedapiresources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched negotiatedAPIResource. -func (c *negotiatedAPIResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NegotiatedAPIResource, err error) { - result = &v1alpha1.NegotiatedAPIResource{} - err = c.client.Patch(pt). - Resource("negotiatedapiresources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied negotiatedAPIResource. -func (c *negotiatedAPIResources) Apply(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - if negotiatedAPIResource == nil { - return nil, fmt.Errorf("negotiatedAPIResource provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(negotiatedAPIResource) - if err != nil { - return nil, err - } - name := negotiatedAPIResource.Name - if name == nil { - return nil, fmt.Errorf("negotiatedAPIResource.Name must be provided to Apply") - } - result = &v1alpha1.NegotiatedAPIResource{} - err = c.client.Patch(types.ApplyPatchType). - Resource("negotiatedapiresources"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *negotiatedAPIResources) ApplyStatus(ctx context.Context, negotiatedAPIResource *apiresourcev1alpha1.NegotiatedAPIResourceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NegotiatedAPIResource, err error) { - if negotiatedAPIResource == nil { - return nil, fmt.Errorf("negotiatedAPIResource provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(negotiatedAPIResource) - if err != nil { - return nil, err - } - - name := negotiatedAPIResource.Name - if name == nil { - return nil, fmt.Errorf("negotiatedAPIResource.Name must be provided to Apply") - } - - result = &v1alpha1.NegotiatedAPIResource{} - err = c.client.Patch(types.ApplyPatchType). - Resource("negotiatedapiresources"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/sdk/client/informers/externalversions/apiresource/interface.go b/sdk/client/informers/externalversions/apiresource/interface.go deleted file mode 100644 index 5ec71ebbfcb..00000000000 --- a/sdk/client/informers/externalversions/apiresource/interface.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package apiresource - -import ( - "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/apiresource/v1alpha1" - "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/internalinterfaces" -) - -type ClusterInterface interface { - // V1alpha1 provides access to the shared informers in V1alpha1. - V1alpha1() v1alpha1.ClusterInterface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new ClusterInterface. -func New(f internalinterfaces.SharedInformerFactory, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterInterface { - return &group{factory: f, tweakListOptions: tweakListOptions} -} - -// V1alpha1 returns a new v1alpha1.ClusterInterface. -func (g *group) V1alpha1() v1alpha1.ClusterInterface { - return v1alpha1.New(g.factory, g.tweakListOptions) -} - -type Interface interface { - // V1alpha1 provides access to the shared informers in V1alpha1. - V1alpha1() v1alpha1.Interface -} - -type scopedGroup struct { - factory internalinterfaces.SharedScopedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// New returns a new Interface. -func NewScoped(f internalinterfaces.SharedScopedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &scopedGroup{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1alpha1 returns a new v1alpha1.ClusterInterface. -func (g *scopedGroup) V1alpha1() v1alpha1.Interface { - return v1alpha1.NewScoped(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/sdk/client/informers/externalversions/apiresource/v1alpha1/apiresourceimport.go b/sdk/client/informers/externalversions/apiresource/v1alpha1/apiresourceimport.go deleted file mode 100644 index 819687b9716..00000000000 --- a/sdk/client/informers/externalversions/apiresource/v1alpha1/apiresourceimport.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - "time" - - 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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - scopedclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned" - clientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster" - "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/internalinterfaces" - apiresourcev1alpha1listers "github.com/kcp-dev/kcp/sdk/client/listers/apiresource/v1alpha1" -) - -// APIResourceImportClusterInformer provides access to a shared informer and lister for -// APIResourceImports. -type APIResourceImportClusterInformer interface { - Cluster(logicalcluster.Name) APIResourceImportInformer - Informer() kcpcache.ScopeableSharedIndexInformer - Lister() apiresourcev1alpha1listers.APIResourceImportClusterLister -} - -type aPIResourceImportClusterInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewAPIResourceImportClusterInformer constructs a new informer for APIResourceImport 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 NewAPIResourceImportClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { - return NewFilteredAPIResourceImportClusterInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredAPIResourceImportClusterInformer constructs a new informer for APIResourceImport 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 NewFilteredAPIResourceImportClusterInformer(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.ApiresourceV1alpha1().APIResourceImports().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ApiresourceV1alpha1().APIResourceImports().Watch(context.TODO(), options) - }, - }, - &apiresourcev1alpha1.APIResourceImport{}, - resyncPeriod, - indexers, - ) -} - -func (f *aPIResourceImportClusterInformer) defaultInformer(client clientset.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { - return NewFilteredAPIResourceImportClusterInformer(client, resyncPeriod, cache.Indexers{ - kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, - }, - f.tweakListOptions, - ) -} - -func (f *aPIResourceImportClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1alpha1.APIResourceImport{}, f.defaultInformer) -} - -func (f *aPIResourceImportClusterInformer) Lister() apiresourcev1alpha1listers.APIResourceImportClusterLister { - return apiresourcev1alpha1listers.NewAPIResourceImportClusterLister(f.Informer().GetIndexer()) -} - -// APIResourceImportInformer provides access to a shared informer and lister for -// APIResourceImports. -type APIResourceImportInformer interface { - Informer() cache.SharedIndexInformer - Lister() apiresourcev1alpha1listers.APIResourceImportLister -} - -func (f *aPIResourceImportClusterInformer) Cluster(clusterName logicalcluster.Name) APIResourceImportInformer { - return &aPIResourceImportInformer{ - informer: f.Informer().Cluster(clusterName), - lister: f.Lister().Cluster(clusterName), - } -} - -type aPIResourceImportInformer struct { - informer cache.SharedIndexInformer - lister apiresourcev1alpha1listers.APIResourceImportLister -} - -func (f *aPIResourceImportInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -func (f *aPIResourceImportInformer) Lister() apiresourcev1alpha1listers.APIResourceImportLister { - return f.lister -} - -type aPIResourceImportScopedInformer struct { - factory internalinterfaces.SharedScopedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -func (f *aPIResourceImportScopedInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1alpha1.APIResourceImport{}, f.defaultInformer) -} - -func (f *aPIResourceImportScopedInformer) Lister() apiresourcev1alpha1listers.APIResourceImportLister { - return apiresourcev1alpha1listers.NewAPIResourceImportLister(f.Informer().GetIndexer()) -} - -// NewAPIResourceImportInformer constructs a new informer for APIResourceImport 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 NewAPIResourceImportInformer(client scopedclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredAPIResourceImportInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredAPIResourceImportInformer constructs a new informer for APIResourceImport 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 NewFilteredAPIResourceImportInformer(client scopedclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ApiresourceV1alpha1().APIResourceImports().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ApiresourceV1alpha1().APIResourceImports().Watch(context.TODO(), options) - }, - }, - &apiresourcev1alpha1.APIResourceImport{}, - resyncPeriod, - indexers, - ) -} - -func (f *aPIResourceImportScopedInformer) defaultInformer(client scopedclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredAPIResourceImportInformer(client, resyncPeriod, cache.Indexers{}, f.tweakListOptions) -} diff --git a/sdk/client/informers/externalversions/apiresource/v1alpha1/interface.go b/sdk/client/informers/externalversions/apiresource/v1alpha1/interface.go deleted file mode 100644 index 9872df11075..00000000000 --- a/sdk/client/informers/externalversions/apiresource/v1alpha1/interface.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/internalinterfaces" -) - -type ClusterInterface interface { - // APIResourceImports returns a APIResourceImportClusterInformer - APIResourceImports() APIResourceImportClusterInformer - // NegotiatedAPIResources returns a NegotiatedAPIResourceClusterInformer - NegotiatedAPIResources() NegotiatedAPIResourceClusterInformer -} - -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} -} - -// APIResourceImports returns a APIResourceImportClusterInformer -func (v *version) APIResourceImports() APIResourceImportClusterInformer { - return &aPIResourceImportClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// NegotiatedAPIResources returns a NegotiatedAPIResourceClusterInformer -func (v *version) NegotiatedAPIResources() NegotiatedAPIResourceClusterInformer { - return &negotiatedAPIResourceClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -type Interface interface { - // APIResourceImports returns a APIResourceImportInformer - APIResourceImports() APIResourceImportInformer - // NegotiatedAPIResources returns a NegotiatedAPIResourceInformer - NegotiatedAPIResources() NegotiatedAPIResourceInformer -} - -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} -} - -// APIResourceImports returns a APIResourceImportInformer -func (v *scopedVersion) APIResourceImports() APIResourceImportInformer { - return &aPIResourceImportScopedInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// NegotiatedAPIResources returns a NegotiatedAPIResourceInformer -func (v *scopedVersion) NegotiatedAPIResources() NegotiatedAPIResourceInformer { - return &negotiatedAPIResourceScopedInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/sdk/client/informers/externalversions/apiresource/v1alpha1/negotiatedapiresource.go b/sdk/client/informers/externalversions/apiresource/v1alpha1/negotiatedapiresource.go deleted file mode 100644 index b053a7531b3..00000000000 --- a/sdk/client/informers/externalversions/apiresource/v1alpha1/negotiatedapiresource.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - "time" - - 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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" - scopedclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned" - clientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster" - "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/internalinterfaces" - apiresourcev1alpha1listers "github.com/kcp-dev/kcp/sdk/client/listers/apiresource/v1alpha1" -) - -// NegotiatedAPIResourceClusterInformer provides access to a shared informer and lister for -// NegotiatedAPIResources. -type NegotiatedAPIResourceClusterInformer interface { - Cluster(logicalcluster.Name) NegotiatedAPIResourceInformer - Informer() kcpcache.ScopeableSharedIndexInformer - Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceClusterLister -} - -type negotiatedAPIResourceClusterInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewNegotiatedAPIResourceClusterInformer constructs a new informer for NegotiatedAPIResource 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 NewNegotiatedAPIResourceClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { - return NewFilteredNegotiatedAPIResourceClusterInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredNegotiatedAPIResourceClusterInformer constructs a new informer for NegotiatedAPIResource 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 NewFilteredNegotiatedAPIResourceClusterInformer(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.ApiresourceV1alpha1().NegotiatedAPIResources().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ApiresourceV1alpha1().NegotiatedAPIResources().Watch(context.TODO(), options) - }, - }, - &apiresourcev1alpha1.NegotiatedAPIResource{}, - resyncPeriod, - indexers, - ) -} - -func (f *negotiatedAPIResourceClusterInformer) defaultInformer(client clientset.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { - return NewFilteredNegotiatedAPIResourceClusterInformer(client, resyncPeriod, cache.Indexers{ - kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, - }, - f.tweakListOptions, - ) -} - -func (f *negotiatedAPIResourceClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1alpha1.NegotiatedAPIResource{}, f.defaultInformer) -} - -func (f *negotiatedAPIResourceClusterInformer) Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceClusterLister { - return apiresourcev1alpha1listers.NewNegotiatedAPIResourceClusterLister(f.Informer().GetIndexer()) -} - -// NegotiatedAPIResourceInformer provides access to a shared informer and lister for -// NegotiatedAPIResources. -type NegotiatedAPIResourceInformer interface { - Informer() cache.SharedIndexInformer - Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceLister -} - -func (f *negotiatedAPIResourceClusterInformer) Cluster(clusterName logicalcluster.Name) NegotiatedAPIResourceInformer { - return &negotiatedAPIResourceInformer{ - informer: f.Informer().Cluster(clusterName), - lister: f.Lister().Cluster(clusterName), - } -} - -type negotiatedAPIResourceInformer struct { - informer cache.SharedIndexInformer - lister apiresourcev1alpha1listers.NegotiatedAPIResourceLister -} - -func (f *negotiatedAPIResourceInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -func (f *negotiatedAPIResourceInformer) Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceLister { - return f.lister -} - -type negotiatedAPIResourceScopedInformer struct { - factory internalinterfaces.SharedScopedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -func (f *negotiatedAPIResourceScopedInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiresourcev1alpha1.NegotiatedAPIResource{}, f.defaultInformer) -} - -func (f *negotiatedAPIResourceScopedInformer) Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceLister { - return apiresourcev1alpha1listers.NewNegotiatedAPIResourceLister(f.Informer().GetIndexer()) -} - -// NewNegotiatedAPIResourceInformer constructs a new informer for NegotiatedAPIResource 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 NewNegotiatedAPIResourceInformer(client scopedclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNegotiatedAPIResourceInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredNegotiatedAPIResourceInformer constructs a new informer for NegotiatedAPIResource 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 NewFilteredNegotiatedAPIResourceInformer(client scopedclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ApiresourceV1alpha1().NegotiatedAPIResources().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ApiresourceV1alpha1().NegotiatedAPIResources().Watch(context.TODO(), options) - }, - }, - &apiresourcev1alpha1.NegotiatedAPIResource{}, - resyncPeriod, - indexers, - ) -} - -func (f *negotiatedAPIResourceScopedInformer) defaultInformer(client scopedclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNegotiatedAPIResourceInformer(client, resyncPeriod, cache.Indexers{}, f.tweakListOptions) -} diff --git a/sdk/client/informers/externalversions/factory.go b/sdk/client/informers/externalversions/factory.go index 7a0bb20ddbf..ce2a7b13cf7 100644 --- a/sdk/client/informers/externalversions/factory.go +++ b/sdk/client/informers/externalversions/factory.go @@ -36,7 +36,6 @@ import ( scopedclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned" clientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster" - apiresourceinformers "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/apiresource" apisinformers "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/apis" coreinformers "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/core" "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/internalinterfaces" @@ -262,17 +261,12 @@ type SharedInformerFactory interface { // InformerFor returns the SharedIndexInformer for obj. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) kcpcache.ScopeableSharedIndexInformer - Apiresource() apiresourceinformers.ClusterInterface Apis() apisinformers.ClusterInterface Core() coreinformers.ClusterInterface Tenancy() tenancyinformers.ClusterInterface Topology() topologyinformers.ClusterInterface } -func (f *sharedInformerFactory) Apiresource() apiresourceinformers.ClusterInterface { - return apiresourceinformers.New(f, f.tweakListOptions) -} - func (f *sharedInformerFactory) Apis() apisinformers.ClusterInterface { return apisinformers.New(f, f.tweakListOptions) } @@ -431,17 +425,12 @@ type SharedScopedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Apiresource() apiresourceinformers.Interface Apis() apisinformers.Interface Core() coreinformers.Interface Tenancy() tenancyinformers.Interface Topology() topologyinformers.Interface } -func (f *sharedScopedInformerFactory) Apiresource() apiresourceinformers.Interface { - return apiresourceinformers.NewScoped(f, f.namespace, f.tweakListOptions) -} - func (f *sharedScopedInformerFactory) Apis() apisinformers.Interface { return apisinformers.NewScoped(f, f.namespace, f.tweakListOptions) } diff --git a/sdk/client/informers/externalversions/generic.go b/sdk/client/informers/externalversions/generic.go index c741e16a0b0..82275753ad4 100644 --- a/sdk/client/informers/externalversions/generic.go +++ b/sdk/client/informers/externalversions/generic.go @@ -30,7 +30,6 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/tools/cache" - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1" tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1" @@ -90,11 +89,6 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericClusterInformer, error) { switch resource { - // Group=apiresource.kcp.io, Version=V1alpha1 - case apiresourcev1alpha1.SchemeGroupVersion.WithResource("apiresourceimports"): - return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Apiresource().V1alpha1().APIResourceImports().Informer()}, nil - case apiresourcev1alpha1.SchemeGroupVersion.WithResource("negotiatedapiresources"): - return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Apiresource().V1alpha1().NegotiatedAPIResources().Informer()}, nil // Group=apis.kcp.io, Version=V1alpha1 case apisv1alpha1.SchemeGroupVersion.WithResource("apibindings"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Apis().V1alpha1().APIBindings().Informer()}, nil @@ -130,13 +124,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // TODO extend this to unknown resources with a client pool func (f *sharedScopedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=apiresource.kcp.io, Version=V1alpha1 - case apiresourcev1alpha1.SchemeGroupVersion.WithResource("apiresourceimports"): - informer := f.Apiresource().V1alpha1().APIResourceImports().Informer() - return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil - case apiresourcev1alpha1.SchemeGroupVersion.WithResource("negotiatedapiresources"): - informer := f.Apiresource().V1alpha1().NegotiatedAPIResources().Informer() - return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil // Group=apis.kcp.io, Version=V1alpha1 case apisv1alpha1.SchemeGroupVersion.WithResource("apibindings"): informer := f.Apis().V1alpha1().APIBindings().Informer() diff --git a/sdk/client/listers/apiresource/v1alpha1/apiresourceimport.go b/sdk/client/listers/apiresource/v1alpha1/apiresourceimport.go deleted file mode 100644 index 4475296e75c..00000000000 --- a/sdk/client/listers/apiresource/v1alpha1/apiresourceimport.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - 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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" -) - -// APIResourceImportClusterLister can list APIResourceImports across all workspaces, or scope down to a APIResourceImportLister for one workspace. -// All objects returned here must be treated as read-only. -type APIResourceImportClusterLister interface { - // List lists all APIResourceImports in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*apiresourcev1alpha1.APIResourceImport, err error) - // Cluster returns a lister that can list and get APIResourceImports in one workspace. - Cluster(clusterName logicalcluster.Name) APIResourceImportLister - APIResourceImportClusterListerExpansion -} - -type aPIResourceImportClusterLister struct { - indexer cache.Indexer -} - -// NewAPIResourceImportClusterLister returns a new APIResourceImportClusterLister. -// 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 -func NewAPIResourceImportClusterLister(indexer cache.Indexer) *aPIResourceImportClusterLister { - return &aPIResourceImportClusterLister{indexer: indexer} -} - -// List lists all APIResourceImports in the indexer across all workspaces. -func (s *aPIResourceImportClusterLister) List(selector labels.Selector) (ret []*apiresourcev1alpha1.APIResourceImport, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*apiresourcev1alpha1.APIResourceImport)) - }) - return ret, err -} - -// Cluster scopes the lister to one workspace, allowing users to list and get APIResourceImports. -func (s *aPIResourceImportClusterLister) Cluster(clusterName logicalcluster.Name) APIResourceImportLister { - return &aPIResourceImportLister{indexer: s.indexer, clusterName: clusterName} -} - -// APIResourceImportLister can list all APIResourceImports, or get one in particular. -// All objects returned here must be treated as read-only. -type APIResourceImportLister interface { - // List lists all APIResourceImports in the workspace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*apiresourcev1alpha1.APIResourceImport, err error) - // Get retrieves the APIResourceImport from the indexer for a given workspace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*apiresourcev1alpha1.APIResourceImport, error) - APIResourceImportListerExpansion -} - -// aPIResourceImportLister can list all APIResourceImports inside a workspace. -type aPIResourceImportLister struct { - indexer cache.Indexer - clusterName logicalcluster.Name -} - -// List lists all APIResourceImports in the indexer for a workspace. -func (s *aPIResourceImportLister) List(selector labels.Selector) (ret []*apiresourcev1alpha1.APIResourceImport, err error) { - err = kcpcache.ListAllByCluster(s.indexer, s.clusterName, selector, func(i interface{}) { - ret = append(ret, i.(*apiresourcev1alpha1.APIResourceImport)) - }) - return ret, err -} - -// Get retrieves the APIResourceImport from the indexer for a given workspace and name. -func (s *aPIResourceImportLister) Get(name string) (*apiresourcev1alpha1.APIResourceImport, error) { - key := kcpcache.ToClusterAwareKey(s.clusterName.String(), "", name) - obj, exists, err := s.indexer.GetByKey(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(apiresourcev1alpha1.Resource("apiresourceimports"), name) - } - return obj.(*apiresourcev1alpha1.APIResourceImport), nil -} - -// NewAPIResourceImportLister returns a new APIResourceImportLister. -// We assume that the indexer: -// - is fed by a workspace-scoped LIST+WATCH -// - uses cache.MetaNamespaceKeyFunc as the key function -func NewAPIResourceImportLister(indexer cache.Indexer) *aPIResourceImportScopedLister { - return &aPIResourceImportScopedLister{indexer: indexer} -} - -// aPIResourceImportScopedLister can list all APIResourceImports inside a workspace. -type aPIResourceImportScopedLister struct { - indexer cache.Indexer -} - -// List lists all APIResourceImports in the indexer for a workspace. -func (s *aPIResourceImportScopedLister) List(selector labels.Selector) (ret []*apiresourcev1alpha1.APIResourceImport, err error) { - err = cache.ListAll(s.indexer, selector, func(i interface{}) { - ret = append(ret, i.(*apiresourcev1alpha1.APIResourceImport)) - }) - return ret, err -} - -// Get retrieves the APIResourceImport from the indexer for a given workspace and name. -func (s *aPIResourceImportScopedLister) Get(name string) (*apiresourcev1alpha1.APIResourceImport, error) { - key := name - obj, exists, err := s.indexer.GetByKey(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(apiresourcev1alpha1.Resource("apiresourceimports"), name) - } - return obj.(*apiresourcev1alpha1.APIResourceImport), nil -} diff --git a/sdk/client/listers/apiresource/v1alpha1/apiresourceimport_expansion.go b/sdk/client/listers/apiresource/v1alpha1/apiresourceimport_expansion.go deleted file mode 100644 index 9e4ae03b4cc..00000000000 --- a/sdk/client/listers/apiresource/v1alpha1/apiresourceimport_expansion.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -// APIResourceImportClusterListerExpansion allows custom methods to be added to APIResourceImportClusterLister. -type APIResourceImportClusterListerExpansion interface{} - -// APIResourceImportListerExpansion allows custom methods to be added to APIResourceImportLister. -type APIResourceImportListerExpansion interface{} diff --git a/sdk/client/listers/apiresource/v1alpha1/negotiatedapiresource.go b/sdk/client/listers/apiresource/v1alpha1/negotiatedapiresource.go deleted file mode 100644 index b40b4ae8911..00000000000 --- a/sdk/client/listers/apiresource/v1alpha1/negotiatedapiresource.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -import ( - 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" - - apiresourcev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apiresource/v1alpha1" -) - -// NegotiatedAPIResourceClusterLister can list NegotiatedAPIResources across all workspaces, or scope down to a NegotiatedAPIResourceLister for one workspace. -// All objects returned here must be treated as read-only. -type NegotiatedAPIResourceClusterLister interface { - // List lists all NegotiatedAPIResources in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*apiresourcev1alpha1.NegotiatedAPIResource, err error) - // Cluster returns a lister that can list and get NegotiatedAPIResources in one workspace. - Cluster(clusterName logicalcluster.Name) NegotiatedAPIResourceLister - NegotiatedAPIResourceClusterListerExpansion -} - -type negotiatedAPIResourceClusterLister struct { - indexer cache.Indexer -} - -// NewNegotiatedAPIResourceClusterLister returns a new NegotiatedAPIResourceClusterLister. -// 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 -func NewNegotiatedAPIResourceClusterLister(indexer cache.Indexer) *negotiatedAPIResourceClusterLister { - return &negotiatedAPIResourceClusterLister{indexer: indexer} -} - -// List lists all NegotiatedAPIResources in the indexer across all workspaces. -func (s *negotiatedAPIResourceClusterLister) List(selector labels.Selector) (ret []*apiresourcev1alpha1.NegotiatedAPIResource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*apiresourcev1alpha1.NegotiatedAPIResource)) - }) - return ret, err -} - -// Cluster scopes the lister to one workspace, allowing users to list and get NegotiatedAPIResources. -func (s *negotiatedAPIResourceClusterLister) Cluster(clusterName logicalcluster.Name) NegotiatedAPIResourceLister { - return &negotiatedAPIResourceLister{indexer: s.indexer, clusterName: clusterName} -} - -// NegotiatedAPIResourceLister can list all NegotiatedAPIResources, or get one in particular. -// All objects returned here must be treated as read-only. -type NegotiatedAPIResourceLister interface { - // List lists all NegotiatedAPIResources in the workspace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*apiresourcev1alpha1.NegotiatedAPIResource, err error) - // Get retrieves the NegotiatedAPIResource from the indexer for a given workspace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*apiresourcev1alpha1.NegotiatedAPIResource, error) - NegotiatedAPIResourceListerExpansion -} - -// negotiatedAPIResourceLister can list all NegotiatedAPIResources inside a workspace. -type negotiatedAPIResourceLister struct { - indexer cache.Indexer - clusterName logicalcluster.Name -} - -// List lists all NegotiatedAPIResources in the indexer for a workspace. -func (s *negotiatedAPIResourceLister) List(selector labels.Selector) (ret []*apiresourcev1alpha1.NegotiatedAPIResource, err error) { - err = kcpcache.ListAllByCluster(s.indexer, s.clusterName, selector, func(i interface{}) { - ret = append(ret, i.(*apiresourcev1alpha1.NegotiatedAPIResource)) - }) - return ret, err -} - -// Get retrieves the NegotiatedAPIResource from the indexer for a given workspace and name. -func (s *negotiatedAPIResourceLister) Get(name string) (*apiresourcev1alpha1.NegotiatedAPIResource, error) { - key := kcpcache.ToClusterAwareKey(s.clusterName.String(), "", name) - obj, exists, err := s.indexer.GetByKey(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(apiresourcev1alpha1.Resource("negotiatedapiresources"), name) - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), nil -} - -// NewNegotiatedAPIResourceLister returns a new NegotiatedAPIResourceLister. -// We assume that the indexer: -// - is fed by a workspace-scoped LIST+WATCH -// - uses cache.MetaNamespaceKeyFunc as the key function -func NewNegotiatedAPIResourceLister(indexer cache.Indexer) *negotiatedAPIResourceScopedLister { - return &negotiatedAPIResourceScopedLister{indexer: indexer} -} - -// negotiatedAPIResourceScopedLister can list all NegotiatedAPIResources inside a workspace. -type negotiatedAPIResourceScopedLister struct { - indexer cache.Indexer -} - -// List lists all NegotiatedAPIResources in the indexer for a workspace. -func (s *negotiatedAPIResourceScopedLister) List(selector labels.Selector) (ret []*apiresourcev1alpha1.NegotiatedAPIResource, err error) { - err = cache.ListAll(s.indexer, selector, func(i interface{}) { - ret = append(ret, i.(*apiresourcev1alpha1.NegotiatedAPIResource)) - }) - return ret, err -} - -// Get retrieves the NegotiatedAPIResource from the indexer for a given workspace and name. -func (s *negotiatedAPIResourceScopedLister) Get(name string) (*apiresourcev1alpha1.NegotiatedAPIResource, error) { - key := name - obj, exists, err := s.indexer.GetByKey(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(apiresourcev1alpha1.Resource("negotiatedapiresources"), name) - } - return obj.(*apiresourcev1alpha1.NegotiatedAPIResource), nil -} diff --git a/sdk/client/listers/apiresource/v1alpha1/negotiatedapiresource_expansion.go b/sdk/client/listers/apiresource/v1alpha1/negotiatedapiresource_expansion.go deleted file mode 100644 index 59730a02769..00000000000 --- a/sdk/client/listers/apiresource/v1alpha1/negotiatedapiresource_expansion.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The KCP Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by kcp code-generator. DO NOT EDIT. - -package v1alpha1 - -// NegotiatedAPIResourceClusterListerExpansion allows custom methods to be added to NegotiatedAPIResourceClusterLister. -type NegotiatedAPIResourceClusterListerExpansion interface{} - -// NegotiatedAPIResourceListerExpansion allows custom methods to be added to NegotiatedAPIResourceLister. -type NegotiatedAPIResourceListerExpansion interface{}