Skip to content

Commit

Permalink
remove unused stuff from APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
joelanford committed Apr 28, 2023
1 parent 9329ecc commit 1487175
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 516 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
42 changes: 0 additions & 42 deletions cmd/apiserver/main.go

This file was deleted.

17 changes: 6 additions & 11 deletions config/crd/bases/catalogd.operatorframework.io_bundlemetadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions config/crd/bases/catalogd.operatorframework.io_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
Expand Down
95 changes: 15 additions & 80 deletions pkg/apis/core/v1beta1/bundlemetadata_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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"`
Expand All @@ -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{})
}
Loading

0 comments on commit 1487175

Please sign in to comment.