diff --git a/go.mod b/go.mod index d2713e063..668542838 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( kmodules.xyz/custom-resources v0.29.0 kmodules.xyz/go-containerregistry v0.0.12 kmodules.xyz/monitoring-agent-api v0.29.0 - kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139 + kmodules.xyz/resource-metadata v0.18.2-0.20240118152448-267a08d36cf0 kmodules.xyz/resource-metrics v0.29.0 kmodules.xyz/sets v0.29.0 kubeops.dev/scanner v0.0.16 diff --git a/go.sum b/go.sum index 9013bf0dc..496779d6e 100644 --- a/go.sum +++ b/go.sum @@ -3456,8 +3456,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9 kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI= kmodules.xyz/offshoot-api v0.29.0 h1:GHLhxxT9jU1N8+FvOCCeJNyU5g0duYS46UGrs6AHNLY= kmodules.xyz/offshoot-api v0.29.0/go.mod h1:5NxhBblXoDHWStx9HCDJR2KFTwYjEZ7i1Id3jelIunw= -kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139 h1:5aMsW8E+Cgvp5jgec/a7j8pQ2zfD00TyiZTuLu+Vw+0= -kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139/go.mod h1:I9HeSgkshwzwUy0IDhp4yIfRFbFQJ21syeSf4NsB04o= +kmodules.xyz/resource-metadata v0.18.2-0.20240118152448-267a08d36cf0 h1:AH4FZ4XybovFyuPi0GuOMibM/ID2DVumdmxqic3SpHs= +kmodules.xyz/resource-metadata v0.18.2-0.20240118152448-267a08d36cf0/go.mod h1:I9HeSgkshwzwUy0IDhp4yIfRFbFQJ21syeSf4NsB04o= kmodules.xyz/resource-metrics v0.29.0 h1:YBSVCbGdAugUqZK4igHu3fPhxvpYar4xejE6njryNM4= kmodules.xyz/resource-metrics v0.29.0/go.mod h1:OuG/QobZ7o8GFHl/u3lqaUR0fDZDegxtV8Vdh+MNBD4= kmodules.xyz/sets v0.29.0 h1:ZX/qOECzUob95JhhRtngJElHSlJ1UNNdwK4hTEy+nl0= diff --git a/pkg/registry/meta/resourceeditor/storage.go b/pkg/registry/meta/resourceeditor/storage.go index 0f0029f09..71dd8fa73 100644 --- a/pkg/registry/meta/resourceeditor/storage.go +++ b/pkg/registry/meta/resourceeditor/storage.go @@ -82,7 +82,10 @@ func (r *Storage) Get(ctx context.Context, name string, options *metav1.GetOptio if err != nil { return nil, kerr.NewNotFound(schema.GroupResource{Group: meta.GroupName, Resource: uiapi.ResourceKindResourceEditor}, name) } - return complete(obj.DeepCopy()), err + return complete(&rsapi.ResourceEditor{ + ObjectMeta: obj.ObjectMeta, + Spec: *obj.Spec.DeepCopy(), + }), err } // Lister @@ -116,7 +119,10 @@ func (r *Storage) List(ctx context.Context, options *metainternalversion.ListOpt if options.LabelSelector != nil && !options.LabelSelector.Matches(labels.Set(obj.GetLabels())) { continue } - items = append(items, *complete(obj.DeepCopy())) + items = append(items, *complete(&rsapi.ResourceEditor{ + ObjectMeta: obj.ObjectMeta, + Spec: *obj.Spec.DeepCopy(), + })) } return &rsapi.ResourceEditorList{Items: items}, nil diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go index 19fe7cddb..5a0bf6abb 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go @@ -370,6 +370,8 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceDescriptor": schema_resource_metadata_apis_meta_v1alpha1_ResourceDescriptor(ref), "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceDescriptorList": schema_resource_metadata_apis_meta_v1alpha1_ResourceDescriptorList(ref), "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceDescriptorSpec": schema_resource_metadata_apis_meta_v1alpha1_ResourceDescriptorSpec(ref), + "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceEditor": schema_resource_metadata_apis_meta_v1alpha1_ResourceEditor(ref), + "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceEditorList": schema_resource_metadata_apis_meta_v1alpha1_ResourceEditorList(ref), "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceExec": schema_resource_metadata_apis_meta_v1alpha1_ResourceExec(ref), "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceGraph": schema_resource_metadata_apis_meta_v1alpha1_ResourceGraph(ref), "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceGraphRequest": schema_resource_metadata_apis_meta_v1alpha1_ResourceGraphRequest(ref), @@ -18267,6 +18269,93 @@ func schema_resource_metadata_apis_meta_v1alpha1_ResourceDescriptorSpec(ref comm } } +func schema_resource_metadata_apis_meta_v1alpha1_ResourceEditor(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + 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("kmodules.xyz/resource-metadata/apis/ui/v1alpha1.ResourceEditorSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kmodules.xyz/resource-metadata/apis/ui/v1alpha1.ResourceEditorSpec"}, + } +} + +func schema_resource_metadata_apis_meta_v1alpha1_ResourceEditorList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + 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("kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceEditor"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kmodules.xyz/resource-metadata/apis/meta/v1alpha1.ResourceEditor"}, + } +} + func schema_resource_metadata_apis_meta_v1alpha1_ResourceExec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/resourceeditor_types.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/resourceeditor_types.go index 64e0d58c2..1ef3c5444 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/resourceeditor_types.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/resourceeditor_types.go @@ -16,9 +16,34 @@ limitations under the License. package v1alpha1 -import uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1" +import ( + uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1" -type ( - ResourceEditor = uiapi.ResourceEditor - ResourceEditorList = uiapi.ResourceEditorList + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) + +// +genclient +// +genclient:nonNamespaced +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=resourceeditors,singular=resourceeditor,scope=Cluster +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type ResourceEditor struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec uiapi.ResourceEditorSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +type ResourceEditorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ResourceEditor `json:"items,omitempty"` +} diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go index 0c3c155b7..4ebd22c7a 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/zz_generated.deepcopy.go @@ -1735,6 +1735,66 @@ func (in *ResourceDescriptorSpec) DeepCopy() *ResourceDescriptorSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceEditor) DeepCopyInto(out *ResourceEditor) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceEditor. +func (in *ResourceEditor) DeepCopy() *ResourceEditor { + if in == nil { + return nil + } + out := new(ResourceEditor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceEditor) 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 *ResourceEditorList) DeepCopyInto(out *ResourceEditorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourceEditor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceEditorList. +func (in *ResourceEditorList) DeepCopy() *ResourceEditorList { + if in == nil { + return nil + } + out := new(ResourceEditorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceEditorList) 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 *ResourceExec) DeepCopyInto(out *ResourceExec) { *out = *in diff --git a/vendor/kmodules.xyz/resource-metadata/crds/meta.k8s.appscode.com_resourceeditors.yaml b/vendor/kmodules.xyz/resource-metadata/crds/meta.k8s.appscode.com_resourceeditors.yaml new file mode 100644 index 000000000..a04354acd --- /dev/null +++ b/vendor/kmodules.xyz/resource-metadata/crds/meta.k8s.appscode.com_resourceeditors.yaml @@ -0,0 +1,378 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + name: resourceeditors.meta.k8s.appscode.com +spec: + group: meta.k8s.appscode.com + names: + kind: ResourceEditor + listKind: ResourceEditorList + plural: resourceeditors + singular: resourceeditor + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.phase + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + icons: + description: Icons is an optional list of icons for an application. + Icon information includes the source, size, and mime type. + items: + description: ImageSpec contains information about an image used + as an icon. + properties: + size: + description: (optional) The size of the image in pixels (e.g., + 25x25). + type: string + src: + description: The source for image represented as either an absolute + URL to the image or a Data URL containing the image. Data + URLs are defined in RFC 2397. + type: string + type: + description: (optional) The mine type of the image (e.g., "image/png"). + type: string + required: + - src + type: object + type: array + installer: + properties: + chart: + description: ChartSourceRef references to a single version of + a Chart + properties: + name: + type: string + sourceRef: + description: TypedObjectReference represents an typed namespaced + object. + properties: + apiGroup: + type: string + kind: + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + required: + - name + type: object + version: + type: string + required: + - name + - sourceRef + - version + type: object + planID: + type: string + productID: + type: string + type: object + resource: + description: ResourceID identifies a resource + properties: + group: + type: string + kind: + description: Kind is the serialized kind of the resource. It + is normally CamelCase and singular. + type: string + name: + description: 'Name is the plural name of the resource to serve. It + must match the name of the CustomResourceDefinition-registration + too: plural.group and it must be all lowercase.' + type: string + scope: + description: ResourceScope is an enum defining the different scopes + available to a custom resource + type: string + version: + type: string + required: + - group + type: object + ui: + properties: + actions: + items: + properties: + description: + type: string + items: + items: + properties: + description: + type: string + disabledTemplate: + type: string + editor: + description: ChartSourceRef references to a single + version of a Chart + properties: + name: + type: string + sourceRef: + description: TypedObjectReference represents an + typed namespaced object. + properties: + apiGroup: + type: string + kind: + type: string + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + required: + - name + type: object + version: + type: string + required: + - name + - sourceRef + - version + type: object + enforceQuota: + type: boolean + flow: + type: string + icons: + items: + description: ImageSpec contains information about + an image used as an icon. + properties: + size: + description: (optional) The size of the image + in pixels (e.g., 25x25). + type: string + src: + description: The source for image represented + as either an absolute URL to the image or + a Data URL containing the image. Data URLs + are defined in RFC 2397. + type: string + type: + description: (optional) The mine type of the + image (e.g., "image/png"). + type: string + required: + - src + type: object + type: array + name: + type: string + operationId: + type: string + required: + - enforceQuota + - flow + - operationId + type: object + type: array + name: + type: string + required: + - items + type: object + type: array + editor: + description: ChartSourceRef references to a single version of + a Chart + properties: + name: + type: string + sourceRef: + description: TypedObjectReference represents an typed namespaced + object. + properties: + apiGroup: + type: string + kind: + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + required: + - name + type: object + version: + type: string + required: + - name + - sourceRef + - version + type: object + enforceQuota: + type: boolean + instanceLabelPaths: + description: app.kubernetes.io/instance label must be updated + at these paths when refilling metadata + items: + type: string + type: array + options: + description: ChartSourceRef references to a single version of + a Chart + properties: + name: + type: string + sourceRef: + description: TypedObjectReference represents an typed namespaced + object. + properties: + apiGroup: + type: string + kind: + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + required: + - name + type: object + version: + type: string + required: + - name + - sourceRef + - version + type: object + required: + - enforceQuota + type: object + variants: + description: Kind == VendorChartPreset | ClusterChartPreset + items: + properties: + description: + type: string + icons: + description: Icons is an optional list of icons for an application. + Icon information includes the source, size, and mime type. + items: + description: ImageSpec contains information about an image + used as an icon. + properties: + size: + description: (optional) The size of the image in pixels + (e.g., 25x25). + type: string + src: + description: The source for image represented as either + an absolute URL to the image or a Data URL containing + the image. Data URLs are defined in RFC 2397. + type: string + type: + description: (optional) The mine type of the image (e.g., + "image/png"). + type: string + required: + - src + type: object + type: array + name: + type: string + selector: + description: A label selector is a label query over a set of + resources. The result of matchLabels and matchExpressions + are ANDed. An empty label selector matches all objects. A + null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. This + array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + title: + type: string + required: + - name + type: object + type: array + required: + - resource + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/vendor/modules.txt b/vendor/modules.txt index c8f8919bc..3a36f25e6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1952,7 +1952,7 @@ kmodules.xyz/monitoring-agent-api/client # kmodules.xyz/offshoot-api v0.29.0 ## explicit; go 1.21.5 kmodules.xyz/offshoot-api/api/v1 -# kmodules.xyz/resource-metadata v0.18.2-0.20240118143554-f415526b8139 +# kmodules.xyz/resource-metadata v0.18.2-0.20240118152448-267a08d36cf0 ## explicit; go 1.21.5 kmodules.xyz/resource-metadata/apis/core/install kmodules.xyz/resource-metadata/apis/core/v1alpha1