From 1487175a838e7db76a4cc8fa30a205fbcb20028c Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Fri, 28 Apr 2023 15:56:38 -0400 Subject: [PATCH] remove unused stuff from APIs --- Makefile | 2 +- cmd/apiserver/main.go | 42 ------ ...d.operatorframework.io_bundlemetadata.yaml | 17 +-- ...d.operatorframework.io_catalogsources.yaml | 5 +- ...atalogd.operatorframework.io_packages.yaml | 5 +- config/rbac/role.yaml | 1 - pkg/apis/core/v1beta1/bundlemetadata_types.go | 95 ++---------- pkg/apis/core/v1beta1/catalogsource_types.go | 102 ++----------- pkg/apis/core/v1beta1/doc.go | 26 ---- .../{register.go => groupversion_info.go} | 28 ++-- pkg/apis/core/v1beta1/package_types.go | 141 +----------------- .../core/v1beta1/zz_generated.deepcopy.go | 106 +------------ .../core/catalogsource_controller.go | 4 +- 13 files changed, 58 insertions(+), 516 deletions(-) delete mode 100644 cmd/apiserver/main.go delete mode 100644 pkg/apis/core/v1beta1/doc.go rename pkg/apis/core/v1beta1/{register.go => groupversion_info.go} (50%) diff --git a/Makefile b/Makefile index 9ec5b677..5a130a52 100644 --- a/Makefile +++ b/Makefile @@ -192,7 +192,7 @@ $(TOOLS_BIN_DIR): KUSTOMIZE_VERSION ?= v5.0.1 KIND_VERSION ?= v0.15.0 -CONTROLLER_TOOLS_VERSION ?= v0.10.0 +CONTROLLER_TOOLS_VERSION ?= v0.11.4 GORELEASER_VERSION ?= v1.16.2 ENVTEST_VERSION ?= latest diff --git a/cmd/apiserver/main.go b/cmd/apiserver/main.go deleted file mode 100644 index 09967baf..00000000 --- a/cmd/apiserver/main.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 ( - "k8s.io/klog" - "sigs.k8s.io/apiserver-runtime/pkg/builder" - - // +kubebuilder:scaffold:resource-imports - - corev1beta1 "github.com/operator-framework/catalogd/pkg/apis/core/v1beta1" -) - -// TODO: We can't properly set the version for the APIServer using the apiserver-runtime -// package because they hardcode the version here: https://github.com/kubernetes-sigs/apiserver-runtime/blob/33c90185692756252ad3e36c5a940167d0de8f41/internal/sample-apiserver/pkg/apiserver/apiserver.go#L86-L89 -// To be able to update this we would need to create a PR to fix it OR create the apiserver w/o using the apiserver-runtime tooling - -func main() { - err := builder.APIServer. - // +kubebuilder:scaffold:resource-register - WithResource(&corev1beta1.Package{}). - WithResource(&corev1beta1.BundleMetadata{}). - WithResource(&corev1beta1.CatalogSource{}). - Execute() - if err != nil { - klog.Fatal(err) - } -} diff --git a/config/crd/bases/catalogd.operatorframework.io_bundlemetadata.yaml b/config/crd/bases/catalogd.operatorframework.io_bundlemetadata.yaml index 9bad23fc..bdd08509 100644 --- a/config/crd/bases/catalogd.operatorframework.io_bundlemetadata.yaml +++ b/config/crd/bases/catalogd.operatorframework.io_bundlemetadata.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.10.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.11.4 name: bundlemetadata.catalogd.operatorframework.io spec: group: catalogd.operatorframework.io @@ -18,7 +17,7 @@ spec: - name: v1beta1 schema: openAPIV3Schema: - description: BundleMetadata + description: BundleMetadata is the Schema for the bundlemetadata API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -51,16 +50,12 @@ spec: description: Properties is a string of references to property objects that are part of the bundle items: - description: 'TODO: In the future we should remove this in favor - of using `property.Property` from https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/property#Property - This will likely require some changes to the `property.Property` - type to make it suitable for usage within the Spec for a CustomResource' properties: type: type: string value: - format: byte - type: string + type: object + x-kubernetes-preserve-unknown-fields: true required: - type - value @@ -70,8 +65,8 @@ spec: description: RelatedImages are the RelatedImages in the bundle items: description: 'TODO: In the future we should remove this in favor - of using `model.RelatedImage` (or similar) from https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/model#RelatedImage - This will likely require some changes to the `model.RelatedImage` + of using `declcfg.RelatedImage` (or similar) from https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/declcfg#RelatedImage + This will likely require some changes to the `declcfg.RelatedImage` type to make it suitable for usage within the Spec for a CustomResource' properties: image: diff --git a/config/crd/bases/catalogd.operatorframework.io_catalogsources.yaml b/config/crd/bases/catalogd.operatorframework.io_catalogsources.yaml index a3638ddb..a376a4c4 100644 --- a/config/crd/bases/catalogd.operatorframework.io_catalogsources.yaml +++ b/config/crd/bases/catalogd.operatorframework.io_catalogsources.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.10.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.11.4 name: catalogsources.catalogd.operatorframework.io spec: group: catalogd.operatorframework.io @@ -18,7 +17,7 @@ spec: - name: v1beta1 schema: openAPIV3Schema: - description: CatalogSource + description: CatalogSource is the Schema for the catalogsources API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/config/crd/bases/catalogd.operatorframework.io_packages.yaml b/config/crd/bases/catalogd.operatorframework.io_packages.yaml index 50922629..e1d71054 100644 --- a/config/crd/bases/catalogd.operatorframework.io_packages.yaml +++ b/config/crd/bases/catalogd.operatorframework.io_packages.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.10.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.11.4 name: packages.catalogd.operatorframework.io spec: group: catalogd.operatorframework.io @@ -18,7 +17,7 @@ spec: - name: v1beta1 schema: openAPIV3Schema: - description: Package + description: Package is the Schema for the packages API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 76c2b05b..5383b7d5 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -2,7 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - creationTimestamp: null name: manager-role rules: - apiGroups: diff --git a/pkg/apis/core/v1beta1/bundlemetadata_types.go b/pkg/apis/core/v1beta1/bundlemetadata_types.go index 660c5e1a..9e041d47 100644 --- a/pkg/apis/core/v1beta1/bundlemetadata_types.go +++ b/pkg/apis/core/v1beta1/bundlemetadata_types.go @@ -17,22 +17,14 @@ limitations under the License. package v1beta1 import ( - "context" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - "sigs.k8s.io/apiserver-runtime/pkg/builder/resource" - "sigs.k8s.io/apiserver-runtime/pkg/builder/resource/resourcestrategy" ) -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:object:root=true +//+kubebuilder:resource:scope=Cluster -// BundleMetadata -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster +// BundleMetadata is the Schema for the bundlemetadata API type BundleMetadata struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -41,8 +33,9 @@ type BundleMetadata struct { Status BundleMetadataStatus `json:"status,omitempty"` } -// BundleMetadataList -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:object:root=true + +// BundleMetadataList contains a list of BundleMetadata type BundleMetadataList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -68,83 +61,25 @@ type BundleMetadataSpec struct { RelatedImages []RelatedImage `json:"relatedImages"` } -// TODO: In the future we should remove this in favor of using `property.Property` from -// https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/property#Property -// This will likely require some changes to the `property.Property` type to -// make it suitable for usage within the Spec for a CustomResource type Property struct { - Type string `json:"type"` - Value []byte `json:"value"` + Type string `json:"type"` + + // +kubebuilder:pruning:PreserveUnknownFields + Value runtime.RawExtension `json:"value"` } -// TODO: In the future we should remove this in favor of using `model.RelatedImage` (or similar) from -// https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/model#RelatedImage -// This will likely require some changes to the `model.RelatedImage` type +// TODO: In the future we should remove this in favor of using `declcfg.RelatedImage` (or similar) from +// https://pkg.go.dev/github.com/operator-framework/operator-registry@v1.26.3/alpha/declcfg#RelatedImage +// This will likely require some changes to the `declcfg.RelatedImage` type // to make it suitable for usage within the Spec for a CustomResource type RelatedImage struct { Name string `json:"name"` Image string `json:"image"` } -var _ resource.Object = &BundleMetadata{} -var _ resourcestrategy.Validater = &BundleMetadata{} - -func (in *BundleMetadata) GetObjectMeta() *metav1.ObjectMeta { - return &in.ObjectMeta -} - -func (in *BundleMetadata) NamespaceScoped() bool { - return false -} - -func (in *BundleMetadata) New() runtime.Object { - return &BundleMetadata{} -} - -func (in *BundleMetadata) NewList() runtime.Object { - return &BundleMetadataList{} -} - -func (in *BundleMetadata) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: "catalogd.operatorframework.io", - Version: "v1beta1", - Resource: "bundlemetadata", - } -} - -func (in *BundleMetadata) IsStorageVersion() bool { - return true -} - -func (in *BundleMetadata) Validate(ctx context.Context) field.ErrorList { - // TODO(user): Modify it, adding your API validation here. - return nil -} - -var _ resource.ObjectList = &BundleMetadataList{} - -func (in *BundleMetadataList) GetListMeta() *metav1.ListMeta { - return &in.ListMeta -} - // BundleMetadataStatus defines the observed state of BundleMetadata type BundleMetadataStatus struct{} -func (in BundleMetadataStatus) SubResourceName() string { - return "status" -} - -// BundleMetadata implements ObjectWithStatusSubResource interface. -var _ resource.ObjectWithStatusSubResource = &BundleMetadata{} - -func (in *BundleMetadata) GetStatus() resource.StatusSubResource { - return in.Status -} - -// BundleMetadataStatus{} implements StatusSubResource interface. -var _ resource.StatusSubResource = &BundleMetadataStatus{} - -func (in BundleMetadataStatus) CopyTo(parent resource.ObjectWithStatusSubResource) { - parent.(*BundleMetadata).Status = in +func init() { + SchemeBuilder.Register(&BundleMetadata{}, &BundleMetadataList{}) } diff --git a/pkg/apis/core/v1beta1/catalogsource_types.go b/pkg/apis/core/v1beta1/catalogsource_types.go index a8cfce93..8b4412f0 100644 --- a/pkg/apis/core/v1beta1/catalogsource_types.go +++ b/pkg/apis/core/v1beta1/catalogsource_types.go @@ -17,14 +17,7 @@ limitations under the License. package v1beta1 import ( - "context" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - "sigs.k8s.io/apiserver-runtime/pkg/builder/resource" - "sigs.k8s.io/apiserver-runtime/pkg/builder/resource/resourcestrategy" ) const ( @@ -34,13 +27,11 @@ const ( ReasonUnpackError = "UnpackError" ) -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:object:root=true +//+kubebuilder:resource:scope=Cluster +//+kubebuilder:subresource:status -// CatalogSource -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status +// CatalogSource is the Schema for the catalogsources API type CatalogSource struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -49,8 +40,9 @@ type CatalogSource struct { Status CatalogSourceStatus `json:"status,omitempty"` } -// CatalogSourceList -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:object:root=true + +// CatalogSourceList contains a list of CatalogSource type CatalogSourceList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -72,88 +64,12 @@ type CatalogSourceSpec struct { PollingInterval *metav1.Duration `json:"pollingInterval,omitempty"` } -var _ resource.Object = &CatalogSource{} -var _ resourcestrategy.Validater = &CatalogSource{} - -func (in *CatalogSource) GetObjectMeta() *metav1.ObjectMeta { - return &in.ObjectMeta -} - -func (in *CatalogSource) NamespaceScoped() bool { - return false -} - -func (in *CatalogSource) New() runtime.Object { - return &CatalogSource{} -} - -func (in *CatalogSource) NewList() runtime.Object { - return &CatalogSourceList{} -} - -func (in *CatalogSource) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: "catalogd.operatorframework.io", - Version: "v1beta1", - Resource: "catalogsources", - } -} - -func (in *CatalogSource) IsStorageVersion() bool { - return true -} - -func (in *CatalogSource) Validate(ctx context.Context) field.ErrorList { - // TODO(user): Modify it, adding your API validation here. - return nil -} - -var _ resource.ObjectList = &CatalogSourceList{} - -func (in *CatalogSourceList) GetListMeta() *metav1.ListMeta { - return &in.ListMeta -} - // CatalogSourceStatus defines the observed state of CatalogSource type CatalogSourceStatus struct { // Conditions store the status conditions of the CatalogSource instances Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` } -func (in CatalogSourceStatus) SubResourceName() string { - return "status" -} - -// CatalogSource implements ObjectWithStatusSubResource interface. -var _ resource.ObjectWithStatusSubResource = &CatalogSource{} - -func (in *CatalogSource) GetStatus() resource.StatusSubResource { - return in.Status -} - -// CatalogSourceStatus{} implements StatusSubResource interface. -var _ resource.StatusSubResource = &CatalogSourceStatus{} - -func (in CatalogSourceStatus) CopyTo(parent resource.ObjectWithStatusSubResource) { - parent.(*CatalogSource).Status = in -} - -// TODO: We should probably move this to a specific errors package -type UnpackPhaseError struct { - message string -} - -func NewUnpackPhaseError(message string) *UnpackPhaseError { - return &UnpackPhaseError{ - message: message, - } -} - -func (upe *UnpackPhaseError) Error() string { - return upe.message -} - -func IsUnpackPhaseError(err error) bool { - _, ok := err.(*UnpackPhaseError) - return ok +func init() { + SchemeBuilder.Register(&CatalogSource{}, &CatalogSourceList{}) } diff --git a/pkg/apis/core/v1beta1/doc.go b/pkg/apis/core/v1beta1/doc.go deleted file mode 100644 index ba44f0f2..00000000 --- a/pkg/apis/core/v1beta1/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2022. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Api versions allow the api contract for a resource to be changed while keeping -// backward compatibility by support multiple concurrent versions -// of the same resource - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/operator-framework/catalogd/pkg/apis/core -// +k8s:defaulter-gen=TypeMeta -// +groupName=catalogd.operatorframework.io -package v1beta1 // import "github.com/operator-framework/catalogd/pkg/apis/core/v1beta1" diff --git a/pkg/apis/core/v1beta1/register.go b/pkg/apis/core/v1beta1/groupversion_info.go similarity index 50% rename from pkg/apis/core/v1beta1/register.go rename to pkg/apis/core/v1beta1/groupversion_info.go index 531c4772..3546d26c 100644 --- a/pkg/apis/core/v1beta1/register.go +++ b/pkg/apis/core/v1beta1/groupversion_info.go @@ -14,27 +14,23 @@ See the License for the specific language governing permissions and limitations under the License. */ +// Package v1beta1 contains API Schema definitions for the core v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=catalogd.operatorframework.io package v1beta1 import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" ) -var AddToScheme = func(scheme *runtime.Scheme) error { - gv := schema.GroupVersion{ - Group: "catalogd.operatorframework.io", - Version: "v1beta1", - } - metav1.AddToGroupVersion(scheme, gv) - // +kubebuilder:scaffold:install +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "catalogd.operatorframework.io", Version: "v1beta1"} - scheme.AddKnownTypes(gv, &Package{}, &PackageList{}) + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - scheme.AddKnownTypes(gv, &CatalogSource{}, &CatalogSourceList{}) - - scheme.AddKnownTypes(gv, &BundleMetadata{}, &BundleMetadataList{}) - - return nil -} + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/pkg/apis/core/v1beta1/package_types.go b/pkg/apis/core/v1beta1/package_types.go index 9ac12837..fa5edf76 100644 --- a/pkg/apis/core/v1beta1/package_types.go +++ b/pkg/apis/core/v1beta1/package_types.go @@ -17,24 +17,13 @@ limitations under the License. package v1beta1 import ( - "context" - - "github.com/operator-framework/api/pkg/lib/version" - operatorv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/validation/field" - "sigs.k8s.io/apiserver-runtime/pkg/builder/resource" - "sigs.k8s.io/apiserver-runtime/pkg/builder/resource/resourcestrategy" ) -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:object:root=true +//+kubebuilder:resource:scope=Cluster -// Package -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster +// Package is the Schema for the packages API type Package struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -43,8 +32,9 @@ type Package struct { Status PackageStatus `json:"status,omitempty"` } -// PackageList -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:object:root=true + +// PackageList contains a list of Package type PackageList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -101,124 +91,9 @@ type Icon struct { Mediatype string `json:"mediatype,omitempty"` } -var _ resource.Object = &Package{} -var _ resourcestrategy.Validater = &Package{} - -func (in *Package) GetObjectMeta() *metav1.ObjectMeta { - return &in.ObjectMeta -} - -func (in *Package) NamespaceScoped() bool { - return false -} - -func (in *Package) New() runtime.Object { - return &Package{} -} - -func (in *Package) NewList() runtime.Object { - return &PackageList{} -} - -func (in *Package) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: "catalogd.operatorframework.io", - Version: "v1beta1", - Resource: "packages", - } -} - -func (in *Package) IsStorageVersion() bool { - return true -} - -func (in *Package) Validate(ctx context.Context) field.ErrorList { - // TODO(user): Modify it, adding your API validation here. - return nil -} - -var _ resource.ObjectList = &PackageList{} - -func (in *PackageList) GetListMeta() *metav1.ListMeta { - return &in.ListMeta -} - -// TODO: Audit this section -// ---- START AUDIT SECTION ---- - -// AppLink defines a link to an application -type AppLink struct { - Name string `json:"name,omitempty"` - URL string `json:"url,omitempty"` -} - -// Maintainer defines a project maintainer -type Maintainer struct { - Name string `json:"name,omitempty"` - Email string `json:"email,omitempty"` -} - -// Description -type Description struct { - // DisplayName - DisplayName string `json:"displayName,omitempty"` - - // Icon is the base64 encoded icon - // +listType=set - Icon []Icon `json:"icon,omitempty"` - - // Version - Version version.OperatorVersion `json:"version,omitempty"` - - // Provider - Provider AppLink `json:"provider,omitempty"` - // // +listType=map - // Annotations map[string]string `json:"annotations,omitempty"` - // +listType=set - Keywords []string `json:"keywords,omitempty"` - // +listType=set - Links []AppLink `json:"links,omitempty"` - // +listType=set - Maintainers []Maintainer `json:"maintainers,omitempty"` - Maturity string `json:"maturity,omitempty"` - - // LongDescription - LongDescription string `json:"description,omitempty"` - - // InstallModes specify supported installation types - // +listType=set - InstallModes []operatorv1alpha1.InstallMode `json:"installModes,omitempty"` - - CustomResourceDefinitions operatorv1alpha1.CustomResourceDefinitions `json:"customresourcedefinitions,omitempty"` - APIServiceDefinitions operatorv1alpha1.APIServiceDefinitions `json:"apiservicedefinitions,omitempty"` - NativeAPIs []metav1.GroupVersionKind `json:"nativeApis,omitempty"` - - // Minimum Kubernetes version for operator installation - MinKubeVersion string `json:"minKubeVersion,omitempty"` - - // List of related images - RelatedImages []string `json:"relatedImages,omitempty"` -} - -// ---- END AUDIT SECTION ---- - // PackageStatus defines the observed state of Package type PackageStatus struct{} -func (in PackageStatus) SubResourceName() string { - return "status" -} - -// Package implements ObjectWithStatusSubResource interface. -var _ resource.ObjectWithStatusSubResource = &Package{} - -func (in *Package) GetStatus() resource.StatusSubResource { - return in.Status -} - -// PackageStatus{} implements StatusSubResource interface. -var _ resource.StatusSubResource = &PackageStatus{} - -func (in PackageStatus) CopyTo(parent resource.ObjectWithStatusSubResource) { - parent.(*Package).Status = in +func init() { + SchemeBuilder.Register(&Package{}, &PackageList{}) } diff --git a/pkg/apis/core/v1beta1/zz_generated.deepcopy.go b/pkg/apis/core/v1beta1/zz_generated.deepcopy.go index e20cd1b2..3c9835ee 100644 --- a/pkg/apis/core/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/core/v1beta1/zz_generated.deepcopy.go @@ -22,26 +22,10 @@ limitations under the License. package v1beta1 import ( - "github.com/operator-framework/api/pkg/operators/v1alpha1" "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AppLink) DeepCopyInto(out *AppLink) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppLink. -func (in *AppLink) DeepCopy() *AppLink { - if in == nil { - return nil - } - out := new(AppLink) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BundleMetadata) DeepCopyInto(out *BundleMetadata) { *out = *in @@ -264,60 +248,6 @@ func (in *ChannelEntry) DeepCopy() *ChannelEntry { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Description) DeepCopyInto(out *Description) { - *out = *in - if in.Icon != nil { - in, out := &in.Icon, &out.Icon - *out = make([]Icon, len(*in)) - copy(*out, *in) - } - in.Version.DeepCopyInto(&out.Version) - out.Provider = in.Provider - if in.Keywords != nil { - in, out := &in.Keywords, &out.Keywords - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Links != nil { - in, out := &in.Links, &out.Links - *out = make([]AppLink, len(*in)) - copy(*out, *in) - } - if in.Maintainers != nil { - in, out := &in.Maintainers, &out.Maintainers - *out = make([]Maintainer, len(*in)) - copy(*out, *in) - } - if in.InstallModes != nil { - in, out := &in.InstallModes, &out.InstallModes - *out = make([]v1alpha1.InstallMode, len(*in)) - copy(*out, *in) - } - in.CustomResourceDefinitions.DeepCopyInto(&out.CustomResourceDefinitions) - in.APIServiceDefinitions.DeepCopyInto(&out.APIServiceDefinitions) - if in.NativeAPIs != nil { - in, out := &in.NativeAPIs, &out.NativeAPIs - *out = make([]v1.GroupVersionKind, len(*in)) - copy(*out, *in) - } - if in.RelatedImages != nil { - in, out := &in.RelatedImages, &out.RelatedImages - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Description. -func (in *Description) DeepCopy() *Description { - if in == nil { - return nil - } - out := new(Description) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Icon) DeepCopyInto(out *Icon) { *out = *in @@ -333,21 +263,6 @@ func (in *Icon) DeepCopy() *Icon { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Maintainer) DeepCopyInto(out *Maintainer) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Maintainer. -func (in *Maintainer) DeepCopy() *Maintainer { - if in == nil { - return nil - } - out := new(Maintainer) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Package) DeepCopyInto(out *Package) { *out = *in @@ -470,11 +385,7 @@ func (in *PackageStatus) DeepCopy() *PackageStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Property) DeepCopyInto(out *Property) { *out = *in - if in.Value != nil { - in, out := &in.Value, &out.Value - *out = make([]byte, len(*in)) - copy(*out, *in) - } + in.Value.DeepCopyInto(&out.Value) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Property. @@ -501,18 +412,3 @@ func (in *RelatedImage) DeepCopy() *RelatedImage { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UnpackPhaseError) DeepCopyInto(out *UnpackPhaseError) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnpackPhaseError. -func (in *UnpackPhaseError) DeepCopy() *UnpackPhaseError { - if in == nil { - return nil - } - out := new(UnpackPhaseError) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/controllers/core/catalogsource_controller.go b/pkg/controllers/core/catalogsource_controller.go index a858adce..808e674b 100644 --- a/pkg/controllers/core/catalogsource_controller.go +++ b/pkg/controllers/core/catalogsource_controller.go @@ -31,6 +31,7 @@ import ( "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + apimacherrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" @@ -41,7 +42,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" corev1beta1 "github.com/operator-framework/catalogd/pkg/apis/core/v1beta1" - apimacherrors "k8s.io/apimachinery/pkg/util/errors" ) // CatalogSourceReconciler reconciles a CatalogSource object @@ -255,7 +255,7 @@ func (r *CatalogSourceReconciler) createBundleMetadata(ctx context.Context, decl bundleMeta.Spec.Properties = append(bundleMeta.Spec.Properties, corev1beta1.Property{ Type: prop.Type, - Value: prop.Value, + Value: runtime.RawExtension{Raw: prop.Value}, }) }